Factorio Prototype DocsVersion 2.1.14

RecipePrototype - Prototype Docs

RecipePrototype 'recipe' changedExample code

A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe, see RecipeCategory.

Inherits from Prototype « PrototypeBase

Properties

categoriesnew optional :: array[RecipeCategoryID]

The categories of this recipe. [...]

The categories of this recipe. [...]

crafting_machine_tint optional :: RecipeTints

Used by WorkingVisualisations::working_visualisations to tint certain layers with the recipe color. [...]

Used by WorkingVisualisations::working_visualisations to tint certain layers with the recipe color. [...]

icons optional :: array[IconData]

Can't be an empty array.

Can't be an empty array.

icon optional :: FileName

If given, this determines the recipe's icon. [...]

If given, this determines the recipe's icon. [...]

icon_size optional :: SpriteSizeType

The size of the square icon, in pixels. [...]

The size of the square icon, in pixels. [...]

ingredients optional :: array[IngredientPrototype]

A table containing ingredient names and amounts. [...]

A table containing ingredient names and amounts. [...]

results optional :: array[ProductPrototype]

A table containing result names and amounts. [...]

A table containing result names and amounts. [...]

main_product optional :: string

For recipes with one or more products: Subgroup, localised_name and icon default to the values of the singular/main product, but can be overwritten by the recipe. [...]

For recipes with one or more products: Subgroup, localised_name and icon default to the values of the singular/main product, but can be overwritten by the recipe. [...]

energy_required optional :: double

The amount of time it takes to make this recipe. [...]

The amount of time it takes to make this recipe. [...]

emissions_multiplier optional :: double
maximum_productivity optional :: double

Must be >= 0.

Must be >= 0.

requester_paste_multiplier optional :: uint32
overload_multiplier optional :: uint32

Used to determine how many extra items are put into an assembling machine before it's considered "full enough". [...]

Used to determine how many extra items are put into an assembling machine before it's considered "full enough". [...]

allow_inserter_overload optional :: boolean

Whether the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).

Whether the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).

enabled optional :: boolean

This can be false to disable the recipe at the start of the game, or true to leave it enabled. [...]

This can be false to disable the recipe at the start of the game, or true to leave it enabled. [...]

hide_from_stats optional :: boolean

Hides the recipe from item/fluid production statistics.

Hides the recipe from item/fluid production statistics.

hide_from_player_crafting optional :: boolean

Hides the recipe from the player's crafting screen. [...]

Hides the recipe from the player's crafting screen. [...]

hide_from_bonus_gui optional :: boolean
allow_decomposition optional :: boolean

Whether this recipe is allowed to be broken down for the recipe tooltip "Total raw" calculations.

Whether this recipe is allowed to be broken down for the recipe tooltip "Total raw" calculations.

allow_as_intermediate optional :: boolean

Whether the recipe can be used as an intermediate recipe in hand-crafting.

Whether the recipe can be used as an intermediate recipe in hand-crafting.

allow_intermediates optional :: boolean

Whether the recipe is allowed to use intermediate recipes when hand-crafting.

Whether the recipe is allowed to use intermediate recipes when hand-crafting.

always_show_made_in optional :: boolean

Whether the "Made in: " part of the tool-tip should always be present, and not only when the recipe can't be hand-crafted.

Whether the "Made in: " part of the tool-tip should always be present, and not only when the recipe can't be hand-crafted.

requires_ingredients_to_unlock_resultsnew optional :: boolean

Whether enabling this recipe requires the ingredients be unlocked before the products are marked as unlocked.

Whether enabling this recipe requires the ingredients be unlocked before the products are marked as unlocked.

unlock_results optional :: boolean

Whether enabling this recipe unlocks its item products to show in selection lists (item filters, logistic requests, etc.).

Whether enabling this recipe unlocks its item products to show in selection lists (item filters, logistic requests, etc.).

