Kryzeth Standard Library

data.recipe

Methods51

function Recipe.__call(recipe: string) -> recipe StdLib.Data.Recipe
Parameters
recipestring

Recipe prototype name

Returns
function Recipe.add_ingredient(ingredient: table) -> StdLib.Data.Recipe

Add a new ingredient to a recipe.

Parameters
ingredienttable

to add (no longer supports string/count)

function Recipe.add_ing(ingredient: table) -> StdLib.Data.Recipe
Parameters
ingredienttable

to add (no longer supports string/count)

function Recipe.remove_ingredient(ingredient: string) -> StdLib.Data.Recipe

Remove one ingredient completely.

Parameters
ingredientstring

Name of ingredient to remove

function Recipe.rem_ing(ingredient: string) -> StdLib.Data.Recipe
Parameters
ingredientstring

Name of ingredient to remove

function Recipe.replace_ingredient(replace: string, ingredient: string | Ingredient, count: nil | number) -> StdLib.Data.Recipe

Replace one ingredient with another.

Parameters
replacestring

Name of ingredient to be replaced

ingredientstring | Ingredient

Name or table to add

countnil | number

[opt] Amount of ingredient

function Recipe.rep_ing(replace: string, ingredient: string | Ingredient, count: nil | number) -> StdLib.Data.Recipe
Parameters
replacestring

Name of ingredient to be replaced

ingredientstring | Ingredient

Name or table to add

countnil | number

[opt] Amount of ingredient

function Recipe.clear_ingredients() -> self

Removes all ingredients from recipe completely.

function Recipe.clr_ing() -> self
function Recipe.copy_ingredients(recipe: string, keep_ingredients: nil | boolean) -> self

Copies ingredients from one recipe to another.

Parameters
recipestring

Name of the recipe to copy ingredients from

keep_ingredientsnil | boolean

[opt] Whether to keep the original ingredients

Returns
self
function Recipe.copy_ing(recipe: string, keep_ingredients: nil | boolean) -> self
Parameters
recipestring

Name of the recipe to copy ingredients from

keep_ingredientsnil | boolean

[opt] Whether to keep the original ingredients

Returns
self
function Recipe.get_ingredients() -> ingredients Ingredient[] | nil

Returns a copy of this recipe's ingredients.

function Recipe.get_ing() -> ingredients Ingredient[] | nil
function Recipe.get_ingredient_amount(ingredient_name: string) -> amount nil | number

Gets the amount of a specified ingredient.

Parameters
ingredient_namestring

Name of the ingredient

Returns
amountnil | number
function Recipe.get_ingredient_count(ingredient_name: string) -> amount nil | number
Parameters
ingredient_namestring

Name of the ingredient

Returns
amountnil | number
function Recipe.set_ingredients(ingredients: string | Ingredient[], amount: nil | number, ingredient_type: "item" | "fluid" | nil) -> success boolean

Sets the ingredients for this recipe.

Parameters
ingredientsstring | Ingredient[]

Ingredient name or complete ingredient array

amountnil | number

Amount when ingredients is a name

ingredient_type"item" | "fluid" | nil

Ingredient type when ingredients is a name

Returns
successboolean
function Recipe.set_ing(ingredients: string | Ingredient[], amount: nil | number, ingredient_type: "item" | "fluid" | nil) -> success boolean
Parameters
ingredientsstring | Ingredient[]

Ingredient name or complete ingredient array

amountnil | number

Amount when ingredients is a name

ingredient_type"item" | "fluid" | nil

Ingredient type when ingredients is a name

Returns
successboolean
function Recipe.set_ingredient_amount(find: string, amount: number) -> success boolean

Sets the amount of a specific ingredient in a recipe.

Parameters
findstring

Name of the ingredient to modify

amountnumber

New amount to assign to the ingredient

Returns
successboolean
function Recipe.set_ingredient_count(find: string, amount: number) -> success boolean
Parameters
findstring

Name of the ingredient to modify

amountnumber

New amount to assign to the ingredient

Returns
successboolean
function Recipe.multiply_ingredient(find: string, mult: number) -> success boolean

Multiplies the amount of one ingredient.

Parameters
findstring

Name of the ingredient

multnumber

Multiplier

Returns
successboolean
function Recipe.multiply_ingredients(mult: number) -> self

Multiplies the amount of each ingredient in a recipe.

Parameters
multnumber

Amount to multiply each ingredient by

Returns
self
function Recipe.add_category(category_name: string) -> self

Add a recipe category to the list of categories

Parameters
category_namestring

The crafting category to add

Returns
self
function Recipe.add_cat(category_name: string) -> self
Parameters
category_namestring

The crafting category to add

Returns
self
function Recipe.add_categories(category_list: string[]) -> self

Adds multiple recipe categories.

Parameters
category_liststring[]

Recipe categories to add

