Factorio Runtime DocsVersion 1.1.110

Concepts

Commonly used conventions for passing data between mods and Factorio.

ElemID table
ElemType union

A string specifying a type for choose elem buttons. [...]

A string specifying a type for choose elem buttons. [...]

SwitchState union

State of a GUI switch.

State of a GUI switch.

CliffOrientation union
RadiusVisualisationSpecification table
CursorBoxRenderType union

One of the following values:

One of the following values:

MapViewSettings table

What is shown in the map view. [...]

What is shown in the map view. [...]

PrototypeFilterMode union

One of the following values:

One of the following values:

AutoplaceSettings table
RailEnd table
TrainStopGoal table
TrainPathRequestType union

A string specifying the type of request for LuaGameScript::request_train_path.

A string specifying the type of request for LuaGameScript::request_train_path.

TrainPathFinderPathResult table
TrainPathAnyGoalResult table
TrainPathAllGoalsResult table
ModifierType union
DamageTypeFilters table
TriggerDelivery table
TriggerEffectItemType union
TriggerEffectItem table
TriggerItem table
TriggerTargetMask dictionary[string → true]

A set of trigger target masks.

A set of trigger target masks.

TextAlign union

The text is aligned so that the target position is at the given side of the text. [...]

The text is aligned so that the target position is at the given side of the text. [...]

VerticalTextAlign union

The text is aligned so that the target position is at the given side of the text. [...]

The text is aligned so that the target position is at the given side of the text. [...]

GuiArrowSpecification table

Used for specifying where a GUI arrow should point to.

Used for specifying where a GUI arrow should point to.

PrintSettings table
PrototypeFilter array[union]

Types "signal" and "item-group" do not support filters. [...]

Types "signal" and "item-group" do not support filters. [...]

EventFilter array[union]

Used to filter out irrelevant event callbacks in a performant way. [...]

Used to filter out irrelevant event callbacks in a performant way. [...]

LocalisedStringstring or number or boolean or LuaObject or nil or array[LocalisedString]

Localised strings are a way to support translation of in-game text. [...]

Localised strings are a way to support translation of in-game text. [...]

DisplayResolution table
LogisticParameters table
RealOrientationfloat

The smooth orientation. [...]

The smooth orientation. [...]

MapPosition table or {double, double}

Coordinates on a surface, for example of an entity. [...]

Coordinates on a surface, for example of an entity. [...]

ChunkPosition table or {int, int}

Coordinates of a chunk in a LuaSurface where each integer x/y represents a different chunk. [...]

Coordinates of a chunk in a LuaSurface where each integer x/y represents a different chunk. [...]

TilePosition table or {int, int}

Coordinates of a tile on a LuaSurface where each integer x/y represents a different tile. [...]

Coordinates of a tile on a LuaSurface where each integer x/y represents a different tile. [...]

EquipmentPosition table or {int, int}

Position inside an equipment grid. [...]

Position inside an equipment grid. [...]

GuiLocation table or {int, int}

Screen coordinates of a GUI element in a LuaGui. [...]

Screen coordinates of a GUI element in a LuaGui. [...]

ChunkPositionAndArea table

A ChunkPosition with an added bounding box for the area of the chunk.

A ChunkPosition with an added bounding box for the area of the chunk.

EquipmentPoint table

A table used to define a manual shape for a piece of equipment.

A table used to define a manual shape for a piece of equipment.

GuiAnchor table
TabAndContent table
OldTileAndPosition table
Tags dictionary[string → AnyBasic]

A dictionary of string to the four basic Lua types: string, boolean, number, table. [...]

A dictionary of string to the four basic Lua types: string, boolean, number, table. [...]

SmokeSource table

The vectors for all 5 position attributes are a table with x and y keys instead of an array.

The vectors for all 5 position attributes are a table with x and y keys instead of an array.

Vector table or {float, float}

A vector is a two-element array containing the x and y components. [...]

A vector is a two-element array containing the x and y components. [...]

BoundingBox table or {MapPosition, MapPosition}

Two positions, specifying the top-left and bottom-right corner of the box respectively. [...]

Two positions, specifying the top-left and bottom-right corner of the box respectively. [...]

ScriptArea table

An area defined using the map editor.

An area defined using the map editor.

ScriptPosition table

A position defined using the map editor.

A position defined using the map editor.

Color table or {float, float, float, float}

Red, green, blue and alpha values, all in range [0, 1] or all in range [0, 255] if any value is > 1. [...]

Red, green, blue and alpha values, all in range [0, 1] or all in range [0, 255] if any value is > 1. [...]

ColorModifier table or {float, float, float, float}

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].

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].

CraftingQueueItem table
Alert table
ScriptRenderVertexTarget table

One vertex of a ScriptRenderPolygon.

One vertex of a ScriptRenderPolygon.

PathfinderWaypoint table
CutsceneWaypoint table
Decorative table
DecorativeResult table
PrototypeHistory table
ChartTagSpec table

Either icon, text, or both must be provided.

Either icon, text, or both must be provided.

GameViewSettings LuaStruct

Parameters that affect the look and control of the game. [...]

Parameters that affect the look and control of the game. [...]

PollutionMapSettings table

These values are for the time frame of one second (60 ticks).

These values are for the time frame of one second (60 ticks).

EnemyEvolutionMapSettings table

These values represent a percentual increase in evolution. [...]

These values represent a percentual increase in evolution. [...]

EnemyExpansionMapSettings table

Candidate chunks are given scores to determine which one of them should be expanded into. [...]

Candidate chunks are given scores to determine which one of them should be expanded into. [...]

UnitGroupMapSettings table
SteeringMapSetting table
SteeringMapSettings table
PathFinderMapSettings table
MapSettings LuaStruct

Various game-related settings. [...]

Various game-related settings. [...]

DifficultySettings LuaStruct

Technology and recipe difficulty settings. [...]

Technology and recipe difficulty settings. [...]

MapAndDifficultySettings table

A standard table containing all MapSettings attributes plus an additional table that contains all DifficultySettings properties.

A standard table containing all MapSettings attributes plus an additional table that contains all DifficultySettings properties.

MapDifficultySettings table
MapExchangeStringData table

The data that can be extracted from a map exchange string, as a plain table.

The data that can be extracted from a map exchange string, as a plain table.

BlueprintSignalIcon table
BlueprintEntity table

The representation of an entity inside of a blueprint. [...]

The representation of an entity inside of a blueprint. [...]

Tile table
Fluid table
Ingredient table
Product table
Loot table
TechnologyModifier table

The effect that is applied when a technology is researched. [...]

The effect that is applied when a technology is researched. [...]

Offer table

A single offer on a market entity.

A single offer on a market entity.

AutoplaceSpecification table

Specifies how probability and richness are calculated when placing something on the map. [...]

Specifies how probability and richness are calculated when placing something on the map. [...]

NoiseExpression table

A fragment of a functional program used to generate coherent noise, probably for purposes related to terrain generation. [...]

A fragment of a functional program used to generate coherent noise, probably for purposes related to terrain generation. [...]

AutoplaceSpecificationPeak table
AutoplaceSpecificationRestriction table
Resistance table
MapGenSize union

A floating point number specifying an amount. [...]

A floating point number specifying an amount. [...]

AutoplaceControl table
CliffPlacementSettings table
MapGenSettings table

The 'map type' dropdown in the map generation GUI is actually a selector for elevation generator. [...]

The 'map type' dropdown in the map generation GUI is actually a selector for elevation generator. [...]

PropertyExpressionNames dictionary[string → string]

All other MapGenSettings feed into named noise expressions, and therefore placement can be overridden by including the name of a property in this dictionary. [...]

All other MapGenSettings feed into named noise expressions, and therefore placement can be overridden by including the name of a property in this dictionary. [...]

AdvancedMapGenSettings table
MapGenPreset table
SignalID table
Signal table

An actual signal transmitted by the network.

An actual signal transmitted by the network.

UpgradeFilter table
InfinityInventoryFilter table

A single filter used by an infinity-filters instance.

A single filter used by an infinity-filters instance.

InfinityPipeFilter table

A single filter used by an infinity-pipe type entity.

A single filter used by an infinity-pipe type entity.

FluidBoxFilter table
FluidBoxFilterSpec table
HeatSetting table

The settings used by a heat-interface type entity.

The settings used by a heat-interface type entity.

HeatConnection table
FluidBoxConnection table

A definition of a fluidbox connection point.

A definition of a fluidbox connection point.

PipeConnection table

A single pipe connection for a given fluidbox.

A single pipe connection for a given fluidbox.

ArithmeticCombinatorParameters table
ConstantCombinatorParameters table
ComparatorString union

A string that specifies how the inputs should be compared. [...]

A string that specifies how the inputs should be compared. [...]

DeciderCombinatorParameters table
InserterCircuitConditions table
CircuitCondition table
CircuitConditionDefinition table
CircuitConnectionDefinition table
CopperConnectionDefinition table
WireConnectionDefinition table
DragTarget table
InventoryFilter table
PlaceAsTileResult table
Command table

Commands can be given to enemies and unit groups.

Commands can be given to enemies and unit groups.

PathfinderFlags table
UnitSpawnDefinition table
SpawnPointDefinition table
ItemStackDefinition table
SimpleItemStack union

An item stack may be specified in one of two ways.

An item stack may be specified in one of two ways.

FluidIdentification union

A fluid may be specified in one of three ways.

A fluid may be specified in one of three ways.

ForceIdentification union

A force may be specified in one of three ways.

A force may be specified in one of three ways.

TechnologyIdentification union

A technology may be specified in one of three ways.

A technology may be specified in one of three ways.

SurfaceIdentification union

A surface may be specified in one of three ways.

A surface may be specified in one of three ways.

PlayerIdentification union

A player may be specified in one of three ways.

A player may be specified in one of three ways.

ItemStackIdentification union

An item may be specified in one of two ways.

An item may be specified in one of two ways.

EntityPrototypeIdentification union

An entity prototype may be specified in one of three ways.

An entity prototype may be specified in one of three ways.

ItemPrototypeIdentification union

An item prototype may be specified in one of three ways.

An item prototype may be specified in one of three ways.

WaitConditionType union

Type of a WaitCondition.

Type of a WaitCondition.

WaitCondition table
TrainScheduleRecord table
TrainSchedule table
TargetType union

Target type of an AmmoType.

Target type of an AmmoType.

AmmoType table
BeamTarget table
RidingState table
SpritePathstring

It can be either the name of a SpritePrototype defined in the data stage, or a path in form "type/name" or "type.name". [...]

It can be either the name of a SpritePrototype defined in the data stage, or a path in form "type/name" or "type.name". [...]

SoundPathstring

It can be either the name of a SoundPrototype defined in the data stage, or a path in the form "type/name". [...]

It can be either the name of a SoundPrototype defined in the data stage, or a path in the form "type/name". [...]

ModuleEffectValue table
ModuleEffects table
EntityPrototypeFlags dictionary[EntityPrototypeFlag → true]

A set of flags. [...]

A set of flags. [...]

EntityPrototypeFlag union

A string specifying an entity prototype flag.

A string specifying an entity prototype flag.

ItemPrototypeFlags dictionary[ItemPrototypeFlag → true]

A set of flags. [...]

A set of flags. [...]

ItemPrototypeFlag union

A string specifying an item prototype flag.

A string specifying an item prototype flag.

CollisionMaskLayer union

A string specifying a collision mask layer. [...]

A string specifying a collision mask layer. [...]

CollisionMask dictionary[CollisionMaskLayer → true]

A set of flags. [...]

A set of flags. [...]

CollisionMaskWithFlags dictionary[union → true]

A CollisionMask which also includes any flags this mask has.

A CollisionMask which also includes any flags this mask has.

CircularParticleCreationSpecification table
CircularProjectileCreationSpecification {RealOrientation, Vector}
AttackParameterFluid table
AttackParameters table
GunShift4Way table
CapsuleAction table
SelectionModeFlags dictionary[union → true]

A set of flags on a selection tool that define how entities and tiles are selected. [...]

A set of flags on a selection tool that define how entities and tiles are selected. [...]

LogisticFilter table
LogisticsNetworkSupplyCounts table
LogisticsNetworkSupplyPoints table
ModSetting table
AnyBasicstring or boolean or number or table

Any basic type (string, number, boolean) or table.

Any basic type (string, number, boolean) or table.

Anystring or boolean or number or table or LuaObject

Any basic type (string, number, boolean), table, or LuaObject.

Any basic type (string, number, boolean), table, or LuaObject.

ProgrammableSpeakerParameters table
ProgrammableSpeakerAlertParameters table
ProgrammableSpeakerCircuitParameters table
ProgrammableSpeakerInstrument table
Alignment union

A string that specifies where a GUI element should be.

A string that specifies where a GUI element should be.

EventData table

Information about the event that has been raised. [...]

Information about the event that has been raised. [...]

NthTickEventData table
ModChangeData table
ConfigurationChangedData table
CustomCommandData table
SelectedPrototypeData table
ScriptRenderTarget table
MouseButtonFlags dictionary[union → true]

A set of flags. [...]

A set of flags. [...]

ForceCondition union
RenderLayer union

A number between 0 and 255 inclusive, represented by one of the following named strings or the string version of the number. [...]

A number between 0 and 255 inclusive, represented by one of the following named strings or the string version of the number. [...]

ItemStackLocation table
VehicleAutomaticTargetingParameters table
SoundType union

Defines which slider in the game's sound settings affects the volume of this sound. [...]

Defines which slider in the game's sound settings affects the volume of this sound. [...]

GuiElementType union
GuiArrowType union
RollingStockDrawData table
GuiDirection union

Direction of a LuaGuiElement's layout.

Direction of a LuaGuiElement's layout.

ScrollPolicy union

Scroll policy of a scroll pane.

Scroll policy of a scroll pane.