preserve_products_in_machine_output optional :: boolean
allow_consumption_message optional :: LocalisedString
allow_speed_message optional :: LocalisedString
allow_productivity_message optional :: LocalisedString
allow_pollution_message optional :: LocalisedString
allow_quality_message optional :: LocalisedString
surface_conditions optional :: array[SurfaceCondition]
hide_from_signal_gui optional :: boolean

If left unset, this property will be determined automatically: If the recipe is not hidden, and no item, fluid, or virtual signal has the same icon as this recipe, this property will be set to false. [...]

If left unset, this property will be determined automatically: If the recipe is not hidden, and no item, fluid, or virtual signal has the same icon as this recipe, this property will be set to false. [...]

allow_consumption optional :: boolean
allow_speed optional :: boolean
allow_productivity optional :: boolean
allow_pollution optional :: boolean
allow_quality optional :: boolean
allowed_module_categories optional :: array[ModuleCategoryID]

Sets the module categories that are allowed to be used with this recipe.

Sets the module categories that are allowed to be used with this recipe.

alternative_unlock_methods optional :: array[TechnologyID]

Additional technologies to list under "Unlocked by" on a recipe's Factoriopedia page.

Additional technologies to list under "Unlocked by" on a recipe's Factoriopedia page.

auto_recycle optional :: boolean

Whether the recipe should be included in the recycling recipes automatically generated by the quality mod. [...]

Whether the recipe should be included in the recycling recipes automatically generated by the quality mod. [...]

sort_item_ingredientsnew optional :: boolean

When set to true, item ingredients will be sorted based on ItemGroup::order_in_recipe.

When set to true, item ingredients will be sorted based on ItemGroup::order_in_recipe.

can_set_qualitynew optional :: boolean

When set to true, player can set quality of this recipe to craft. [...]

When set to true, player can set quality of this recipe to craft. [...]

raise_on_craftednew optional :: boolean

If set to true, an event with identifier of LuaRecipePrototype::on_crafted_event will be raised when this recipe is crafted. [...]

If set to true, an event with identifier of LuaRecipePrototype::on_crafted_event will be raised when this recipe is crafted. [...]

Inherited from Prototype
factoriopedia_alternative optional :: string

The ID type corresponding to the prototype that inherits from this. [...]

The ID type corresponding to the prototype that inherits from this. [...]

custom_tooltip_fields optional :: array[CustomTooltipField]

Allows to add extra description items to the tooltip and Factoriopedia.

Allows to add extra description items to the tooltip and Factoriopedia.

Inherited from PrototypeBase
type :: string

Specifies the kind of prototype this is. [...]

Specifies the kind of prototype this is. [...]

name :: string

Unique textual identification of the prototype. [...]

Unique textual identification of the prototype. [...]

order optional :: Order

Used to order prototypes in inventory, recipes and GUIs. [...]

Used to order prototypes in inventory, recipes and GUIs. [...]

localised_name optional :: LocalisedString

Overwrites the name set in the locale file. [...]

Overwrites the name set in the locale file. [...]

localised_description optional :: LocalisedString

Overwrites the description set in the locale file. [...]

Overwrites the description set in the locale file. [...]

factoriopedia_description optional :: LocalisedString

Provides additional description used in factoriopedia.

Provides additional description used in factoriopedia.

subgroup optional :: ItemSubGroupID

The name of an ItemSubGroup.

The name of an ItemSubGroup.

hidden[overridden] optional :: boolean

Hides the recipe from crafting menus and other recipe selection lists.

Hides the recipe from crafting menus and other recipe selection lists.

hidden_in_factoriopedia optional :: boolean
parameter optional :: boolean

Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.

Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.

factoriopedia_simulation optional :: SimulationDefinition

The simulation shown when looking at this prototype in the Factoriopedia GUI.

The simulation shown when looking at this prototype in the Factoriopedia GUI.

Properties

categories :: array[RecipeCategoryID] optional new

Default: {"crafting"}

