Types/ItemProductPrototype: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (Undo revision 188871 by Meifraye (talk) uints can't be negative)
Tag: Undo
(→‎probability: effect and outcome of using probability (as it appears in game))
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__NOTOC__An item product definition for a [[Prototype/Recipe]]. Its loading is triggered by the <code>type</code> of a [[Types/ProductPrototype]] being "item". It can be specified as a table with named or numbered keys, but not a mix of both.
__NOTOC__An item product definition, for example for a [[Prototype/Recipe]]. Its loading is triggered by the <code>type</code> 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 ==
== Mandatory properties ==
Line 22: Line 22:


Value between 0 and 1, 0 for 0% chance and 1 for 100% chance.
Value between 0 and 1, 0 for 0% chance and 1 for 100% chance.
The effect of probability is no product, or, a linear distribution on [min, max]. For a recipe with probability p, amount_min min, and amount_max max, the Expected Value of this '''product''' can be expressed as <code>p * (0.5 * (max + min))</code>. This is what will be shown in a recipe tooltip. The effect of <code>catalyst_amount</code> on the product is not shown.


=== amount_min ===
=== amount_min ===
Line 41: Line 43:


Amount that should not be affected by productivity modules (not yielded from bonus production) and should not be included in the item production statistics.
Amount that should not be affected by productivity modules (not yielded from bonus production) and should not be included in the item production statistics.
If this ItemProductPrototype is used in a recipe, the catalyst amount is calculated automatically based on the [[Prototype/Recipe#ingredients|ingredients]] and [[Prototype/Recipe#results|results]].[https://factorio.com/blog/post/fff-256]


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

Latest revision as of 21:05, 23 October 2022

An item product definition, for example 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.

The effect of probability is no product, or, a linear distribution on [min, max]. For a recipe with probability p, amount_min min, and amount_max max, the Expected Value of this product can be expressed as p * (0.5 * (max + min)). This is what will be shown in a recipe tooltip. The effect of catalyst_amount on the product is not shown.

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.

If this ItemProductPrototype is used in a recipe, the catalyst amount is calculated automatically based on the ingredients and results.[1]

See also