float builtin

A floating-point number. [...]

A floating-point number. [...]

double builtin

A double-precision floating-point number. [...]

A double-precision floating-point number. [...]

int builtin

32-bit signed integer. [...]

32-bit signed integer. [...]

int8 builtin

8-bit signed integer. [...]

8-bit signed integer. [...]

uint builtin

32-bit unsigned integer. [...]

32-bit unsigned integer. [...]

uint8 builtin

8-bit unsigned integer. [...]

8-bit unsigned integer. [...]

uint16 builtin

16-bit unsigned integer. [...]

16-bit unsigned integer. [...]

uint64 builtin

64-bit unsigned integer. [...]

64-bit unsigned integer. [...]

number builtin

Any kind of integer or floating point number.

Any kind of integer or floating point number.

string builtin

Strings are enclosed in double-quotes, like this "hi".

Strings are enclosed in double-quotes, like this "hi".

boolean builtin

Either true or false.

Either true or false.

nil builtin

Nil is the type of the value nil, whose main property is to be different from any other value. [...]

Nil is the type of the value nil, whose main property is to be different from any other value. [...]

table builtin

Tables are enclosed in curly brackets, like this {}. [...]

Tables are enclosed in curly brackets, like this {}. [...]

LuaObject builtin

Any LuaObject listed on the Classes page.

Any LuaObject listed on the Classes page.

FluidPrototypeFilter table
AchievementPrototypeFilter table
DecorativePrototypeFilter table
EntityPrototypeFilter table
EquipmentPrototypeFilter table
ItemPrototypeFilter table
ModSettingPrototypeFilter table
RecipePrototypeFilter table
TechnologyPrototypeFilter table
TilePrototypeFilter table
LuaEntityClonedEventFilter table
LuaEntityDamagedEventFilter table
LuaEntityDeconstructionCancelledEventFilter table
LuaEntityDiedEventFilter table
LuaEntityMarkedForDeconstructionEventFilter table
LuaEntityMarkedForUpgradeEventFilter table
LuaPlayerBuiltEntityEventFilter table
LuaPlayerMinedEntityEventFilter table
LuaPlayerRepairedEntityEventFilter table
LuaPostEntityDiedEventFilter table
LuaPreGhostDeconstructedEventFilter table
LuaPreGhostUpgradedEventFilter table
LuaPrePlayerMinedEntityEventFilter table
LuaPreRobotMinedEntityEventFilter table
LuaRobotBuiltEntityEventFilter table
LuaRobotMinedEntityEventFilter table
LuaScriptRaisedBuiltEventFilter table
LuaScriptRaisedDestroyEventFilter table
LuaScriptRaisedReviveEventFilter table
LuaScriptRaisedTeleportedEventFilter table
LuaSectorScannedEventFilter table
LuaUpgradeCancelledEventFilter table

Concepts

ElemID :: table

Table fields

type :: ElemType
name :: string

Name of a prototype as defined by type.

Name of a prototype as defined by type.


ElemType :: union

A string specifying a type for choose elem buttons. It's also used by ElemID for LuaGuiElement::elem_tooltip.

Union members

"achievement"
"decorative"
"entity"
"equipment"
"fluid"
"item"
"item-group"
"recipe"
"signal"
"technology"
"tile"


SwitchState :: union

State of a GUI switch.

Union members

"left"
"right"
"none"


CliffOrientation :: union

Union members

"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"


RadiusVisualisationSpecification :: table

Table fields

distance :: double
offset :: Vector
draw_in_cursor :: boolean
draw_on_selection :: boolean


CursorBoxRenderType :: union

One of the following values:

Union members

"entity"

The normal entity selection box. Yellow by default.

"electricity"

The selection box used to specify electric poles an entity is connected to. Light blue by default.

"copy"

The selection box used when doing entity copy-paste. Green by default.

"not-allowed"

The selection box used when specifying colliding entities. Red by default.

"pair"

Light blue by default.

"logistics"

Light blue by default.

"train-visualization"

White by default.

"blueprint-snap-rectangle"

Green by default.


MapViewSettings :: table

What is shown in the map view. If a field is not given, that setting will not be changed.

Table fields

show-logistic-network :: boolean?
show-electric-network :: boolean?
show-turret-range :: boolean?
show-pollution :: boolean?
show-networkless-logistic-members :: boolean?
show-train-station-names :: boolean?
show-player-names :: boolean?
show-tags :: boolean?
show-worker-robots :: boolean?
show-rail-signal-states :: boolean?
show-recipe-icons :: boolean?
show-non-standard-map-info :: boolean?


PrototypeFilterMode :: union

One of the following values:

Union members

"none"
"whitelist"
"blacklist"


AutoplaceSettings :: table

Table fields

treat_missing_as_default :: boolean?

Whether missing autoplace names for this type should be default enabled. Always defined when reading autoplace settings.

Whether missing autoplace names for this type should be default enabled. Always defined when reading autoplace settings.

settings :: dictionary[string → AutoplaceControl]?

Always defined when reading autoplace settings.

Always defined when reading autoplace settings.


RailEnd :: table

Table fields

rail :: LuaEntity
direction :: defines.rail_direction


TrainStopGoal :: table

Table fields

train_stop :: LuaEntity

Train stop target. Must be connected to rail (LuaEntity::connected_rail returns valid LuaEntity).

Train stop target. Must be connected to rail (LuaEntity::connected_rail returns valid LuaEntity).


TrainPathRequestType :: union

A string specifying the type of request for LuaGameScript::request_train_path.

Union members

"path"

The method will return TrainPathFinderPathResult.

"any-goal-accessible"

The method will return TrainPathAnyGoalResult.

"all-goals-accessible"

The method will return TrainPathAllGoalsResult.

"all-goals-penalties"

The method will return TrainPathAllGoalsResult with penalties.


TrainPathFinderPathResult :: table

Table fields

found_path :: boolean

True if found path.

True if found path.

path :: array[LuaEntity]?

Only returned if return_path was set to true and path was found. Contains all rails in order that are part of the found path.

Only returned if return_path was set to true and path was found. Contains all rails in order that are part of the found path.

goal_index :: uint?

If path was found, provides index of the specific goal to which the path goes to.

If path was found, provides index of the specific goal to which the path goes to.

penalty :: double?

Penalty of the path to goal if path was found.

Penalty of the path to goal if path was found.

total_length :: double?

If path was found, provides total length of all rails of the path.

If path was found, provides total length of all rails of the path.

is_front :: boolean?

If path was found, tells if the path was reached from the from_front or train's front end.

If path was found, tells if the path was reached from the from_front or train's front end.

steps_count :: uint

Amount of steps pathfinder performed. This is a measure of how expensive this search was.

Amount of steps pathfinder performed. This is a measure of how expensive this search was.


TrainPathAnyGoalResult :: table

Table fields

found_path :: boolean

True if any goal was accessible.

True if any goal was accessible.

goal_index :: uint?

If any goal was accessible, this gives index of the particular goal that was found.

If any goal was accessible, this gives index of the particular goal that was found.

penalty :: double?

Penalty of the path to goal if a goal was accessible.

Penalty of the path to goal if a goal was accessible.

steps_count :: uint

Amount of steps pathfinder performed. This is a measure of how expensive this search was.

Amount of steps pathfinder performed. This is a measure of how expensive this search was.


TrainPathAllGoalsResult :: table

Table fields

amount_accessible :: uint

Amount of goals that are accessible.

Amount of goals that are accessible.

accessible :: array[boolean]

Array of the same length as requested goals: each field will tell if related goal is accessible for the train.

Array of the same length as requested goals: each field will tell if related goal is accessible for the train.

penalties :: array[double]?

Array of the same length as requested goals. Only present if request type was "all-goals-penalties".

Array of the same length as requested goals. Only present if request type was "all-goals-penalties".

steps_count :: uint

Amount of steps pathfinder performed. This is a measure of how expensive this search was.

Amount of steps pathfinder performed. This is a measure of how expensive this search was.


ModifierType :: union

Union members

"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-logistic-requests"


DamageTypeFilters :: table

Table fields

whitelist :: boolean

Whether this is a whitelist or a blacklist of damage types. true means whitelist.

Whether this is a whitelist or a blacklist of damage types. true means whitelist.

types :: dictionary[string → true]

The damage types to filter for. The value in the dictionary is meaningless and exists just to allow for easy lookup.

The damage types to filter for. The value in the dictionary is meaningless and exists just to allow for easy lookup.


TriggerDelivery :: table

Table fields

type :: "instant" or "projectile" or "flame-thrower" or "beam" or "stream" or "artillery"
source_effects :: array[TriggerEffectItem]
target_effects :: array[TriggerEffectItem]


TriggerEffectItemType :: union

Union members

"damage"
"create-entity"
"create-explosion"
"create-fire"
"create-smoke"
"create-trivial-smoke"
"create-particle"
"create-sticker"
"create-decorative"
"nested-result"
"play-sound"
"push-back"
"destroy-cliffs"
"show-explosion-on-chart"
"insert-item"
"script"
"set-tile"
"invoke-tile-trigger"
"destroy-decoratives"
"camera-effect"


TriggerEffectItem :: table

Table fields

type :: TriggerEffectItemType
repeat_count :: uint16
repeat_count_deviation :: uint16
probability :: float
affects_target :: boolean
show_in_tooltip :: boolean
damage_type_filters :: DamageTypeFilters?


TriggerItem :: table

Table fields

type :: "direct" or "area" or "line" or "cluster"
action_delivery :: array[TriggerDelivery]?
entity_flags :: EntityPrototypeFlags?

The trigger will only affect entities that contain any of these flags.

The trigger will only affect entities that contain any of these flags.

ignore_collision_condition :: boolean
collision_mask :: CollisionMask

The trigger will only affect entities that would collide with given collision mask.

The trigger will only affect entities that would collide with given collision mask.

trigger_target_mask :: TriggerTargetMask
force :: ForceCondition

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".

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".

repeat_count :: uint
probability :: float


TriggerTargetMask :: dictionary[string → true]

A set of trigger target masks.


TextAlign :: union

The text is aligned so that the target position is at the given side of the text.

For example, "right" aligned text means the right side of the text is at the target position. Or in other words, the target is on the right of the text.

Union members

"left"
"right"
"center"


VerticalTextAlign :: union

The text is aligned so that the target position is at the given side of the text.

For example, "top" aligned text means the top of the text is at the target position. Or in other words, the target is at the top of the text.

Union members

"top"
"middle"
"baseline"
"bottom"


GuiArrowSpecification :: table

Used for specifying where a GUI arrow should point to.

Table fields

margin :: uint
type :: GuiArrowType

This determines which of the following fields will be required.

This determines which of the following fields will be required.

Other attributes may be specified depending on type:

entity

entity :: LuaEntity

position

position :: MapPosition

crafting_queue

crafting_queueindex :: uint

Index in the crafting queue to point to.

Index in the crafting queue to point to.

item_stack

inventory_index :: defines.inventory

Which inventory the stack is in.

Which inventory the stack is in.

item_stack_index :: uint

Which stack to point to.

Which stack to point to.

source :: "player" or "target" or "player-quickbar" or "player-equipment-bar"


PrintSettings :: table

Table fields

color :: Color?

Color of the message to print. Defaults to white.

Color of the message to print. Defaults to white.

sound :: defines.print_sound?

If a sound should be emitted for this message. Defaults to defines.print_sound.use_player_settings.

If a sound should be emitted for this message. Defaults to defines.print_sound.use_player_settings.

skip :: defines.print_skip?

Condition when to skip adding message. Defaults to defines.print_skip.if_redundant.

Condition when to skip adding message. Defaults to defines.print_skip.if_redundant.

sound_path :: SoundPath?

The sound to play. If not given, UtilitySounds::console_message will be used instead.

The sound to play. If not given, UtilitySounds::console_message will be used instead.

volume_modifier :: double?

The volume of the sound to play. Must be between 0 and 1 inclusive. Defaults to 1.

The volume of the sound to play. Must be between 0 and 1 inclusive. Defaults to 1.

game_state :: boolean?

If set to false, message will not be part of game state and will disappear from output console after save-load. Defaults to true.

If set to false, message will not be part of game state and will disappear from output console after save-load. Defaults to true.


PrototypeFilter :: array[union]

Types "signal" and "item-group" do not support filters.

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.

Union members



LocalisedString :: string or number or boolean or LuaObject or nil or array[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.

There are two special flags for the localised string, indicated by the key being a particular string. First, if the key is the empty string (""), then all parameters will be concatenated (after processing, if any are localised strings themselves). Second, if the key is a question mark ("?"), then the first valid parameter will be used. A parameter can be invalid if its name doesn't match any string template. If no parameters are valid, the last one is returned. This is useful to implement a fallback for missing locale templates.

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, boolean or nil, which will be converted to their textual representation.

Examples

-- 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})
-- As an example of a localised string with fallback, consider this:
{"?", {"", {"entity-description.furnace"}, "\n"}, {"item-description.furnace"}, "optional fallback"}
-- If 'entity-description.furnace' exists, it is concatenated with "\n" and returned. Otherwise, if 'item-description.furnace'
--  exists, it is returned as-is. Otherwise, "optional fallback" is returned. If this value wasn't specified, the
--  translation result would be "Unknown key: 'item-description.furnace'".

DisplayResolution :: table

Table fields

width :: uint
height :: uint


LogisticParameters :: table

Table fields

name :: string?

The item. nil clears the filter.

The item. nil clears the filter.

min :: uint?

Defaults to 0.

Defaults to 0.

max :: uint?

Defaults to max uint.

Defaults to max uint.


RealOrientation :: float

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".


MapPosition :: table or {double, double}

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.

Table fields

x :: double
y :: double

Examples