The categories of this recipe. Controls which machines can craft this recipe.

The built-in categories can be found here. The base "crafting" category can not contain recipes with fluid ingredients or products.

The array must contain at least one category, it cannot be empty.

Example

categories = {"smelting"}

crafting_machine_tint :: RecipeTints optional

Used by WorkingVisualisations::working_visualisations to tint certain layers with the recipe color. WorkingVisualisation::apply_recipe_tint determines which of the four colors is used for that layer, if any.

icons :: array[IconData] optional

Can't be an empty array.

icon :: FileName optional

If given, this determines the recipe's icon. Otherwise, the icon of main_product or the singular product is used.

Only loaded if icons is not defined.

Mandatory if icons is not defined for a recipe with more than one product and no main_product, or no product.

Example

icon = "__base__/graphics/icons/fluid/heavy-oil.png"

icon_size :: SpriteSizeType optional

Default: 64

The size of the square icon, in pixels. E.g. 32 for a 32px by 32px icon. Must be larger than 0.

Only loaded if icons is not defined.

ingredients :: array[IngredientPrototype] optional

A table containing ingredient names and amounts. Can also contain information about fluid temperature and whether some of the amount is ignored by production statistics.

Can be set to an empty table to create a recipe that needs no ingredients. Assembling machines do not support recipes with more than 65 535 different item ingredients.

Duplicate ingredients, e.g. two entries with the same name, are not allowed. In-game, the item ingredients are ordered by ItemGroup::order_in_recipe if RecipePrototype::sort_item_ingredients is set to true.

Examples

-- Recipe with items
ingredients =
{
  {type = "item", name = "iron-stick", amount = 2},
  {type = "item", name = "iron-plate", amount = 3}
}
-- Recipe with fluids
ingredients =
{
  {type = "fluid", name = "water", amount = 50},
  {type = "fluid", name = "crude-oil", amount = 100}
}

results :: array[ProductPrototype] optional

A table containing result names and amounts. Products also contain information such as fluid temperature, probability of results and whether some of the amount is ignored by productivity.

Can be set to an empty table to create a recipe that produces nothing. Assembling machines do not support recipes with more than 65 535 different item products.

Duplicate results, e.g. two entries with the same name, are allowed.

Examples

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-plate", amount = 9},
  {type = "item", name = "copper-plate", amount = 1}
}
results = {{type = "fluid", name = "steam", amount = 1, temperature = 165}}

main_product :: string optional

For recipes with one or more products: Subgroup, localised_name and icon default to the values of the singular/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.

energy_required :: double optional

Default: 0.5

The amount of time it takes to make this recipe. Must be > 0.001. Equals the number of seconds it takes to craft at crafting speed 1.

emissions_multiplier :: double optional

Default: 1

maximum_productivity :: double optional

Default: 3.0

Must be >= 0.

requester_paste_multiplier :: uint32 optional

Default: 30

overload_multiplier :: uint32 optional

Default: 0

Used to determine how many extra items are put into an assembling machine before it's considered "full enough". See 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 to be between2 and 100. The numbers used in this formula can be changed by the UtilityConstants properties dynamic_recipe_overload_factor, minimum_recipe_overload_multiplier, and maximum_recipe_overload_multiplier.

allow_inserter_overload :: boolean optional

Default: true

Whether the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).

enabled :: boolean optional

Default: true

This can be false to disable the recipe at the start of the game, or true to leave it enabled.

If a recipe is unlocked via technology, this should be set to false.

hide_from_stats :: boolean optional

Default: false

Hides the recipe from item/fluid production statistics.

hide_from_player_crafting :: boolean optional

Default: false

Hides the recipe from the player's crafting screen. The recipe will still show up for selection in machines.

hide_from_bonus_gui :: boolean optional

Default: false

allow_decomposition :: boolean optional

Default: true

Whether this recipe is allowed to be broken down for the recipe tooltip "Total raw" calculations.

allow_as_intermediate :: boolean optional

