Factorio Prototype DocsVersion 1.1.107

RecipePrototype - 'recipe' Example code

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

This prototype has two different formats that can be specified. If both normal and expensive are not defined, the standard properties define this recipe. Otherwise, they are ignored, and the normal and expensive properties are used exclusively to define this recipe.

Inherits from PrototypeBase

Properties

category optional :: RecipeCategoryID

The category of this recipe. [...]

The category of this recipe. [...]

subgroup optional :: ItemSubGroupID

The name of the subgroup of this recipe. [...]

The name of the subgroup of this recipe. [...]

crafting_machine_tint optional :: CraftingMachineTint

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

Used by CraftingMachinePrototype::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. [...]

icon_mipmaps optional :: IconMipMapType

Icons of reduced size will be used at decreased scale.

Icons of reduced size will be used at decreased scale.

normal optional :: RecipeData or false

Can be set to false if the expensive property is defined. [...]

Can be set to false if the expensive property is defined. [...]

expensive optional :: RecipeData or false

Can be set to false if the normal property is defined. [...]

Can be set to false if the normal property is defined. [...]

ingredients optional :: array[IngredientPrototype]

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

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

results optional :: array[ProductPrototype]

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

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

result optional :: ItemID

The item created by this recipe. [...]

The item created by this recipe. [...]

result_count optional :: uint16

The number of items created by this recipe. [...]

The number of items created by this recipe. [...]

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

Only loaded if neither normal nor expensive are defined.

Only loaded if neither normal nor expensive are defined.

requester_paste_multiplier optional :: uint32

Only loaded if neither normal nor expensive are defined.

Only loaded if neither normal nor expensive are defined.

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 :: bool

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 :: bool

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. [...]

hidden optional :: bool

Hides the recipe from crafting menus. [...]

Hides the recipe from crafting menus. [...]

hide_from_stats optional :: bool

Hides the recipe from item/fluid production statistics. [...]

Hides the recipe from item/fluid production statistics. [...]

hide_from_player_crafting optional :: bool

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

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

allow_decomposition optional :: bool

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 :: bool

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 :: bool

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 :: bool

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. [...]

show_amount_in_title optional :: bool

Whether the recipe name should have the product amount in front of it. [...]

Whether the recipe name should have the product amount in front of it. [...]

always_show_products optional :: bool

Whether the products are always shown in the recipe tooltip. [...]

Whether the products are always shown in the recipe tooltip. [...]

unlock_results optional :: bool

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.). [...]

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. [...]

Properties

category :: RecipeCategoryID optional

Default: "crafting"

The category 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.

Example

category = "smelting"

subgroup :: ItemSubGroupID optional

The name of the subgroup of this recipe. If not specified, it defaults to the subgroup of the product if there is only one, or of the main_product if multiple products exist.

Mandatory if multiple products exist and no main_product is specified, or if there is no product.

crafting_machine_tint :: CraftingMachineTint optional

Used by CraftingMachinePrototype::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.

CraftingMachineTint :: struct

If no tint is specified, the crafting machine falls back to CraftingMachinePrototype::default_recipe_tint.

Properties

primary :: Color optional

Default: no tint

secondary :: Color optional

Default: no tint

tertiary :: Color optional

Default: no tint

quaternary :: Color optional

Default: no tint

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.

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

The size of the square icon, in pixels. E.g. 32 for a 32px by 32px icon.

Only loaded if icons is not defined, or if icon_size is not specified for all instances of icons.

icon_mipmaps :: IconMipMapType optional

Default: 0

Icons of reduced size will be used at decreased scale.

normal :: RecipeData or false optional

Can be set to false if the expensive property is defined. This will disable this difficulty, same as setting enabled to false would. If it's later enabled (by research, etc.), it will use the data from expensive.

If this property is not defined while expensive is, it will mirror its data.

expensive :: RecipeData or false optional

Can be set to false if the normal property is defined. This will disable this difficulty, same as setting enabled to false would. If it's later enabled (by research, etc.), it will use the data from normal.

If this property is not defined while normal is, it will mirror its data.

ingredients :: array[IngredientPrototype] optional

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 (see here).

The maximum ingredient amount is 65 535. Can be set to an empty table to create a recipe that needs no 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.

Mandatory if neither normal nor expensive are defined.

Examples

-- Shorthand format
ingredients = {{"iron-stick", 2}, {"iron-plate", 3}}
-- Full format
ingredients = {
  {type = "item", name = "iron-stick", amount = 2},
  {type = "item", name = "iron-plate", amount = 3}
}
-- Fluids don't support shorthand
ingredients = {
  {type="fluid", name="water", amount=50},
  {type="fluid", name="crude-oil", amount=100}
}

results :: array[ProductPrototype] optional

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 (see here).

Can be set to an empty table to create a recipe that produces nothing. Duplicate results, e.g. two entries with the same name, are allowed.

Mandatory if neither normal nor expensive are defined.

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

result :: ItemID optional

The item created by this recipe. Must be the name of an item, such as "iron-gear-wheel".

Only loaded if neither results, normal nor expensive are defined.

result_count :: uint16 optional

Default: 1

The number of items created by this recipe.

Only loaded if neither results, normal nor expensive are defined.

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.

Only loaded if neither normal nor expensive are defined.

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.

Only loaded if neither normal nor expensive are defined.

emissions_multiplier :: double optional

Default: 1

Only loaded if neither normal nor expensive are defined.

requester_paste_multiplier :: uint32 optional

Default: 30

Only loaded if neither normal nor expensive are defined.

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.

Only loaded if neither normal nor expensive are defined.

allow_inserter_overload :: bool optional

Default: true

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

Only loaded if neither normal nor expensive are defined.

enabled :: bool 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.

Only loaded if neither normal nor expensive are defined.

hidden :: bool optional

Default: false

Hides the recipe from crafting menus.

Only loaded if neither normal nor expensive are defined.

hide_from_stats :: bool optional

Default: false

Hides the recipe from item/fluid production statistics.

Only loaded if neither normal nor expensive are defined.

hide_from_player_crafting :: bool optional

Default: false

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

Only loaded if neither normal nor expensive are defined.

allow_decomposition :: bool optional

Default: true

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

Only loaded if neither normal nor expensive are defined.

allow_as_intermediate :: bool optional

Default: true

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

Only loaded if neither normal nor expensive are defined.

allow_intermediates :: bool optional

Default: true

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

Only loaded if neither normal nor expensive are defined.

always_show_made_in :: bool 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.

Only loaded if neither normal nor expensive are defined.

show_amount_in_title :: bool optional

Default: true

Whether the recipe name should have the product amount in front of it. E.g. "2x Transport belt".

Only loaded if neither normal nor expensive are defined.

always_show_products :: bool optional

Default: false

Whether the products are always shown in the recipe tooltip.

Only loaded if neither normal nor expensive are defined.

unlock_results :: bool optional

Default: true

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

Only loaded if neither normal nor expensive are defined.

Examples

{
  type = "recipe",
  name = "iron-plate",
  category = "smelting",
  energy_required = 3.5,
  ingredients = {{"iron-ore", 1}},
  result = "iron-plate"
}
{
  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
}
{  -- 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"
  }
}
{  -- Uncraftable 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"
  }
}
{  -- Expensive recipe always used, even when in normal mode
  type = "recipe",
  name = "iron-gear-wheel",
  normal = nil, -- can be omitted
  expensive =
  {
    ingredients = {{"iron-plate", 4}},
    result = "iron-gear-wheel"
  }
}

Prototypes

Types