Prototype/Recipe: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
Line 66: Line 66:
Optional. The amount of time it takes to make this recipe. The default appears to be 0.5 (confirm).
Optional. The amount of time it takes to make this recipe. The default appears to be 0.5 (confirm).


For crafting recipes, this is the number of seconds it takes to craft.
For crafting recipes, this is the number of seconds it takes to craft. The time can be higher (or less), if assembler machine has higher tier or modules.
For smelting recipes, this is a percentage of the default smelting time. Most smelting recipes use 100, but steel plates use 500.


=== enabled ===
=== enabled ===

Revision as of 21:52, 21 October 2017

Basics

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

Properties

type

Type: Types/string

Must be "recipe".

name

Type: Types/string

The unique name of this recipe.

ingredients

Type: Types/table

A table containing ingredient names and counts. For example:

ingredients = {{"iron-stick", 2}, {"iron-plate", 3}}

or the same with full format:

ingredients = {{type = "item", name = "iron-stick", amount = 2}, {type = "item", name = "iron-plate", amount = 3}}

In version 0.15 maximal ingredient amount is 65535.

result

Type: Types/string

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".

result_count

Type: Types/unsigned

Optional. The number of items created by this recipe. The default is 1.

results

Type: Types/table

A table containing result names and counts. For example:

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}
     },

category

Type: Types/string

Optional. The category of this recipe. The default is "crafting". Built-in categories are "crafting" and "smelting"; mods can add other categories. See Prototype/RecipeCategory.

energy_required

Type: Types/unsigned

Optional. The amount of time it takes to make this recipe. The default appears to be 0.5 (confirm).

For crafting recipes, this is the number of seconds it takes to craft. The time can be higher (or less), if assembler machine has higher tier or modules.

enabled

Type: Types/string (!)

Optional. This can be "false" to disable the recipe at the start of the game, or "true" to leave it enabled. The default is "true".

If your recipe is unlocked by a technology, you should set this to "false".


Examples

vanilla "iron-plate"

  {
    type = "recipe",
    name = "iron-plate",
    category = "smelting",
    energy_required = 3.5,
    ingredients = {{"iron-ore", 1}},
    result = "iron-plate"
  }

vanilla "coal-liquefaction"

data.raw.recipe["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,
  icons = {{icon = "__base__/graphics/icons/fluid/coal-liquefaction.png"}},
  ingredients = {
    {
      amount = 10,
      name = "coal",
      type = "item"
    },
    {
      amount = 25,
      name = "heavy-oil",
      type = "fluid"
    },
    {
      amount = 50,
      name = "steam",
      type = "fluid"
    }
  },

  results = {
    {
      amount = 35,
      name = "heavy-oil",
      type = "fluid"
    },
    {
      amount = 15,
      name = "light-oil",
      type = "fluid"
    },
    {
      amount = 20,
      name = "petroleum-gas",
      type = "fluid"
    }
  },
  allow_decomposition = false
}