Commonly used conventions for passing data between mods and Factorio.
Localised strings are a way to support translation of in-game text.
The smooth orientation.
Coordinates on a surface, for example of an entity.
Coordinates of a chunk in a LuaSurface where each integer x
/y
represents a different chunk.
Coordinates of a tile on a LuaSurface where each integer x
/y
represents a different tile.
Position inside an equipment grid.
Screen coordinates of a GUI element in a LuaGui.
A ChunkPosition with an added bounding box for the area of the chunk.
A table used to define a manual shape for a piece of equipment.
A dictionary of string to the four basic Lua types: string
, boolean
, number
, table
.
A vector is a two-element array containing the x
and y
components.
Two positions, specifying the top-left and bottom-right corner of the box respectively.
An area defined using the map editor.
A position defined using the map editor.
Red, green, blue and alpha values, all in range [0, 1] or all in range [0, 255] if any value is > 1.
Same as Color, but red, green, blue and alpha values can be any floating point number, without any special handling of the range [1, 255].
One vertex of a ScriptRenderPolygon.
Parameters that affect the look and control of the game.
What is shown in the map view.
These values are for the time frame of one second (60 ticks).
These values represent a percentual increase in evolution.
Candidate chunks are given scores to determine which one of them should be expanded into.
Various game-related settings.
Technology and recipe difficulty settings.
All regular MapSettings plus an additional table that contains the DifficultySettings.
The data that can be extracted from a map exchange string, as a plain table.
The representation of an entity inside of a blueprint.
The effect that is applied when a technology is researched.
A single offer on a market entity.
Specifies how probability and richness are calculated when placing something on the map.
A fragment of a functional program used to generate coherent noise, probably for purposes related to terrain generation.
A floating point number specifying an amount.
The 'map type' dropdown in the map generation GUI is actually a selector for elevation generator.
An actual signal transmitted by the network.
A single filter used by an infinity-filters instance.
A single filter used by an infinity-pipe type entity.
The settings used by a heat-interface type entity.
A definition of a fluidbox connection point.
Commands can be given to enemies and unit groups.
Used for specifying where a GUI arrow should point to.
It is specified by string.
This is a set of flags given as a dictionary[string → boolean].
This is a set of flags given as dictionary[string → boolean].
A string specifying a collision mask layer.
This is a set of masks given as a dictionary[CollisionMaskLayer → boolean].
A CollisionMask which also includes any flags this mask has.
This is a set of trigger target masks given as a dictionary[string → boolean].
An array with the following members:
- A RealOrientation
- A Vector
This is a set of flags given as a dictionary[string → boolean].
Any basic type (string, number, boolean) or table.
Any basic type (string, number, boolean), table, or LuaObject.
Information about the event that has been raised.
This is a set of flags given as a dictionary[string → boolean].
A value between 0 and 255 inclusive represented by one of the following named string or string version of the value (for example "27"
and "decals"
are both valid).
Defines which slider in the game's sound settings affects the volume of this sound.
Used to filter out irrelevant event callbacks in a performant way.
concept LocalisedString
Localised strings are a way to support translation of in-game text. It is an array where the first element is the key and the remaining elements are parameters that will be substituted for placeholders in the template designated by the key.
The key identifies the string template. For example, "gui-alert-tooltip.attack"
(for the template "__1__
objects are being damaged"
; see the file data/core/locale/en.cfg
).
The template can contain placeholders such as __1__
or __2__
. These will be replaced by the respective parameter in the LocalisedString. The parameters themselves can be other localised strings, which will be processed recursively in the same fashion. Localised strings can not be recursed deeper than 20 levels and can not have more than 20 parameters.
As a special case, when the key is just the empty string, all the parameters will be concatenated (after processing, if any are localised strings). If there is only one parameter, it will be used as is.
Furthermore, when an API function expects a localised string, it will also accept a regular string (i.e. not a table) which will not be translated, as well as a number or boolean, which will be converted to their textual representation.
In the English translation, this will print "No ammo"
; in the Czech translation, it will print "Bez munice"
:
game.player.print({"description.no-ammo"})
The description.no-ammo
template contains no placeholders, so no further parameters are necessary.
In the English translation, this will print "Durability: 5/9"
; in the Japanese one, it will print "耐久度: 5/9"
:
game.player.print({"description.durability", 5, 9})
This will print "hello"
in all translations:
game.player.print({"", "hello"})
This will print "Iron plate: 60"
in the English translation and "Eisenplatte: 60"
in the German translation.
game.print({"", {"item-name.iron-plate"}, ": ", 60})
concept RealOrientation
The smooth orientation. It is a float in the range [0, 1)
that covers a full circle, starting at the top and going clockwise. This means a value of 0
indicates "north", a value of 0.5
indicates "south".
For example then, a value of 0.625
would indicate "south-west", and a value of 0.875
would indicate "north-west".
table_or_array MapPosition
Coordinates on a surface, for example of an entity. MapPositions may be specified either as a dictionary with x
, y
as keys, or simply as an array with two elements.
The coordinates are saved as a fixed-size 32 bit integer, with 8 bits reserved for decimal precision, meaning the smallest value step is 1/2^8 = 0.00390625
tiles.
Explicit definition:
{x = 5.5, y = 2}
{y = 2.25, x = 5.125}
Shorthand:
{1.625, 2.375}
table_or_array ChunkPosition
Coordinates of a chunk in a LuaSurface where each integer x
/y
represents a different chunk. This uses the same format as MapPosition, meaning it can be specified either with or without explicit keys. A MapPosition can be translated to a ChunkPosition by dividing the x
/y
values by 32.
table_or_array TilePosition
Coordinates of a tile on a LuaSurface where each integer x
/y
represents a different tile. This uses the same format as MapPosition, except it rounds any non-integer x
/y
down to whole numbers. It can be specified either with or without explicit keys.
table_or_array EquipmentPosition
Position inside an equipment grid. This uses the same format as MapPosition, meaning it can be specified either with or without explicit keys.
Explicit definition:
{x = 5, y = 2}
{y = 2, x = 5}
Shorthand:
{1, 2}
table_or_array GuiLocation
Screen coordinates of a GUI element in a LuaGui. This uses the same format as TilePosition, meaning it can be specified either with or without explicit keys.
table ChunkPositionAndArea
A ChunkPosition with an added bounding box for the area of the chunk.
table GuiAnchor
If provided, only anchors the GUI element when the opened things type matches the type.
If provided, only anchors the GUI element when the opened thing matches the name. name
takes precedence over names
.
If provided, only anchors the GUI element when the opened thing matches one of the names. When reading an anchor, names
is always populated.
table OldTileAndPosition
concept Tags
A dictionary of string to the four basic Lua types: string
, boolean
, number
, table
.
{a = 1, b = true, c = "three", d = {e = "f"}}
table SmokeSource
The vectors for all 5 position attributes are a table with x
and y
keys instead of an array.
concept Vector
A vector is a two-element array containing the x
and y
components. In some specific cases, the vector is a table with x
and y
keys instead, which the documentation will point out.
right = {1.0, 0.0}
table_or_array BoundingBox
Two positions, specifying the top-left and bottom-right corner of the box respectively. Like with MapPosition, the names of the members may be omitted. When read from the game, the third member orientation
is present if it is non-zero, however it is ignored when provided to the game.
Explicit definition:
{left_top = {-2, -3}, right_bottom = {5, 8}}
Shorthand:
{{-2, -3}, {5, 8}}
table ScriptArea
An area defined using the map editor.
table ScriptPosition
A position defined using the map editor.
table_or_array Color
Red, green, blue and alpha values, all in range [0, 1] or all in range [0, 255] if any value is > 1. All values here are optional. Color channels default to 0
, the alpha channel defaults to 1
.
Similar to MapPosition, Color allows the short-hand notation of passing an array of exactly 3 or 4 numbers. The game usually expects colors to be in pre-multiplied form (color channels are pre-multiplied by alpha).
red1 = {r = 0.5, g = 0, b = 0, a = 0.5} -- Half-opacity red
red2 = {r = 0.5, a = 0.5} -- Same color as red1
black = {} -- All channels omitted: black
red1_short = {0.5, 0, 0, 0.5} -- Same color as red1 in short-hand notation
table Alert
The tick this alert was created.
The SignalID used for a custom alert. Only present for custom alerts.
The message for a custom alert. Only present for custom alerts.
table ScriptRenderVertexTarget
One vertex of a ScriptRenderPolygon.
Only used if target
is a LuaEntity.
table PathfinderWaypoint
The position of the waypoint on its surface.
true
if the path from the previous waypoint to this one goes through an entity that must be destroyed.
table CutsceneWaypoint
Position to pan the camera to.
Entity or unit group to pan the camera to.
How many ticks it will take to reach this waypoint from the previous one.
Time in ticks to wait before moving to the next waypoint.
Zoom level to be set when the waypoint is reached. When not specified, the previous waypoint's zoom is used.
table Decorative
The name of the decorative prototype.
table DecorativeResult
table ChartTagSpec
Either icon
, text
, or both must be provided.
struct GameViewSettings
Parameters that affect the look and control of the game. Updating any of the member attributes here will immediately take effect in the game engine.
show_controller_gui
:: boolean
[Read/Write]
Show the controller GUI elements. This includes the toolbar, the selected tool slot, the armour slot, and the gun and ammunition slots.
show_minimap
:: boolean
[Read/Write]
Show the chart in the upper right-hand corner of the screen.
show_research_info
:: boolean
[Read/Write]
Show research progress and name in the upper right-hand corner of the screen.
show_entity_info
:: boolean
[Read/Write]
Show overlay icons on entities. Also known as "alt-mode".
show_alert_gui
:: boolean
[Read/Write]
Show the flashing alert icons next to the player's toolbar.
update_entity_selection
:: boolean
[Read/Write]
When true
(the default), mousing over an entity will select it. Otherwise, moving the mouse won't update entity selection.
show_rail_block_visualisation
:: boolean
[Read/Write]
When true
(false
is default), the rails will always show the rail block visualisation.
show_map_view_options
:: boolean
[Read/Write]
Shows or hides the view options when map is opened.
show_quickbar
:: boolean
[Read/Write]
Shows or hides quickbar of shortcuts.
show_shortcut_bar
:: boolean
[Read/Write]
Shows or hides the shortcut bar.
table MapViewSettings
What is shown in the map view. If a field is not given, that setting will not be changed.
table PollutionMapSettings
These values are for the time frame of one second (60 ticks).
Whether pollution is enabled at all.
The amount that is diffused to a neighboring chunk (possibly repeated for other directions as well). Defaults to 0.02
.
The amount of PUs that need to be in a chunk for it to start diffusing. Defaults to 15
.
The amount of pollution eaten by a chunk's tiles as a percentage of 1. Defaults to 1
.
Any amount of pollution larger than this value is visualized as this value instead. Defaults to 150
.
Any amount of pollution smaller than this value (but bigger than zero) is visualized as this value instead. Defaults to 50
.
Defaults to 60
.
Defaults to 150
.
Defaults to 50
.
Defaults to 10
.
Defaults to 20
.
Defaults to 1
.
table EnemyEvolutionMapSettings
These values represent a percentual increase in evolution. This means a value of 0.1
would increase evolution by 10%.
Whether enemy evolution is enabled at all.
The amount evolution naturally progresses by every second. Defaults to 0.000004
.
The amount evolution progresses for every destroyed spawner. Defaults to 0.002
.
The amount evolution progresses for every unit of pollution. Defaults to 0.0000009
.
table EnemyExpansionMapSettings
Candidate chunks are given scores to determine which one of them should be expanded into. This score takes into account various settings noted below. The iteration is over a square region centered around the chunk for which the calculation is done, and includes the central chunk as well. Distances are calculated as Manhattan distance.
The pseudocode algorithm to determine a chunk's score is as follows:
player = 0
for neighbour in all chunks within enemy_building_influence_radius from chunk:
player += number of player buildings on neighbour
* building_coefficient
* neighbouring_chunk_coefficient^distance(chunk, neighbour)
base = 0
for neighbour in all chunk within friendly_base_influence_radius from chunk:
base += num of enemy bases on neighbour
* other_base_coefficient
* neighbouring_base_chunk_coefficient^distance(chunk, neighbour)
score(chunk) = 1 / (1 + player + base)
Whether enemy expansion is enabled at all.
Distance in chunks from the furthest base around to prevent expansions from reaching too far into the player's territory. Defaults to 7
.
Defaults to 2
.
Defaults to 2
.
Defaults to 0.1
.
Defaults to 2.0
.
Defaults to 0.5
.
Defaults to 0.4
.
A chunk has to have at most this high of a percentage of unbuildable tiles for it to be considered a candidate to avoid chunks full of water as candidates. Defaults to 0.9
, or 90%.
The minimum size of a biter group that goes to build a new base. This is multiplied by the evolution factor. Defaults to 5
.
The maximum size of a biter group that goes to build a new base. This is multiplied by the evolution factor. Defaults to 20
.
The minimum time between expansions in ticks. The actual cooldown is adjusted to the current evolution levels. Defaults to 4*3,600=14,400
ticks.
The maximum time between expansions in ticks. The actual cooldown is adjusted to the current evolution levels. Defaults to 60*3,600=216,000
ticks.
table UnitGroupMapSettings
The minimum amount of time in ticks a group will spend gathering before setting off. The actual time is a random time between the minimum and maximum times. Defaults to 3,600
ticks.
The maximum amount of time in ticks a group will spend gathering before setting off. The actual time is a random time between the minimum and maximum times. Defaults to 10*3,600=36,000
ticks.
After gathering has finished, the group is allowed to wait this long in ticks for delayed members. New members are not accepted anymore however. Defaults to 2*3,600=7,200
ticks.
The minimum group radius in tiles. The actual radius is adjusted based on the number of members. Defaults to 5.0
.
The maximum group radius in tiles. The actual radius is adjusted based on the number of members. Defaults to 30.0
.
The maximum speed a percentage of its regular speed that a group member can speed up to when catching up with the group. Defaults to 1.4
, or 140%.
The minimum speed a percentage of its regular speed that a group member can slow down to when ahead of the group. Defaults to 0.6
, or 60%.
The minimum speed as a percentage of its maximum speed that a group will slow down to so members that fell behind can catch up. Defaults to 0.3
, or 30%.
When a member of a group falls back more than this factor times the group radius, the group will slow down to its max_group_slowdown_factor
speed to let them catch up. Defaults to 3
.
When a member of a group falls back more than this factor times the group radius, it will be dropped from the group. Defaults to 10
.
The maximum number of automatically created unit groups gathering for attack at any time. Defaults to 30
.
The maximum number of members for an attack unit group. This only affects automatically created unit groups, manual groups created through the API are unaffected. Defaults to 200
.
table PathFinderMapSettings
The pathfinder performs a step of the backward search every fwd2bwd_ratio
'th step. The minimum allowed value is 2
, which means symmetric search. The default value is 5
.
When looking at which node to check next, their heuristic value is multiplied by this ratio. The higher it is, the more the search is directed straight at the goal. Defaults to 2
.
The maximum number of nodes that are expanded per tick. Defaults to 1,000
.
The maximum amount of work each pathfinding job is allowed to do per tick. Defaults to 8,000
.
Whether to cache paths at all. Defaults to true
.
Number of elements in the short cache. Defaults to 5
.
Number of elements in the long cache. Defaults to 25
.
The minimal distance to the goal in tiles required to be searched in the short path cache. Defaults to 10
.
The minimal number of nodes required to be searched in the short path cache. Defaults to 50
.
The minimal distance to the goal in tiles required to be searched in the long path cache. Defaults to 30
.
When looking for a connection to a cached path, search at most for this number of steps times the original estimate. Defaults to 100
.
When looking for a path from cache, make sure it doesn't start too far from the requested start in relative terms. Defaults to 0.2
.
When looking for a path from cache, make sure it doesn't end too far from the requested end in relative terms. This is typically more lenient than the start ratio since the end target could be moving. Defaults to 0.15
.
Same principle as cache_accept_path_start_distance_ratio
, but used for negative cache queries. Defaults to 0.3
.
Same principle as cache_accept_path_end_distance_ratio
, but used for negative cache queries. Defaults to 0.3
.
When assigning a rating to the best path, this multiplier times start distances is considered. Defaults to 10
.
When assigning a rating to the best path, this multiplier times end distances is considered. This value is typically higher than the start multiplier as this results in better end path quality. Defaults to 20
.
A penalty that is applied for another unit that is on the way to the goal. This is mainly relevant for situations where a group of units has arrived at the target they are supposed to attack, making units further back circle around to reach the target. Defaults to 30
.
The distance in tiles after which other moving units are not considered for pathfinding. Defaults to 5
.
A penalty that is applied for another unit that is too close and either not moving or has a different goal. Defaults to 30
.
The general collision penalty with other units. Defaults to 10
.
The collision penalty for positions that require the destruction of an entity to get to. Defaults to 3
.
The collision penalty for collisions in the extended bounding box but outside the entity's actual bounding box. Defaults to 3
.
The amount of path finder requests accepted per tick regardless of the requested path's length. Defaults to 10
.
When the max_clients_to_accept_any_new_request
amount is exhausted, only path finder requests with a short estimate will be accepted until this amount (per tick) is reached. Defaults to 100
.
The maximum direct distance in tiles before a request is no longer considered short. Defaults to 100
.
The maximum amount of nodes a short request will traverse before being rescheduled as a long request. Defaults to 1000
.
The amount of steps that are allocated to short requests each tick, as a percentage of all available steps. Defaults to 0.5
, or 50%.
The minimum amount of steps that are guaranteed to be performed for every request. Defaults to 2000
.
If the actual amount of steps is higher than the initial estimate by this factor, pathfinding is terminated. Defaults to 2000.0
.
The thresholds of waiting clients after each of which the per-tick work limit will be increased by the corresponding value in overload_multipliers
. This is to avoid clients having to wait too long. Must have the same number of elements as overload_multipliers
. Defaults to {0, 100, 500}
.
The multipliers to the amount of per-tick work applied after the corresponding thresholds in overload_levels
have been reached. Must have the same number of elements as overload_multipliers
. Defaults to {2, 3, 4}
.
The delay in ticks between decrementing the score of all paths in the negative cache by one. Defaults to 20
.
table MapSettings
Various game-related settings. Updating any of the attributes will immediately take effect in the game engine.
If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.
Increase the number of short paths the pathfinder can cache.
game.map_settings.path_finder.short_cache_size = 15
table DifficultySettings
Technology and recipe difficulty settings. Updating any of the attributes will immediately take effect in the game engine.
A value in range [0.001, 1000].
table MapAndDifficultySettings
All regular MapSettings plus an additional table that contains the DifficultySettings.
If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.
table MapExchangeStringData
The data that can be extracted from a map exchange string, as a plain table.
table BlueprintEntity
The representation of an entity inside of a blueprint. It has at least these fields, but can contain additional ones depending on the kind of entity.
The entity's unique identifier in the blueprint.
The prototype name of the entity.
The position of the entity.
The direction the entity is facing. Only present for entities that can face in different directions and when the entity is not facing north.
The entity tags of the entity, if there are any. Only relevant for entity ghosts.
The items that the entity will request when revived, if there are any. It's a mapping of prototype names to amounts. Only relevant for entity ghosts.
The circuit network connections of the entity, if there are any. Only relevant for entities that support circuit connections.
The control behavior of the entity, if it has one. The format of the control behavior depends on the entity's type. Only relevant for entities that support control behaviors.
The schedule of the entity, if it has one. Only relevant for locomotives.
table Tile
The position of the tile.
The prototype name of the tile.
table Fluid
Fluid prototype name of the fluid.
Amount of the fluid.
The temperature. When reading from LuaFluidBox, this field will always be present. It is not necessary to specify it when writing, however. When not specified, the fluid will be set to the fluid's default temperature as specified in the fluid's prototype.
table Product
"item"
or "fluid"
.
Prototype name of the result.
Amount of the item or fluid to give. If not specified, amount_min
, amount_max
and probability
must all be specified.
Minimal amount of the item or fluid to give. Has no effect when amount
is specified.
Maximum amount of the item or fluid to give. Has no effect when amount
is specified.
A value in range [0, 1]. Item or fluid is only given with this probability; otherwise no product is produced.
Other attributes may be specified depending on type
:
fluid
The fluid temperature of this product.
Products of the "steel-chest" recipe (an array of Product):
{{type="item", name="steel-chest", amount=1}}
Products of the "advanced-oil-processing" recipe:
{{type="fluid", name="heavy-oil", amount=1},
{type="fluid", name="light-oil", amount=4.5},
{type="fluid", name="petroleum-gas", amount=5.5}}
What a custom recipe would look like that had a probability of 0.5 to return a minimum amount of 1 and a maximum amount of 5:
{{type=0, name="custom-item", probability=0.5, amount_min=1, amount_max=5}}
table TechnologyModifier
The effect that is applied when a technology is researched. It is a table that contains at least the field type
.
Modifier type. Specifies which of the other fields will be available. Possible values are: "inserter-stack-size-bonus"
, "stack-inserter-capacity-bonus"
, "laboratory-speed"
, "character-logistic-trash-slots"
, "maximum-following-robots-count"
, "worker-robot-speed"
, "worker-robot-storage"
, "ghost-time-to-live"
, "turret-attack"
, "ammo-damage"
, "give-item"
, "gun-speed"
, "unlock-recipe"
, "character-crafting-speed"
, "character-mining-speed"
, "character-running-speed"
, "character-build-distance"
, "character-item-drop-distance"
, "character-reach-distance"
, "character-resource-reach-distance"
, "character-item-pickup-distance"
, "character-loot-pickup-distance"
, "character-inventory-slots-bonus"
, "deconstruction-time-to-live"
, "max-failed-attempts-per-tick-per-construction-queue"
, "max-successful-attempts-per-tick-per-construction-queue"
, "character-health-bonus"
, "mining-drill-productivity-bonus"
, "train-braking-force-bonus"
, "zoom-to-world-enabled"
, "zoom-to-world-ghost-building-enabled"
, "zoom-to-world-blueprint-enabled"
, "zoom-to-world-deconstruction-planner-enabled"
, "zoom-to-world-upgrade-planner-enabled"
, "zoom-to-world-selection-tool-enabled"
, "worker-robot-battery"
, "laboratory-productivity"
, "follower-robot-lifetime"
, "artillery-range"
, "nothing"
, "character-additional-mining-categories"
, "character-logistic-requests"
.
Other attributes may be specified depending on type
:
gun-speed
Prototype name of the ammunition category that is affected
Modification value. This will be added to the current gun speed modifier upon researching.
ammo-damage
Prototype name of the ammunition category that is affected
Modification value. This will be added to the current ammo damage modifier upon researching.
give-item
turret-attack
Turret prototype name this modifier will affect.
Modification value. This will be added to the current turret damage modifier upon researching.
unlock-recipe
Recipe prototype name to unlock.
nothing
Description of this nothing modifier.
Other types
Modification value. This value will be added to the variable it modifies.
table Offer
A single offer on a market entity.
List of prices.
The action that will take place when a player accepts the offer. Usually a "give-item"
modifier.
table AutoplaceSpecification
Specifies how probability and richness are calculated when placing something on the map. Can be specified either using probability_expression
and richness_expression
or by using all the other fields.
Control prototype name.
table NoiseExpression
A fragment of a functional program used to generate coherent noise, probably for purposes related to terrain generation. These can only be meaningfully written/modified during the data load phase. More detailed information is found on the wiki.
Names the type of the expression and determines what other fields are required.
table AutoplaceSpecificationPeak
Prototype name of the noise layer.
concept MapGenSize
A floating point number specifying an amount.
For backwards compatibility, MapGenSizes can also be specified as one of the following strings, which will be converted to a number (when queried, a number will always be returned):
"none"
- equivalent to 0
"very-low"
, "very-small"
, "very-poor"
- equivalent to 1/2
"low"
, "small"
, "poor"
- equivalent to 1/sqrt(2)
"normal"
, "medium"
, "regular"
- equivalent to 1
"high"
, "big"
, "good"
- equivalent to sqrt(2)
"very-high"
, "very-big"
, "very-good"
- equivalent to 2
The map generation algorithm officially supports the range of values the in-game map generation screen shows (specifically 0
and values from 1/6
to 6
). Values outside this range are not guaranteed to work as expected.
table AutoplaceSetting
table AutoplaceSettings
Whether missing autoplace names for this type should be default enabled.
table AutoplaceControl
For things that are placed as spots such as ores and enemy bases, frequency is generally proportional to number of spots placed per unit area. For continuous features such as forests, frequency is how compressed the probability function is over distance, i.e. the inverse of 'scale' (similar to terrain_segmentation). When the LuaAutoplaceControlPrototype is of the category "terrain"
, then scale is shown in the map generator GUI instead of frequency.
For things that are placed as spots, size is proportional to the area of each spot. For continuous features, size affects how much of the map is covered with the thing, and is called 'coverage' in the GUI.
Has different effects for different things, but generally affects the 'health' or density of a thing that is placed without affecting where it is placed. For trees, richness affects tree health. For ores, richness multiplies the amount of ore at any given tile in a patch. Metadata about autoplace controls (such as whether or not 'richness' does anything for them) can be found in the LuaAutoplaceControlPrototype by looking up game.autoplace_control_prototypes[(control prototype name)]
, e.g. game.autoplace_control_prototypes["enemy-base"].richness
is false, because enemy base autoplacement doesn't use richness.
table CliffPlacementSettings
Name of the cliff prototype.
Elevation at which the first row of cliffs is placed. The default is 10
, and this cannot be set from the map generation GUI.
Elevation difference between successive rows of cliffs. This is inversely proportional to 'frequency' in the map generation GUI. Specifically, when set from the GUI the value is 40 / frequency
.
Corresponds to 'continuity' in the GUI. This value is not used directly, but is used by the 'cliffiness' noise expression, which in combination with elevation and the two cliff elevation properties drives cliff placement (cliffs are placed when elevation crosses the elevation contours defined by cliff_elevation_0
and cliff_elevation_interval
when 'cliffiness' is greater than 0.5
). The default 'cliffiness' expression interprets this value such that larger values result in longer unbroken walls of cliffs, and smaller values (between 0
and 1
) result in larger gaps in cliff walls.
table MapGenSettings
The 'map type' dropdown in the map generation GUI is actually a selector for elevation generator. The base game sets property_expression_names.elevation
to "0_16-elevation"
to reproduce terrain from 0.16 or to "0_17-island"
for the island preset. If generators are available for other properties, the 'map type' dropdown in the GUI will be renamed to 'elevation' and shown along with selectors for the other selectable properties.
The inverse of 'water scale' in the map generator GUI. Lower terrain_segmentation
increases the scale of elevation features (lakes, continents, etc). This behavior can be overridden with alternate elevation generators (see property_expression_names
, below).
The equivalent to 'water coverage' in the map generator GUI. Specifically, when this value is non-zero, water_level = 10 * log2
(the value of this field), and the elevation generator subtracts water level from elevation before adding starting lakes. If water is set to 'none', elevation is clamped to a small positive value before adding starting lakes. This behavior can be overridden with alternate elevation generators (see property_expression_names
, below).
Indexed by autoplace control prototype name.
Whether undefined autoplace_controls
should fall back to the default controls or not. Defaults to true
.
Each setting in this dictionary maps the string type to the settings for that type. Valid types are "entity"
, "tile"
and "decorative"
.
Map generation settings for entities of the type "cliff".
The random seed used to generated this map.
Width in tiles. If 0
, the map has 'infinite' width, with the actual limitation being one million tiles in each direction from the center.
Height in tiles. If 0
, the map has 'infinite' height, with the actual limitation being one million tiles in each direction from the center.
Size of the starting area.
Positions of the starting areas.
Whether peaceful mode is enabled for this map.
Overrides for tile property value generators. Values either name a NamedNoiseExpression or can be literal numbers, stored as strings (e.g. "5"
). All other controls can be overridden by a property expression names. Notable properties:
- moisture
- a value between 0 and 1 that determines whether a tile becomes sandy (low moisture) or grassy (high moisture).
- aux
- a value between 0 and 1 that determines whether low-moisture tiles become sand or red desert.
- temperature
- provides a value (vaguely representing degrees Celsius, varying between -20 and 50) that is used (together with moisture and aux) as part of tree and decorative placement.
- elevation
- tiles values less than zero become water. Cliffs are placed along certain contours according to CliffPlacementSettings.
- cliffiness
- determines whether (when >0.5) or not (when <0.5) a cliff will be placed at an otherwise suitable (according to CliffPlacementSettings) location.
- enemy-base-intensity
- a number that is referenced by both enemy-base-frequency
and enemy-base-radius
. i.e. if this is overridden, enemy base frequency and size will both be affected and do something reasonable. By default, this expression returns a value proportional to distance from any starting point, clamped at about 7.
- enemy-base-frequency
- a number representing average number of enemy bases per tile for a region, by default in terms of enemy-base-intensity
.
- enemy-base-radius
- a number representing the radius of an enemy base, if one were to be placed on the given tile, by default proportional to a constant plus enemy-base-intensity
. Climate controls ('Moisture' and 'Terrain type' at the bottom of the Terrain tab in the map generator GUI) don't have their own dedicated structures in MapGenSettings. Instead, their values are stored as property expression overrides with long names:
- control-setting:moisture:frequency:multiplier
- frequency (inverse of scale) multiplier for moisture noise. Default is 1.
- control-setting:moisture:bias
- global bias for moisture (which normally varies between 0 and 1). Default is 0.
- control-setting:aux:frequency:multiplier
- frequency (inverse of scale) multiplier for aux (called 'terrain type' in the GUI) noise. Default is 1.
- control-setting:aux:bias
- global bias for aux/terrain type (which normally varies between 0 and 1). Default is 0. All other MapGenSettings feed into named noise expressions, and therefore placement can be overridden by including the name of a property in this dictionary. The probability and richness functions for placing specific tiles, entities, and decoratives can be overridden by including an entry named {tile|entity|decorative}:(prototype name):{probability|richness}
.
Assuming a NamedNoiseExpression with the name "my-alternate-grass1-probability" is defined
local surface = game.player.surface
local mgs = surface.map_gen_settings
mgs.property_expression_names["tile:grass1:probability"] = "my-alternate-grass1-probability"
surface.map_gen_settings = mgs
would override the probability of grass1 being placed at any given point on the current surface.
To make there be no deep water on (newly generated chunks) a surface:
local surface = game.player.surface
local mgs = surface.map_gen_settings
mgs.property_expression_names["tile:deepwater:probability"] = -1000
surface.map_gen_settings = mgs
This does not require a NamedNoiseExpression to be defined, since literal numbers (and strings naming literal numbers, e.g. "123"
) are understood to stand for constant value expressions.
table InfinityPipeFilter
A single filter used by an infinity-pipe type entity.
Name of the fluid.
The fill percentage the pipe (e.g. 0.5 for 50%). Can't be negative.
The temperature of the fluid. Defaults to the default/minimum temperature of the fluid.
"at-least"
, "at-most"
, "exactly"
, "add"
, or "remove"
. Defaults to "at-least"
.
table FluidBoxFilterSpec
Fluid prototype name of the filtered fluid.
The minimum temperature allowed into the fluidbox.
The maximum temperature allowed into the fluidbox.
Force the filter to be set, regardless of current fluid content.
table HeatConnection
table FluidBoxConnection
A definition of a fluidbox connection point.
The connection type: "input", "output", or "input-output".
The 4 cardinal direction connection points for this pipe. This vector is a table with x
and y
keys instead of an array.
The maximum tile distance this underground connection can connect at if this is an underground pipe.
table ArithmeticCombinatorParameters
First signal to use in an operation. If not specified, the second argument will be the value of first_constant
.
Second signal to use in an operation. If not specified, the second argument will be the value of second_constant
.
Constant to use as the first argument of the operation. Has no effect when first_signal
is set. Defaults to 0
.
Constant to use as the second argument of the operation. Has no effect when second_signal
is set. Defaults to 0
.
Must be one of "*"
, "/"
, "+"
, "-"
, "%"
, "^"
, "<<"
, ">>"
, "AND"
, "OR"
, "XOR"
. When not specified, defaults to "*"
.
Specifies the signal to output.
enum ComparatorString
"equal to"
"greater than"
"lesser than"
"greater than or equal to"
"greater than or equal to"
"lesser than or equal to"
"lesser than or equal to"
"not equal to"
"not equal to"
While the API accepts both versions for "less/greater than or equal to"
and "not equal"
, it'll always return "≥"
, "≤"
or "≠"
respectively when reading them back.
table DeciderCombinatorParameters
Defaults to blank.
Second signal to use in an operation, if any. If this is not specified, the second argument to a decider combinator's operation is assumed to be the value of constant
.
Constant to use as the second argument of operation. Defaults to 0
.
Specifies how the inputs should be compared. If not specified, defaults to "<"
.
Defaults to blank.
Defaults to true
. When false
, will output a value of 1
for the given output_signal
.
table InserterCircuitConditions
table CircuitCondition
Specifies how the inputs should be compared. If not specified, defaults to "<"
.
Defaults to blank
What to compare first_signal
to. If not specified, first_signal
will be compared to constant
.
Constant to compare first_signal
to. Has no effect when second_signal
is set. When neither second_signal
nor constant
are specified, the effect is as though constant
were specified with the value 0
.
table CircuitConditionDefinition
Whether the condition is currently fulfilled
table CircuitConnectionDefinition
Wire color, either defines.wire_type.red or defines.wire_type.green.
table WireConnectionDefinition
Wire color, either defines.wire_type.red or defines.wire_type.green.
The entity to (dis)connect the source entity with.
Mandatory if the source entity has more than one circuit connection using circuit wire.
Mandatory if the target entity has more than one circuit connection using circuit wire.
Mandatory if the source entity has more than one wire connection using copper wire.
Mandatory if the target entity has more than one wire connection using copper wire.
table PlaceAsTileResult
The tile prototype.
table Command
Commands can be given to enemies and unit groups.
Type of command. The remaining fields depend on the value of this field.
Other attributes may be specified depending on type
:
defines.command.attack
Defaults to defines.distraction.by_enemy
.
defines.command.go_to_location
The position to path to. Either this or destination_entity
need to be specified. If both are, destination_entity
is used.
The entity to path to. Either this or destination
need to be specified. If both are, destination_entity
is used.
Defaults to defines.distraction.by_enemy
.
Flags that affect pathfinder behavior.
How close the pathfinder needs to get to its destination (in tiles). Defaults to 3
.
defines.command.compound
How the commands should be chained together.
The sub-commands.
defines.command.group
The group whose command to follow.
Defaults to defines.distraction.by_enemy
.
Whether the unit will use the group distraction or the commands distraction. Defaults to true.
defines.command.attack_area
Center of the attack area.
Radius of the attack area.
Defaults to defines.distraction.by_enemy
.
defines.command.wander
Defaults to defines.distraction.by_enemy
.
Defaults to 10. Does not apply when wander_in_group
is true
.
When commanding a group, defines how the group will wander. When true
, the units in the group will wander around inside the group's radius, just like gathering biters. When false
, the units will wander as a group, ie they will all walk together in the same random direction. Default is true for groups. Passing true for a single unit is an error.
Ticks to wander before successfully completing the command. Default is max uint, which means wander forever.
defines.command.stop
Defaults to defines.distraction.by_enemy
.
Ticks to wander before successfully completing the command. Default is max uint, which means stop forever.
defines.command.flee
The entity to flee from
Defaults to defines.distraction.by_enemy
.
defines.command.build_base
Where to build the base.
Defaults to defines.distraction.by_enemy
.
Whether the units should ignore expansion candidate chunks. When false
, they will obey and not build a base in a non-candidate chunk. Defaults to false
.
table PathfinderFlags
Allows pathing through friendly entities. Defaults to false
.
Allows the pathfinder to path through entities of the same force. Defaults to false
.
Enables path caching. This can be more efficient, but might fail to respond to changes in the environment. Defaults to true
.
Makes the pathfinder try to path in straight lines. Defaults to false
.
Sets lower priority on the path request, meaning it might take longer to find a path at the expense of speeding up others. Defaults to false
.
Makes the pathfinder not break in the middle of processing this pathfind, no matter how much work is needed. Defaults to false
.
table UnitSpawnDefinition
Prototype name of the unit that would be spawned.
The points at which to spawn the unit.
table ItemStackDefinition
Prototype name of the item the stack holds.
Number of items the stack holds. If not specified, defaults to 1
.
Health of the items in the stack. Defaults to 1.0
.
Durability of the tool items in the stack.
Amount of ammo in the ammo items in the stack.
Tags of the items with tags in the stack.
union SimpleItemStack
The name of the item, which represents a full stack of that item.
The detailed definition of an item stack.
Both of these lines specify an item stack of one iron plate:
{name="iron-plate"}
{name="iron-plate", count=1}
This is a stack of 47 copper plates:
{name="copper-plate", count=47}
These are both full stacks of iron plates (for iron-plate, a full stack is 100 plates):
"iron-plate"
{name="iron-plate", count=100}
union TechnologyIdentification
The technology name.
A reference to LuaTechnology may be passed directly.
A reference to LuaTechnologyPrototype may be passed directly.
union SurfaceIdentification
It will be the index of the surface. nauvis
has index 1
, the first surface-created surface will have index 2
and so on.
It will be the surface name. E.g. "nauvis"
.
A reference to LuaSurface may be passed directly.
union ItemStackIdentification
union ItemPrototypeIdentification
The item.
The item prototype.
The prototype name.
table WaitCondition
One of "time"
, "inactivity"
, "full"
, "empty"
, "item_count"
, "circuit"
, "robots_inactive"
, "fluid_count"
, "passenger_present"
, "passenger_not_present"
.
Either "and"
, or "or"
. Tells how this condition is to be compared with the preceding conditions in the corresponding wait_conditions
array.
Number of ticks to wait or of inactivity. Only present when type
is "time"
or "inactivity"
.
Only present when type
is "item_count"
, "circuit"
or "fluid_count"
.
table TrainScheduleRecord
Name of the station.
Rail to path to. Ignored if station
is present.
When a train is allowed to reach rail target from any direction it will be nil
. If rail has to be reached from specific direction, this value allows to choose the direction. This value corresponds to LuaEntity::connected_rail_direction of a TrainStop.
Only present when the station is temporary, the value is then always true
.
table TrainSchedule
Index of the currently active record
table GuiArrowSpecification
Used for specifying where a GUI arrow should point to.
This determines which of the following fields will be required. Must be one of "nowhere"
(will remove the arrow entirely), "goal"
(will point to the current goal), "entity_info"
, "active_window"
, "entity"
, "position"
, "crafting_queue"
or "item_stack"
(will point to a given item stack in an inventory). Depending on this value, other fields may have to be specified.
Other attributes may be specified depending on type
:
entity
position
crafting_queue
Index in the crafting queue to point to.
item_stack
table AmmoType
One of "entity"
(fires at an entity), "position"
(fires directly at a position), or "direction"
(fires in a direction).
When true
, the gun will be able to shoot even when the target is out of range. Only applies when target_type
is position
. The gun will fire at the maximum range in the direction of the target position. Defaults to false
.
Ammo category of this ammo.
Energy consumption of a single shot, if applicable. Defaults to 0
.
table BeamTarget
The target entity.
The target position.
concept SpritePath
It is specified by string. It can be either the name of a sprite prototype defined in the data stage or a path in form "type/name".
The supported types are:
- "item"
- for example "item/iron-plate" is the icon sprite of iron plate
- "entity"
- for example "entity/small-biter" is the icon sprite of the small biter
- "technology"
- "recipe"
- "item-group"
- "fluid"
- "tile"
- "virtual-signal"
- "achievement"
- "equipment"
- "file"
- path to an image file located inside the current scenario. This file is not preloaded so it will be slower; for frequently used sprites, it is better to define sprite prototype and use it instead.
- "utility"
- sprite defined in the utility-sprites object, these are the pictures used by the game internally for the UI.
concept SoundPath
A sound defined by a string. It can be either the name of a sound prototype defined in the data stage or a path in the form "type/name"
. The latter option can be sorted into three categories.
The utility and ambient types each contain general use sound prototypes defined by the game itself.
- "utility"
- Uses the UtilitySounds prototype. Example: "utility/wire_connect_pole"
- "ambient"
- Uses AmbientSound prototypes. Example: "ambient/resource-deficiency"
The following types can be combined with any tile name as long as its prototype defines the
corresponding sound.
- "tile-walking"
- Uses Tile::walking_sound. Example: "tile-walking/concrete"
- "tile-mined"
- Uses Tile::mined_sound
- "tile-build-small"
- Uses Tile::build_sound. Example: "tile-build-small/concrete"
- "tile-build-medium"
- Uses Tile::build_sound
- "tile-build-large"
- Uses Tile::build_sound
The following types can be combined with any entity name as long as its prototype defines the
corresponding sound.
- "entity-build"
- Uses Entity::build_sound. Example: "entity-build/wooden-chest"
- "entity-mined"
- Uses Entity::mined_sound
- "entity-mining"
- Uses Entity::mining_sound
- "entity-vehicle_impact"
- Uses Entity::vehicle_impact_sound
- "entity-rotated"
- Uses Entity::rotated_sound
- "entity-open"
- Uses Entity::open_sound
- "entity-close"
- Uses Entity::close_sound
table ModuleEffectValue
The percentual increase of the attribute. A value of 0.6
means a 60% increase.
table ModuleEffects
These are the effects of the vanilla Productivity Module 3 (up to floating point imprecisions):
{consumption={bonus=0.6},
speed={bonus=-0.15},
productivity={bonus=0.06},
pollution={bonus=0.075}}
flag EntityPrototypeFlags
This is a set of flags given as a dictionary[string → boolean]. When a flag is set, it is present in the dictionary with the value true
. Unset flags aren't present in the dictionary at all. So, the boolean value is meaningless and exists just for easy table lookup if a flag is set.
flag ItemPrototypeFlags
This is a set of flags given as dictionary[string → boolean]. When a flag is set, it is present in the dictionary with the value true
. Unset flags aren't present in the dictionary at all. So, the boolean value is meaningless and exists just for easy table lookup if a flag is set.
concept CollisionMaskLayer
A string specifying a collision mask layer.
Possible values for the string are:
- "ground-tile"
- "water-tile"
- "resource-layer"
- "doodad-layer"
- "floor-layer"
- "item-layer"
- "ghost-layer"
- "object-layer"
- "player-layer"
- "train-layer"
- "rail-layer"
- "transport-belt-layer"
- "not-setup"
Additionally the values "layer-13"
through "layer-55"
. These layers are currently unused by the game but may change. If a mod is going to use one of the unused layers it's recommended to start at the higher layers because the base game will take from the lower ones.
concept CollisionMask
This is a set of masks given as a dictionary[CollisionMaskLayer → boolean]. Only set masks are present in the dictionary and they have the value true
. Unset flags aren't present at all.
concept CollisionMaskWithFlags
A CollisionMask which also includes any flags this mask has.
Flags such as:
- "not-colliding-with-itself"
: Any two entities that both have this option enabled on their prototype and have an identical collision mask layers list will not collide. Other collision mask options are not included in the identical layer list check. This does mean that two different prototypes with the same collision mask layers and this option enabled will not collide.
- "consider-tile-transitions"
: Uses the prototypes position rather than its collision box when doing collision checks with tile prototypes. Allows the prototype to overlap colliding tiles up until its center point. This is only respected for character movement and cars driven by players.
- "colliding-with-tiles-only"
: Any prototype with this collision option will only be checked for collision with other prototype's collision masks if they are a tile.
table TriggerEffectItem
One of"damage"
, "create-entity"
, "create-explosion"
, "create-fire"
, "create-smoke"
, "create-trivial-smoke"
, "create-particle"
, "create-sticker"
, "nested-result"
, "play-sound"
, "push-back"
, "destroy-cliffs"
, "show-explosion-on-chart"
, "insert-item"
, "script"
.
table TriggerDelivery
One of "instant"
, "projectile"
, "flame-thrower"
, "beam"
, "stream"
, "artillery"
.
table TriggerItem
One of "direct"
, "area"
, "line"
, "cluster"
.
The trigger will only affect entities that contain any of these flags.
The trigger will only affect entities that would collide with given collision mask.
If "enemy"
, the trigger will only affect entities whose force is different from the attacker's and for which there is no cease-fire set. "ally"
is the opposite of "enemy"
.
table CircularParticleCreationSpecification
Name of the LuaEntityPrototype
This vector is a table with x
and y
keys instead of an array.
concept CircularProjectileCreationSpecification
An array with the following members:
- A RealOrientation
- A Vector
table AttackParameterFluid
Name of the LuaFluidPrototype.
Multiplier applied to the damage of an attack.
table AttackParameters
The type of AttackParameter. One of 'projectile'
, 'stream'
or 'beam'
.
Maximum range of attack.
Minimum range of attack. Used with flamethrower turrets to prevent self-immolation.
Defines how the range is determined. Either 'center-to-center'
or 'bounding-box-to-bounding-box'
.
When searching for the nearest enemy to attack, fire_penalty
is added to the enemy's distance if they are on fire.
When searching for an enemy to attack, a higher rotate_penalty
will discourage targeting enemies that would take longer to turn to face.
When searching for an enemy to attack, a higher health_penalty
will discourage targeting enemies with high health. A negative penalty will do the opposite.
If less than range
, the entity will choose a random distance between range
and min_attack_distance
and attack from that distance. Used for spitters.
The arc that the entity can attack in as a fraction of a circle. A value of 1
means the full 360 degrees.
Multiplier applied to the damage of an attack.
Multiplier applied to the ammo consumption of an attack.
Minimum amount of ticks between shots. If this is less than 1
, multiple shots can be performed per tick.
Number of ticks it takes for the weapon to actually shoot after it has been ordered to do so.
List of the names of compatible LuaAmmoCategoryPrototypes.
Other attributes may be specified depending on type
:
projectile
stream
table CapsuleAction
One of "throw"
, "equipment-remote"
, "use-on-self"
.
Only present when type
is "throw"
or "use-on-self"
.
Only present when type
is "equipment-remote"
. It is the equipment prototype name.
flag SelectionModeFlags
This is a set of flags given as a dictionary[string → boolean]. Set flags are present in the dictionary with the value true
; unset flags aren't present at all.
Entities that can be selected for blueprint.
Entities that can be marked for deconstruction.
Entities that can be marked for deconstruction cancelling.
Buildable entities.
Only select an area.
Entities that can be placed using an item.
Entities with the same force as the selector.
enum Alignment
A string that specifies where a gui element should be.
The same as "middle-left"
The same as "middle-center"
The same as "middle-right"
table EventData
Information about the event that has been raised. The table can also contain other fields depending on the type of event. See the list of Factorio events for more information on these.
The identifier of the event this handler was registered to.
The tick during which the event happened.
The name of the mod that raised the event if it was raised using LuaBootstrap::raise_event.
table ConfigurationChangedData
Old version of the map. Present only when loading map version other than the current version.
New version of the map. Present only when loading map version other than the current version.
Dictionary of mod changes. It is indexed by mod name.
true
when mod startup settings have changed since the last time this save was loaded.
true
when mod prototype migrations have been applied since the last time this save was loaded.
table ScriptRenderTarget
concept MouseButtonFlags
This is a set of flags given as a dictionary[string → boolean]. When a flag is set, it is present in the dictionary with the value true
. Unset flags aren't present in the dictionary at all.
To write to this, use an array[string] of the mouse buttons that should be possible to use with on button.
When setting flags, the flag "left-and-right"
can also be set which will set "left"
and "right"
true.
Possible flags when reading are:
- "left"
- "right"
- "middle"
- "button-4"
- "button-5"
- "button-6"
- "button-7"
- "button-8"
- "button-9"
enum CursorBoxRenderType
Yellow box.
Red box.
Light blue box.
Light blue box.
Green box.
White box.
Light blue box.
Green box.
enum ForceCondition
All forces pass.
Forces which will attack pass.
Forces which won't attack pass.
Forces which are friends pass.
Forces which are not friends pass.
The same force pass.
The non-same forces pass.
concept RenderLayer
A value between 0 and 255 inclusive represented by one of the following named string or string version of the value (for example "27"
and "decals"
are both valid). Higher values are rendered on top of lower values.
"water-tile"
: 15"ground-tile"
: 25"tile-transition"
: 26"decals"
: 27"lower-radius-visualization"
: 29"radius-visualization"
: 30"transport-belt-integration"
: 65"resource"
:66"building-smoke"
:67"decorative"
: 92"ground-patch"
: 93"ground-patch-higher"
: 94"ground-patch-higher2"
: 95"remnants"
: 112"floor"
: 113"transport-belt"
: 114"transport-belt-endings"
: 115"floor-mechanics-under-corpse"
: 120"corpse"
: 121"floor-mechanics"
: 122"item"
: 123"lower-object"
: 124"transport-belt-circuit-connector"
: 126"lower-object-above-shadow"
: 127"object"
: 129"higher-object-under"
: 131"higher-object-above"
: 132"item-in-inserter-hand"
: 134"wires"
: 135"wires-above"
: 136"entity-info-icon"
: 138"entity-info-icon-above"
: 139"explosion"
: 142"projectile"
: 143"smoke"
: 144"air-object"
: 145"air-entity-info-icon"
: 147"light-effect"
: 148"selection-box"
: 187"higher-selection-box"
: 188"collision-selection-box"
: 189"arrow"
: 190"cursor"
: 210enum CliffOrientation
table ItemStackLocation
enum SoundType
Defines which slider in the game's sound settings affects the volume of this sound. Furthermore, some sound types are mixed differently than others, e.g. zoom level effects are applied.
filter ItemPrototypeFilter
The condition to filter on. One of "tool"
, "mergeable"
, "item-with-inventory"
, "selection-tool"
, "item-with-label"
, "has-rocket-launch-products"
, "fuel"
, "place-result"
, "burnt-result"
, "place-as-tile"
, "placed-as-equipment-result"
, "name"
, "type"
, "flag"
, "subgroup"
, "fuel-category"
, "stack-size"
, "default-request-amount"
, "wire-count"
, "fuel-value"
, "fuel-acceleration-multiplier"
, "fuel-top-speed-multiplier"
, "fuel-emissions-multiplier"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
place-result
Filters for the place result.
burnt-result
Filters for the burnt result.
place-as-tile
Filters for the placed tile.
placed-as-equipment-result
Filters for the placed equipment.
name
For use within nested filters such as the has-product-item
filter of array[RecipePrototypeFilter]. To get a specific prototype by name, see LuaGameScript::item_prototypes.
type
The prototype type
Usage example:
game.get_filtered_item_prototypes({{filter = "type", type = "armor"}})
flag
One of the values in ItemPrototypeFlags.
subgroup
fuel-category
A LuaFuelCategoryPrototype name
stack-size
The value to compare against.
Usage example:
game.get_filtered_item_prototypes({{filter = "stack-size", comparison = ">", value = 20}, {filter = "stack-size", comparison = "<", value = 100, mode = "and"}})
default-request-amount
The value to compare against.
wire-count
The value to compare against.
fuel-value
The value to compare against.
fuel-acceleration-multiplier
The value to compare against.
fuel-top-speed-multiplier
The value to compare against.
fuel-emissions-multiplier
The value to compare against.
filter ModSettingPrototypeFilter
The condition to filter on. One of "type"
, "mod"
, "setting-type"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter TechnologyPrototypeFilter
The condition to filter on. One of "enabled"
, "hidden"
, "upgrade"
, "visible-when-disabled"
, "has-effects"
, "has-prerequisites"
, "research-unit-ingredient"
, "level"
, "max-level"
, "time"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
research-unit-ingredient
The research ingredient to check.
level
The value to compare against.
max-level
The value to compare against.
time
The value to compare against.
filter DecorativePrototypeFilter
The condition to filter on. One of "decal"
, "autoplace"
, "collision-mask"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
collision-mask
How to filter: "collides"
or "layers-equals"
filter AchievementPrototypeFilter
The condition to filter on. One of "allowed-without-fight"
, "type"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter FluidPrototypeFilter
The condition to filter on. One of "hidden"
, "name"
, "subgroup"
, "default-temperature"
, "max-temperature"
, "heat-capacity"
, "fuel-value"
, "emissions-multiplier"
, "gas-temperature"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
name
For use within nested filters such as the has-product-fluid
filter of array[RecipePrototypeFilter]. To get a specific prototype by name, see LuaGameScript::fluid_prototypes.
subgroup
default-temperature
The value to compare against.
max-temperature
The value to compare against.
heat-capacity
The value to compare against.
fuel-value
The value to compare against.
emissions-multiplier
The value to compare against.
gas-temperature
The value to compare against.
filter EquipmentPrototypeFilter
The condition to filter on. One of "item-to-place"
, "type"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter TilePrototypeFilter
The condition to filter on. One of "minable"
, "autoplace"
, "blueprintable"
, "item-to-place"
, "collision-mask"
, "walking-speed-modifier"
, "vehicle-friction-modifier"
, "decorative-removal-probability"
, "emissions"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
collision-mask
How to filter: "collides"
or "layers-equals"
walking-speed-modifier
The value to compare against.
vehicle-friction-modifier
The value to compare against.
decorative-removal-probability
The value to compare against.
emissions
The value to compare against.
filter RecipePrototypeFilter
The condition to filter on. One of "enabled"
, "hidden"
, "hidden-from-flow-stats"
, "hidden-from-player-crafting"
, "allow-as-intermediate"
, "allow-intermediates"
, "allow-decomposition"
, "always-show-made-in"
, "always-show-products"
, "show-amount-in-title"
, "has-ingredients"
, "has-products"
, "has-ingredient-item"
, "has-ingredient-fluid"
, "has-product-item"
, "has-product-fluid"
, "subgroup"
, "category"
, "energy"
, "emissions-multiplier"
, "request-paste-multiplier"
, "overload-multiplier"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
has-ingredient-item
Matches if at least 1 ingredient is an item that matches these filters.
has-ingredient-fluid
Matches if at least 1 ingredient is a fluid that matches these filters.
Usage example:
-- selects recipes that consume sulfuric acid
{{filter = "has-ingredient-fluid", elem_filters = {{filter = "name", name = "sulfuric-acid"}}}}
has-product-item
Matches if at least 1 product is an item that matches these filters.
Usage example:
-- selects recipes that produce an item
{{filter = "has-product-item"}}
-- selects recipes that produce iron plates
{{filter = "has-product-item", elem_filters = {{filter = "name", name = "iron-plate"}}}}
-- selects recipes that produce items that place furnaces
{{filter = "has-product-item", elem_filters = {{filter = "place-result", elem_filters = {{filter = "type", type = "furnace"}}}}}}
has-product-fluid
Matches if at least 1 product is a fluid that matches these filters.
subgroup
category
A LuaRecipeCategoryPrototype name
energy
The value to compare against.
emissions-multiplier
The value to compare against.
request-paste-multiplier
The value to compare against.
overload-multiplier
The value to compare against.
filter EntityPrototypeFilter
The condition to filter on. One of "flying-robot"
, "robot-with-logistics-interface"
, "rail"
, "ghost"
, "explosion"
, "vehicle"
, "crafting-machine"
, "rolling-stock"
, "turret"
, "transport-belt-connectable"
, "wall-connectable"
, "buildable"
, "placable-in-editor"
, "clonable"
, "selectable"
, "hidden"
, "entity-with-health"
, "building"
, "fast-replaceable"
, "uses-direction"
, "minable"
, "circuit-connectable"
, "autoplace"
, "blueprintable"
, "item-to-place"
, "name"
, "type"
, "collision-mask"
, "flag"
, "build-base-evolution-requirement"
, "selection-priority"
, "emissions"
, "crafting-category"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
name
For use within nested filters such as the place-result
filter of array[ItemPrototypeFilter]. To get a specific prototype by name, see LuaGameScript::entity_prototypes.
type
The prototype type
Usage example:
game.get_filtered_entity_prototypes({{filter = "type", type = "unit"}})
collision-mask
How to filter: "collides"
or "layers-equals"
Usage example:
game.get_filtered_entity_prototypes({{filter = "collision-mask", mask = "player-layer", mask_mode = "collides"}})
flag
One of the values in EntityPrototypeFlags.
Usage example:
game.get_filtered_entity_prototypes({{filter = "flag", flag = "placeable-player"}, {filter = "flag", flag = "placeable-enemy", mode = "and"}})
build-base-evolution-requirement
The value to compare against.
selection-priority
The value to compare against.
emissions
The value to compare against.
crafting-category
Matches if the prototype is for a crafting machine with this crafting category.
concept EventFilter
Used to filter out irrelevant event callbacks in a performant way.
Available filters:
- LuaEntityClonedEventFilter
- LuaEntityDamagedEventFilter
- LuaPlayerMinedEntityEventFilter
- LuaPreRobotMinedEntityEventFilter
- LuaRobotBuiltEntityEventFilter
- LuaPostEntityDiedEventFilter
- LuaEntityDiedEventFilter
- LuaScriptRaisedReviveEventFilter
- LuaPrePlayerMinedEntityEventFilter
- LuaEntityMarkedForDeconstructionEventFilter
- LuaPreGhostDeconstructedEventFilter
- LuaEntityDeconstructionCancelledEventFilter
- LuaEntityMarkedForUpgradeEventFilter
- LuaSectorScannedEventFilter
- LuaRobotMinedEntityEventFilter
- LuaScriptRaisedDestroyEventFilter
- LuaUpgradeCancelledEventFilter
- LuaScriptRaisedBuiltEventFilter
- LuaPlayerBuiltEntityEventFilter
- LuaPlayerRepairedEntityEventFilter
Filters are always used as an array of filters of a specific type. Every filter can only be used with its corresponding event, and different types of event filters can not be mixed.
filter LuaScriptRaisedReviveEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaEntityDiedEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaEntityMarkedForDeconstructionEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaPreGhostDeconstructedEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaScriptRaisedDestroyEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaUpgradeCancelledEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaPlayerRepairedEntityEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaEntityMarkedForUpgradeEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaPreRobotMinedEntityEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaEntityClonedEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaScriptRaisedBuiltEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaRobotMinedEntityEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaPrePlayerMinedEntityEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaRobotBuiltEntityEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
, "force"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaEntityDeconstructionCancelledEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaPlayerBuiltEntityEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
, "force"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaPlayerMinedEntityEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
filter LuaEntityDamagedEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
, "original-damage-amount"
, "final-damage-amount"
, "damage-type"
, "final-health"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.
Other attributes may be specified depending on filter
:
type
The prototype type
name
The prototype name
ghost_type
The ghost prototype type
ghost_name
The ghost prototype name
original-damage-amount
The value to compare against.
final-damage-amount
The value to compare against.
damage-type
A LuaDamagePrototype name
final-health
The value to compare against.
filter LuaSectorScannedEventFilter
The condition to filter on. One of "ghost"
, "rail"
, "rail-signal"
, "rolling-stock"
, "robot-with-logistics-interface"
, "vehicle"
, "turret"
, "crafting-machine"
, "wall-connectable"
, "transport-belt-connectable"
, "circuit-network-connectable"
, "type"
, "name"
, "ghost_type"
, "ghost_name"
.
How to combine this with the previous filter. Must be "or"
or "and"
. Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.
Inverts the condition. Default is false
.