Prototype/Recipe: Difference between revisions
m (Protected "Prototype/Recipe": Migrated prototype doc to separate website ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
(Updated styling of prototype doc migration note) |
||
Line 1: | Line 1: | ||
'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/prototypes/RecipePrototype.html https://lua-api.factorio.com/latest/prototypes/RecipePrototype.html] | <div class="stub"><p>'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/prototypes/RecipePrototype.html https://lua-api.factorio.com/latest/prototypes/RecipePrototype.html] | ||
This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums]. | </p><p>This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div> | ||
Revision as of 10:43, 21 September 2023
The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/prototypes/RecipePrototype.html
This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.
Template:Prototype parent A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe (see Prototype/RecipeCategory).
General properties
Inherits all properties from PrototypeBase.
Template:Prototype property Optional. Name of a Prototype/RecipeCategory. The category of the recipe is used to control which machines can craft the recipe. The built-in categories can be found here.
The recipe category "crafting" cannot contain recipes with fluid ingredients or products.
Template:Prototype property Optional. Name of a Prototype/ItemSubGroup. The subgroup of this recipe. If not specified, defaults to the subgroup of the product if there is only 1, or main_product if multiple products exist. If multiple products exist and no main_product is specified, or if there is no product, the subgroup is required.
Template:Prototype property If given, this determines the recipe's icon. Mandatory for a recipe with more than 1 product and no main_product, or, no product.
Otherwise, the icon of main_product or the only product is used.
Template:Prototype property
Optional. Used by crafting machine working_visualisations
to tint certain layers with the recipe color. apply_recipe_tint on the working visualisation determines which of the 4 colors is used for that layer (if any).
Format:
crafting_machine_tint = { primary = {r=0,g=0,b=0,a=0}, secondary = {r=0,g=0,b=0,a=0}, tertiary = {r=0,g=0,b=0,a=0}, quaternary = {r=0,g=0,b=0,a=0}}
Each key/value pair is optional and defaults to no tint. If no tint is specified, the crafting machine falls back to Prototype/CraftingMachine#default_recipe_tint.
Recipe data
If the recipe does not have a difficulty, this is located directly in the prototype. Otherwise, if the "normal" or "expensive" property exists, the recipe has difficulty. Then, the recipe data has to be specified for each difficulty instead of directly in the prototype. If at least one difficulty has recipe data defined, the other difficulty can be set to false
. This will disable the recipe for the difficulty, same as setting it enabled = false
. If it is enabled (by technologies etc), it will use the data from the other difficulty. Not setting a difficulty, e.g. normal = nil
, is possible and gives that difficulty the exact same properties as the difficulty that is defined. Setting one or both difficulties to true
is not valid and will produce an error. See below for examples of difficulty.
Template:Prototype property
A table containing ingredient names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the IngredientPrototype.[1]
Maximum ingredient amount is 65535.
ingredients
can be set to an empty table to create a recipe that needs no ingredients.
Duplicate ingredients, e.g. two entries for the "wood" item, are not allowed.
In-game, the item ingredients are ordered by item group order_in_recipe.
ingredients = {{"iron-stick", 2}, {"iron-plate", 3}}
The same with full format:
ingredients = {{type = "item", name = "iron-stick", amount = 2}, {type = "item", name = "iron-plate", amount = 3}}
For fluids, the full format always has to be used:
ingredients = {{type="fluid", name="water", amount=50}, {type="fluid", name="crude-oil", amount=100}}
Template:Prototype property
Can be replaced with the results parameter. The item created by this recipe. Must be the name of an item, such as "iron-gear-wheel".
Note that results
takes priority over result
. So if a recipe has both keys set, result
will be ignored.
Template:Prototype property Optional. The number of items created by this recipe.
Template:Prototype property
A table containing result names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the ProductPrototype.[2]
results
can be set to an empty table to create a recipe that produces nothing.
Duplicate results, e.g. two entries for the "iron-plate" item, are allowed.
results=
{
{type="fluid", name="heavy-oil", amount=3},
{type="fluid", name="light-oil", amount=3},
{type="fluid", name="petroleum-gas", amount=4}
},
results =
{
{type = "item", name = "iron-nuggets", amount = 9},
{type = "item", name = "gold-nuggets", amount = 1}
},
results =
{
{type = "fluid", name = "steam", amount = 1, temperature = 165}
},
Template:Prototype property Optional. The amount of time it takes to make this recipe. Must be greater than 0.001.
This is the number of seconds it takes to craft at crafting speed 1.
Template:Prototype property Used to determine how many extra items are put into an assembling machine before it's considered "full enough". See Inserters#Insertion_limits.
If set to 0, it instead uses the following formula: 1.166 / (energy_required / the assembler's crafting_speed), rounded up, and clamped between 2 and 100. The numbers used in this formula can be changed by the Prototype/UtilityConstants dynamic_recipe_overload_factor, minimum_recipe_overload_multiplier and maximum_recipe_overload_multiplier.
Template:Prototype property If the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).
Template:Prototype property Optional. This can be false to disable the recipe at the start of the game, or "true" to leave it enabled.
If your recipe is unlocked by a technology, you should set this to "false".
Template:Prototype property Optional. Hides the recipe from crafting menus.
Template:Prototype property Optional. Hides the recipe from flow stats (item/fluid production statistics).
Template:Prototype property Optional. Hides the recipe from the player's crafting screen. The recipe will still show up for selection in machines.
Template:Prototype property Optional. Whether this recipe is allowed to be broken down for the recipe tooltip "Total raw" calculations.
Template:Prototype property Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.
Template:Prototype property Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.
Template:Prototype property Optional. Whether the "Made in: {Machine}" part of the tool-tip should always be present, not only when the recipe can not be hand-crafted.
Template:Prototype property Optional. Whether the recipe name should have the product amount in front of it, e.g. "2 transport belt".
Template:Prototype property Optional. Whether the products are always shown in the recipe tool-tip.
Template:Prototype property Optional. Whether enabling this recipe unlocks its item products to show in selection lists (item filter, logistic request etc.).
Template:Prototype property Optional.
For recipes with one or more products: Subgroup, localised_name and icon default to the values of the only/main product, but can be overwritten by the recipe. Setting the main_product to an empty string (""
) forces the title in the recipe tooltip to use the recipe's name (not that of the product) and shows the products in the tooltip.
If 1) there are multiple products and this property is nil, 2) this property is set to an empty string (""
), or 3) there are no products, the recipe will use the localised_name, icon, and subgroup of the recipe. icon and subgroup become non-optional.
Examples
"iron-plate"
{
type = "recipe",
name = "iron-plate",
category = "smelting",
energy_required = 3.5,
ingredients = {{"iron-ore", 1}},
result = "iron-plate"
}
"coal-liquefaction"
{
type = "recipe",
name = "coal-liquefaction",
category = "oil-processing",
subgroup = "fluid-recipes",
order = "a[oil-processing]-c[coal-liquefaction]",
enabled = false,
energy_required = 5,
icon = "__base__/graphics/icons/fluid/coal-liquefaction.png",
icon_size = 32,
ingredients =
{
{type="item", name="coal", amount=10},
{type="fluid", name="heavy-oil", amount=25},
{type="fluid", name="steam", amount=50}
},
results=
{
{type="fluid", name="heavy-oil", amount=35},
{type="fluid", name="light-oil", amount=15},
{type="fluid", name="petroleum-gas", amount=20}
},
allow_decomposition = false
}
"iron-gear-wheel" — recipe with difficulty
{
type = "recipe",
name = "iron-gear-wheel",
normal =
{
ingredients = {{"iron-plate", 2}},
result = "iron-gear-wheel"
},
expensive =
{
ingredients = {{"iron-plate", 4}},
result = "iron-gear-wheel"
}
},
Modified so that it cannot be crafted in normal mode, unless unlocked via command/research
{
type = "recipe",
name = "iron-gear-wheel",
normal = false,
expensive =
{
ingredients = {{"iron-plate", 4}},
result = "iron-gear-wheel"
}
},
Modified so that the expensive recipe is always used, even in normal mode
{
type = "recipe",
name = "iron-gear-wheel",
normal = nil, --this line can be omitted
expensive =
{
ingredients = {{"iron-plate", 4}},
result = "iron-gear-wheel"
}
},