Commonly used conventions for passing data between mods and Factorio
show_controller_gui :: boolean [RW] | Show the controller GUI elements. |
show_minimap :: boolean [RW] | Show the chart in the upper right-hand corner of the screen. |
show_research_info :: boolean [RW] | Show research progress and name in the upper right-hand corner of the screen. |
show_entity_info :: boolean [RW] | Show overlay icons on entities. |
show_alert_gui :: boolean [RW] | Show the flashing alert icons next to the player's toolbar. |
update_entity_selection :: boolean [RW] |
When true (the default), mousing over an entity will select it. |
show_rail_block_visualisation :: boolean [RW] |
When true (false is default), the rails will always show the rail block visualisation. |
show_side_menu :: boolean [RW] | Shows or hides the buttons row. |
show_map_view_options :: boolean [RW] | Shows or hides the view options when map is opened. |
show_quickbar :: boolean [RW] | Shows or hides quickbar of shortcuts. |
show_shortcut_bar :: boolean [RW] | Shows or hides the shortcut bar. |
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 cannot be recursed deeper than 20 levels and
cannot 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, or number which will be converted to its textual representation.
"No ammo"
; in the Czech translation, it will print "Bez munice"
:
game.player.print({"description.no-ammo"})
description.no-ammo
template contains no placeholders, so no further parameters are necessary."Durability: 5/9"
; in the Japanese one, it will print "耐久度: 5/9"
:
game.player.print({"description.durability", 5, 9})
"hello"
in all translations:
game.player.print({"", "hello"})
"Iron plate: 60"
in the English translation and "Eisenplatte: 60"
in the German translation.
game.print({"", {"item-name.iron-plate"}, ": ", 60})
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".
Coordinates of a chunk in a LuaSurface where each integer x
/y
represents a different chunk.
This uses the same format as Position, meaning it can be specified either with or without explicit keys.
A Position can be translated to a ChunkPosition by dividing the x
/y
values by 32.
Table with the following fields:
Coordinates of a tile in a chunk on a LuaSurface where each integer x
/y
represents a different tile.
This uses the same format as Position except it rounds any x
/y
down to whole numbers. It can be specified
either with or without explicit keys.
Table with the following fields:
A ChunkPosition with an added bounding box for the area of the chunk.
Table with the following fields:
Table with the following fields:
name
takes precedence over names
.names
is always populated.
A dictionary of string to the four basic Lua types: string
, boolean
, number
, table
.
{a = 1, b = true, c = "three", d = {e = "f"}}
Table with the following fields:
x
and y
keys instead of an array.
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}
Two positions, specifying the top-left and bottom-right corner of the box respectively. Like with Position,
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.
Table with the following fields:
{left_top = {-2, -3}, right_bottom = {5, 8}}
{{-2, -3}, {5, 8}}
An area defined using the map editor.
Table with the following fields:
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 Position, 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).
Table with the following fields:
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 with the following fields:
Table with the following fields:
Table with the following fields:
Table with the following fields:
icon
, text
, or both must be provided.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 the controller GUI elements. This includes the toolbar, the selected tool slot, the armour slot, and the gun and ammunition slots.
Show the chart in the upper right-hand corner of the screen.
Show research progress and name in the upper right-hand corner of the screen.
Show overlay icons on entities. Also known as "alt-mode".
Show the flashing alert icons next to the player's toolbar.
When true
(the default), mousing over an entity will select it. Otherwise, moving the mouse won't update
entity selection.
When true
(false
is default), the rails will always show the rail block visualisation.
Shows or hides the view options when map is opened.
Shows or hides quickbar of shortcuts.
Shows or hides the shortcut bar.
What is shown in the map view. If a field is not given, that setting will not be changed.
Table with the following fields:
Various game-related settings. See data/base/prototypes/map-settings.lua
for a description
of all attributes. Updating any of the attributes will immediately take effect in the game engine.
game.map_settings.path_finder.short_cache_size = 15
Technology and recipe difficulty settings.
Table with the following fields:
"after-victory"
, "always"
or "never"
. Changing this to
"always"
or "after-victory"
does not automatically unlock the research queue. See LuaForce for that.
The data that can be extracted from a map exchange string, as a plain table.
Table with the following fields:
difficulty_settings
that contains the DifficultySettings.
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.
Table with the following fields:
Table with the following fields:
Table with the following fields:
"item"
or "fluid"
.type
:
Table with the following fields:
"item"
or "fluid"
.amount_min
,
amount_max
and probability
must all be specified.amount
is specified.amount
is specified.type
:fluid
{{type="item", name="steel-chest", amount=1}}
{{type="fluid", name="heavy-oil", amount=1},
{type="fluid", name="light-oil", amount=4.5},
{type="fluid", name="petroleum-gas", amount=5.5}}
{{type=0, name="custom-item", probability=0.5, amount_min=1, amount_max=5}}
The effect that is applied when a technology is researched. It is a table that contains at least the field type
.
Table with the following fields:
"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"
.type
:gun-speed
ammo-damage
give-item
turret-attack
unlock-recipe
nothing
Other types
A single offer on a market entity.
Table with the following fields:
"give-item"
modifier.
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.
Table with the following fields:
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.
Table with the following fields:
Table with the following fields:
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
0
and values from 1/6
to 6
). Values outside this range are not guaranteed to work as expected.Table with the following fields:
Table with the following fields:
"terrain"
, then scale
is shown in the map generator GUI instead of frequency.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 with the following fields:
10
, and
this cannot be set from the map generation GUI.40 / frequency
.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 with the following fields:
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).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).autoplace_controls
should fall back to
the default controls or not. Defaults to true
."entity"
, "tile"
and "decorative"
.0
, the map has 'infinite' width, with the actual limitation being one million tiles in each direction from the center.0
, the map has 'infinite' height, with the actual limitation being one million tiles in each direction from the center."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
.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.{tile|entity|decorative}:(prototype name):{probability|richness}
. 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.
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
local surface = game.player.surface
local mgs = surface.map_gen_settings
mgs.property_expression_names["tile:deepwater:probability"] = -1000
surface.map_gen_settings = mgs
"123"
) are understood to stand for constant value expressions.
A single filter used by an infinity-filters instance.
Table with the following fields:
"at-least"
, "at-most"
, or "exactly"
. Defaults to "at-least"
.
A single filter used by an infinity-pipe type entity.
Table with the following fields:
"at-least"
, "at-most"
, "exactly"
, "add"
, or "remove"
. Defaults
to "at-least"
.
Table with the following fields:
The settings used by a heat-interface type entity.
Table with the following fields:
"at-least"
, "at-most"
, "exactly"
, "add"
, or "remove"
. Defaults
to "at-least"
.
A definition of a fluidbox connection point.
Table with the following fields:
x
and y
keys instead of an array.
Table with the following fields:
first_constant
.second_constant
.first_signal
is set. Defaults to 0
.second_signal
is set. Defaults to 0
."*"
, "/"
, "+"
, "-"
, "%"
, "^"
, "<<"
, ">>"
,
"AND"
, "OR"
, "XOR"
. When not specified, defaults to "*"
.
A string that specifies how the inputs should be compared.
"="
: "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"
"less/greater than or equal to"
and "not equal"
, it'll always return
"≥"
, "≤"
or "≠"
respectively when reading them back.Table with the following fields:
constant
.0
."<"
.true
. When false
, will output a value of 1
for
the given output_signal
.
Table with the following fields:
Table with the following fields:
"<"
.first_signal
to. If not specified, first_signal
will be compared to constant
.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 with the following fields:
Table with the following fields:
Table with the following fields:
Table with the following fields:
Commands can be given to enemies and unit groups.
Table with the following fields:
type
:defines.command.attack
defines.distraction.by_enemy
.defines.command.go_to_location
destination_entity
need to be specified. If both are, destination_entity
is used.destination
need to be specified. If both are, destination_entity
is used.defines.distraction.by_enemy
.3
.defines.command.compound
defines.command.group
defines.distraction.by_enemy
.defines.command.attack_area
defines.distraction.by_enemy
.defines.command.wander
defines.distraction.by_enemy
.wander_in_group
is true
.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.defines.command.stop
defines.distraction.by_enemy
.defines.command.flee
defines.distraction.by_enemy
.defines.command.build_base
defines.distraction.by_enemy
.false
, they will obey and not build a base in a non-candidate chunk. Defaults to false
.
Table with the following fields:
false
.false
.true
.false
.false
.false
.
Table with the following fields:
Table with the following fields:
1
.1.0
.
An item stack may be specified in one of two ways:
{name="iron-plate"}
{name="iron-plate", count=1}
{name="copper-plate", count=47}
"iron-plate"
{name="iron-plate", count=100}
A fluid may be specified in one of three ways:
A technology may be specified in one of three ways:
A surface may be specified in one of three ways:
nauvis
has index 1
, the first surface-created
surface will have index 2
and so on."nauvis"
.
An entity prototype may be specified in one of three ways:
An item prototype may be specified in one of three ways:
Table with the following fields:
"time"
, "inactivity"
, "full"
, "empty"
, "item_count"
, "circuit"
,
"robots_inactive"
, "fluid_count"
, "passenger_present"
, "passenger_not_present"
."and"
, or "or"
. Tells how this condition is to be compared with
the preceding conditions in the corresponding wait_conditions
array.type
is "time"
or "inactivity"
.type
is "item_count"
, "circuit"
or "fluid_count"
.
Table with the following fields:
station
is present.true
.
Table with the following fields:
Used for specifying where a GUI arrow should point to.
Table with the following fields:
"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.type
:entity
position
crafting_queue
item_stack
"player"
, "target"
, "player-quickbar"
or "player-equipment-bar"
.
Table with the following fields:
"entity"
(fires at an entity), "position"
(fires directly at a position),
or "direction"
(fires in a direction).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
.0
.
Table with the following fields:
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.
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_soundThe 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 with the following fields:
0.6
means a 60% increase.
Table with the following fields:
{consumption={bonus=0.6},
speed={bonus=-0.15},
productivity={bonus=0.06},
pollution={bonus=0.075}}
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.
Possible flags are:
"not-rotatable"
"placeable-neutral"
"placeable-player"
"placeable-enemy"
"placeable-off-grid"
"player-creation"
"building-direction-8-way"
"filter-directions"
"fast-replaceable-no-build-while-moving"
"breaths-air"
"not-repairable"
"not-on-map"
"not-deconstructable"
"not-blueprintable"
"hidden"
"hide-alt-info"
"fast-replaceable-no-cross-type-while-moving"
"no-gap-fill-while-building"
"not-flammable"
"no-automated-item-removal"
"no-automated-item-insertion"
"no-copy-paste"
"not-selectable-in-game"
"not-upgradable"
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.
Possible flags are:
"draw-logistic-overlay"
"hidden"
"always-show"
"hide-from-bonus-gui"
"hide-from-fuel-tooltip"
"not-stackable"
"can-extend-inventory"
"primary-place-result"
"mod-openable"
"only-in-cursor"
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.
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.
A CollisionMask but also includes any flags this mask has.
Flags such as:
"not-colliding-with-itself"
"consider-tile-transitions"
"colliding-with-tiles-only"
Table with the following fields:
"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 with the following fields:
"instant"
, "projectile"
, "flame-thrower"
, "beam"
, "stream"
, "artillery"
.
Table with the following fields:
"direct"
, "area"
, "line"
, "cluster"
."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 with the following fields:
x
and y
keys instead of an array.
Table with the following fields:
Table with the following fields:
'projectile'
, 'stream'
or 'beam'
.'center-to-center'
or 'bounding-box-to-bounding-box'
.fire_penalty
is added to the
enemy's distance if they are on fire.rotate_penalty
will discourage
targeting enemies that would take longer to turn to face.health_penalty
will discourage
targeting enemies with high health. A negative penalty will do the opposite.range
, the entity will choose a random distance between range
and min_attack_distance
and attack from that distance. Used for spitters.1
means
the full 360 degrees.1
, multiple shots can be
performed per tick.type
:projectile
stream
Table with the following fields:
"throw"
, "equipment-remote"
, "use-on-self"
.type
is "throw"
or "use-on-self"
.type
is "equipment-remote"
. It is the equipment
prototype name.
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.
Possible flags are:
"blueprint"
: Entities that can be selected for blueprint."deconstruct"
: Entities that can be marked for deconstruction."cancel-deconstruct"
: Entities that can be marked for deconstruction cancelling."items"
"trees"
"buildable-type"
: Buildable entities."nothing"
: Only select an area."items-to-place"
: Entities that can be placed using an item."any-entity"
"any-tile"
"same-force"
: Entities with the same force as the selector."not-same-force"
"friend"
"enemy"
"upgrade"
"cancel-upgrade"
"entity-with-health"
"entity-with-force"
"entity-with-owner"
Any basic type (string, number, boolean) or table.
Any basic type (string, number, boolean), table, or LuaObject.
A string that specifies where a gui element should be.
Possible values are:
"top-left"
"middle-left"
"left"
: The same as "middle-left"
"bottom-left"
"top-center"
"middle-center"
"center"
: The same as "middle-center"
"bottom-center"
"top-right"
"right"
: The same as "middle-right"
"bottom-right"
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.
Table with the following fields:
Table with the following fields:
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 with the following fields:
nil
if it was issued from the
server console.
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"
It is specified by string.
"entity"
: Yellow box."not-allowed"
: Red box."electricity"
: Light blue box."pair"
: Light blue box."copy"
: Green box."train-visualization"
: White box."logistics"
: Light blue box."blueprint-snap-rectangle"
: Green box.
It is specified by string.
"all"
: All forces pass."enemy"
: Forces which will attack pass."ally"
: Forces which won't attack pass."friend"
: Forces which are friends pass."not-friend"
: Forces which are not friends pass."same"
: The same force pass."not-same"
: The non-same forces pass.
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"
: 210
"west-to-east"
"north-to-south"
"east-to-west"
"south-to-north"
"west-to-north"
"north-to-east"
"east-to-south"
"south-to-west"
"west-to-south"
"north-to-west"
"east-to-north"
"south-to-east"
"west-to-none"
"none-to-east"
"east-to-none"
"none-to-west"
"north-to-none"
"none-to-south"
"south-to-none"
"none-to-north"
"game-effect"
"gui-effect"
"ambient"
"environment"
"walking"
"alert"
"wind"
Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"tool"
"mergeable"
"item-with-inventory"
"selection-tool"
"item-with-label"
"has-rocket-launch-products"
"fuel"
"place-result"
: Additional fields:"burnt-result"
: Additional fields:"place-as-tile"
: Additional fields:"placed-as-equipment-result"
: Additional fields:"name"
: Additional fields:
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"
: Additional fields: game.get_filtered_item_prototypes({{filter = "type", type = "armor"}})
"flag"
: Additional fields:"subgroup"
: Additional fields:"fuel-category"
: Additional fields:"stack-size"
: Additional fields: game.get_filtered_item_prototypes({{filter = "stack-size", comparison = ">", value = 20}, {filter = "stack-size", comparison = "<", value = 100, mode = "and"}})
"default-request-amount"
: Additional fields:"wire-count"
: Additional fields:"fuel-value"
: Additional fields:"fuel-acceleration-multiplier"
: Additional fields:"fuel-top-speed-multiplier"
: Additional fields:"fuel-emissions-multiplier"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"enabled"
"hidden"
"upgrade"
"visible-when-disabled"
"has-effects"
"has-prerequisites"
"research-unit-ingredient"
: Additional fields:"level"
: Additional fields:"max-level"
: Additional fields:"time"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"decal"
"autoplace"
"collision-mask"
: Additional fields:"collides"
or "layers-equals"
Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"allowed-without-fight"
"type"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"hidden"
"name"
: Additional fields:
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"
: Additional fields:"default-temperature"
: Additional fields:"max-temperature"
: Additional fields:"heat-capacity"
: Additional fields:"fuel-value"
: Additional fields:"emissions-multiplier"
: Additional fields:"gas-temperature"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"item-to-place"
"type"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"minable"
"autoplace"
"blueprintable"
"item-to-place"
"collision-mask"
: Additional fields:"collides"
or "layers-equals"
"walking-speed-modifier"
: Additional fields:"vehicle-friction-modifier"
: Additional fields:"decorative-removal-probability"
: Additional fields:"emissions"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"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"
: Additional fields:"has-ingredient-fluid"
: Additional fields: -- selects recipes that consume sulfuric acid
{{filter = "has-ingredient-fluid", elem_filters = {{filter = "name", name = "sulfuric-acid"}}}}
"has-product-item"
: Additional fields: -- 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"
: Additional fields:"subgroup"
: Additional fields:"category"
: Additional fields:"energy"
: Additional fields:"emissions-multiplier"
: Additional fields:"request-paste-multiplier"
: Additional fields:"overload-multiplier"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"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"
: Additional fields:
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"
: Additional fields: game.get_filtered_entity_prototypes({{filter = "type", type = "unit"}})
"collision-mask"
: Additional fields:"collides"
or "layers-equals"
game.get_filtered_entity_prototypes({{filter = "collision-mask", mask = "player-layer", mask_mode = "collides"}})
"flag"
: Additional fields: game.get_filtered_entity_prototypes({{filter = "flag", flag = "placeable-player"}, {filter = "flag", flag = "placeable-enemy", mode = "and"}})
"build-base-evolution-requirement"
: Additional fields:"selection-priority"
: Additional fields:"emissions"
: Additional fields:"crafting-category"
: Additional fields:Used to filter out irrelevant event callbacks in a performant way.
Available filters:
Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"type"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:"force"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:"force"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields:"original-damage-amount"
: Additional fields:"final-damage-amount"
: Additional fields:"damage-type"
: Additional fields:"final-health"
: Additional fields:Table with the following fields:
"or"
or "and"
.
Defaults to "or"
. When evaluating the filters, "and"
has higher precedence than "or"
.false
. Depending on the value of filter
, the table may take additional fields. filter
may be one of the following:
"ghost"
"rail"
"rail-signal"
"rolling-stock"
"robot-with-logistics-interface"
"vehicle"
"turret"
"crafting-machine"
"wall-connectable"
"transport-belt-connectable"
"circuit-network-connectable"
"type"
: Additional fields:"name"
: Additional fields:"ghost_type"
: Additional fields:"ghost_name"
: Additional fields: