Prototype/Recipe: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Changed links going to the redirect Types/unsigned to go to Types/uint32.)
m (→‎Recipe data: text mistake)
 
(39 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Basics ==
{{Prototype parent|PrototypeBase}}
A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe (see [[Prototype/RecipeCategory]]).
A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe (see [[Prototype/RecipeCategory]]).
{{Prototype TOC|recipe}}


== General properties ==
== General properties ==
Inherits all properties from [[Prototype]].
Inherits all properties from [[PrototypeBase]].
 
=== category ===
'''Type''': [[Types/string]]
 
'''Default''': "crafting"


{{Prototype property|category|[[Types/string|string]]|"crafting"|optional=true}}
Optional. The category of this recipe. The built-in categories can be found [[Data.raw#recipe-category|here]]. See also [[Prototype/RecipeCategory]].
Optional. The category of this recipe. The built-in categories can be found [[Data.raw#recipe-category|here]]. See also [[Prototype/RecipeCategory]].


=== subgroup ===
The recipe category "crafting" cannot contain recipes with fluid ingredients or products.
'''Type''': [[Types/string]]


Optional. 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 exit and no main_product is specified, the subgroup is required.
{{Prototype property|subgroup|[[Types/string|string]]||optional=true}}
 
Optional. 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, the subgroup is required.
=== icons, icon,  icon_size (IconSpecification) ===
'''Type''': [[Types/IconSpecification]]


{{Prototype property|icons, icon,  icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]|optional=true}}
An icon is mandatory for recipe with more than 1 product and no main_product. Otherwise defaults to the icon of main_product/1 product.
An icon is mandatory for recipe with more than 1 product and no main_product. Otherwise defaults to the icon of main_product/1 product.


If given, it overwrites the icon of the main_product/1 product.
If given, it overwrites the icon of the main_product/1 product.


=== crafting_machine_tint ===
{{Prototype property|crafting_machine_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}
'''Type''': [[Types/table]] of [[Types/Color]]
Optional. Used by crafting machine <code>[[Prototype/CraftingMachine#working_visualisations|working_visualisations]]</code> to tint certain layers with the recipe color. [[Types/WorkingVisualisation#apply_recipe_tint|apply_recipe_tint]] on the working visualisation determines which of the 4 colors is used for that layer (if any).
 
'''Default''': nil


Format:
Format:
<syntaxhighlight lang="lua">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}}</syntaxhighlight>
<syntaxhighlight lang="lua">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}}</syntaxhighlight>


Each key/value pair is optional and defaults to the above value.
Each key/value pair is optional and defaults to the above value.


== Recipe data ==
== 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 give it the exact same properties as the difficulty that is defined. See below for examples.
<!--
Anchor and property for the TOC at the top --><span id="normal">{{#subobject:normal
|Prototype property name=normal
|Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]
|Prototype property optional=true
|Prototype property pagename={{FULLPAGENAME}}
}}</span><!--
Anchor and property for the TOC at the top --><span id="expensive">{{#subobject:expensive
|Prototype property name=expensive
|Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]
|Prototype property optional=true
|Prototype property pagename={{FULLPAGENAME}}
}}</span><!--
-->
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 <code>false</code>. This will disable the recipe for the difficulty, same as setting it <code>enabled = false</code>. If it is enabled (by technologies etc), it will use the data from the other difficulty. Not setting a difficulty, e.g. <code>normal = nil</code>, is possible and gives that difficulty the exact same properties as the difficulty that is defined. Setting one or both difficulties to <code>true</code> is not valid and will produce an error. See below for examples of difficulty.


=== ingredients ===
{{Prototype property|ingredients|[[Types/table|table]] of [[Types/IngredientPrototype|IngredientPrototype]]}}
'''Type''': [[Types/table]]
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 [[Types/IngredientPrototype|IngredientPrototype]].<sup>[https://factorio.com/blog/post/fff-256]</sup><br>
 
Maximum ingredient amount is 65535.<br>
A table containing ingredient names and counts. For example:  
<code>ingredients</code> can be set to an empty table  to create a recipe that needs no ingredients.<br>
<pre>
Duplicate ingredients, e.g. two entries for the "wood" item, are ''not'' allowed.<br>
In-game, the item ingredients are ordered by [[Prototype/ItemGroup#order_in_recipe|item group order_in_recipe]].
<syntaxhighlight lang="lua">
ingredients = {{"iron-stick", 2}, {"iron-plate", 3}}
ingredients = {{"iron-stick", 2}, {"iron-plate", 3}}
</pre>
</syntaxhighlight>
or the same with full format:
The same with full format:
<pre>
<syntaxhighlight lang="lua">
ingredients = {{type = "item", name = "iron-stick", amount = 2}, {type = "item", name = "iron-plate", amount = 3}}
ingredients = {{type = "item", name = "iron-stick", amount = 2}, {type = "item", name = "iron-plate", amount = 3}}
</pre>
</syntaxhighlight>
Maximal ingredient amount is 65535.
For fluids, the full format always has to be used:
 
<syntaxhighlight lang="lua">
=== result ===
ingredients = {{type="fluid", name="water", amount=50}, {type="fluid", name="crude-oil", amount=100}}
'''Type''': [[Types/string]]
</syntaxhighlight>


{{Prototype property|result|[[Types/string|string]]|optional=true}}
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".
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 <code>results</code> takes priority over <code>result</code>. So if a recipe has both keys set, <code>result</code> will be ignored.<br>


=== result_count ===
{{Prototype property|result_count|[[Types/uint32|uint32]]|1|optional=true}}
'''Type''': [[Types/uint32]]
Optional. The number of items created by this recipe.


Optional. The number of items created by this recipe. The default is 1.
{{Prototype property|results|[[Types/table|table]] of [[Types/ProductPrototype|ProductPrototype]]|optional=true}}
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 [[Types/ProductPrototype|ProductPrototype]].<sup>[https://factorio.com/blog/post/fff-256]</sup><br>
<code>results</code> can be set to an empty table to create a recipe that produces nothing.<br>
Duplicate results, e.g. two entries for the "iron-plate" item, are allowed.


=== results ===
<syntaxhighlight lang="lua">
'''Type''': [[Types/table]]
 
A table containing result names and counts. For example:
<pre>
results=
results=
     {
     {
Line 71: Line 82:
       {type="fluid", name="petroleum-gas", amount=4}
       {type="fluid", name="petroleum-gas", amount=4}
     },
     },
</pre>
</syntaxhighlight>
<pre>
<syntaxhighlight lang="lua">
results =  
results =  
     {
     {
Line 78: Line 89:
       {type = "item", name = "gold-nuggets", amount = 1}
       {type = "item", name = "gold-nuggets", amount = 1}
     },
     },
</pre>
</syntaxhighlight>
 
<syntaxhighlight lang="lua">
=== energy_required ===
results =  
'''Type''': [[Types/double]]
    {
 
      {type = "fluid", name = "steam", amount = 1, temperature = 165}
'''Default''': 0.5
    },
</syntaxhighlight>


Optional. The amount of time it takes to make this recipe.
{{Prototype property|energy_required|[[Types/double|double]]|0.5|optional=true}}
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.
This is the number of seconds it takes to craft at crafting speed 1.


=== emissions_multiplier ===
{{Prototype property|emissions_multiplier|[[Types/double|double]]|1.0|optional=true}}
'''Type''': [[Types/double]]
 
'''Default''': 1.0
 
=== requester_paste_multiplier ===
'''Type''': [[Types/uint]]
 
'''Default''': 30


=== overload_multiplier ===
{{Prototype property|requester_paste_multiplier|[[Types/uint32|uint32]]|30|optional=true}}
'''Type''': [[Types/uint]]


'''Default''': 0
{{Prototype property|overload_multiplier|[[Types/uint32|uint32]]|0|optional=true}}
Used to determine how many extra items are put into an assembling machine before it's considered "full enough". See [[Inserters#Insertion_limits]].


=== enabled ===
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.
'''Type''': [[Types/bool]]


'''Default''': true
{{Prototype property|allow_inserter_overload|[[Types/bool|bool]]|true|optional=true}}
If the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).


{{Prototype property|enabled|[[Types/bool|bool]]|true|optional=true}}
Optional. This can be false to disable the recipe at the start of the game, or "true" to leave it enabled.
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".
If your recipe is unlocked by a technology, you should set this to "false".


=== hidden ===
{{Prototype property|hidden|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/bool]]
 
'''Default''': false
 
Optional. Hides the recipe from crafting menus.
Optional. Hides the recipe from crafting menus.


=== hide_from_stats ===
{{Prototype property|hide_from_stats|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/bool]]
Optional. Hides the recipe from flow stats (item/fluid production statistics).


'''Default''': false
{{Prototype property|hide_from_player_crafting|[[Types/bool|bool]]|false|optional=true}}
Optional. Hides the recipe from the player's crafting screen. The recipe will still show up for selection in machines.


Optional. Hides the recipe from flow stats (production statistics).
{{Prototype property|allow_decomposition|[[Types/bool|bool]]|true|optional=true}}
 
Optional. Whether this recipe is allowed to be broken down for the recipe tooltip "Total raw" calculations.
=== allow_decomposition ===
'''Type''': [[Types/bool]]
 
'''Default''': true
 
Optional. Whether the recipe can be broken down for "total-raw" calculations.
 
=== allow_as_intermediate ===
'''Type''': [[Types/bool]]
 
'''Default''': true


{{Prototype property|allow_as_intermediate|[[Types/bool|bool]]|true|optional=true}}
Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.
Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.


=== allow_intermediates ===
{{Prototype property|allow_intermediates|[[Types/bool|bool]]|true|optional=true}}
'''Type''': [[Types/bool]]
 
'''Default''': true
 
Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.
Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.


=== always_show_made_in ===
{{Prototype property|always_show_made_in|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/bool]]
 
'''Default''': false
 
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.
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.


=== show_amount_in_title ===
{{Prototype property|show_amount_in_title|[[Types/bool|bool]]|true|optional=true}}
'''Type''': [[Types/bool]]
 
'''Default''': true
 
Optional. Whether the recipe name should have the product amount in front of it, e.g. "2 [[transport belt]]"
Optional. Whether the recipe name should have the product amount in front of it, e.g. "2 [[transport belt]]"


=== always_show_products ===
{{Prototype property|always_show_products|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/bool]]
 
'''Default''': false
 
Optional. Whether the products are always shown in the recipe tool-tip.
Optional. Whether the products are always shown in the recipe tool-tip.


=== main_product ===
{{Prototype property|unlock_results|[[Types/bool|bool]]|true|optional=true}}
'''Type''': [[Types/string]]
Optional. Whether enabling this recipe unlocks its item products to show in selection lists (item filter, logistic request etc.).


{{Prototype property|main_product|[[Types/string|string]]|optional=true}}
Optional.
Optional.


For recipes with more than one product: This defines of which result the icon, subgroup and name is used. If it is not set and the recipe has more than 1 result the recipe will use the recipe-name and recipe-description locale and its own subgroup and icon.
For recipes with more than one product: This defines of which result the icon, subgroup and name is used. If it is not set and the recipe has more than 1 result the recipe will use the recipe-name and recipe-description locale and its own subgroup and icon.


For recipes with 1 result: The recipe uses the icon, subgroup and name of the result by default. If set this property is set to an empty string, the recipe will use the properties of the recipe instead of the result.
For recipes with 1 result: The recipe uses the icon, subgroup and name of the result by default. If this property is set to an empty string, the recipe will use the properties of the recipe instead of the result.


== Examples ==
== Examples ==
Line 227: Line 205:
       result = "iron-gear-wheel"
       result = "iron-gear-wheel"
     },
     },
    expensive =
    {
      ingredients = {{"iron-plate", 4}},
      result = "iron-gear-wheel"
    }
  },</syntaxhighlight>
==== Modified so that it cannot be crafted in normal mode, unless unlocked via command/research ====
<syntaxhighlight lang="lua">  {
    type = "recipe",
    name = "iron-gear-wheel",
    normal = false,
     expensive =
     expensive =
     {
     {
Line 238: Line 228:
     type = "recipe",
     type = "recipe",
     name = "iron-gear-wheel",
     name = "iron-gear-wheel",
     normal = false,
     normal = nil, --this line can be omitted
     expensive =
     expensive =
     {
     {

Latest revision as of 09:54, 9 November 2022

Prototype definitions » PrototypeBase » Prototype/Recipe


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


Prototype/Recipe — recipe
ingredients::table of IngredientPrototype
allow_as_intermediate::bool (optional)
allow_decomposition::bool (optional)
allow_inserter_overload::bool (optional)
allow_intermediates::bool (optional)
always_show_made_in::bool (optional)
always_show_products::bool (optional)
category::string (optional)
crafting_machine_tint::table of Color (optional)
emissions_multiplier::double (optional)
enabled::bool (optional)
energy_required::double (optional)
expensive::Recipe data or bool (optional)
hidden::bool (optional)
hide_from_player_crafting::bool (optional)
hide_from_stats::bool (optional)
icons, icon, icon_size (IconSpecification)::IconSpecification (optional)
main_product::string (optional)
normal::Recipe data or bool (optional)
overload_multiplier::uint32 (optional)
requester_paste_multiplier::uint32 (optional)
result::string (optional)
result_count::uint32 (optional)
results::table of ProductPrototype (optional)
show_amount_in_title::bool (optional)
subgroup::string (optional)
unlock_results::bool (optional)
Inherited from PrototypeBase
name::string
type::string
localised_description::LocalisedString (optional)
localised_name::LocalisedString (optional)
order::Order (optional)

General properties

Inherits all properties from PrototypeBase.

category

Type: string
Default: "crafting"
Optional. The category of this recipe. The built-in categories can be found here. See also Prototype/RecipeCategory.

The recipe category "crafting" cannot contain recipes with fluid ingredients or products.

subgroup

Type: string
Optional. 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, the subgroup is required.

icons, icon, icon_size (IconSpecification)

Type: IconSpecification
An icon is mandatory for recipe with more than 1 product and no main_product. Otherwise defaults to the icon of main_product/1 product.

If given, it overwrites the icon of the main_product/1 product.

crafting_machine_tint

Type: table of Color
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 the above value.

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.

ingredients

Type: table of IngredientPrototype
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}}

result

Type: 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". Note that results takes priority over result. So if a recipe has both keys set, result will be ignored.

result_count

Type: uint32
Default: 1
Optional. The number of items created by this recipe.

results

Type: table of ProductPrototype
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}
     },

energy_required

Type: double
Default: 0.5
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.

emissions_multiplier

Type: double
Default: 1.0

requester_paste_multiplier

Type: uint32
Default: 30

overload_multiplier

Type: uint32
Default: 0
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.

allow_inserter_overload

Type: bool
Default: true
If the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).

enabled

Type: bool
Default: true
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".

hidden

Type: bool
Default: false
Optional. Hides the recipe from crafting menus.

hide_from_stats

Type: bool
Default: false
Optional. Hides the recipe from flow stats (item/fluid production statistics).

hide_from_player_crafting

Type: bool
Default: false
Optional. Hides the recipe from the player's crafting screen. The recipe will still show up for selection in machines.

allow_decomposition

Type: bool
Default: true
Optional. Whether this recipe is allowed to be broken down for the recipe tooltip "Total raw" calculations.

allow_as_intermediate

Type: bool
Default: true
Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.

allow_intermediates

Type: bool
Default: true
Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.

always_show_made_in

Type: bool
Default: false
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.

show_amount_in_title

Type: bool
Default: true
Optional. Whether the recipe name should have the product amount in front of it, e.g. "2 transport belt"

always_show_products

Type: bool
Default: false
Optional. Whether the products are always shown in the recipe tool-tip.

unlock_results

Type: bool
Default: true
Optional. Whether enabling this recipe unlocks its item products to show in selection lists (item filter, logistic request etc.).

main_product

Type: string
Optional.

For recipes with more than one product: This defines of which result the icon, subgroup and name is used. If it is not set and the recipe has more than 1 result the recipe will use the recipe-name and recipe-description locale and its own subgroup and icon.

For recipes with 1 result: The recipe uses the icon, subgroup and name of the result by default. If this property is set to an empty string, the recipe will use the properties of the recipe instead of the result.

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