Prototype/Technology

From Official Factorio Wiki
Revision as of 17:53, 16 August 2023 by BilkaBot (talk | contribs) (Protected "Prototype/Technology": Migrated prototype doc to separate website ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Jump to navigation Jump to search

The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/prototypes/TechnologyPrototype.html

This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.


Template:Prototype parent A technology.

Template:Prototype TOC

General properties

Inherits all properties from PrototypeBase.

Template:Prototype property

name

See PrototypeBase#name

Inherited from PrototypeBase. If the name ends with -number, the number is ignored for localization purposes. E. g. if the name is whatever-name-3, the game looks for the technology-name.whatever-name localization. The technology tree will also show the number on the technology icon.

Technology data

If the technology does not have a difficulty, this is located directly in the prototype. Otherwise, if the "normal" or "expensive" property exists, the technology has difficulty. Then, the technology data has to be specified for each difficulty instead of directly in the prototype. If at least one difficulty has technology data defined, the other difficulty can be set to false. This will disable the technology for the difficulty, same as setting it enabled = false. If it is enabled (by script 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.

Template:Prototype property When set to true, and the technology contains several levels, only the relevant one is displayed in the technology screen.

  {
    type = "technology",
    name = "physical-projectile-damage-2",
    ...
    upgrade = "true"
  }

Template:Prototype property

Template:Prototype property Hides the technology from the tech screen.

Template:Prototype property Controls whether the technology is shown in the tech GUI when it is disabled (enabled = false).

Template:Prototype property Controls whether the technology cost ignores the tech cost multiplier set in the DifficultySettings, e.g. 4 for the default expensive difficulty.

Template:Prototype property table with the following key/value pairs:

  • count — uint64 — How many units are needed. Must be larger than 0. May not be specified if count_formula is specified.
  • count_formula — string — Formula that specifies how many units are needed per level of the technology. May not be specified if count is specified.
If the last characters of the prototype name are "-digits", the level is taken to be the digits. e.g. physical-projectile-damage-2 -> 2. The unspecified default is 1. There does not need to be lower-level technologies for a technology to be detected as having a level. (a technology or sequence of upgrade technologies can begin at any number)
For an infinite technology, the level begins at the suffix (or 1) and gains +1 level upon being researched, or is completed when the max_level is completed. The initial level of a technology cannot be greater than the max_level.
The formula is executed following the BODMAS order (also known as PEMDAS).
Supported operators & characters:
Operator meaning
+ Addition
- Subtraction
* Multiplication
^ Power, raise the preceding base number by the following exponent number
() Brackets for order, supported nested brackets
l or L The current level of the technology
Digits Are treated as numbers
. Decimal point in number
SPACE Space characters are ignored
  • time — double — How much time is needed per one unit, in lab with crafting speed 1 it is the number of seconds.
  • ingredients — table of IngredientPrototype — list of ingredients needed for one unit of research. The item types must all be tools.
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
}

Note: The count formula can also be used in the runtime api. Template:Prototype property "infinite" for infinite technologies, otherwise uint.

Template:Prototype property List of technologies needed to be researched before this one can be researched.

 prerequisites = {"explosives", "military-2"}

Template:Prototype property List of effects of the technology (applied when the technology is researched).

{
  {
    type  = "unlock-recipe",
    recipe = "land-mine"
  }
}

Example

{
  type = "technology",
  name = "steel-processing",
  icon_size = 256,
  icon_mipmaps = 4,
  icon = "__base__/graphics/technology/steel-processing.png",
  effects =
  {
    {
      type = "unlock-recipe",
      recipe = "steel-plate"
    },
    {
      type = "unlock-recipe",
      recipe = "steel-chest"
    }
  },
  unit =
  {
    count = 50,
    ingredients = {{"automation-science-pack", 1}},
    time = 5
  },
  order = "c-a"
}