-- Explicit definition
{x = 5.5, y = 2}
{y = 2.25, x = 5.125}
-- Shorthand
{1.625, 2.375}

ChunkPosition :: table or {int, int}

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 fields

x :: int
y :: int


TilePosition :: table or {int, int}

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 fields

x :: int
y :: int


EquipmentPosition :: table or {int, int}

Position inside an equipment grid. This uses the same format as MapPosition, meaning it can be specified either with or without explicit keys.

Table fields

x :: int
y :: int

Examples

-- Explicit definition
{x = 5, y = 2}
{y = 2, x = 5}
-- Shorthand
{1, 2}

GuiLocation :: table or {int, int}

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 fields

x :: int
y :: int


ChunkPositionAndArea :: table

A ChunkPosition with an added bounding box for the area of the chunk.

Table fields

x :: int
y :: int
area :: BoundingBox


EquipmentPoint :: table

A table used to define a manual shape for a piece of equipment.

Table fields

x :: uint
y :: uint


GuiAnchor :: table

Table fields

gui :: defines.relative_gui_type
position :: defines.relative_gui_position
type :: string?

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 things type matches the type.

name :: string?

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 the name. name takes precedence over names.

names :: array[string]?

If provided, only anchors the GUI element when the opened thing matches one of the names. When reading an anchor, names is always populated.

If provided, only anchors the GUI element when the opened thing matches one of the names. When reading an anchor, names is always populated.


TabAndContent :: table

Table fields

tab :: LuaGuiElement
content :: LuaGuiElement


OldTileAndPosition :: table

Table fields

old_tile :: LuaTilePrototype
position :: TilePosition


Tags :: dictionary[string → AnyBasic]

A dictionary of string to the four basic Lua types: string, boolean, number, table.

Note that the API returns tags as a simple table, meaning any modifications to it will not propagate back to the game. Thus, to modify a set of tags, the whole table needs to be written back to the respective property.

Example

{a = 1, b = true, c = "three", d = {e = "f"}}

SmokeSource :: table

The vectors for all 5 position attributes are a table with x and y keys instead of an array.

Table fields

name :: string
frequency :: double
offset :: double
position :: Vector?
north_position :: Vector?
east_position :: Vector?
south_position :: Vector?
west_position :: Vector?
deviation :: MapPosition?
starting_frame_speed :: uint16
starting_frame_speed_deviation :: double
starting_frame :: uint16
starting_frame_deviation :: double
slow_down_factor :: uint8
height :: float
height_deviation :: float
starting_vertical_speed :: float
starting_vertical_speed_deviation :: float
vertical_speed_slowdown :: float


Vector :: table or {float, float}

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.

Table fields

x :: float
y :: float

Example

right = {1.0, 0.0}

BoundingBox :: table or {MapPosition, MapPosition}

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.

Table fields

left_top :: MapPosition
right_bottom :: MapPosition
orientation :: RealOrientation?

Examples

-- Explicit definition
{left_top = {x = -2, y = -3}, right_bottom = {x = 5, y = 8}}
-- Shorthand
{{-2, -3}, {5, 8}}

ScriptArea :: table

An area defined using the map editor.

Table fields

area :: BoundingBox
name :: string
color :: Color
id :: uint


ScriptPosition :: table

A position defined using the map editor.

Table fields

position :: MapPosition
name :: string
color :: Color
id :: uint


Color :: table or {float, float, float, float}

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).

Table fields

r :: float?
g :: float?
b :: float?
a :: float?

Example

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

ColorModifier :: table or {float, float, float, float}

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].

Table fields

r :: float?
g :: float?
b :: float?
a :: float?


CraftingQueueItem :: table

Table fields

index :: uint

The index of the item in the crafting queue.

The index of the item in the crafting queue.

recipe :: string

The recipe being crafted.

The recipe being crafted.

count :: uint

The amount of items being crafted.

The amount of items being crafted.

prerequisite :: boolean

The item is a prerequisite for another item in the queue.

The item is a prerequisite for another item in the queue.


Alert :: table

Table fields

tick :: uint

The tick this alert was created.

The tick this alert was created.

target :: LuaEntity?
prototype :: LuaEntityPrototype?
position :: MapPosition?
icon :: SignalID?

The SignalID used for a custom alert. Only present for custom alerts.

The SignalID used for a custom alert. Only present for custom alerts.

message :: LocalisedString?

The message for a custom alert. Only present for custom alerts.

The message for a custom alert. Only present for custom alerts.


ScriptRenderVertexTarget :: table

One vertex of a ScriptRenderPolygon.

Table fields

target :: MapPosition or LuaEntity
target_offset :: Vector?

Only used if target is a LuaEntity.

Only used if target is a LuaEntity.


PathfinderWaypoint :: table

Table fields

position :: MapPosition

The position of the waypoint on its surface.

The position of the waypoint on its surface.

needs_destroy_to_reach :: boolean

true if the path from the previous waypoint to this one goes through an entity that must be destroyed.

true if the path from the previous waypoint to this one goes through an entity that must be destroyed.


CutsceneWaypoint :: table

Table fields

position :: MapPosition?

Position to pan the camera to.

Position to pan the camera to.

target :: LuaEntity or LuaUnitGroup?

Entity or unit group to pan the camera to.

Entity or unit group to pan the camera to.

transition_time :: uint

How many ticks it will take to reach this waypoint from the previous one.

How many ticks it will take to reach this waypoint from the previous one.

time_to_wait :: uint

Time in ticks to wait before moving to the next waypoint.

Time in ticks to wait before moving to the next waypoint.

zoom :: double?

Zoom level to be set when the waypoint is reached. When not specified, the previous waypoint's zoom is used.

Zoom level to be set when the waypoint is reached. When not specified, the previous waypoint's zoom is used.


Decorative :: table

Table fields

name :: string

The name of the decorative prototype.

The name of the decorative prototype.

position :: TilePosition
amount :: uint8


DecorativeResult :: table

Table fields

position :: TilePosition
decorative :: LuaDecorativePrototype
amount :: uint


PrototypeHistory :: table

Table fields

created :: string

The mod that created this prototype.

The mod that created this prototype.

changed :: array[string]

The mods that changed this prototype in the order they changed it.

The mods that changed this prototype in the order they changed it.


ChartTagSpec :: table

Either icon, text, or both must be provided.

Table fields

position :: MapPosition
icon :: SignalID?
text :: string?
last_user :: PlayerIdentification?


GameViewSettings :: LuaStruct

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.

Attributes

show_controller_gui :: booleanRead/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 :: booleanRead/Write

Show the chart in the upper right-hand corner of the screen.


show_research_info :: booleanRead/Write

Show research progress and name in the upper right-hand corner of the screen.


show_entity_info :: booleanRead/Write

Show overlay icons on entities. Also known as "alt-mode".


show_alert_gui :: booleanRead/Write

Show the flashing alert icons next to the player's toolbar.


update_entity_selection :: booleanRead/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 :: booleanRead/Write

When true (false is default), the rails will always show the rail block visualisation.


show_side_menu :: booleanRead/Write

Shows or hides the buttons row.


show_map_view_options :: booleanRead/Write

Shows or hides the view options when map is opened.


show_entity_tooltip :: booleanRead/Write

Shows or hides the tooltip that is displayed when selecting an entity.


show_quickbar :: booleanRead/Write

Shows or hides quickbar of shortcuts.


show_shortcut_bar :: booleanRead/Write

Shows or hides the shortcut bar.


show_crafting_queue :: booleanRead/Write

Shows or hides the crafting queue.


show_tool_bar :: booleanRead/Write

Shows or hides the tool window with the weapons and armor.


show_hotkey_suggestions :: booleanRead/Write

Shows or hides the mouse and keyboard/controller button hints in the bottom left corner if they are enabled in the interface settings.


PollutionMapSettings :: table

These values are for the time frame of one second (60 ticks).

Table fields

enabled :: boolean

Whether pollution is enabled at all.

Whether pollution is enabled at all.

diffusion_ratio :: double

The amount that is diffused to a neighboring chunk (possibly repeated for other directions as well). Defaults to 0.02.

The amount that is diffused to a neighboring chunk (possibly repeated for other directions as well). Defaults to 0.02.

min_to_diffuse :: double

The amount of PUs that need to be in a chunk for it to start diffusing. Defaults to 15.

The amount of PUs that need to be in a chunk for it to start diffusing. Defaults to 15.

ageing :: double

The amount of pollution eaten by a chunk's tiles as a percentage of 1. Also known as absorption modifier. Defaults to 1.

The amount of pollution eaten by a chunk's tiles as a percentage of 1. Also known as absorption modifier. Defaults to 1.

expected_max_per_chunk :: double

Any amount of pollution larger than this value is visualized as this value instead. Defaults to 150.

Any amount of pollution larger than this value is visualized as this value instead. Defaults to 150.

min_to_show_per_chunk :: double

Any amount of pollution smaller than this value (but bigger than zero) is visualized as this value instead. Defaults to 50.

Any amount of pollution smaller than this value (but bigger than zero) is visualized as this value instead. Defaults to 50.

min_pollution_to_damage_trees :: double

Defaults to 60.

Defaults to 60.

pollution_with_max_forest_damage :: double

Defaults to 150.

Defaults to 150.

pollution_per_tree_damage :: double

Defaults to 50.

Defaults to 50.

pollution_restored_per_tree_damage :: double

Defaults to 10.

Defaults to 10.

max_pollution_to_restore_trees :: double

Defaults to 20.

Defaults to 20.

enemy_attack_pollution_consumption_modifier :: double

Defaults to 1.

Defaults to 1.


EnemyEvolutionMapSettings :: table

These values represent a percentual increase in evolution. This means a value of 0.1 would increase evolution by 10%.

Table fields

enabled :: boolean

Whether enemy evolution is enabled at all.

Whether enemy evolution is enabled at all.

time_factor :: double

The amount evolution naturally progresses by every second. Defaults to 0.000004.

The amount evolution naturally progresses by every second. Defaults to 0.000004.

destroy_factor :: double

The amount evolution progresses for every destroyed spawner. Defaults to 0.002.

The amount evolution progresses for every destroyed spawner. Defaults to 0.002.

pollution_factor :: double

The amount evolution progresses for every unit of pollution. Defaults to 0.0000009.

The amount evolution progresses for every unit of pollution. Defaults to 0.0000009.


EnemyExpansionMapSettings :: table

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)

Table fields

enabled :: boolean

Whether enemy expansion is enabled at all.

Whether enemy expansion is enabled at all.

max_expansion_distance :: uint

Distance in chunks from the furthest base around to prevent expansions from reaching too far into the player's territory. Defaults to 7.

Distance in chunks from the furthest base around to prevent expansions from reaching too far into the player's territory. Defaults to 7.

friendly_base_influence_radius :: uint

Defaults to 2.

Defaults to 2.

enemy_building_influence_radius :: uint

Defaults to 2.

Defaults to 2.

building_coefficient :: double

Defaults to 0.1.

Defaults to 0.1.

other_base_coefficient :: double

Defaults to 2.0.

Defaults to 2.0.

neighbouring_chunk_coefficient :: double

Defaults to 0.5.

Defaults to 0.5.

neighbouring_base_chunk_coefficient :: double

Defaults to 0.4.

Defaults to 0.4.

max_colliding_tiles_coefficient :: double

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%.

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%.

settler_group_min_size :: uint

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 minimum size of a biter group that goes to build a new base. This is multiplied by the evolution factor. Defaults to 5.

settler_group_max_size :: uint

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 maximum size of a biter group that goes to build a new base. This is multiplied by the evolution factor. Defaults to 20.

min_expansion_cooldown :: uint

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 minimum time between expansions in ticks. The actual cooldown is adjusted to the current evolution levels. Defaults to 4*3 600=14 400 ticks.

max_expansion_cooldown :: uint

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.

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.


UnitGroupMapSettings :: table

Table fields

min_group_gathering_time :: uint

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 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.

max_group_gathering_time :: uint

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.

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.

max_wait_time_for_late_members :: uint

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.

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.

min_group_radius :: double

The minimum group radius in tiles. The actual radius is adjusted based on the number of members. Defaults to 5.0.

The minimum group radius in tiles. The actual radius is adjusted based on the number of members. Defaults to 5.0.

max_group_radius :: double

The maximum group radius in tiles. The actual radius is adjusted based on the number of members. Defaults to 30.0.

The maximum group radius in tiles. The actual radius is adjusted based on the number of members. Defaults to 30.0.

max_member_speedup_when_behind :: double

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 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%.

max_member_slowdown_when_ahead :: double

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 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%.

max_group_slowdown_factor :: double

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%.

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%.

max_group_member_fallback_factor :: double

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, the group will slow down to its max_group_slowdown_factor speed to let them catch up. Defaults to 3.

member_disown_distance :: double

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.

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.

tick_tolerance_when_member_arrives :: uint
max_gathering_unit_groups :: uint

The maximum number of automatically created unit groups gathering for attack at any time. Defaults to 30.

The maximum number of automatically created unit groups gathering for attack at any time. Defaults to 30.

max_unit_group_size :: uint

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.

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.


SteeringMapSetting :: table

Table fields

radius :: double

Does not include the radius of the unit.

Does not include the radius of the unit.

separation_factor :: double
separation_force :: double
force_unit_fuzzy_goto_behavior :: boolean

Used to make steering look better for aesthetic purposes.

Used to make steering look better for aesthetic purposes.


SteeringMapSettings :: table

Table fields

default :: SteeringMapSetting
moving :: SteeringMapSetting


PathFinderMapSettings :: table

Table fields

fwd2bwd_ratio :: uint

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.

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.

goal_pressure_ratio :: double

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.

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.

max_steps_worked_per_tick :: double

The maximum number of nodes that are expanded per tick. Defaults to 1 000.

The maximum number of nodes that are expanded per tick. Defaults to 1 000.

