Types/ItemProductPrototype: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Removed explanation/examples of catalyst amount that is outside of the intended usecase)
Line 40: Line 40:
'''Default''': 0
'''Default''': 0


Amount that should not be affected by productivity modules (not yielded from bonus production) and should not be included in the item production statistics.<br>
Amount that should not be affected by productivity modules (not yielded from bonus production) and should not be included in the item production statistics.
When this value is 0,Product will be produce when green production bar or purple production bar(productivity bar) is full;<br>
When this vaule is 65535,Product will ONLY be produce when green production bar is full.
 
== Example ==
=== A Custom Result ===
<syntaxhighlight lang="lua">
  {type="item",name="iron-plate",amount_min=1,amount_max=3,catalyst_amount=2}
</syntaxhighlight>
When green production bar is full.it will produce 1~3 iron plates;<br>
When purple production bar is full.it will have 33.33% chance produce 1 iron plates;<br>
this is because internally,the range will become (1-2)~(3-2),taht is -1~1 iron plates,
but game will treat negative amount as zero,that is mean range -1~1,or all possible amount {-1,0,1} will become {0,0,1},that is 33.33% chance to get 1 iron plates.
 
=== Another Custom Result ===
<syntaxhighlight lang="lua">
  {type="item",name="iron-plate",amount_min=1,amount_max=3,catalyst_amount=10}
</syntaxhighlight>
When green production bar is full.it will produce 1~3 iron plates;<br>
When purple production bar is full.it will NEVER produce iron plates;<br>
this is because internally,the range will become (1-10)~(3-10),taht is -9~-7 iron plates,
but game will treat negative amount as zero,that is mean range -9~-7,or all possible amount {-9,-8,-7} will become {0,0,0},that is impossible to get a plate.


== See also ==
== See also ==
* [[Types/ProductPrototype]]
* [[Types/ProductPrototype]]
* [[Types/FluidProductPrototype]]
* [[Types/FluidProductPrototype]]

Revision as of 10:47, 9 February 2022

An item product definition for a Prototype/Recipe. Its loading is triggered by the type of a Types/ProductPrototype being "item". It can be specified as a table with named or numbered keys, but not a mix of both.

Mandatory properties

name or 1

Type: Types/string

The name of a Prototype/Item.

Optional properties

amount or 2

Type: Types/uint16

Mandatory when using numbered keys (an array).
If amount is present, amount_min and amount_max are not loaded.

probability

Type: Types/double

Default: 1

Value between 0 and 1, 0 for 0% chance and 1 for 100% chance.

amount_min

Type: Types/uint16

Mandatory if amount is not specified and named keys are being used.

amount_max

Type: Types/uint16

Mandatory if amount is not specified and named keys are being used.

If set to a number that is less than amount_min, the game will use amount_min internally.

catalyst_amount

Type: Types/uint16

Default: 0

Amount that should not be affected by productivity modules (not yielded from bonus production) and should not be included in the item production statistics.

See also