StdLib.Data.Recipe
Wrapper for Factorio recipe prototypes.
Methods51
function Recipe.__call(recipe: string) -> recipe StdLib.Data.Recipe
recipestringRecipe prototype name
recipeStdLib.Data.Recipe
function Recipe.add_ingredient(ingredient: table) -> StdLib.Data.Recipe
Add a new ingredient to a recipe.
ingredienttableto add (no longer supports string/count)
function Recipe.add_ing(ingredient: table) -> StdLib.Data.Recipe
ingredienttableto add (no longer supports string/count)
function Recipe.remove_ingredient(ingredient: string) -> StdLib.Data.Recipe
Remove one ingredient completely.
ingredientstringName of ingredient to remove
function Recipe.rem_ing(ingredient: string) -> StdLib.Data.Recipe
ingredientstringName of ingredient to remove
function Recipe.replace_ingredient(replace: string, ingredient: string | Ingredient, count: nil | number) -> StdLib.Data.Recipe
Replace one ingredient with another.
replacestringName of ingredient to be replaced
ingredientstring | IngredientName 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
replacestringName of ingredient to be replaced
ingredientstring | IngredientName 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.
recipestringName of the recipe to copy ingredients from
keep_ingredientsnil | boolean[opt] Whether to keep the original ingredients
- self
function Recipe.copy_ing(recipe: string, keep_ingredients: nil | boolean) -> self
recipestringName of the recipe to copy ingredients from
keep_ingredientsnil | boolean[opt] Whether to keep the original ingredients
- 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.
ingredient_namestringName of the ingredient
amountnil | number
function Recipe.get_ingredient_count(ingredient_name: string) -> amount nil | number
ingredient_namestringName of the ingredient
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.
ingredientsstring | Ingredient[]Ingredient name or complete ingredient array
amountnil | numberAmount when
ingredientsis a nameingredient_type"item" | "fluid" | nilIngredient type when
ingredientsis a name
successboolean
function Recipe.set_ing(ingredients: string | Ingredient[], amount: nil | number, ingredient_type: "item" | "fluid" | nil) -> success boolean
ingredientsstring | Ingredient[]Ingredient name or complete ingredient array
amountnil | numberAmount when
ingredientsis a nameingredient_type"item" | "fluid" | nilIngredient type when
ingredientsis a name
successboolean
function Recipe.set_ingredient_amount(find: string, amount: number) -> success boolean
Sets the amount of a specific ingredient in a recipe.
findstringName of the ingredient to modify
amountnumberNew amount to assign to the ingredient
successboolean
function Recipe.set_ingredient_count(find: string, amount: number) -> success boolean
findstringName of the ingredient to modify
amountnumberNew amount to assign to the ingredient
successboolean
function Recipe.multiply_ingredient(find: string, mult: number) -> success boolean
Multiplies the amount of one ingredient.
findstringName of the ingredient
multnumberMultiplier
successboolean
function Recipe.multiply_ingredients(mult: number) -> self
Multiplies the amount of each ingredient in a recipe.
multnumberAmount to multiply each ingredient by
- self
function Recipe.add_category(category_name: string) -> self
Add a recipe category to the list of categories
category_namestringThe crafting category to add
- self
function Recipe.add_cat(category_name: string) -> self
category_namestringThe crafting category to add
- self
function Recipe.add_categories(category_list: string[]) -> self
Adds multiple recipe categories.
category_liststring[]Recipe categories to add
- self
function Recipe.add_cats(category_list: string[]) -> self
category_liststring[]Recipe categories to add
- self
function Recipe.remove_category(category_name: string) -> self
Remove a recipe category from the list of categories
category_namestringThe crafting category to remove
- self
function Recipe.rem_cat(category_name: string) -> self
category_namestringThe crafting category to remove
- self
function Recipe.remove_categories(category_list: string[]) -> self
Removes multiple recipe categories.
category_liststring[]Recipe categories to remove
- self
function Recipe.rem_cats(category_list: string[]) -> self
category_liststring[]Recipe categories to remove
- self
function Recipe.add_unlock(tech_name: string) -> self
Add to technology as a recipe unlock.
tech_namestringName of the technology to add the unlock too
- self
function Recipe.remove_unlock(tech_name: string) -> self
Remove the recipe unlock from the technology.
tech_namestringName of the technology to remove the unlock from
- 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.
copy_namestringSource recipe name
- self
function Recipe.set_enabled(enabled: boolean) -> self
Set the enabled status of the recipe.
enabledbooleanEnable or disable the recipe
- 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.
productstring | Productproduct 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.
productstring | ProductName 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.
replacestringName of product to be replaced
productstring | ProductName 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.
recipestringName of the recipe to copy results from
keep_resultsnil | boolean[opt] Whether to keep the original results
- 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.
result_namestringName of the result
amountnil | number
function Recipe.get_result_amount(result_name: string) -> amount nil | number
result_namestringName of the result
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.
resultsstring | Product[]Result name or complete product array
amountnil | numberAmount when
resultsis a nameresult_type"item" | "fluid" | nilResult type when
resultsis a name
successboolean
function Recipe.set_result_amount(find: string, amount: number) -> success boolean
Sets the amount of a specific result in a recipe.
findstringName of the result to modify
amountnumberNew amount to assign to the result
successboolean
function Recipe.multiply_result(find: string, mult: number) -> success boolean
Multiplies the amount of one result.
findstringName of the result
multnumberMultiplier
successboolean
function Recipe.multiply_results(mult: number) -> self
Multiplies the amount of each result in a recipe.
multnumberAmount to multiply each result by
- 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