max_work_done_per_tick :: uint

The maximum amount of work each pathfinding job is allowed to do per tick. Defaults to 8 000.

The maximum amount of work each pathfinding job is allowed to do per tick. Defaults to 8 000.

use_path_cache :: boolean

Whether to cache paths at all. Defaults to true.

Whether to cache paths at all. Defaults to true.

short_cache_size :: uint

Number of elements in the short cache. Defaults to 5.

Number of elements in the short cache. Defaults to 5.

long_cache_size :: uint

Number of elements in the long cache. Defaults to 25.

Number of elements in the long cache. Defaults to 25.

short_cache_min_cacheable_distance :: double

The minimal distance to the goal in tiles required to be searched in the short path cache. Defaults to 10.

The minimal distance to the goal in tiles required to be searched in the short path cache. Defaults to 10.

short_cache_min_algo_steps_to_cache :: uint

The minimal number of nodes required to be searched in the short path cache. Defaults to 50.

The minimal number of nodes required to be searched in the short path cache. Defaults to 50.

long_cache_min_cacheable_distance :: double

The minimal distance to the goal in tiles required to be searched in the long path cache. Defaults to 30.

The minimal distance to the goal in tiles required to be searched in the long path cache. Defaults to 30.

cache_max_connect_to_cache_steps_multiplier :: uint

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 connection to a cached path, search at most for this number of steps times the original estimate. Defaults to 100.

cache_accept_path_start_distance_ratio :: double

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 start too far from the requested start in relative terms. Defaults to 0.2.

cache_accept_path_end_distance_ratio :: double

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.

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.

negative_cache_accept_path_start_distance_ratio :: double

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_start_distance_ratio, but used for negative cache queries. Defaults to 0.3.

negative_cache_accept_path_end_distance_ratio :: double

Same principle as cache_accept_path_end_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.

cache_path_start_distance_rating_multiplier :: double

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 start distances is considered. Defaults to 10.

cache_path_end_distance_rating_multiplier :: double

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.

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.

stale_enemy_with_same_destination_collision_penalty :: double

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.

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.

ignore_moving_enemy_collision_distance :: double

The distance in tiles after which other moving units are not considered for pathfinding. Defaults to 5.

The distance in tiles after which other moving units are not considered for pathfinding. Defaults to 5.

enemy_with_different_destination_collision_penalty :: double

A penalty that is applied for another unit that is too close and either not moving or has a different goal. Defaults to 30.

A penalty that is applied for another unit that is too close and either not moving or has a different goal. Defaults to 30.

general_entity_collision_penalty :: double

The general collision penalty with other units. Defaults to 10.

The general collision penalty with other units. Defaults to 10.

general_entity_subsequent_collision_penalty :: double

The collision penalty for positions that require the destruction of an entity to get to. Defaults to 3.

The collision penalty for positions that require the destruction of an entity to get to. Defaults to 3.

extended_collision_penalty :: double

The collision penalty for collisions in the extended bounding box but outside the entity's actual bounding box. Defaults to 3.

The collision penalty for collisions in the extended bounding box but outside the entity's actual bounding box. Defaults to 3.

max_clients_to_accept_any_new_request :: uint

The amount of path finder requests accepted per tick regardless of the requested path's length. Defaults to 10.

The amount of path finder requests accepted per tick regardless of the requested path's length. Defaults to 10.

max_clients_to_accept_short_new_request :: uint

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.

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.

direct_distance_to_consider_short_request :: uint

The maximum direct distance in tiles before a request is no longer considered short. Defaults to 100.

The maximum direct distance in tiles before a request is no longer considered short. Defaults to 100.

short_request_max_steps :: uint

The maximum amount of nodes a short request will traverse before being rescheduled as a long request. Defaults to 1000.

The maximum amount of nodes a short request will traverse before being rescheduled as a long request. Defaults to 1000.

short_request_ratio :: double

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 amount of steps that are allocated to short requests each tick, as a percentage of all available steps. Defaults to 0.5, or 50%.

min_steps_to_check_path_find_termination :: uint

The minimum amount of steps that are guaranteed to be performed for every request. Defaults to 2000.

The minimum amount of steps that are guaranteed to be performed for every request. Defaults to 2000.

start_to_goal_cost_multiplier_to_terminate_path_find :: double

If the actual amount of steps is higher than the initial estimate by this factor, pathfinding is terminated. Defaults to 2000.0.

If the actual amount of steps is higher than the initial estimate by this factor, pathfinding is terminated. Defaults to 2000.0.

overload_levels :: array[uint]

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 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}.

overload_multipliers :: array[double]

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 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}.

negative_path_cache_delay_interval :: uint

The delay in ticks between decrementing the score of all paths in the negative cache by one. Defaults to 20.

The delay in ticks between decrementing the score of all paths in the negative cache by one. Defaults to 20.


MapSettings :: LuaStruct

Various game-related settings. Updating any of the attributes will immediately take effect in the game engine.

Attributes

pollution :: PollutionMapSettingsRead/Write


enemy_evolution :: EnemyEvolutionMapSettingsRead/Write


enemy_expansion :: EnemyExpansionMapSettingsRead/Write


unit_group :: UnitGroupMapSettingsRead/Write


steering :: SteeringMapSettingRead/Write


path_finder :: PathFinderMapSettingsRead/Write


max_failed_behavior_count :: uintRead/Write

If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.

Example

-- Increase the number of short paths the pathfinder can cache
game.map_settings.path_finder.short_cache_size = 15

DifficultySettings :: LuaStruct

Technology and recipe difficulty settings. Updating any of the attributes will immediately take effect in the game engine.

Attributes

recipe_difficulty :: defines.difficulty_settings.recipe_difficultyRead/Write


technology_difficulty :: defines.difficulty_settings.technology_difficultyRead/Write


technology_price_multiplier :: doubleRead/Write

A value in range [0.001, 1000].


research_queue_setting :: "after-victory" or "always" or "never"Read/Write

Changing this to "always" or "after-victory" does not automatically unlock the research queue. See LuaForce::research_queue_enabled for that.


MapAndDifficultySettings :: table

A standard table containing all MapSettings attributes plus an additional table that contains all DifficultySettings properties.

Table fields

pollution :: PollutionMapSettings
enemy_evolution :: EnemyEvolutionMapSettings
enemy_expansion :: EnemyExpansionMapSettings
unit_group :: UnitGroupMapSettings
steering :: SteeringMapSettings
path_finder :: PathFinderMapSettings
max_failed_behavior_count :: uint

If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.

If a behavior fails this many times, the enemy (or enemy group) is destroyed. This solves biters getting stuck within their own base.

difficulty_settings :: MapDifficultySettings


MapDifficultySettings :: table

Table fields

recipe_difficulty :: defines.difficulty_settings.recipe_difficulty
technology_difficulty :: defines.difficulty_settings.technology_difficulty
technology_price_multiplier :: double

A value in range [0.001, 1000].

A value in range [0.001, 1000].

research_queue_setting :: "after-victory" or "always" or "never"

Changing this to "always" or "after-victory" does not automatically unlock the research queue. See LuaForce::research_queue_enabled for that.

Changing this to "always" or "after-victory" does not automatically unlock the research queue. See LuaForce::research_queue_enabled for that.


MapExchangeStringData :: table

The data that can be extracted from a map exchange string, as a plain table.

Table fields

map_settings :: MapAndDifficultySettings
map_gen_settings :: MapGenSettings


BlueprintSignalIcon :: table

Table fields

signal :: SignalID

The icon to use. It can be any item icon as well as any virtual signal icon.

The icon to use. It can be any item icon as well as any virtual signal icon.

index :: uint

Index of the icon in the blueprint icons slots. Has to be an integer in the range [1, 4].

Index of the icon in the blueprint icons slots. Has to be an integer in the range [1, 4].


BlueprintEntity :: table

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 fields

entity_number :: uint

The entity's unique identifier in the blueprint.

The entity's unique identifier in the blueprint.

name :: string

The prototype name of the entity.

The prototype name of the entity.

position :: MapPosition

The position of the entity.

The position of the entity.

direction :: defines.direction?

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 direction the entity is facing. Only present for entities that can face in different directions and when the entity is not facing north.

tags :: Tags?

The entity tags of the entity, if there are any. Only relevant for entity ghosts.

The entity tags of the entity, if there are any. Only relevant for entity ghosts.

items :: dictionary[string → uint]?

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 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.

connections :: BlueprintCircuitConnection?

The circuit network connections of the entity, if there are any. Only relevant for entities that support circuit connections.

The circuit network connections of the entity, if there are any. Only relevant for entities that support circuit connections.

control_behavior :: BlueprintControlBehavior?

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 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.

schedule :: array[TrainScheduleRecord]?

The schedule of the entity, if it has one. Only relevant for locomotives.

The schedule of the entity, if it has one. Only relevant for locomotives.


Tile :: table

Table fields

position :: TilePosition

The position of the tile.

The position of the tile.

name :: string

The prototype name of the tile.

The prototype name of the tile.


Fluid :: table

Table fields

name :: string

Fluid prototype name of the fluid.

Fluid prototype name of the fluid.

amount :: double

Amount of the fluid.

Amount of the fluid.

temperature :: double?

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.

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.


Ingredient :: table

Table fields

type :: "item" or "fluid"
name :: string

Prototype name of the required item or fluid.

Prototype name of the required item or fluid.

amount :: double

Amount of the item or fluid.

Amount of the item or fluid.

catalyst_amount :: uint or double?

How much of this ingredient is a catalyst.

How much of this ingredient is a catalyst.

Other attributes may be specified depending on type:

fluid

minimum_temperature :: double?

The minimum fluid temperature required.

The minimum fluid temperature required.

maximum_temperature :: double?

The maximum fluid temperature allowed.

The maximum fluid temperature allowed.


Product :: table

Table fields

type :: "item" or "fluid"
name :: string

Prototype name of the result.

Prototype name of the result.

amount :: double?

Amount of the item or fluid to give. If not specified, amount_min, amount_max and probability must all be specified.

Amount of the item or fluid to give. If not specified, amount_min, amount_max and probability must all be specified.

amount_min :: uint or double?

Minimal amount of the item or fluid to give. Has no effect when amount is specified.

Minimal amount of the item or fluid to give. Has no effect when amount is specified.

amount_max :: uint or double?

Maximum 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.

probability :: double?

A value in range [0, 1]. Item or fluid is only given with this probability; otherwise no product is produced.

A value in range [0, 1]. Item or fluid is only given with this probability; otherwise no product is produced.

catalyst_amount :: uint or double?

How much of this product is a catalyst.

How much of this product is a catalyst.

Other attributes may be specified depending on type:

fluid

temperature :: double?

The fluid temperature of this product.

The fluid temperature of this product.

Examples

-- 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 amaximum amount of 5
{{type="item", name="custom-item", probability=0.5, amount_min=1, amount_max=5}}

Loot :: table

Table fields

item :: string

Item prototype name of the result.

Item prototype name of the result.

probability :: double

Probability that any loot at all will drop, as a number in range [0, 1].

Probability that any loot at all will drop, as a number in range [0, 1].

count_min :: double

Minimum amount of loot to drop.

Minimum amount of loot to drop.

count_max :: double

Maximum amount of loot to drop.

Maximum amount of loot to drop.


TechnologyModifier :: table

The effect that is applied when a technology is researched. It is a table that contains at least the field type.

Table fields

type :: ModifierType

Modifier type. Specifies which of the other fields will be available.

Modifier type. Specifies which of the other fields will be available.

Other attributes may be specified depending on type:

gun-speed

ammo_category :: string

Prototype name of the ammunition category that is affected

Prototype name of the ammunition category that is affected

modifier :: double

Modification value. This will be added to the current gun speed modifier upon researching.

Modification value. This will be added to the current gun speed modifier upon researching.

ammo-damage

ammo_category :: string

Prototype name of the ammunition category that is affected

Prototype name of the ammunition category that is affected

modifier :: double

Modification value. This will be added to the current ammo damage modifier upon researching.

Modification value. This will be added to the current ammo damage modifier upon researching.

give-item

item :: string

Item prototype name to give.

Item prototype name to give.

count :: uint?

Number of items to give. Defaults to 1.

Number of items to give. Defaults to 1.

turret-attack

turret_id :: string

Turret prototype name this modifier will affect.

Turret prototype name this modifier will affect.

modifier :: double

Modification value. This will be added to the current turret damage modifier upon researching.

Modification value. This will be added to the current turret damage modifier upon researching.

unlock-recipe

recipe :: string

Recipe prototype name to unlock.

Recipe prototype name to unlock.

nothing

effect_description :: LocalisedString

Description of this nothing modifier.

Description of this nothing modifier.

OtherTypes

modifier :: double

Modification value. This value will be added to the variable it modifies.

Modification value. This value will be added to the variable it modifies.


Offer :: table

A single offer on a market entity.

Table fields

price :: array[Ingredient]

List of prices.

List of prices.

offer :: TechnologyModifier

The action that will take place when a player accepts the offer. Usually a "give-item" modifier.

The action that will take place when a player accepts the offer. Usually a "give-item" modifier.


AutoplaceSpecification :: table

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 fields

probability_expression :: NoiseExpression
richness_expression :: NoiseExpression
coverage :: double
sharpness :: double
max_probability :: double
placement_density :: uint
richness_base :: double
richness_multiplier :: double
richness_multiplier_distance_bonus :: double
starting_area_size :: uint
order :: string
default_enabled :: boolean
peaks :: array[AutoplaceSpecificationPeak]?
control :: string?

Control prototype name.

Control prototype name.

tile_restriction :: array[AutoplaceSpecificationRestriction]?
force :: string
random_probability_penalty :: double


NoiseExpression :: table

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 prototype docs.

Table fields

type :: string

Names the type of the expression and determines what other fields are required.

