Factorio Prototype DocsVersion 1.1.107

TechnologyUnit :: struct Example code

Either count or count_formula must be defined, never both.

Properties

count optional :: uint64

How many units are needed. [...]

How many units are needed. [...]

count_formula optional :: string

Formula that specifies how many units are needed per level of the technology. [...]

Formula that specifies how many units are needed per level of the technology. [...]

time :: double

How much time one unit takes to research. [...]

How much time one unit takes to research. [...]

ingredients :: array[IngredientPrototype]

List of ingredients needed for one unit of research. [...]

List of ingredients needed for one unit of research. [...]

Properties

count :: uint64 optional

How many units are needed. Must be > 0.

count_formula :: string optional

Formula that specifies how many units are needed per level of the technology.

If the last characters of the prototype name are -<number>, the level is taken to be the number, e.g. physical-projectile-damage-2 implies a number of 2. This defaults to 1. There does not need to be lower-level technologies for a technology to be detected as having a level, meaning a technology or sequence of upgrade technologies can begin at any number.

For an infinite technology, the level begins at the given suffix (or 1 by default) and gains 1 level upon being researched, or if the max_level is reached, marked as completed. The initial level of a technology can not be greater than its max_level.

The formula is executed following the BODMAS order (also known as PEMDAS). It supports these operators and characters:

  • +: Addition

  • -: Subtraction

  • *: Multiplication

  • ^: Exponentiation

  • (): Brackets for order of operations; supports nested brackets

  • l or L: The current level of the technology

  • Digits: Treated as numbers

  • .: Decimal point in numbers

  • SPACE: Spaces are ignored

Note that this formula can also be used at runtime.

time :: double

How much time one unit takes to research. In a lab with a crafting speed of 1, it corresponds to the number of seconds.

ingredients :: array[IngredientPrototype]

List of ingredients needed for one unit of research. The items must all be ToolPrototypes.

Example

unit =
{
  count_formula = "2^(L-6)*1000",
  ingredients =
  {
    {"automation-science-pack", 1},
    {"logistic-science-pack", 1},
    {"chemical-science-pack", 1},
    {"production-science-pack", 1},
    {"utility-science-pack", 1},
    {"space-science-pack", 1}
  },
  time = 60
}

Prototypes

Types