Returns
self
function Recipe.add_cats(category_list: string[]) -> self
Parameters
category_liststring[]

Recipe categories to add

Returns
self
function Recipe.remove_category(category_name: string) -> self

Remove a recipe category from the list of categories

Parameters
category_namestring

The crafting category to remove

Returns
self
function Recipe.rem_cat(category_name: string) -> self
Parameters
category_namestring

The crafting category to remove

Returns
self
function Recipe.remove_categories(category_list: string[]) -> self

Removes multiple recipe categories.

Parameters
category_liststring[]

Recipe categories to remove

Returns
self
function Recipe.rem_cats(category_list: string[]) -> self
Parameters
category_liststring[]

Recipe categories to remove

Returns
self
function Recipe.add_unlock(tech_name: string) -> self

Add to technology as a recipe unlock.

Parameters
tech_namestring

Name of the technology to add the unlock too

Returns
self
function Recipe.remove_unlock(tech_name: string) -> self

Remove the recipe unlock from the technology.

Parameters
tech_namestring

Name of the technology to remove the unlock from

Returns
self
function Recipe.get_technologies() -> technologies {string, true} | nil

Returns all technologies that unlock this recipe.

function Recipe.get_tech() -> technologies {string, true} | nil
function Recipe.copy_unlock(copy_name: string) -> self

Copies recipe unlocks from another recipe.

Parameters
copy_namestring

Source recipe name

Returns
self
function Recipe.set_enabled(enabled: boolean) -> self

Set the enabled status of the recipe.

Parameters
enabledboolean

Enable or disable the recipe

Returns
self
function Recipe.get_main_product() -> StdLib.Data.Item

Get the recipe's main product item. Attempts to use main_product first, then falls back to the first result.

function Recipe.set_main_product(main_product: string) -> self

Set the main product of the recipe.

function Recipe.remove_main_product() -> self

Remove the main product of the recipe.

function Recipe.add_result(product: string | Product, count: nil | number, probability: nil | number) -> StdLib.Data.Recipe

Add a new product to results table.

Parameters
productstring | Product

product Name or table to add

countnil | number

[opt] Amount of product

probabilitynil | number

[opt] A value in range [0, 1]. Item is only given with this probability; otherwise no product is produced.

function Recipe.remove_result(product: string | Product) -> StdLib.Data.Recipe

Remove a product from results table.

Parameters
productstring | Product

Name or table to add

function Recipe.replace_result(replace: string, product: string | Product, count: nil | number, probability: nil | number) -> StdLib.Data.Recipe

Replace a product from results with a new product.

Parameters
replacestring

Name of product to be replaced

productstring | Product

Name or table to add

countnil | number

[opt] Amount of product

probabilitynil | number

[opt] A value in range [0, 1]. Item is only given with this probability; otherwise no product is produced.

function Recipe.clear_results() -> self

Removes all results from recipe completely.

function Recipe.copy_results(recipe: string, keep_results: nil | boolean) -> self

Copies results from one recipe to another.

Parameters
recipestring

Name of the recipe to copy results from

keep_resultsnil | boolean

[opt] Whether to keep the original results

Returns
self
function Recipe.get_results() -> results Product[] | nil

Returns this recipe's results.

function Recipe.get_result_count(result_name: string) -> amount nil | number

Gets the amount of a specified result.

Parameters
result_namestring

Name of the result

Returns
amountnil | number
function Recipe.get_result_amount(result_name: string) -> amount nil | number
Parameters
result_namestring

Name of the result

Returns
amountnil | number
function Recipe.set_results(results: string | Product[], amount: nil | number, result_type: "item" | "fluid" | nil) -> success boolean

Sets the results for this recipe.

Parameters
resultsstring | Product[]

Result name or complete product array

amountnil | number

Amount when results is a name

result_type"item" | "fluid" | nil

Result type when results is a name

Returns
successboolean
function Recipe.set_result_amount(find: string, amount: number) -> success boolean

Sets the amount of a specific result in a recipe.

Parameters
findstring

Name of the result to modify

amountnumber

New amount to assign to the result

Returns
successboolean
function Recipe.multiply_result(find: string, mult: number) -> success boolean

Multiplies the amount of one result.

Parameters
findstring

Name of the result

multnumber

Multiplier

Returns
successboolean
function Recipe.multiply_results(mult: number) -> self

Multiplies the amount of each result in a recipe.

Parameters
multnumber

Amount to multiply each result by

Returns
self
function Recipe.clear_surface_conditions() -> self

Removes all surface conditions from recipe completely.

Fields8

Recipe.main_product : nil | string
Recipe.results : Product[] | nil
Recipe.__class: string = "Recipe"
Recipe.__index : unknown
Recipe.ingredients: table
Recipe.categories : ("crafting")

'crafting' is set by default when recipe.categories is undefined

Recipe.enabled : boolean
Recipe.surface_conditions: table