Names the type of the expression and determines what other fields are required.


AutoplaceSpecificationPeak :: table

Table fields

influence :: double
max_influence :: double
min_influence :: double
richness_influence :: double
noisePersistence :: double
noise_layer :: string?

Prototype name of the noise layer.

Prototype name of the noise layer.

noise_octaves_difference :: double
water_optimal :: double
water_range :: double
water_max_range :: double
water_top_property_limit :: double
elevation_optimal :: double
elevation_range :: double
elevation_max_range :: double
elevation_top_property_limit :: double
temperature_optimal :: double
temperature_range :: double
temperature_max_range :: double
temperature_top_property_limit :: double
starting_area_weight_optimal :: double
starting_area_weight_range :: double
starting_area_weight_max_range :: double
starting_area_weight_top_property_limit :: double
tier_from_start_optimal :: double
tier_from_start_range :: double
tier_from_start_max_range :: double
tier_from_start_top_property_limit :: double
distance_optimal :: double
distance_range :: double
distance_max_range :: double
distance_top_property_limit :: double
aux_optimal :: double
aux_range :: double
aux_max_range :: double
aux_top_property_limit :: double


AutoplaceSpecificationRestriction :: table

Table fields

first :: string?

Tile prototype name

Tile prototype name

second :: string?

Second prototype name

Second prototype name


Resistance :: table

Table fields

decrease :: float

Absolute damage decrease

Absolute damage decrease

percent :: float

Percentual damage decrease

Percentual damage decrease


MapGenSize :: union

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):

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.

Union members

float

Specifying a map gen dimension.

"none"

equivalent to 0.

"very-low"

equivalent to 1/2.

"very-small"

equivalent to 1/2.

"very-poor"

equivalent to 1/2.

"low"

equivalent to 1/sqrt(2).

"small"

equivalent to 1/sqrt(2).

"poor"

equivalent to 1/sqrt(2).

"normal"

equivalent to 1.

"medium"

equivalent to 1.

"regular"

equivalent to 1.

"high"

equivalent to sqrt(2).

"big"

equivalent to sqrt(2).

"good"

equivalent to sqrt(2).

"very-high"

equivalent to 2.

"very-big"

equivalent to 2.

"very-good"

equivalent to 2.


AutoplaceControl :: table

Table fields

frequency :: MapGenSize

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 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.

size :: MapGenSize

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.

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.

richness :: MapGenSize

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.

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.


CliffPlacementSettings :: table

Table fields

name :: string

Name of the cliff prototype.

Name of the cliff prototype.

cliff_elevation_0 :: float

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 at which the first row of cliffs is placed. The default is 10, and this cannot be set from the map generation GUI.

cliff_elevation_interval :: float

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.

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.

richness :: MapGenSize

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.

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.


MapGenSettings :: table

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.

Table fields

terrain_segmentation :: MapGenSize

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 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).

water :: MapGenSize

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).

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).

autoplace_controls :: dictionary[string → AutoplaceControl]

Indexed by autoplace control prototype name.

Indexed by autoplace control prototype name.

default_enable_all_autoplace_controls :: boolean

Whether undefined autoplace_controls should fall back to the default controls or not. Defaults to true.

Whether undefined autoplace_controls should fall back to the default controls or not. Defaults to true.

autoplace_settings :: dictionary["entity" or "tile" or "decorative" → AutoplaceSettings]

Each setting in this dictionary maps the string type to the settings for that type.

Each setting in this dictionary maps the string type to the settings for that type.

cliff_settings :: CliffPlacementSettings

Map generation settings for entities of the type "cliff".

Map generation settings for entities of the type "cliff".

seed :: uint

The random seed used to generated this map.

The random seed used to generated this map.

width :: uint

Width in tiles. If 0, the map has 'infinite' width, with the actual limitation being one million tiles in each direction from the center.

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 :: uint

Height in tiles. If 0, the map has 'infinite' height, 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.

starting_area :: MapGenSize

Size of the starting area.

Size of the starting area.

starting_points :: array[MapPosition]

Positions of the starting areas.

Positions of the starting areas.

peaceful_mode :: boolean

Whether peaceful mode is enabled for this map.

Whether peaceful mode is enabled for this map.

property_expression_names :: PropertyExpressionNames

Overrides for tile property value generators.

Overrides for tile property value generators.

Examples

-- 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.

PropertyExpressionNames :: dictionary[string → string]

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}.

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.

AdvancedMapGenSettings :: table

Table fields

pollution :: PollutionMapSettings
enemy_evolution :: EnemyEvolutionMapSettings
enemy_expansion :: EnemyExpansionMapSettings
difficulty_settings :: DifficultySettings


MapGenPreset :: table

Table fields

order :: string

The string used to alphabetically sort the presets. It is a simple string that has no additional semantic meaning.

The string used to alphabetically sort the presets. It is a simple string that has no additional semantic meaning.

default :: boolean?

Whether this is the preset that is selected by default.

Whether this is the preset that is selected by default.

basic_settings :: MapGenSettings?
advanced_settings :: AdvancedMapGenSettings?


SignalID :: table

Table fields

type :: "item" or "fluid" or "virtual"
name :: string?

Name of the item, fluid or virtual signal.

Name of the item, fluid or virtual signal.


Signal :: table

An actual signal transmitted by the network.

Table fields

signal :: SignalID

ID of the signal.

ID of the signal.

count :: int

Value of the signal.

Value of the signal.


UpgradeFilter :: table

Table fields

type :: "item" or "entity"
name :: string?

Name of the item, or entity.

Name of the item, or entity.


InfinityInventoryFilter :: table

A single filter used by an infinity-filters instance.

Table fields

name :: string

Name of the item.

Name of the item.

count :: uint?

The count of the filter.

The count of the filter.

mode :: "at-least" or "at-most" or "exactly"?

Defaults to "at-least".

Defaults to "at-least".

index :: uint

The index of this filter in the filters list. Not required when writing a filter.

The index of this filter in the filters list. Not required when writing a filter.


InfinityPipeFilter :: table

A single filter used by an infinity-pipe type entity.

Table fields

name :: string

Name of the fluid.

Name of the fluid.

percentage :: double?

The fill percentage the pipe (for example 0.5 for 50%). Can't be negative.

The fill percentage the pipe (for example 0.5 for 50%). Can't be negative.

temperature :: double?

The temperature of the fluid. Defaults to the default/minimum temperature of the fluid.

The temperature of the fluid. Defaults to the default/minimum temperature of the fluid.

mode :: "at-least" or "at-most" or "exactly" or "add" or "remove"?

Defaults to "at-least".

Defaults to "at-least".


FluidBoxFilter :: table

Table fields

name :: string

Fluid prototype name of the filtered fluid.

Fluid prototype name of the filtered fluid.

minimum_temperature :: double

The minimum temperature allowed into the fluidbox.

The minimum temperature allowed into the fluidbox.

maximum_temperature :: double

The maximum temperature allowed into the fluidbox.

The maximum temperature allowed into the fluidbox.


FluidBoxFilterSpec :: table

Table fields

name :: string

Fluid prototype name of the filtered fluid.

Fluid prototype name of the filtered fluid.

minimum_temperature :: double?

The minimum temperature allowed into the fluidbox.

The minimum temperature allowed into the fluidbox.

maximum_temperature :: double?

The maximum temperature allowed into the fluidbox.

The maximum temperature allowed into the fluidbox.

force :: boolean?

Force the filter to be set, regardless of current fluid content.

Force the filter to be set, regardless of current fluid content.


HeatSetting :: table

The settings used by a heat-interface type entity.

Table fields

temperature :: double?

The target temperature. Defaults to the minimum temperature of the heat buffer.

The target temperature. Defaults to the minimum temperature of the heat buffer.

mode :: "at-least" or "at-most" or "exactly" or "add" or "remove"?

Defaults to "at-least".

Defaults to "at-least".


HeatConnection :: table

Table fields

position :: Vector
direction :: defines.direction


FluidBoxConnection :: table

A definition of a fluidbox connection point.

Table fields

type :: "input" or "output" or "input-output"
positions :: array[Vector]

The 4 cardinal direction connection points for this pipe. This vector is a table with x and y keys instead of an array.

The 4 cardinal direction connection points for this pipe. This vector is a table with x and y keys instead of an array.

max_underground_distance :: uint?

The maximum tile distance this underground connection can connect at if this is an underground pipe.

The maximum tile distance this underground connection can connect at if this is an underground pipe.


PipeConnection :: table

A single pipe connection for a given fluidbox.

Table fields

flow_direction :: "input" or "output" or "input-output"
connection_type :: "normal" or "underground"
position :: MapPosition

The absolute position of this connection within the entity.

The absolute position of this connection within the entity.

target_position :: MapPosition

The absolute position of the connection's intended target.

The absolute position of the connection's intended target.

target :: LuaFluidBox?

The connected fluidbox, if any.

The connected fluidbox, if any.

target_fluidbox_index :: uint?

The index of the target fluidbox, if any.

The index of the target fluidbox, if any.

target_pipe_connection_index :: uint?

The index of the target fluidbox pipe connection, if any.

The index of the target fluidbox pipe connection, if any.


ArithmeticCombinatorParameters :: table

Table fields

first_signal :: SignalID?

First signal to use in an operation. If not specified, the second argument will be the value of first_constant.

First signal to use in an operation. If not specified, the second argument will be the value of first_constant.

second_signal :: SignalID?

Second signal to use in an operation. If not specified, the second argument will be the value of second_constant.

Second signal to use in an operation. If not specified, the second argument will be the value of second_constant.

first_constant :: int?

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 first argument of the operation. Has no effect when first_signal is set. Defaults to 0.

second_constant :: int?

Constant to use as the second argument of the operation. Has no effect when second_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.

operation :: "*" or "/" or "+" or "-" or "%" or "^" or "<<" or ">>" or "AND" or "OR" or "XOR"?

When not specified, defaults to "*".

When not specified, defaults to "*".

output_signal :: SignalID?

Specifies the signal to output.

Specifies the signal to output.


ConstantCombinatorParameters :: table

Table fields

signal :: SignalID

Signal to emit.

Signal to emit.

count :: int

Value of the signal to emit.

Value of the signal to emit.

index :: uint

Index of the constant combinator's slot to set this signal to.

Index of the constant combinator's slot to set this signal to.


ComparatorString :: union

A string that specifies how the inputs should be compared.

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.

Union members

"="

"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"


DeciderCombinatorParameters :: table

Table fields

first_signal :: SignalID?

Defaults to blank.

Defaults to blank.

second_signal :: SignalID?

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.

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 :: uint?

Constant to use as the second argument of operation. Defaults to 0.

Constant to use as the second argument of operation. Defaults to 0.

comparator :: ComparatorString?

Specifies how the inputs should be compared. If not specified, defaults to "<".

Specifies how the inputs should be compared. If not specified, defaults to "<".

output_signal :: SignalID?

Defaults to blank.

Defaults to blank.

copy_count_from_input :: boolean?

Defaults to true. When false, will output a value of 1 for the given output_signal.

Defaults to true. When false, will output a value of 1 for the given output_signal.


InserterCircuitConditions :: table

Table fields

circuit :: CircuitCondition?
logistics :: CircuitCondition?


CircuitCondition :: table

Table fields

comparator :: ComparatorString?

Specifies how the inputs should be compared. If not specified, defaults to "<".

Specifies how the inputs should be compared. If not specified, defaults to "<".

first_signal :: SignalID?

Defaults to blank

Defaults to blank

second_signal :: SignalID?

What to compare first_signal to. If not specified, first_signal will be compared to constant.

What to compare first_signal to. If not specified, first_signal will be compared to constant.

constant :: int?

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.

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.


CircuitConditionDefinition :: table

Table fields

condition :: CircuitCondition
fulfilled :: boolean?

Whether the condition is currently fulfilled

Whether the condition is currently fulfilled


CircuitConnectionDefinition :: table

Table fields

wire :: defines.wire_type
target_entity :: LuaEntity
source_circuit_id :: defines.circuit_connector_id
target_circuit_id :: defines.circuit_connector_id


CopperConnectionDefinition :: table

Table fields

source_wire_connector :: defines.wire_connection_id
target_entity :: LuaEntity
target_wire_connector :: defines.wire_connection_id


WireConnectionDefinition :: table

Table fields

wire :: defines.wire_type

The type of wire used.

The type of wire used.

target_entity :: LuaEntity

The entity to (dis)connect the source entity with.

The entity to (dis)connect the source entity with.

source_circuit_id :: defines.circuit_connector_id?

Mandatory if the source entity has more than one circuit connection using circuit wire.

Mandatory if the source entity has more than one circuit connection using circuit wire.

target_circuit_id :: defines.circuit_connector_id?

Mandatory if the target entity has more than one circuit connection using circuit wire.

Mandatory if the target entity has more than one circuit connection using circuit wire.

source_wire_id :: defines.wire_connection_id?

Mandatory if the source entity has more than one wire connection using copper wire.

Mandatory if the source entity has more than one wire connection using copper wire.

target_wire_id :: defines.wire_connection_id?

Mandatory if the target entity has more than one wire connection using copper wire.

Mandatory if the target entity has more than one wire connection using copper wire.


DragTarget :: table

Table fields

target_entity :: LuaEntity
target_circuit_id :: defines.circuit_connector_id?

If the wire being dragged is a circuit wire this is the connector id.

If the wire being dragged is a circuit wire this is the connector id.

target_wire_id :: defines.wire_connection_id?

If the wire being dragged is copper wire this is the wire id.

If the wire being dragged is copper wire this is the wire id.


InventoryFilter :: table

Table fields

index :: uint

Position of the corresponding filter slot.

Position of the corresponding filter slot.

name :: string

Item prototype name of the item to filter.

Item prototype name of the item to filter.