Default: true

Whether the recipe can be used as an intermediate recipe in hand-crafting.

allow_intermediates :: boolean optional

Default: true

Whether the recipe is allowed to use intermediate recipes when hand-crafting.

always_show_made_in :: boolean optional

Default: false

Whether the "Made in: " part of the tool-tip should always be present, and not only when the recipe can't be hand-crafted.

requires_ingredients_to_unlock_results :: boolean optional new

Default: Value of hidden

Whether enabling this recipe requires the ingredients be unlocked before the products are marked as unlocked.

unlock_results :: boolean optional

Default: true

Whether enabling this recipe unlocks its item products to show in selection lists (item filters, logistic requests, etc.).

preserve_products_in_machine_output :: boolean optional

Default: false

allow_consumption_message :: LocalisedString optional

Default: {"item-limitation.consumption-effect"}

allow_speed_message :: LocalisedString optional

Default: {"item-limitation.speed-effect"}

allow_productivity_message :: LocalisedString optional

Default: {"item-limitation.productivity-effect"}

allow_pollution_message :: LocalisedString optional

Default: {"item-limitation.pollution-effect"}

allow_quality_message :: LocalisedString optional

Default: {"item-limitation.quality-effect"}

surface_conditions :: array[SurfaceCondition] optional

hide_from_signal_gui :: boolean optional

If left unset, this property will be determined automatically: If the recipe is not hidden, and no item, fluid, or virtual signal has the same icon as this recipe, this property will be set to false. It'll be true otherwise.

allow_consumption :: boolean optional

Default: true

allow_speed :: boolean optional

Default: true

allow_productivity :: boolean optional

Default: false

allow_pollution :: boolean optional

Default: true

allow_quality :: boolean optional

Default: true

allowed_module_categories :: array[ModuleCategoryID] optional

Default: All module categories are allowed

Sets the module categories that are allowed to be used with this recipe.

alternative_unlock_methods :: array[TechnologyID] optional

Additional technologies to list under "Unlocked by" on a recipe's Factoriopedia page.

auto_recycle :: boolean optional

Default: true

Whether the recipe should be included in the recycling recipes automatically generated by the quality mod.

This property is not read by the game engine itself, but the quality mod's recycling.lua file. This means it is discarded by the game engine after loading finishes.

sort_item_ingredients :: boolean optional new

Default: true

When set to true, item ingredients will be sorted based on ItemGroup::order_in_recipe.

can_set_quality :: boolean optional new

When set to true, player can set quality of this recipe to craft. If set to false then this recipe can only be crafted at normal quality.

Defaults to true if recipe is a parameter, or has at least one item ingredient that does not have any of quality_min, quality_max, or quality_change set.

This property also influences the automatic Furnace Recipe Selection.

raise_on_crafted :: boolean optional new

Default: false

If set to true, an event with identifier of LuaRecipePrototype::on_crafted_event will be raised when this recipe is crafted. Currently this is only raised when recipe is crafted by a crafting machine.

Event raised will be given data as described by OnRecipeCraftedData.

Example

-- in data stage:
data.raw.recipe["iron-plate"].raise_on_crafted = true
-- in control stage:
script.on_event(prototypes.recipe["iron-plate"].on_crafted_event, function(event)
  game.print("Iron plate was crafted by ".. event.entity.name .. " at " .. event.entity.gps_tag)
end)

Overridden Properties

hidden :: boolean optional

Default: false

Hides the recipe from crafting menus and other recipe selection lists.

Examples

{
  type = "recipe",
  name = "iron-plate",
  categories = {"smelting"},
  energy_required = 3.5,
  ingredients = {{type = "item", name = "iron-ore", amount = 1}},
  results = {{type = "item", name = "iron-plate", amount = 1}}
}
{
  type = "recipe",
  name = "coal-liquefaction",
  categories = {"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
}
Fulltext search

Prototypes

Types

Defines

Fulltext search for