PlaceAsTileResult :: table

Table fields

result :: LuaTilePrototype

The tile prototype.

The tile prototype.

condition_size :: uint
condition :: CollisionMask


Command :: table

Commands can be given to enemies and unit groups.

Table fields

type :: defines.command

Type of command. The remaining fields depend on the value of this field.

Type of command. The remaining fields depend on the value of this field.

Other attributes may be specified depending on type:

defines.command.attack

target :: LuaEntity
distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

defines.command.go_to_location

destination :: MapPosition?

The position to path to. Either this or destination_entity need to be specified. If both are, destination_entity is used.

The position to path to. Either this or destination_entity need to be specified. If both are, destination_entity is used.

destination_entity :: LuaEntity?

The entity to path to. Either this or destination 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.

distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

pathfind_flags :: PathfinderFlags?

Flags that affect pathfinder behavior.

Flags that affect pathfinder behavior.

radius :: double?

How close the pathfinder needs to get to its destination (in tiles). Defaults to 3.

How close the pathfinder needs to get to its destination (in tiles). Defaults to 3.

defines.command.compound

structure_type :: defines.compound_command

How the commands should be chained together.

How the commands should be chained together.

commands :: array[Command]

The sub-commands.

The sub-commands.

defines.command.group

group :: LuaUnitGroup

The group whose command to follow.

The group whose command to follow.

distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

use_group_distraction :: boolean?

Whether the unit will use the group distraction or the commands distraction. Defaults to true.

Whether the unit will use the group distraction or the commands distraction. Defaults to true.

defines.command.attack_area

destination :: MapPosition

Center of the attack area.

Center of the attack area.

radius :: double

Radius of the attack area.

Radius of the attack area.

distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

defines.command.wander

distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

radius :: double?

Defaults to 10. Does not apply when wander_in_group is true.

Defaults to 10. Does not apply when wander_in_group is true.

wander_in_group :: boolean?

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.

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_wait :: uint?

Ticks to wander before successfully completing the command. Default is max uint, which means wander forever.

Ticks to wander before successfully completing the command. Default is max uint, which means wander forever.

defines.command.stop

distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

ticks_to_wait :: uint?

Ticks to wander before successfully completing the command. Default is max uint, which means stop forever.

Ticks to wander before successfully completing the command. Default is max uint, which means stop forever.

defines.command.flee

from :: LuaEntity

The entity to flee from

The entity to flee from

distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

defines.command.build_base

destination :: MapPosition

Where to build the base.

Where to build the base.

distraction :: defines.distraction?

Defaults to defines.distraction.by_enemy.

Defaults to defines.distraction.by_enemy.

ignore_planner :: boolean?

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.

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.


PathfinderFlags :: table

Table fields

allow_destroy_friendly_entities :: boolean?

Allows pathing through friendly entities. Defaults to false.

Allows pathing through friendly entities. Defaults to false.

allow_paths_through_own_entities :: boolean?

Allows the pathfinder to path through entities of the same force. Defaults to false.

Allows the pathfinder to path through entities of the same force. Defaults to false.

cache :: boolean?

Enables path caching. This can be more efficient, but might fail to respond to changes in the environment. Defaults to true.

Enables path caching. This can be more efficient, but might fail to respond to changes in the environment. Defaults to true.

prefer_straight_paths :: boolean?

Makes the pathfinder try to path in straight lines. Defaults to false.

Makes the pathfinder try to path in straight lines. Defaults to false.

low_priority :: boolean?

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.

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.

no_break :: boolean?

Makes the pathfinder not break in the middle of processing this pathfind, no matter how much work is needed. 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.


UnitSpawnDefinition :: table

Table fields

unit :: string

Prototype name of the unit that would be spawned.

Prototype name of the unit that would be spawned.

spawn_points :: array[SpawnPointDefinition]

The points at which to spawn the unit.

The points at which to spawn the unit.


SpawnPointDefinition :: table

Table fields

evolution_factor :: double

Evolution factor for which this weight applies.

Evolution factor for which this weight applies.

weight :: double

Probability of spawning this unit at this evolution factor.

Probability of spawning this unit at this evolution factor.


ItemStackDefinition :: table

Table fields

name :: string

Prototype name of the item the stack holds.

Prototype name of the item the stack holds.

count :: uint?

Number of items the stack holds. If not specified, defaults to 1.

Number of items the stack holds. If not specified, defaults to 1.

health :: float?

Health of the items in the stack. Defaults to 1.0.

Health of the items in the stack. Defaults to 1.0.

durability :: double?

Durability of the tool items in the stack.

Durability of the tool items in the stack.

ammo :: double?

Amount of ammo in the ammo items in the stack.

Amount of ammo in the ammo items in the stack.

tags :: array[string]?

Tags of the items with tags in the stack.

Tags of the items with tags in the stack.


SimpleItemStack :: union

An item stack may be specified in one of two ways.

Union members

string

The name of the item, which represents a full stack of that item.

ItemStackDefinition

The detailed definition of an item stack.

Examples

-- 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}

FluidIdentification :: union

A fluid may be specified in one of three ways.

Union members

string

The fluid name.

LuaFluidPrototype

The fluid prototype.

Fluid

The fluid.


ForceIdentification :: union

A force may be specified in one of three ways.

Union members

uint8

The force index.

string

The force name.

LuaForce

A reference to LuaForce may be passed directly.


TechnologyIdentification :: union

A technology may be specified in one of three ways.

Union members

string

The technology name.

LuaTechnology

A reference to LuaTechnology may be passed directly.

LuaTechnologyPrototype

A reference to LuaTechnologyPrototype may be passed directly.


SurfaceIdentification :: union

A surface may be specified in one of three ways.

Union members

uint

It will be the index of the surface. nauvis has index 1, the first surface-created surface will have index 2 and so on.

string

It will be the surface name. E.g. "nauvis".

LuaSurface

A reference to LuaSurface may be passed directly.


PlayerIdentification :: union

A player may be specified in one of three ways.

Union members

uint

The player index.

string

The player name.

LuaPlayer

A reference to LuaPlayer may be passed directly.


ItemStackIdentification :: union

An item may be specified in one of two ways.

Union members


EntityPrototypeIdentification :: union

An entity prototype may be specified in one of three ways.

Union members

LuaEntity

The entity.

LuaEntityPrototype

The entity prototype.

string

The prototype name.


ItemPrototypeIdentification :: union

An item prototype may be specified in one of three ways.

Union members

LuaItemStack

The item.

LuaItemPrototype

The item prototype.

string

The prototype name.


WaitConditionType :: union

Type of a WaitCondition.

Union members

"time"
"full"
"empty"
"item_count"
"circuit"
"inactivity"
"robots_inactive"
"fluid_count"
"passenger_present"
"passenger_not_present"


WaitCondition :: table

Table fields

type :: WaitConditionType
compare_type :: "and" or "or"

Specifies how this condition is to be compared with the preceding conditions in the corresponding wait_conditions array.

Specifies how this condition is to be compared with the preceding conditions in the corresponding wait_conditions array.

ticks :: uint?

Number of ticks to wait when type is "time", or number of ticks of inactivity when type is "inactivity".

Number of ticks to wait when type is "time", or number of ticks of inactivity when type is "inactivity".

condition :: CircuitCondition?

Only present when type is "item_count", "circuit" or "fluid_count", and a circuit condition is configured.

Only present when type is "item_count", "circuit" or "fluid_count", and a circuit condition is configured.


TrainScheduleRecord :: table

Table fields

station :: string?

Name of the station.

Name of the station.

rail :: LuaEntity?

Rail to path to. Ignored if station is present.

Rail to path to. Ignored if station is present.

rail_direction :: defines.rail_direction?

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.

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.

wait_conditions :: array[WaitCondition]?
temporary :: boolean?

Only present when the station is temporary, the value is then always true.

Only present when the station is temporary, the value is then always true.


TrainSchedule :: table

Table fields

current :: uint

Index of the currently active record

Index of the currently active record

records :: array[TrainScheduleRecord]


TargetType :: union

Target type of an AmmoType.

Union members

"entity"

Fires at an entity.

"position"

Fires directly at a position.

"direction"

Fires in a direction.


AmmoType :: table

Table fields

action :: array[TriggerItem]?
target_type :: TargetType
clamp_position :: boolean?

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.

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.

category :: string

Ammo category of this ammo.

Ammo category of this ammo.

energy_consumption :: double?

Energy consumption of a single shot, if applicable. Defaults to 0.

Energy consumption of a single shot, if applicable. Defaults to 0.

range_modifier :: double?
cooldown_modifier :: double?
consumption_modifier :: double?


BeamTarget :: table

Table fields

entity :: LuaEntity?

The target entity.

The target entity.

position :: MapPosition?

The target position.

The target position.


RidingState :: table

Table fields


SpritePath :: string

It can be either the name of a SpritePrototype defined in the data stage, or a path in form "type/name" or "type.name".

The validity of a SpritePath can be verified at runtime using LuaGameScript::is_valid_sprite_path.

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.

SoundPath :: string

It can be either the name of a SoundPrototype defined in the data stage, or a path in the form "type/name". The latter option can be sorted into three categories.

The validity of a SoundPath can be verified at runtime using LuaGameScript::is_valid_sound_path.

The utility and ambient types each contain general use sound prototypes defined by the game itself:
  • "utility" - Uses UtilitySounds. Example: "utility/wire_connect_pole"
  • "ambient" - Uses AmbientSound. Example: "ambient/resource-deficiency"
The following types can be combined with any tile name as long as its prototype defines the corresponding sound:
The following types can be combined with any entity name as long as its prototype defines the corresponding sound:

ModuleEffectValue :: table

Table fields

bonus :: float

The percentual increase of the attribute. A value of 0.6 means a 60% increase.

The percentual increase of the attribute. A value of 0.6 means a 60% increase.


ModuleEffects :: table

Table fields

consumption :: ModuleEffectValue?
speed :: ModuleEffectValue?
productivity :: ModuleEffectValue?
pollution :: ModuleEffectValue?

Example

-- 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}}

EntityPrototypeFlags :: dictionary[EntityPrototypeFlag → true]

A set of flags. Active flags are in the dictionary as true, while inactive flags aren't present at all. By default, none of these flags are set.


EntityPrototypeFlag :: union

A string specifying an entity prototype flag.

Union members

"not-rotatable"

Prevents the entity from being rotated before or after placement.

"placeable-neutral"

Determines the default force when placing entities in the map editor and using the "AUTO" option for the force.

"placeable-player"

Determines the default force when placing entities in the map editor and using the "AUTO" option for the force.

"placeable-enemy"

Determines the default force when placing entities in the map editor and using the "AUTO" option for the force.

"placeable-off-grid"

Determines whether the entity needs to be aligned with the invisible grid within the world. Most entities are confined in this way, with a few exceptions such as trees and land mines.

"player-creation"

Makes it possible to blueprint, deconstruct, and repair the entity (which can be turned off again using the specific flags). Makes it possible for the biter AI to target the entity as a distraction. Enables dust to automatically be created when building the entity. If the entity does not have a map_color set, this flag makes the entity appear on the map with the default color specified by the UtilityConstants.

"building-direction-8-way"

Uses 45 degree angle increments when selecting direction.

"filter-directions"

Used to automatically detect the proper direction of the entity if possible. Used by the pump, train stop, and train signal by default.

"fast-replaceable-no-build-while-moving"

Fast replace will not apply when building while moving.

"breaths-air"

Used to specify that the entity breathes air, and is thus affected by poison.

"not-repairable"

Used to specify that the entity can not be 'healed' by repair packs.

"not-on-map"

Prevents the entity from being drawn on the map.

"not-deconstructable"

Prevents the entity from being deconstructed.

"not-blueprintable"

Prevents the entity from being part of a blueprint.

"hidden"

Hides the entity from the bonus GUI and from the "made in"-property of recipe tooltips.

"hide-alt-info"

Hides the alt-info of this entity when in alt-mode.

"fast-replaceable-no-cross-type-while-moving"

Does not fast replace this entity over other entity types when building while moving.

"no-gap-fill-while-building"
"not-flammable"

Does not apply fire stickers to the entity.

"no-automated-item-removal"

Prevents inserters and loaders from taking items from this entity.

"no-automated-item-insertion"

Prevents inserters and loaders from inserting items into this entity.

"no-copy-paste"

Prevents the entity from being copy-pasted.

"not-selectable-in-game"

Disallows selection of the entity even when a selection box is specified for other reasons. For example, selection boxes are used to determine the size of outlines to be shown when highlighting entities inside electric pole ranges.

"not-upgradable"

Prevents the entity from being selected by the upgrade planner.

"not-in-kill-statistics"

Prevents the entity from being shown in the kill statistics.

"not-in-made-in"

Prevents the entity from being shown in the "made in" list in recipe tooltips.


ItemPrototypeFlags :: dictionary[ItemPrototypeFlag → true]

A set of flags. Active flags are in the dictionary as true, while inactive flags aren't present at all. By default, none of these flags are set.


ItemPrototypeFlag :: union

A string specifying an item prototype flag.

Union members

"draw-logistic-overlay"

Determines whether the logistics areas of roboports should be drawn when holding this item. Used by the deconstruction planner by default.

"hidden"

Hides the item in the logistic requests and filters GUIs (among others).

"always-show"

Always shows the item in the logistic requests and filters GUIs (among others) even when the recipe for that item is locked.

"hide-from-bonus-gui"

Hides the item from the bonus GUI.

"hide-from-fuel-tooltip"

Hides the item from the tooltip that's shown when hovering over a burner inventory.

"not-stackable"

Prevents the item from being stacked. It also prevents the item from stacking in assembling machine input slots, which can otherwise exceed the item stack size if required by the recipe. Additionally, the item does not show an item count when in the cursor.

"can-extend-inventory"

Makes the item act as an extension to the inventory that it is placed in. Only has an effect for items with inventory.

"primary-place-result"

Makes construction bots prefer this item when building the entity specified by its place_result.

"mod-openable"

Allows the item to be opened by the player, firing the on_mod_item_opened event. Only has an effect for selection tool items.

"only-in-cursor"

Makes it so the item is deleted when clearing the cursor, instead of being put into the player's inventory. The copy-paste tools use this by default, for example.

"spawnable"

Allows the item to be spawned by a quickbar shortcut or custom input.


CollisionMaskLayer :: union

A string specifying a collision mask layer.

In addition to the listed layers, there is "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.

Union members

"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"


CollisionMask :: dictionary[CollisionMaskLayer → true]

A set of flags. Active flags are in the dictionary as true, while inactive flags aren't present at all.


CollisionMaskWithFlags :: dictionary[union → true]

A CollisionMask which also includes any flags this mask has.

Union members

CollisionMaskLayer
"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.


CircularParticleCreationSpecification :: table

Table fields

name :: string

Name of the LuaEntityPrototype.

Name of the LuaEntityPrototype.

direction :: float
direction_deviation :: float
speed :: float
speed_deviation :: float
starting_frame_speed :: float
starting_frame_speed_deviation :: float
height :: float
height_deviation :: float
vertical_speed :: float
vertical_speed_deviation :: float
center :: Vector

This vector is a table with x and y keys instead of an array.

This vector is a table with x and y keys instead of an array.

creation_distance :: double
creation_distance_orientation :: double
use_source_position :: boolean


CircularProjectileCreationSpecification :: {RealOrientation, Vector}


AttackParameterFluid :: table

Table fields

type :: string

Name of the LuaFluidPrototype.

Name of the LuaFluidPrototype.

damage_modifier :: double

Multiplier applied to the damage of an attack.

Multiplier applied to the damage of an attack.


AttackParameters :: table

Table fields

type :: "projectile" or "stream" or "beam"

The type of AttackParameter.

The type of AttackParameter.

range :: float

Maximum range of attack.

Maximum range of attack.

min_range :: float

Minimum range of attack. Used with flamethrower turrets to prevent self-immolation.

Minimum range of attack. Used with flamethrower turrets to prevent self-immolation.

range_mode :: "center-to-center" or "bounding-box-to-bounding-box"

Defines how the range is determined.

Defines how the range is determined.

fire_penalty :: float

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 the nearest enemy to attack, fire_penalty is added to the enemy's distance if they are on fire.

rotate_penalty :: float

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 rotate_penalty will discourage targeting enemies that would take longer to turn to face.

health_penalty :: float

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.

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.

min_attack_distance :: float

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.

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.

turn_range :: float

The arc that the entity can attack in as a fraction of a circle. A value of 1 means the full 360 degrees.

The arc that the entity can attack in as a fraction of a circle. A value of 1 means the full 360 degrees.

damage_modifier :: float

Multiplier applied to the damage of an attack.

Multiplier applied to the damage of an attack.

ammo_consumption_modifier :: float

Multiplier applied to the ammo consumption of an attack.

Multiplier applied to the ammo consumption of an attack.

cooldown :: float

Minimum amount of ticks between shots. If this is less than 1, multiple shots can be performed per tick.

Minimum amount of ticks between shots. If this is less than 1, multiple shots can be performed per tick.

warmup :: uint

Number of ticks it takes for the weapon to actually shoot after it has been ordered to do so.

Number of ticks it takes for the weapon to actually shoot after it has been ordered to do so.

movement_slow_down_factor :: double
movement_slow_down_cooldown :: float
ammo_type :: AmmoType?
ammo_categories :: array[string]?

List of the names of compatible LuaAmmoCategoryPrototypes.

List of the names of compatible LuaAmmoCategoryPrototypes.

Other attributes may be specified depending on type:

projectile

projectile_center :: Vector
projectile_creation_distance :: float
projectile_orientation_offset :: float
shell_particle :: CircularParticleCreationSpecification?
projectile_creation_parameters :: array[CircularProjectileCreationSpecification]?

stream

gun_barrel_length :: float
gun_center_shift :: GunShift4Way
fluid_consumption :: float
fluids :: array[AttackParameterFluid]?
projectile_creation_parameters :: array[CircularProjectileCreationSpecification]?


GunShift4Way :: table

Table fields

north :: Vector
east :: Vector
south :: Vector
west :: Vector


CapsuleAction :: table

Table fields

type :: "throw" or "equipment-remote" or "use-on-self" or "artillery-remote" or "destroy-cliffs"

Other attributes may be specified depending on type:

throw

attack_parameters :: AttackParameters
uses_stack :: boolean

Whether using the capsule consumes an item from the stack.

Whether using the capsule consumes an item from the stack.

equipment-remote

equipment :: string

use-on-self

attack_parameters :: AttackParameters

artillery-remote

flare :: string

Name of the flare prototype.

Name of the flare prototype.

destroy-cliffs

attack_parameters :: AttackParameters
radius :: float
timeout :: uint


SelectionModeFlags :: dictionary[union → true]

A set of flags on a selection tool that define how entities and tiles are selected. Active flags are in the dictionary as true, while inactive flags aren't present at all.

Union members

"blueprint"

Selects entities and tiles as if selecting them for a blueprint.

"deconstruct"

Selects entities and tiles as if selecting them for deconstruction.

"cancel-deconstruct"

Selects entities and tiles as if selecting them for deconstruction cancellation.

"items"

Selects items on the ground.

"trees"

Selects trees.

"buildable-type"

Selects entities which are considered a building, plus landmines.

"nothing"

Selects no entities or tiles, but is useful to select an area.

"items-to-place"

Selects entities and tiles that can be built by an item.

"any-entity"

Selects all entities.

"any-tile"

Selects all tiles.

"same-force"

Selects entities with the same force as the selecting player.

"not-same-force"

Selects entities with a different force as the selecting player.

"friend"

Selects entities from a friendly force.

"enemy"

Selects entities from an enemy force.

"upgrade"

Selects entities as if selecting them for upgrading.

"cancel-upgrade"

Selects entities as if selecting them for upgrade cancellation.

"downgrade"

Selects entities as if selecting them for downgrading.

"entity-with-health"

Selects entities that are entities with health.

"entity-with-force"

Deprecated. Replaced by is-military-target.

"is-military-target"

Selects entities that are military targets.

"entity-with-owner"

Selects entities that are entities with owner.

"avoid-rolling-stock"

Selects entities that are not rolling-stocks.

"entity-ghost"

Selects entities that are entity-ghosts.

"tile-ghost"

Selects entities that are tile-ghosts.


LogisticFilter :: table

Table fields

index :: uint

The index this filter applies to.

The index this filter applies to.

name :: string

The item name for this filter.

The item name for this filter.

count :: uint

The count for this filter.

The count for this filter.


LogisticsNetworkSupplyCounts :: table

Table fields

storage :: uint

Number of available items in the storage members.

Number of available items in the storage members.

passive-provider :: uint

Number of available items in the passive provider members.

Number of available items in the passive provider members.

buffer :: uint

Number of available items in the buffer members.

Number of available items in the buffer members.

active-provider :: uint

Number of available items in the active provider members.

Number of available items in the active provider members.


LogisticsNetworkSupplyPoints :: table

Table fields

storage :: array[LuaLogisticPoint]
passive-provider :: array[LuaLogisticPoint]
buffer :: array[LuaLogisticPoint]
active-provider :: array[LuaLogisticPoint]


ModSetting :: table

Table fields

value :: int or double or boolean or string or Color

The value of the mod setting. The type depends on the kind of setting.

The value of the mod setting. The type depends on the kind of setting.


AnyBasic :: string or boolean or number or table

Any basic type (string, number, boolean) or table.


Any :: string or boolean or number or table or LuaObject

Any basic type (string, number, boolean), table, or LuaObject.


ProgrammableSpeakerParameters :: table

Table fields

playback_volume :: double
playback_globally :: boolean
allow_polyphony :: boolean


ProgrammableSpeakerAlertParameters :: table

Table fields

show_alert :: boolean
show_on_map :: boolean
icon_signal_id :: SignalID
alert_message :: string


ProgrammableSpeakerCircuitParameters :: table

Table fields

signal_value_is_pitch :: boolean
instrument_id :: uint
note_id :: uint


ProgrammableSpeakerInstrument :: table

Table fields

name :: string
notes :: array[string]


Alignment :: union

A string that specifies where a GUI element should be.

Union members

"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"


EventData :: table

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 fields

name :: defines.events

The identifier of the event this handler was registered to.

The identifier of the event this handler was registered to.

tick :: uint

The tick during which the event happened.

The tick during which the event happened.

mod_name :: string?

The name of the mod that raised the event if it was raised using LuaBootstrap::raise_event.

The name of the mod that raised the event if it was raised using LuaBootstrap::raise_event.


NthTickEventData :: table

Table fields

tick :: uint

The tick during which the event happened.

The tick during which the event happened.

nth_tick :: uint

The nth tick this handler was registered to.

The nth tick this handler was registered to.


ModChangeData :: table

Table fields

old_version :: string

Old version of the mod. May be nil if the mod wasn't previously present (i.e. it was just added).

Old version of the mod. May be nil if the mod wasn't previously present (i.e. it was just added).

new_version :: string

New version of the mod. May be nil if the mod is no longer present (i.e. it was just removed).

New version of the mod. May be nil if the mod is no longer present (i.e. it was just removed).


ConfigurationChangedData :: table

Table fields

old_version :: string?

Old version of the map. Present only when loading map version other than the current version.

Old version of the map. Present only when loading map version other than the current version.

new_version :: string?

New 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.

mod_changes :: dictionary[string → ModChangeData]

Dictionary of mod changes. It is indexed by mod name.

Dictionary of mod changes. It is indexed by mod name.

mod_startup_settings_changed :: boolean

true when mod startup settings have changed since the last time this save was loaded.

true when mod startup settings have changed since the last time this save was loaded.

migration_applied :: boolean

true when mod prototype migrations have been applied since the last time this save was loaded.

true when mod prototype migrations have been applied since the last time this save was loaded.


CustomCommandData :: table

Table fields

name :: string

The name of the command.

The name of the command.

tick :: uint

The tick the command was used in.

The tick the command was used in.

player_index :: uint?

The player who issued the command, or nil if it was issued from the server console.

The player who issued the command, or nil if it was issued from the server console.

parameter :: string?

The parameter passed after the command, if there is one.

The parameter passed after the command, if there is one.


SelectedPrototypeData :: table

Table fields

base_type :: string

E.g. "entity".

E.g. "entity".

derived_type :: string

The type of the prototype. E.g. "tree".

The type of the prototype. E.g. "tree".

name :: string

The name of the prototype. E.g. "tree-05".

The name of the prototype. E.g. "tree-05".


ScriptRenderTarget :: table

Table fields

entity :: LuaEntity?
entity_offset :: Vector?
position :: MapPosition?


MouseButtonFlags :: dictionary[union → true]

A set of flags. Active flags are in the dictionary as true, while inactive flags aren't present at all.

To write to this, use an array[string] of the mouse buttons that should be possible to use with on button. The flag "left-and-right" can also be set, which will set "left" and "right" to true.

Union members

"left"
"right"
"middle"
"button-4"
"button-5"
"button-6"
"button-7"
"button-8"
"button-9"


ForceCondition :: union

Union members

"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.


RenderLayer :: union

A number between 0 and 255 inclusive, represented by one of the following named strings or the string version of the number. For example "27" and "decals" are both valid. Higher values are rendered above lower values.

Union members

string

A string of a number

"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


ItemStackLocation :: table

Table fields

inventory :: defines.inventory
slot :: uint


VehicleAutomaticTargetingParameters :: table

Table fields

auto_target_without_gunner :: boolean
auto_target_with_gunner :: boolean


SoundType :: union

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.

Union members

"game-effect"
"gui-effect"
"ambient"
"environment"
"walking"
"alert"
"wind"


GuiElementType :: union

Union members

"button"

A clickable element. Relevant event: on_gui_click

"sprite-button"

A button that displays a sprite rather than text. Relevant event: on_gui_click

"checkbox"

A clickable element with a check mark that can be turned off or on. Relevant event: on_gui_checked_state_changed

"flow"

An invisible container that lays out its children either horizontally or vertically.

"frame"

A non-transparent box that contains other elements. It can have a title (set via the caption attribute). Just like a flow, it lays out its children either horizontally or vertically. Relevant event: on_gui_location_changed

"label"

A piece of text.

"line"

A horizontal or vertical separation line.

"progressbar"

A partially filled bar that can be used to indicate progress.

"table"

An invisible container that lays out its children in a specific number of columns. The width of each column is determined by the widest element it contains.

"textfield"

A single-line box the user can type into. Relevant events: on_gui_text_changed, on_gui_confirmed

"radiobutton"

An element that is similar to a checkbox, but with a circular appearance. Clicking a selected radio button will not unselect it. Radio buttons are not linked to each other in any way. Relevant event: on_gui_checked_state_changed

"sprite"

An element that shows an image.

"scroll-pane"

An invisible element that is similar to a flow, but has the ability to show and use scroll bars.

"drop-down"

A drop-down containing strings of text. Relevant event: on_gui_selection_state_changed

"list-box"

A list of strings, only one of which can be selected at a time. Shows a scroll bar if necessary. Relevant event: on_gui_selection_state_changed

"camera"

A camera that shows the game at the given position on the given surface. It can visually track an entity that is set after the element has been created.

"choose-elem-button"

A button that lets the player pick from a certain kind of prototype, with optional filtering. Relevant event: on_gui_elem_changed

"text-box"

A multi-line textfield. Relevant event: on_gui_text_changed

"slider"

A horizontal number line which can be used to choose a number. Relevant event: on_gui_value_changed

"minimap"

A minimap preview, similar to the normal player minimap. It can visually track an entity that is set after the element has been created.

"entity-preview"

A preview of an entity. The entity has to be set after the element has been created.

"empty-widget"

An empty element that just exists. The root GUI elements screen and relative are empty-widgets.

"tabbed-pane"

A collection of tabs and their contents. Relevant event: on_gui_selected_tab_changed

"tab"

A tab for use in a tabbed-pane.

"switch"

A switch with three possible states. Can have labels attached to either side. Relevant event: on_gui_switch_state_changed


GuiArrowType :: union

Union members

"nowhere"

Will remove the arrow entirely.

"goal"

Will point to the current goal.

"entity_info"
"active_window"
"entity"
"position"
"crafting_queue"
"item_stack"

Will point to a given item stack in an inventory.


RollingStockDrawData :: table

Table fields

position :: MapPosition
orientaton :: RealOrientation


GuiDirection :: union

Direction of a LuaGuiElement's layout.

Union members

"horizontal"
"vertical"


ScrollPolicy :: union

Scroll policy of a scroll pane.

Union members

"never"
"dont-show-but-allow-scrolling"
"always"
"auto"
"auto-and-reserve-space"


float :: builtin

A floating-point number. This is a single-precision floating point number. Whilst Lua only uses double-precision numbers, when a function takes a float, the game engine will immediately convert the double-precision number to single-precision.


double :: builtin

A double-precision floating-point number. This is the same data type as all Lua numbers use.


int :: builtin

32-bit signed integer. Possible values are -2 147 483 648 to 2 147 483 647.

Since Lua 5.2 only uses doubles, any API that asks for int will floor the given double.


int8 :: builtin

8-bit signed integer. Possible values are -128 to 127.

Since Lua 5.2 only uses doubles, any API that asks for int8 will floor the given double.


uint :: builtin

32-bit unsigned integer. Possible values are 0 to 4 294 967 295.

Since Lua 5.2 only uses doubles, any API that asks for uint will floor the given double.


uint8 :: builtin

8-bit unsigned integer. Possible values are 0 to 255.

Since Lua 5.2 only uses doubles, any API that asks for uint8 will floor the given double.


uint16 :: builtin

16-bit unsigned integer. Possible values are 0 to 65 535.

Since Lua 5.2 only uses doubles, any API that asks for uint16 will floor the given double.


uint64 :: builtin

64-bit unsigned integer. Possible values are 0 to 18 446 744 073 709 551 615.

Since Lua 5.2 only uses doubles, any API that asks for uint64 will floor the given double.


number :: builtin

Any kind of integer or floating point number.


string :: builtin

Strings are enclosed in double-quotes, like this "hi".


boolean :: builtin

Either true or false.


nil :: builtin

Nil is the type of the value nil, whose main property is to be different from any other value. It usually represents the absence of a useful value.


table :: builtin

Tables are enclosed in curly brackets, like this {}.

Throughout the API docs, the terms "array" and "dictionary" are used. These are fundamentally just Lua tables, but have a limitation on which kind of table keys can be used. An array is a table that uses continuous integer keys starting at 1, while a dictionary can use numeric or string keys in any order or combination.


LuaObject :: builtin

Any LuaObject listed on the Classes page.


FluidPrototypeFilter :: table

Table fields

filter :: "hidden" or "name" or "subgroup" or "default-temperature" or "max-temperature" or "heat-capacity" or "fuel-value" or "emissions-multiplier" or "gas-temperature"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

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.

name :: string or array[string]

The prototype name, or list of acceptable names.

The prototype name, or list of acceptable names.

subgroup

subgroup :: string

A LuaGroup (subgroup) name

A LuaGroup (subgroup) name

default-temperature

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

max-temperature

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

heat-capacity

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

fuel-value

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

emissions-multiplier

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

gas-temperature

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.


AchievementPrototypeFilter :: table

Table fields

filter :: "allowed-without-fight" or "type"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string or array[string]

The prototype type, or a list of acceptable types.

The prototype type, or a list of acceptable types.


DecorativePrototypeFilter :: table

Table fields

filter :: "decal" or "autoplace" or "collision-mask"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

collision-mask

mask :: CollisionMask or CollisionMaskWithFlags
mask_mode :: "collides" or "layers-equals" or "contains-any" or "contains-all"

How to filter.

How to filter.


EntityPrototypeFilter :: table

Table fields

filter :: "flying-robot" or "robot-with-logistics-interface" or "rail" or "ghost" or "explosion" or "vehicle" or "crafting-machine" or "rolling-stock" or "turret" or "transport-belt-connectable" or "wall-connectable" or "buildable" or "placable-in-editor" or "clonable" or "selectable" or "hidden" or "entity-with-health" or "building" or "fast-replaceable" or "uses-direction" or "minable" or "circuit-connectable" or "autoplace" or "blueprintable" or "item-to-place" or "name" or "type" or "collision-mask" or "flag" or "build-base-evolution-requirement" or "selection-priority" or "emissions" or "crafting-category"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

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.

name :: string or array[string]

The prototype name, or list of acceptable names.

The prototype name, or list of acceptable names.

type

Usage example:

game.get_filtered_entity_prototypes({{filter = "type", type = "unit"}})
type :: string or array[string]

The prototype type, or a list of acceptable types.

The prototype type, or a list of acceptable types.

collision-mask

Usage example:

game.get_filtered_entity_prototypes({{filter = "collision-mask", mask = "player-layer", mask_mode = "collides"}})
mask :: CollisionMask or CollisionMaskWithFlags
mask_mode :: "collides" or "layers-equals" or "contains-any" or "contains-all"

flag

Usage example:

game.get_filtered_entity_prototypes({{filter = "flag", flag = "placeable-player"}, {filter = "flag", flag = "placeable-enemy", mode = "and"}})

build-base-evolution-requirement

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

selection-priority

comparison :: ComparatorString
value :: uint8

The value to compare against.

The value to compare against.

emissions

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

crafting-category

crafting_category :: string

Matches if the prototype is for a crafting machine with this crafting category.

Matches if the prototype is for a crafting machine with this crafting category.


EquipmentPrototypeFilter :: table

Table fields

filter :: "item-to-place" or "type"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string or array[string]

The prototype type, or a list of acceptable types.

The prototype type, or a list of acceptable types.


ItemPrototypeFilter :: table

Table fields

filter :: "tool" or "mergeable" or "item-with-inventory" or "selection-tool" or "item-with-label" or "has-rocket-launch-products" or "fuel" or "place-result" or "burnt-result" or "place-as-tile" or "placed-as-equipment-result" or "name" or "type" or "flag" or "subgroup" or "fuel-category" or "stack-size" or "default-request-amount" or "wire-count" or "fuel-value" or "fuel-acceleration-multiplier" or "fuel-top-speed-multiplier" or "fuel-emissions-multiplier"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

place-result

elem_filters :: array[EntityPrototypeFilter]?

Filters for the place result.

Filters for the place result.

burnt-result

elem_filters :: array[ItemPrototypeFilter]?

Filters for the burnt result.

Filters for the burnt result.

place-as-tile

elem_filters :: array[TilePrototypeFilter]?

Filters for the placed tile.

Filters for the placed tile.

placed-as-equipment-result

elem_filters :: array[EquipmentPrototypeFilter]?

Filters for the placed equipment.

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.

name :: string or array[string]

The prototype name, or list of acceptable names.

The prototype name, or list of acceptable names.

type

Usage example:

game.get_filtered_item_prototypes({{filter = "type", type = "armor"}})
type :: string or array[string]

The prototype type, or a list of acceptable types.

The prototype type, or a list of acceptable types.

flag

subgroup

subgroup :: string

A LuaGroup (subgroup) name

A LuaGroup (subgroup) name

fuel-category

stack-size

Usage example:

game.get_filtered_item_prototypes({{filter = "stack-size", comparison = ">", value = 20}, {filter = "stack-size", comparison = "<", value = 100, mode = "and"}})
comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.

default-request-amount

comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.

wire-count

comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.

fuel-value

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

fuel-acceleration-multiplier

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

fuel-top-speed-multiplier

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

fuel-emissions-multiplier

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.


ModSettingPrototypeFilter :: table

Table fields

filter :: "type" or "mod" or "setting-type"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string or array[string]

The prototype type, or a list of acceptable types.

The prototype type, or a list of acceptable types.

mod

mod :: string

The mod name

The mod name

setting-type

type :: "startup" or "runtime-global" or "runtime-per-user"

The setting scope type.

The setting scope type.


RecipePrototypeFilter :: table

Table fields

filter :: "enabled" or "hidden" or "hidden-from-flow-stats" or "hidden-from-player-crafting" or "allow-as-intermediate" or "allow-intermediates" or "allow-decomposition" or "always-show-made-in" or "always-show-products" or "show-amount-in-title" or "has-ingredients" or "has-products" or "has-ingredient-item" or "has-ingredient-fluid" or "has-product-item" or "has-product-fluid" or "subgroup" or "category" or "energy" or "emissions-multiplier" or "request-paste-multiplier" or "overload-multiplier"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

has-ingredient-item

elem_filters :: array[ItemPrototypeFilter]?

Matches if at least 1 ingredient is an item that matches these filters.

Matches if at least 1 ingredient is an item that matches these filters.

has-ingredient-fluid

-- selects recipes that consume sulfuric acid
{{filter = "has-ingredient-fluid", elem_filters = {{filter = "name", name = "sulfuric-acid"}}}}
elem_filters :: array[FluidPrototypeFilter]?

Matches if at least 1 ingredient is a fluid that matches these filters.

Matches if at least 1 ingredient is a fluid that matches these filters.

has-product-item

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"}}}}}}
elem_filters :: array[ItemPrototypeFilter]?

Matches if at least 1 product is an item that matches these filters.

Matches if at least 1 product is an item that matches these filters.

has-product-fluid

elem_filters :: array[FluidPrototypeFilter]?

Matches if at least 1 product is a fluid that matches these filters.

Matches if at least 1 product is a fluid that matches these filters.

subgroup

subgroup :: string

A LuaGroup (subgroup) name

A LuaGroup (subgroup) name

category

energy

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

emissions-multiplier

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

request-paste-multiplier

comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.

overload-multiplier

comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.


TechnologyPrototypeFilter :: table

Table fields

filter :: "enabled" or "hidden" or "upgrade" or "visible-when-disabled" or "has-effects" or "has-prerequisites" or "research-unit-ingredient" or "unlocks-recipe" or "level" or "max-level" or "time"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

research-unit-ingredient

ingredient :: string

The research ingredient to check.

The research ingredient to check.

unlocks-recipe

recipe :: string

The recipe to check.

The recipe to check.

level

comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.

max-level

comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.

time

comparison :: ComparatorString
value :: uint

The value to compare against.

The value to compare against.


TilePrototypeFilter :: table

Table fields

filter :: "minable" or "autoplace" or "blueprintable" or "item-to-place" or "collision-mask" or "walking-speed-modifier" or "vehicle-friction-modifier" or "decorative-removal-probability" or "emissions"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

collision-mask

mask :: CollisionMask or CollisionMaskWithFlags
mask_mode :: "collides" or "layers-equals" or "contains-any" or "contains-all"

How to filter.

How to filter.

walking-speed-modifier

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

vehicle-friction-modifier

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.

decorative-removal-probability

comparison :: ComparatorString
value :: float

The value to compare against.

The value to compare against.

emissions

comparison :: ComparatorString
value :: double

The value to compare against.

The value to compare against.


LuaEntityClonedEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaEntityDamagedEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable" or "original-damage-amount" or "final-damage-amount" or "damage-type" or "final-health"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.

original-damage-amount

comparison :: ComparatorString
value :: float

The value to compare against.

The value to compare against.

final-damage-amount

comparison :: ComparatorString
value :: float

The value to compare against.

The value to compare against.

damage-type

final-health

comparison :: ComparatorString
value :: float

The value to compare against.

The value to compare against.


LuaEntityDeconstructionCancelledEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaEntityDiedEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaEntityMarkedForDeconstructionEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaEntityMarkedForUpgradeEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaPlayerBuiltEntityEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable" or "force"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.

force

force :: string

The entity force

The entity force


LuaPlayerMinedEntityEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaPlayerRepairedEntityEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaPostEntityDiedEventFilter :: table

Table fields

filter :: "type"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.


LuaPreGhostDeconstructedEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaPreGhostUpgradedEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaPrePlayerMinedEntityEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaPreRobotMinedEntityEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaRobotBuiltEntityEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable" or "force"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.

force

force :: string

The entity force

The entity force


LuaRobotMinedEntityEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaScriptRaisedBuiltEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaScriptRaisedDestroyEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaScriptRaisedReviveEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaScriptRaisedTeleportedEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaSectorScannedEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.


LuaUpgradeCancelledEventFilter :: table

Table fields

filter :: "type" or "name" or "ghost_type" or "ghost_name" or "ghost" or "rail" or "rail-signal" or "rolling-stock" or "robot-with-logistics-interface" or "vehicle" or "turret" or "crafting-machine" or "wall-connectable" or "transport-belt-connectable" or "circuit-network-connectable"

The condition to filter on.

The condition to filter on.

mode :: "or" or "and"?

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

How to combine this with the previous filter. Defaults to "or". When evaluating the filters, "and" has higher precedence than "or".

invert :: boolean?

Inverts the condition. Default is false.

Inverts the condition. Default is false.

Other attributes may be specified depending on filter:

type

type :: string

The prototype type.

The prototype type.

name

name :: string

The prototype name.

The prototype name.

ghost_type

type :: string

The ghost prototype type.

The ghost prototype type.

ghost_name

name :: string

The ghost prototype name.

The ghost prototype name.

Classes

Events

Concepts

Defines