Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# LuaEntity - Runtime Docs

## Class LuaEntity extends LuaControl

The primary interface for interacting with entities through the Lua API. Entities are everything that exists on the map except for tiles (see LuaTile).

Most functions on LuaEntity also work when the entity is contained in a ghost.

Inherits from LuaControl

## Members

get_output_inventory() | → LuaInventory? | Gets the entity's output inventory if it has one.
Gets the entity's output inventory if it has one.
get_module_inventory() | → LuaInventory? | Inventory for storing modules of this entity; `nil` if this entity has no module inventory.
Inventory for storing modules of this entity; `nil` if this entity has no module inventory.
get_fuel_inventory() | → LuaInventory? | The fuel inventory for this entity or `nil` if this entity doesn't have a fuel inventory.
The fuel inventory for this entity or `nil` if this entity doesn't have a fuel inventory.
get_burnt_result_inventory() | → LuaInventory? | The burnt result inventory for this entity or `nil` if this entity doesn't have a burnt result inventory.
The burnt result inventory for this entity or `nil` if this entity doesn't have a burnt result inventory.
damage(damage, force, type?, source?, cause?) | → float | Damages the entity.
Damages the entity.
can_be_destroyed() | → boolean | Whether the entity can be destroyed
Whether the entity can be destroyed
destroy{do_cliff_correction?=…, raise_destroy?=…, player?=…, undo_index?=…} | → boolean | Destroys the entity. [...]
Destroys the entity. [...]
die(force?, cause?) | → boolean | Immediately kills the entity. [...]
Immediately kills the entity. [...]
has_flag(flag) | → boolean | Test whether this entity's prototype has a certain flag set. [...]
Test whether this entity's prototype has a certain flag set. [...]
ghost_has_flag(flag) | → boolean | Same as LuaEntity::has_flag, but targets the inner entity on a entity ghost.
Same as LuaEntity::has_flag, but targets the inner entity on a entity ghost.
add_market_item(offer) |  | Offer a thing on the market.
Offer a thing on the market.
remove_market_item(offer) | → boolean | Remove an offer from a market. [...]
Remove an offer from a market. [...]
get_market_items() | → array[Offer] | Get all offers in a market as an array.
Get all offers in a market as an array.
clear_market_items() |  | Removes all offers from a market.
Removes all offers from a market.
order_deconstruction(force, player?, undo_index?) | → boolean | Sets the entity to be deconstructed by construction robots.
Sets the entity to be deconstructed by construction robots.
cancel_deconstruction(force, player?) |  | Cancels deconstruction if it is scheduled, does nothing otherwise.
Cancels deconstruction if it is scheduled, does nothing otherwise.
to_be_deconstructed() | → boolean | Is this entity marked for deconstruction?
Is this entity marked for deconstruction?
order_upgrade{target=…, force=…, player?=…, undo_index?=…} | → boolean | Sets the entity to be upgraded by construction robots.
Sets the entity to be upgraded by construction robots.
cancel_upgrade(force, player?) | → boolean | Cancels upgrade if it is scheduled, does nothing otherwise.
Cancels upgrade if it is scheduled, does nothing otherwise.
to_be_upgraded() | → boolean | Is this entity marked for upgrade?
Is this entity marked for upgrade?
apply_upgrade() | → LuaEntity?, LuaEntity? | Upgrades this entity in place if it's marked to be upgraded.
Upgrades this entity in place if it's marked to be upgraded.
is_crafting() | → boolean | Returns whether a craft is currently in process. [...]
Returns whether a craft is currently in process. [...]
is_opened() | → boolean |
is_opening() | → boolean |
is_closed() | → boolean |
is_closing() | → boolean |
request_to_open(force, extra_time?) |  |
request_to_close(force) |  |
get_transport_line(index) | → LuaTransportLine | Get a transport line of a belt or belt connectable entity.
Get a transport line of a belt or belt connectable entity.
get_item_insert_specification(position) | → uint32, float | Get an item insert specification onto a belt connectable: for a given map position provides into which line at what position item should be inserted to be closest to the provided position.
Get an item insert specification onto a belt connectable: for a given map position provides into which line at what position item should be inserted to be closest to the provided position.
get_line_item_position(index, position) | → MapPosition | Get a map position related to a position on a transport line.
Get a map position related to a position on a transport line.
get_max_transport_line_index() | → defines.transport_line | Get the maximum transport line index of a belt or belt connectable entity.
Get the maximum transport line index of a belt or belt connectable entity.
launch_rocket(destination?, character?) | → boolean |
revive{raise_revive?=…, overflow?=…} | → array[ItemWithQualityCount]?, LuaEntity?, LuaEntity? | Revive a ghost, which turns it from a ghost into a real entity or tile.
Revive a ghost, which turns it from a ghost into a real entity or tile.
silent_revive{raise_revive?=…, overflow?=…} | → array[ItemWithQualityCount], LuaEntity?, LuaEntity? | Revives a ghost silently, so the revival makes no sound and no smoke is created.
Revives a ghost silently, so the revival makes no sound and no smoke is created.
get_connected_rail{rail_direction=…, rail_connection_direction=…} | → LuaEntity?, defines.rail_direction?, defines.rail_connection_direction? |
get_connected_rails() | → array[LuaEntity] | Get the rails that this signal is connected to.
Get the rails that this signal is connected to.
get_rail_segment_signal(direction, in_else_out) | → LuaEntity? | Get the rail signal at the start/end of the rail segment this rail is in. [...]
Get the rail signal at the start/end of the rail segment this rail is in. [...]
get_rail_segment_stop(direction) | → LuaEntity? | Get train stop at the start/end of the rail segment this rail is in. [...]
Get train stop at the start/end of the rail segment this rail is in. [...]
get_rail_segment_end(direction) | → LuaEntity, defines.rail_direction | Get the rail at the end of the rail segment this rail is in. [...]
Get the rail at the end of the rail segment this rail is in. [...]
get_rail_segment_rails(direction) | → array[LuaEntity] | Get all rails of a rail segment this rail is in A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Get all rails of a rail segment this rail is in A rail segment is a continuous section of rail with no branches, signals, nor train stops.
get_rail_segment_length() | → double | Get the length of the rail segment this rail is in. [...]
Get the length of the rail segment this rail is in. [...]
get_rail_segment_overlaps() | → array[LuaEntity] | Get a rail from each rail segment that overlaps with this rail's rail segment. [...]
Get a rail from each rail segment that overlaps with this rail's rail segment. [...]
is_rail_in_same_rail_segment_as(other_rail) | → boolean | Checks if this rail and other rail both belong to the same rail segment.
Checks if this rail and other rail both belong to the same rail segment.
is_rail_in_same_rail_block_as(other_rail) | → boolean | Checks if this rail and other rail both belong to the same rail block.
Checks if this rail and other rail both belong to the same rail block.
get_parent_signals() | → array[LuaEntity] | Returns all parent signals. [...]
Returns all parent signals. [...]
get_child_signals() | → array[LuaEntity] | Returns all child signals. [...]
Returns all child signals. [...]
get_inbound_signals() | → array[LuaEntity] | Returns all signals guarding entrance to a rail block this rail belongs to.
Returns all signals guarding entrance to a rail block this rail belongs to.
get_outbound_signals() | → array[LuaEntity] | Returns all signals guarding exit from a rail block this rail belongs to.
Returns all signals guarding exit from a rail block this rail belongs to.
get_filter(slot_index) | → ItemFilter or EntityID or AsteroidChunkID? | Get the filter for a slot in an inserter, loader, mining drill, asteroid collector, or logistic storage container. [...]
Get the filter for a slot in an inserter, loader, mining drill, asteroid collector, or logistic storage container. [...]
set_filter(index, filter?) |  | Set the filter for a slot in an inserter (ItemFilter), loader (ItemFilter), mining drill (EntityID), asteroid collector (AsteroidChunkID) or logistic storage container (ItemWithQualityID). [...]
Set the filter for a slot in an inserter (ItemFilter), loader (ItemFilter), mining drill (EntityID), asteroid collector (AsteroidChunkID) or logistic storage container (ItemWithQualityID). [...]
get_infinity_container_filter(index) | → InfinityInventoryFilter? | Gets the filter for this infinity container at the given index, or `nil` if the filter index doesn't exist or is empty.
Gets the filter for this infinity container at the given index, or `nil` if the filter index doesn't exist or is empty.
set_infinity_container_filter(index, filter) |  | Sets the filter for this infinity container at the given index.
Sets the filter for this infinity container at the given index.
get_infinity_pipe_filter() | → InfinityPipeFilter? | Gets the filter for this infinity pipe, or `nil` if the filter is empty.
Gets the filter for this infinity pipe, or `nil` if the filter is empty.
set_infinity_pipe_filter(filter) |  | Sets the filter for this infinity pipe.
Sets the filter for this infinity pipe.
get_heat_setting() | → HeatSetting | Gets the heat setting for this heat interface.
Gets the heat setting for this heat interface.
set_heat_setting(filter) |  | Sets the heat setting for this heat interface.
Sets the heat setting for this heat interface.
get_control_behavior() | → LuaControlBehavior? | Gets the control behavior of the entity (if any).
Gets the control behavior of the entity (if any).
get_or_create_control_behavior() | → LuaControlBehavior? | Gets (and or creates if needed) the control behavior of the entity.
Gets (and or creates if needed) the control behavior of the entity.
get_circuit_network(wire_connector_id) | → LuaCircuitNetwork? |
get_signal(signal, wire_connector_id, extra_wire_connector_id?) | → int32 | Read a single signal from the selected wire connector
Read a single signal from the selected wire connector
get_signals(wire_connector_id, extra_wire_connector_id?) | → array[Signal]? | Read all signals from the selected wire connector.
Read all signals from the selected wire connector.
supports_backer_name() | → boolean | Whether this entity supports a backer name.
Whether this entity supports a backer name.
copy_settings(entity, by_player?) | → array[ItemWithQualityCount] | Copies settings from the given entity onto this entity.
Copies settings from the given entity onto this entity.
get_logistic_point(index?) | → LuaLogisticPoint or array[LuaLogisticPoint]? | Gets all the `LuaLogisticPoint`s that this entity owns. [...]
Gets all the `LuaLogisticPoint`s that this entity owns. [...]
play_note(instrument, note, stop_playing_sounds?) | → boolean | Plays a note with the given instrument and note.
Plays a note with the given instrument and note.
connect_rolling_stock(direction) | → boolean | Connects the rolling stock in the given direction.
Connects the rolling stock in the given direction.
disconnect_rolling_stock(direction) | → boolean | Tries to disconnect this rolling stock in the given direction.
Tries to disconnect this rolling stock in the given direction.
update_connections() |  | Reconnect loader, beacon, cliff and mining drill connections to entities that might have been teleported out or in by the script. [...]
Reconnect loader, beacon, cliff and mining drill connections to entities that might have been teleported out or in by the script. [...]
get_recipe() | → LuaRecipe?, LuaQualityPrototype? | Current recipe being assembled by this machine, if any.
Current recipe being assembled by this machine, if any.
set_recipe(recipe?, quality?) | → array[ItemWithQualityCount] | Sets the given recipe in this assembly machine.
Sets the given recipe in this assembly machine.
rotate{reverse?=…, by_player?=…} | → boolean | Rotates this entity as if the player rotated it.
Rotates this entity as if the player rotated it.
get_driver() | → LuaEntity or LuaPlayer? | Gets the driver of this vehicle if any.
Gets the driver of this vehicle if any.
set_driver(driver) |  | Sets the driver of this vehicle. [...]
Sets the driver of this vehicle. [...]
get_passenger() | → LuaEntity or LuaPlayer? | Gets the passenger of this car, spidertron, or cargo pod if any. [...]
Gets the passenger of this car, spidertron, or cargo pod if any. [...]
set_passenger(passenger) |  | Sets the passenger of this car, spidertron, or cargo pod. [...]
Sets the passenger of this car, spidertron, or cargo pod. [...]
is_connected_to_electric_network() | → boolean | Returns `true` if this entity produces or consumes electricity and is connected to an electric network that has at least one entity that can produce power.
Returns `true` if this entity produces or consumes electricity and is connected to an electric network that has at least one entity that can produce power.
get_train_stop_trains() | → array[LuaTrain] | The trains scheduled to stop at this train stop.
The trains scheduled to stop at this train stop.
get_stopped_train() | → LuaTrain? | The train currently stopped at this train stop, if any.
The train currently stopped at this train stop, if any.
clone{position=…, surface?=…, force?=…, create_build_effect_smoke?=…} | → LuaEntity? | Clones this entity.
Clones this entity.
get_fluid_count(fluid?) | → double | Get the amount of all or some fluid in this entity. [...]
Get the amount of all or some fluid in this entity. [...]
get_fluid_contents() | → dictionary[string → FluidAmount] | Get amounts of all fluids in this entity. [...]
Get amounts of all fluids in this entity. [...]
remove_fluid{name=…, amount=…, minimum_temperature?=…, maximum_temperature?=…, temperature?=…} | → double | Remove fluid from this entity. [...]
Remove fluid from this entity. [...]
insert_fluid(fluid) | → double | Insert fluid into this entity. [...]
Insert fluid into this entity. [...]
clear_fluid_inside() |  | Remove all fluids from this entity.
Remove all fluids from this entity.
get_beam_source() | → BeamTarget? | Get the source of this beam.
Get the source of this beam.
set_beam_source(source) |  | Set the source of this beam.
Set the source of this beam.
get_beam_target() | → BeamTarget? | Get the target of this beam.
Get the target of this beam.
set_beam_target(target) |  | Set the target of this beam.
Set the target of this beam.
get_radius() | → double | The radius of this entity. [...]
The radius of this entity. [...]
get_health_ratio() | → float? | The health ratio of this entity between 1 and 0 (for full health and no health respectively).
The health ratio of this entity between 1 and 0 (for full health and no health respectively).
create_build_effect_smoke() |  | Creates the same smoke that is created when you place a building by hand. [...]
Creates the same smoke that is created when you place a building by hand. [...]
release_from_spawner() |  | Release the unit from the spawner which spawned it. [...]
Release the unit from the spawner which spawned it. [...]
toggle_equipment_movement_bonus() |  | Toggle this entity's equipment movement bonus. [...]
Toggle this entity's equipment movement bonus. [...]
can_shoot(target, position) | → boolean | Whether this character can shoot the given entity or position.
Whether this character can shoot the given entity or position.
start_fading_out() |  | Only works if the entity is a speech-bubble, with an "effect" defined in its wrapper_flow_style. [...]
Only works if the entity is a speech-bubble, with an "effect" defined in its wrapper_flow_style. [...]
get_upgrade_target() | → LuaEntityPrototype?, LuaQualityPrototype? | Returns the new entity prototype and its quality.
Returns the new entity prototype and its quality.
get_damage_to_be_taken() | → float? | Returns the amount of damage to be taken by this entity.
Returns the amount of damage to be taken by this entity.
deplete() |  | Depletes and destroys this resource entity.
Depletes and destroys this resource entity.
mine{inventory?=…, force?=…, raise_destroyed?=…, ignore_minable?=…} | → boolean | Mines this entity. [...]
Mines this entity. [...]
spawn_decorations() |  | Triggers spawn_decoration actions defined in the entity prototype or does nothing if entity is not "turret" or "unit-spawner".
Triggers spawn_decoration actions defined in the entity prototype or does nothing if entity is not "turret" or "unit-spawner".
get_priority_target(index) | → LuaEntityPrototype? | Get the entity ID at the specified position in the turret's priority list.
Get the entity ID at the specified position in the turret's priority list.
set_priority_target(index, entity_id?) |  | Set the entity ID name at the specified position in the turret's priority list.
Set the entity ID name at the specified position in the turret's priority list.
can_wires_reach(entity) | → boolean | Can wires reach between these entities.
Can wires reach between these entities.
get_connected_rolling_stock(direction) | → LuaEntity?, defines.rail_direction? | Gets rolling stock connected to the given end of this stock.
Gets rolling stock connected to the given end of this stock.
is_registered_for_construction() | → boolean | Is this entity or tile ghost or item request proxy registered for construction? [...]
Is this entity or tile ghost or item request proxy registered for construction? [...]
is_registered_for_deconstruction(force) | → boolean | Is this entity registered for deconstruction with this force? [...]
Is this entity registered for deconstruction with this force? [...]
is_registered_for_upgrade() | → boolean | Is this entity registered for upgrade? [...]
Is this entity registered for upgrade? [...]
is_registered_for_repair() | → boolean | Is this entity registered for repair? [...]
Is this entity registered for repair? [...]
add_autopilot_destination(position) |  | Adds the given position to this spidertron's autopilot's queue of destinations.
Adds the given position to this spidertron's autopilot's queue of destinations.
connect_linked_belts(neighbour?) |  | Connects current linked belt with another one. [...]
Connects current linked belt with another one. [...]
disconnect_linked_belts() |  | Disconnects linked belt from its neighbour.
Disconnects linked belt from its neighbour.
get_spider_legs() | → array[LuaEntity] | Gets legs of given SpiderVehicle.
Gets legs of given SpiderVehicle.
stop_spider() |  | Sets the speed of the given SpiderVehicle to zero. [...]
Sets the speed of the given SpiderVehicle to zero. [...]
get_wire_connector(wire_connector_id, or_create) | → LuaWireConnector? | Gets a single wire connector of this entity, if any.
Gets a single wire connector of this entity, if any.
get_wire_connectors(or_create) | → dictionary[defines.wire_connector_id → LuaWireConnector] | Gets all wire connectors of this entity
Gets all wire connectors of this entity
get_rail_end(direction) | → LuaRailEnd | Gets a LuaRailEnd object for specified end of this rail
Gets a LuaRailEnd object for specified end of this rail
get_electric_input_flow_limit(quality?) | → double? | The input flow limit for the electric energy source. [...]
The input flow limit for the electric energy source. [...]
get_electric_output_flow_limit(quality?) | → double? | The output flow limit for the electric energy source. [...]
The output flow limit for the electric energy source. [...]
get_beacons() | → array[LuaEntity]? | Returns a table with all beacons affecting this effect receiver. [...]
Returns a table with all beacons affecting this effect receiver. [...]
get_beacon_effect_receivers() | → array[LuaEntity] | Returns a table with all entities affected by this beacon
Returns a table with all entities affected by this beacon
force_finish_ascending() |  | Take an ascending cargo pod and safely make it skip all animation and immediately switch surface.
Take an ascending cargo pod and safely make it skip all animation and immediately switch surface.
force_finish_descending() |  | Take a descending cargo pod and safely make it arrive and deposit cargo.
Take a descending cargo pod and safely make it arrive and deposit cargo.
create_cargo_pod(cargo_hatch?) | → LuaEntity? | Creates a cargo pod if possible. [...]
Creates a cargo pod if possible. [...]
get_cargo_bays() | → array[LuaEntity] | Gets the cargo bays connected to this cargo landing pad or space platform hub.
Gets the cargo bays connected to this cargo landing pad or space platform hub.
inventory_supports_bar(inventory_index) | → boolean | The same as LuaInventory::supports_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::supports_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
get_inventory_bar(inventory_index) | → uint32 | The same as LuaInventory::get_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::get_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
set_inventory_bar(inventory_index, bar?) |  | The same as LuaInventory::set_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::set_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
inventory_supports_filters(inventory_index) | → boolean | The same as LuaInventory::supports_filters but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::supports_filters but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
is_inventory_filtered(inventory_index) | → boolean | The same as LuaInventory::is_filtered but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::is_filtered but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
can_set_inventory_filter(inventory_index, index, filter) | → boolean | The same as LuaInventory::can_set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::can_set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
get_inventory_filter(inventory_index, index) | → ItemFilter? | The same as LuaInventory::get_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::get_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
set_inventory_filter(inventory_index, index, filter) | → boolean | The same as LuaInventory::set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
The same as LuaInventory::set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
register_tree(tree) | → boolean | Registers the given tree in this agricultural tower. [...]
Registers the given tree in this agricultural tower. [...]
get_movement() | → Vector | Gets the combined movement vector (direction and speed) of this combat robot or asteroid. [...]
Gets the combined movement vector (direction and speed) of this combat robot or asteroid. [...]
set_movement(direction, speed) |  | Sets the movement direction and movement speed for this combat robot or asteroid. [...]
Sets the movement direction and movement speed for this combat robot or asteroid. [...]
get_fluid(index) | → Fluid? | Gets fluid of the index-th fluid storage. [...]
Gets fluid of the index-th fluid storage. [...]
set_fluid(index, fluid?) | → Fluid? | Sets fluid to the index-th fluid storage. [...]
Sets fluid to the index-th fluid storage. [...]
get_logistic_sections() | → LuaLogisticSections? | Gives logistic sections of this entity if it uses logistic sections.
Gives logistic sections of this entity if it uses logistic sections.
set_inventory_size_override(inventory_index, size_override, overflow?) |  | Sets inventory size override. [...]
Sets inventory size override. [...]
get_inventory_size_override(inventory_index) | → uint16? | Gets the inventory size override of the selected inventory if size override was set using set_inventory_size_override.
Gets the inventory size override of the selected inventory if size override was set using set_inventory_size_override.
get_fluid_source_tile() | → TilePosition | Gives TilePosition of a tile which this offshore pump uses to check what fluid should be produced.
Gives TilePosition of a tile which this offshore pump uses to check what fluid should be produced.
get_fluid_source_fluid() | → string? | Checks what is expected fluid to be produced from the offshore pump's source tile. [...]
Checks what is expected fluid to be produced from the offshore pump's source tile. [...]
rail_length | :: R double | Length of this rail piece.
Length of this rail piece.
name | :: R string | Name of the entity prototype. [...]
Name of the entity prototype. [...]
ghost_name | :: R string | Name of the entity or tile contained in this ghost.
Name of the entity or tile contained in this ghost.
localised_name | :: R LocalisedString | Localised name of the entity.
Localised name of the entity.
localised_description | :: R LocalisedString |
ghost_localised_name | :: R LocalisedString | Localised name of the entity or tile contained in this ghost.
Localised name of the entity or tile contained in this ghost.
ghost_localised_description | :: R LocalisedString |
type | :: R string | The entity prototype type of this entity.
The entity prototype type of this entity.
ghost_type | :: R string | The prototype type of the entity or tile contained in this ghost.
The prototype type of the entity or tile contained in this ghost.
use_filters | :: RW boolean | If set to 'true', this inserter will use filtering logic. [...]
If set to 'true', this inserter will use filtering logic. [...]
active | :: RW boolean | Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will stop moving etc). [...]
Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will stop moving etc). [...]
destructible | :: RW boolean | If set to `false`, this entity can't be damaged and won't be attacked automatically. [...]
If set to `false`, this entity can't be damaged and won't be attacked automatically. [...]
minable | :: RW boolean | Not minable entities can still be destroyed. [...]
Not minable entities can still be destroyed. [...]
minable_flag | :: RW boolean | Script controlled flag that allows entity to be mined.
Script controlled flag that allows entity to be mined.
rotatable | :: RW boolean | When entity is not to be rotatable (inserter, transport belt etc), it can't be rotated by player using the R key. [...]
When entity is not to be rotatable (inserter, transport belt etc), it can't be rotated by player using the R key. [...]
operable | :: RW boolean | Player can't open gui of this entity and he can't quick insert/input stuff in to the entity when it is not operable.
Player can't open gui of this entity and he can't quick insert/input stuff in to the entity when it is not operable.
health | :: RW float? | The current health of the entity, if any. [...]
The current health of the entity, if any. [...]
max_health | :: R float | Max health of this entity.
Max health of this entity.
direction | :: RW defines.direction | The current direction this entity is facing.
The current direction this entity is facing.
mirroring | :: RW boolean | Whether the entity is currently mirrored. [...]
Whether the entity is currently mirrored. [...]
supports_direction | :: R boolean | Whether the entity has direction. [...]
Whether the entity has direction. [...]
orientation | :: RW RealOrientation | The smooth orientation of this entity. [...]
The smooth orientation of this entity. [...]
cliff_orientation | :: R CliffOrientation | The orientation of this cliff.
The orientation of this cliff.
relative_turret_orientation | :: RW RealOrientation? | The relative orientation of the vehicle turret, artillery turret, artillery wagon. [...]
The relative orientation of the vehicle turret, artillery turret, artillery wagon. [...]
torso_orientation | :: RW RealOrientation | The torso orientation of this spider vehicle.
The torso orientation of this spider vehicle.
amount | :: RW uint32 | Count of resource units contained.
Count of resource units contained.
initial_amount | :: RW uint32? | Count of initial resource units contained. [...]
Count of initial resource units contained. [...]
effectivity_modifier | :: RW float | Multiplies the acceleration the car can create for one unit of energy. [...]
Multiplies the acceleration the car can create for one unit of energy. [...]
consumption_modifier | :: RW float | Multiplies the energy consumption.
Multiplies the energy consumption.
friction_modifier | :: RW float | Multiplies the car friction rate.
Multiplies the car friction rate.
driver_is_gunner | :: RW boolean? | Whether the driver of this car or spidertron is the gunner. [...]
Whether the driver of this car or spidertron is the gunner. [...]
vehicle_automatic_targeting_parameters | :: RW VehicleAutomaticTargetingParameters | Read when this spidertron auto-targets enemies
Read when this spidertron auto-targets enemies
speed | :: RW float? | The current speed if this is a car, rolling stock, projectile or spidertron, or the maximum speed if this is a unit. [...]
The current speed if this is a car, rolling stock, projectile or spidertron, or the maximum speed if this is a unit. [...]
effective_speed | :: R float? | The current speed of this unit in tiles per tick, taking into account any walking speed modifier given by the tile the unit is standing on. [...]
The current speed of this unit in tiles per tick, taking into account any walking speed modifier given by the tile the unit is standing on. [...]
stack | :: R LuaItemStack |
prototype | :: R LuaEntityPrototype | The entity prototype of this entity.
The entity prototype of this entity.
ghost_prototype | :: R LuaEntityPrototype or LuaTilePrototype | The prototype of the entity or tile contained in this ghost.
The prototype of the entity or tile contained in this ghost.
drop_position | :: RW MapPosition | Position where the entity puts its stuff. [...]
Position where the entity puts its stuff. [...]
pickup_position | :: RW MapPosition | Where the inserter will pick up items from. [...]
Where the inserter will pick up items from. [...]
drop_target | :: RW LuaEntity? | The entity this entity is putting its items to. [...]
The entity this entity is putting its items to. [...]
pickup_target | :: RW LuaEntity? | The entity this inserter will attempt to pick up items from. [...]
The entity this inserter will attempt to pick up items from. [...]
selected_gun_index | :: RW uint32? | Index of the currently selected weapon slot of this character, car, or spidertron. [...]
Index of the currently selected weapon slot of this character, car, or spidertron. [...]
energy | :: RW double | Energy stored in the entity's energy buffer (energy stored in electrical devices etc.). [...]
Energy stored in the entity's energy buffer (energy stored in electrical devices etc.). [...]
temperature | :: RW double? | The temperature of this entity's heat energy source. [...]
The temperature of this entity's heat energy source. [...]
previous_recipe | :: R RecipeIDAndQualityIDPair? | The previous recipe this furnace was using, if any.
The previous recipe this furnace was using, if any.
held_stack | :: R LuaItemStack | The item stack currently held in an inserter's hand.
The item stack currently held in an inserter's hand.
held_stack_position | :: R MapPosition | Current position of the inserter's "hand".
Current position of the inserter's "hand".
train | :: R LuaTrain? | The train this rolling stock belongs to, if any. [...]
The train this rolling stock belongs to, if any. [...]
neighbours | :: R dictionary[string → LuaEntity] or array[array[LuaEntity]] or LuaEntity? | A list of neighbours for certain types of entities. [...]
A list of neighbours for certain types of entities. [...]
belt_neighbours | :: R table | The belt connectable neighbours of this belt connectable entity. [...]
The belt connectable neighbours of this belt connectable entity. [...]
heat_neighbours | :: R array[LuaEntity] | The entities connected to this entities heat buffer.
The entities connected to this entities heat buffer.
fluidbox | :: R LuaFluidBox | Fluidboxes of this entity.
Fluidboxes of this entity.
backer_name | :: RW string? | The backer name assigned to this entity. [...]
The backer name assigned to this entity. [...]
entity_label | :: RW string? | The label on this spider-vehicle entity, if any. [...]
The label on this spider-vehicle entity, if any. [...]
time_to_live | :: RW uint64 | The ticks left before a combat robot, highlight box, smoke, or sticker entity is destroyed.
The ticks left before a combat robot, highlight box, smoke, or sticker entity is destroyed.
color | :: RW Color? | The color of this character, rolling stock, corpse, character corpse, train stop, simple-entity-with-owner, car, spider-vehicle, or lamp. [...]
The color of this character, rolling stock, corpse, character corpse, train stop, simple-entity-with-owner, car, spider-vehicle, or lamp. [...]
signal_state | :: R defines.signal_state | The state of this rail signal.
The state of this rail signal.
chain_signal_state | :: R defines.chain_signal_state | The state of this chain signal.
The state of this chain signal.
to_be_looted | :: RW boolean | Will this item entity be picked up automatically when the player walks over it?
Will this item entity be picked up automatically when the player walks over it?
crafting_speed | :: R double | The current crafting speed, including speed bonuses from modules and beacons.
The current crafting speed, including speed bonuses from modules and beacons.
crafting_progress | :: RW float | The current crafting progress, as a number in range `[0, 1]`.
The current crafting progress, as a number in range `[0, 1]`.
bonus_progress | :: RW double | The current productivity bonus progress, as a number in range `[0, 1]`.
The current productivity bonus progress, as a number in range `[0, 1]`.
result_quality | :: R LuaQualityPrototype| W QualityID? | The quality produced when this crafting machine finishes crafting. [...]
The quality produced when this crafting machine finishes crafting. [...]
productivity_bonus | :: R double | The productivity bonus of this entity. [...]
The productivity bonus of this entity. [...]
pollution_bonus | :: R double | The pollution bonus of this entity.
The pollution bonus of this entity.
speed_bonus | :: R double | The speed bonus of this entity. [...]
The speed bonus of this entity. [...]
consumption_bonus | :: R double | The consumption bonus of this entity.
The consumption bonus of this entity.
belt_to_ground_type | :: R BeltConnectionType | Whether this underground belt goes into or out of the ground.
Whether this underground belt goes into or out of the ground.
loader_type | :: RW BeltConnectionType | Whether this loader gets items from or puts item into a container.
Whether this loader gets items from or puts item into a container.
use_transitional_requests | :: RW boolean | When true, the rocket silo will automatically request items for space platforms in orbit. [...]
When true, the rocket silo will automatically request items for space platforms in orbit. [...]
transitional_request_target | :: R LuaSpacePlatform? | The space platform in orbit this rocket silo is automatically requesting items for.
The space platform in orbit this rocket silo is automatically requesting items for.
rocket_parts | :: RW uint32 | Number of rocket parts in this rocket silo.
Number of rocket parts in this rocket silo.
send_to_orbit_automatically | :: RW boolean | Whether this rocket silo is set to send items to orbit automatically. [...]
Whether this rocket silo is set to send items to orbit automatically. [...]
logistic_network | :: RW LuaLogisticNetwork | The logistic network this entity is a part of, or `nil` if this entity is not a part of any logistic network.
The logistic network this entity is a part of, or `nil` if this entity is not a part of any logistic network.
logistic_cell | :: R LuaLogisticCell | The logistic cell this entity is a part of. [...]
The logistic cell this entity is a part of. [...]
item_requests | :: R array[ItemWithQualityCount] | Items this ghost will request when revived or items this item request proxy is requesting.
Items this ghost will request when revived or items this item request proxy is requesting.
insert_plan | :: RW array[BlueprintInsertPlan] | The insert plan for this ghost or item request proxy.
The insert plan for this ghost or item request proxy.
removal_plan | :: RW array[BlueprintInsertPlan] | The removal plan for this item request proxy.
The removal plan for this item request proxy.
player | :: R LuaPlayer? | The player connected to this character, if any.
The player connected to this character, if any.
damage_dealt | :: RW double | The damage dealt by this turret, artillery turret, or artillery wagon.
The damage dealt by this turret, artillery turret, or artillery wagon.
kills | :: RW uint32 | The number of units killed by this turret, artillery turret, or artillery wagon.
The number of units killed by this turret, artillery turret, or artillery wagon.
ignore_unprioritised_targets | :: RW boolean | Whether this turret shoots at targets that are not on its priority list.
Whether this turret shoots at targets that are not on its priority list.
last_user | :: R LuaPlayer| W PlayerIdentification? | The last player that changed any setting on this entity. [...]
The last player that changed any setting on this entity. [...]
electric_buffer_size | :: RW double? | The buffer size for the electric energy source. [...]
The buffer size for the electric energy source. [...]
electric_drain | :: R double? | The electric drain for the electric energy source. [...]
The electric drain for the electric energy source. [...]
electric_emissions_per_joule | :: R dictionary[string → double]? | The table of emissions of this energy source in `pollution/Joule`, indexed by pollutant type. [...]
The table of emissions of this energy source in `pollution/Joule`, indexed by pollutant type. [...]
unit_number | :: R uint64? | A unique number identifying this entity for the lifetime of the save. [...]
A unique number identifying this entity for the lifetime of the save. [...]
ghost_unit_number | :: R uint64? | The unit_number of the entity contained in this ghost. [...]
The unit_number of the entity contained in this ghost. [...]
mining_progress | :: RW double? | The mining progress for this mining drill. [...]
The mining progress for this mining drill. [...]
bonus_mining_progress | :: RW double? | The bonus mining progress for this mining drill. [...]
The bonus mining progress for this mining drill. [...]
mining_area | :: R BoundingBox | Area in which this mining drill looks for resources to mine.
Area in which this mining drill looks for resources to mine.
power_production | :: RW double | The power production specific to the ElectricEnergyInterface entity type.
The power production specific to the ElectricEnergyInterface entity type.
power_usage | :: RW double | The power usage specific to the ElectricEnergyInterface entity type.
The power usage specific to the ElectricEnergyInterface entity type.
bounding_box | :: R BoundingBox | LuaEntityPrototype::collision_box around entity's given position and respecting the current entity orientation.
LuaEntityPrototype::collision_box around entity's given position and respecting the current entity orientation.
secondary_bounding_box | :: R BoundingBox? | The secondary bounding box of this entity or `nil` if it doesn't have one. [...]
The secondary bounding box of this entity or `nil` if it doesn't have one. [...]
selection_box | :: R BoundingBox | LuaEntityPrototype::selection_box around entity's given position and respecting the current entity orientation.
LuaEntityPrototype::selection_box around entity's given position and respecting the current entity orientation.
secondary_selection_box | :: R BoundingBox? | The secondary selection box of this entity or `nil` if it doesn't have one. [...]
The secondary selection box of this entity or `nil` if it doesn't have one. [...]
mining_target | :: R LuaEntity? | The mining target, if any.
The mining target, if any.
filter_slot_count | :: R uint32 | The number of filter slots this inserter, loader, mining drill, asteroid collector or logistic storage container has. [...]
The number of filter slots this inserter, loader, mining drill, asteroid collector or logistic storage container has. [...]
loader_container | :: R LuaEntity? | The container entity this loader is pointing at/pulling from depending on the LuaEntity::loader_type, if any.
The container entity this loader is pointing at/pulling from depending on the LuaEntity::loader_type, if any.
grid | :: R LuaEquipmentGrid? | This entity's equipment grid, if any.
This entity's equipment grid, if any.
graphics_variation | :: RW uint8? | The graphics variation for this entity. [...]
The graphics variation for this entity. [...]
tree_color_index | :: RW uint8 | Index of the tree color.
Index of the tree color.
tree_color_index_max | :: R uint8 | Maximum index of the tree colors.
Maximum index of the tree colors.
tree_stage_index | :: RW uint8 | Index of the tree stage.
Index of the tree stage.
tree_stage_index_max | :: R uint8 | Maximum index of the tree stages.
Maximum index of the tree stages.
tree_gray_stage_index | :: RW uint8 | Index of the tree gray stage
Index of the tree gray stage
tree_gray_stage_index_max | :: R uint8 | Maximum index of the tree gray stages.
Maximum index of the tree gray stages.
burner | :: R LuaBurner? | The burner energy source for this entity, if any.
The burner energy source for this entity, if any.
shooting_target | :: RW LuaEntity? | The shooting target for this turret, if any. [...]
The shooting target for this turret, if any. [...]
proxy_target | :: R LuaEntity? | The target entity for this item-request-proxy, if any.
The target entity for this item-request-proxy, if any.
stickers | :: R array[LuaEntity]? | The sticker entities attached to this entity, if any.
The sticker entities attached to this entity, if any.
sticked_to | :: R LuaEntity | The entity this sticker is sticked to.
The entity this sticker is sticked to.
sticker_vehicle_modifiers | :: R table? | The vehicle modifiers applied to this entity through the attached stickers.
The vehicle modifiers applied to this entity through the attached stickers.
parameters | :: RW ProgrammableSpeakerParameters |
alert_parameters | :: RW ProgrammableSpeakerAlertParameters |
electric_network_statistics | :: R LuaFlowStatistics | The electric network statistics for this electric pole.
The electric network statistics for this electric pole.
inserter_target_pickup_count | :: R uint32 | Returns the current target pickup count of the inserter. [...]
Returns the current target pickup count of the inserter. [...]
inserter_stack_size_override | :: RW uint32 | Sets the stack size limit on this inserter. [...]
Sets the stack size limit on this inserter. [...]
products_finished | :: RW uint32 | The number of products this machine finished crafting in its lifetime.
The number of products this machine finished crafting in its lifetime.
spawning_cooldown | :: R double |
absorbed_pollution | :: R double |
spawn_shift | :: R double |
units | :: R array[LuaEntity] | The units associated with this spawner entity.
The units associated with this spawner entity.
power_switch_state | :: RW boolean | The state of this power switch.
The state of this power switch.
combinator_description | :: RW string | The description on this combinator.
The description on this combinator.
effects | :: R ModuleEffects? | The effects being applied to this entity, if any. [...]
The effects being applied to this entity, if any. [...]
beacons_count | :: R uint32? | Number of beacons affecting this effect receiver. [...]
Number of beacons affecting this effect receiver. [...]
infinity_container_filters | :: RW array[InfinityInventoryFilter] | The filters for this infinity container.
The filters for this infinity container.
remove_unfiltered_items | :: RW boolean | Whether items not included in this infinity container filters should be removed from the container.
Whether items not included in this infinity container filters should be removed from the container.
character_corpse_player_index | :: RW uint32 | The player index associated with this character corpse. [...]
The player index associated with this character corpse. [...]
character_corpse_tick_of_death | :: RW uint32 | The tick this character corpse died at.
The tick this character corpse died at.
character_corpse_death_cause | :: RW LocalisedString | The reason this character corpse character died. [...]
The reason this character corpse character died. [...]
associated_player | :: R LuaPlayer| W PlayerIdentification? | The player this character is associated with, if any. [...]
The player this character is associated with, if any. [...]
tick_of_last_attack | :: RW uint32 | The last tick this character entity was attacked.
The last tick this character entity was attacked.
tick_of_last_damage | :: RW uint32 | The last tick this character entity was damaged.
The last tick this character entity was damaged.
splitter_filter | :: RW ItemFilter? | The filter for this splitter, if any is set.
The filter for this splitter, if any is set.
inserter_filter_mode | :: RW `"whitelist"` or `"blacklist"`? | The filter mode for this filter inserter. [...]
The filter mode for this filter inserter. [...]
loader_filter_mode | :: RW PrototypeFilterMode? | The filter mode for this loader. [...]
The filter mode for this loader. [...]
loader_belt_stack_size_override | :: RW uint8 | The belt stack size override for this loader. [...]
The belt stack size override for this loader. [...]
mining_drill_filter_mode | :: RW `"whitelist"` or `"blacklist"`? | The filter mode for this mining drill. [...]
The filter mode for this mining drill. [...]
splitter_input_priority | :: RW `"left"` or `"none"` or `"right"` | The input priority for this splitter.
The input priority for this splitter.
splitter_output_priority | :: RW `"left"` or `"none"` or `"right"` | The output priority for this splitter.
The output priority for this splitter.
inserter_spoil_priority | :: RW SpoilPriority | The spoil priority for this inserter.
The spoil priority for this inserter.
armed | :: R boolean | Whether this land mine is armed.
Whether this land mine is armed.
recipe_locked | :: RW boolean | When locked; the recipe in this assembling machine can't be changed by the player.
When locked; the recipe in this assembling machine can't be changed by the player.
connected_rail | :: R LuaEntity? | The rail entity this train stop is connected to, if any.
The rail entity this train stop is connected to, if any.
connected_rail_direction | :: R defines.rail_direction | Rail direction to which this train stop is binding. [...]
Rail direction to which this train stop is binding. [...]
trains_in_block | :: R uint32 | The number of trains in this rail block for this rail entity.
The number of trains in this rail block for this rail entity.
timeout | :: RW uint32 | The timeout that's left on this landmine in ticks. [...]
The timeout that's left on this landmine in ticks. [...]
neighbour_bonus | :: R double | The current total neighbour bonus of this reactor.
The current total neighbour bonus of this reactor.
ai_settings | :: R LuaAISettings | The ai settings of this unit.
The ai settings of this unit.
highlight_box_type | :: RW CursorBoxRenderType | The highlight box type of this highlight box entity.
The highlight box type of this highlight box entity.
highlight_box_blink_interval | :: RW uint32 | The blink interval of this highlight box entity. [...]
The blink interval of this highlight box entity. [...]
status | :: R defines.entity_status? | The status of this entity, if any. [...]
The status of this entity, if any. [...]
custom_status | :: RW CustomEntityStatus? | A custom status for this entity that will be displayed in the GUI.
A custom status for this entity that will be displayed in the GUI.
enable_logistics_while_moving | :: RW boolean | Whether equipment grid logistics are enabled while this vehicle is moving.
Whether equipment grid logistics are enabled while this vehicle is moving.
render_player | :: R LuaPlayer| W PlayerIdentification? | The player that this `simple-entity-with-owner`, `simple-entity-with-force`, or `highlight-box` is visible to. [...]
The player that this `simple-entity-with-owner`, `simple-entity-with-force`, or `highlight-box` is visible to. [...]
render_to_forces | :: R array[LuaForce]| W ForceSet? | The forces that this `simple-entity-with-owner` or `simple-entity-with-force` is visible to. [...]
The forces that this `simple-entity-with-owner` or `simple-entity-with-force` is visible to. [...]
pump_rail_target | :: R LuaEntity? | The rail target of this pump, if any.
The rail target of this pump, if any.
valve_threshold_override | :: RW float? | The threshold override of this valve, or `nil` if an override is not defined. [...]
The threshold override of this valve, or `nil` if an override is not defined. [...]
electric_network_id | :: R uint32? | Returns the id of the electric network that this entity is connected to, if any.
Returns the id of the electric network that this entity is connected to, if any.
allow_dispatching_robots | :: RW boolean | Whether this character's personal roboports are allowed to dispatch robots.
Whether this character's personal roboports are allowed to dispatch robots.
energy_generated_last_tick | :: R double | How much energy this generator generated in the last tick.
How much energy this generator generated in the last tick.
storage_filter | :: R ItemIDAndQualityIDPair| W ItemWithQualityID? | The storage filter for this logistic storage container. [...]
The storage filter for this logistic storage container. [...]
request_from_buffers | :: RW boolean | Whether this requester chest is set to also request from buffer chests. [...]
Whether this requester chest is set to also request from buffer chests. [...]
corpse_expires | :: RW boolean | Whether this corpse will ever fade away.
Whether this corpse will ever fade away.
corpse_immune_to_entity_placement | :: RW boolean | If true, corpse won't be destroyed when entities are placed over it. [...]
If true, corpse won't be destroyed when entities are placed over it. [...]
tags | :: RW Tags? | The tags associated with this entity ghost. [...]
The tags associated with this entity ghost. [...]
time_to_next_effect | :: RW uint32 | The ticks until the next trigger effect of this smoke-with-trigger.
The ticks until the next trigger effect of this smoke-with-trigger.
autopilot_destination | :: RW MapPosition? | Destination of this spidertron's autopilot, if any. [...]
Destination of this spidertron's autopilot, if any. [...]
autopilot_destinations | :: R array[MapPosition] | The queued destination positions of spidertron's autopilot.
The queued destination positions of spidertron's autopilot.
trains_count | :: R uint32 | Amount of trains related to this particular train stop. [...]
Amount of trains related to this particular train stop. [...]
trains_limit | :: RW uint32 | Amount of trains above which no new trains will be sent to this train stop. [...]
Amount of trains above which no new trains will be sent to this train stop. [...]
is_military_target | :: RW boolean | Whether this entity is a MilitaryTarget. [...]
Whether this entity is a MilitaryTarget. [...]
is_entity_with_owner | :: R boolean | If this entity is EntityWithOwner
If this entity is EntityWithOwner
is_entity_with_health | :: R boolean | If this entity is EntityWithHealth
If this entity is EntityWithHealth
combat_robot_owner | :: RW LuaEntity? | The owner of this combat robot, if any.
The owner of this combat robot, if any.
link_id | :: RW uint32 | The link ID this linked container is using.
The link ID this linked container is using.
follow_target | :: RW LuaEntity? | The follow target of this spidertron, if any.
The follow target of this spidertron, if any.
follow_offset | :: RW Vector? | The follow offset of this spidertron, if any entity is being followed. [...]
The follow offset of this spidertron, if any entity is being followed. [...]
linked_belt_type | :: RW BeltConnectionType | Type of linked belt. [...]
Type of linked belt. [...]
linked_belt_neighbour | :: R LuaEntity? | Neighbour to which this linked belt is connected to, if any. [...]
Neighbour to which this linked belt is connected to, if any. [...]
quality | :: R LuaQualityPrototype | The quality of this entity. [...]
The quality of this entity. [...]
rail_layer | :: R defines.rail_layer | Gets rail layer of a given signal
Gets rail layer of a given signal
radar_scan_progress | :: R float | The current radar scan progress, as a number in range `[0, 1]`.
The current radar scan progress, as a number in range `[0, 1]`.
name_tag | :: RW string | Name tag of this entity. [...]
Name tag of this entity. [...]
rocket_silo_status | :: R defines.rocket_silo_status | The status of this rocket silo entity.
The status of this rocket silo entity.
tile_width | :: R uint32 | Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). [...]
Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). [...]
tile_height | :: R uint32 | Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). [...]
Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). [...]
crane_end_position_3d | :: R Vector3D | Returns current position in 3D for the end of the crane of this entity.
Returns current position in 3D for the end of the crane of this entity.
crane_destination | :: RW MapPosition | Destination of the crane of this entity. [...]
Destination of the crane of this entity. [...]
crane_destination_3d | :: RW Vector3D | Destination of the crane of this entity in 3D. [...]
Destination of the crane of this entity in 3D. [...]
crane_grappler_destination | :: W MapPosition | Will set destination for the grappler of crane of this entity. [...]
Will set destination for the grappler of crane of this entity. [...]
crane_grappler_destination_3d | :: W Vector3D | Will set destination in 3D for the grappler of crane of this entity. [...]
Will set destination in 3D for the grappler of crane of this entity. [...]
owned_plants | :: R array[LuaEntity] | Plants registered by this agricultural tower. [...]
Plants registered by this agricultural tower. [...]
copy_color_from_train_stop | :: RW boolean | If this rolling stock has 'copy color from train stop' enabled.
If this rolling stock has 'copy color from train stop' enabled.
is_headed_to_trains_front | :: R boolean | If the rolling stock is facing train's front.
If the rolling stock is facing train's front.
draw_data | :: R RollingStockDrawData | Gives a draw data of the given entity if it supports such data.
Gives a draw data of the given entity if it supports such data.
train_stop_priority | :: RW uint8 | Priority of this train stop.
Priority of this train stop.
belt_shape | :: R `"straight"` or `"left"` or `"right"` | Gives what is the current shape of a transport-belt.
Gives what is the current shape of a transport-belt.
gps_tag | :: R string | Returns a rich text string containing this entity's position and surface name as a gps tag. [...]
Returns a rich text string containing this entity's position and surface name as a gps tag. [...]
commandable | :: R LuaCommandable? | Returns a LuaCommandable for this entity or nil if entity is not commandable. [...]
Returns a LuaCommandable for this entity or nil if entity is not commandable. [...]
fluids_count | :: R uint32 | Returns count of fluid storages. [...]
Returns count of fluid storages. [...]
tick_grown | :: RW MapTick | The tick when this plant is fully grown.
The tick when this plant is fully grown.
always_on | :: RW boolean | If the lamp is always on when not driven by control behavior.
If the lamp is always on when not driven by control behavior.
artillery_auto_targeting | :: RW boolean | If this artillery auto-targets enemies.
If this artillery auto-targets enemies.
robot_order_queue | :: R array[WorkerRobotOrder] | Get the current queue of robot orders.
Get the current queue of robot orders.
procession_tick | :: RW MapTick | how far into the current procession the cargo pod is.
how far into the current procession the cargo pod is.
is_updatable | :: R boolean | Whether the entity is updatable and considered an UpdatableEntity.
Whether the entity is updatable and considered an UpdatableEntity.
disabled_by_script | :: RW boolean | If the updatable entity is disabled by script. [...]
If the updatable entity is disabled by script. [...]
disabled_by_control_behavior | :: R boolean | If the updatable entity is disabled by control behavior. [...]
If the updatable entity is disabled by control behavior. [...]
disabled_by_recipe | :: R boolean | If the assembling machine is disabled by recipe, e.g. [...]
If the assembling machine is disabled by recipe, e.g. [...]
is_freezable | :: R boolean | Whether the entity is freezable and considered a FreezableEntity.
Whether the entity is freezable and considered a FreezableEntity.
frozen | :: R boolean | Whether the freezable entity is currently frozen. [...]
Whether the freezable entity is currently frozen. [...]
cargo_hatches | :: R array[LuaCargoHatch] | The cargo hatches owned by this entity if any.
The cargo hatches owned by this entity if any.
cargo_pod_state | :: R `"awaiting_launch"` or `"ascending"` or `"surface_transition"` or `"descending"` or `"parking"` | The state of this cargo pod entity.
The state of this cargo pod entity.
cargo_pod_destination | :: RW CargoDestination | The destination of this cargo pod entity. [...]
The destination of this cargo pod entity. [...]
cargo_pod_origin | :: RW LuaEntity? | The origin of this cargo pod entity. [...]
The origin of this cargo pod entity. [...]
attached_cargo_pod | :: R LuaEntity? | The cargo pod attached to this rocket silo rocket if any.
The cargo pod attached to this rocket silo rocket if any.
rocket | :: R LuaEntity? | The rocket silo rocket this cargo pod is attached to, or rocket silo rocket attached to this rocket silo - if any.
The rocket silo rocket this cargo pod is attached to, or rocket silo rocket attached to this rocket silo - if any.
item_request_proxy | :: R LuaEntity? | The first found item request proxy targeting this entity.
The first found item request proxy targeting this entity.
base_damage_modifiers | :: RW TriggerModifierData |
bonus_damage_modifiers | :: RW TriggerModifierData |
cargo_bay_connection_owner | :: R LuaEntity? | The space platform hub or cargo landing pad this cargo bay is connected to if any.
The space platform hub or cargo landing pad this cargo bay is connected to if any.
pickup_from_left_lane | :: RW boolean | For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the left lane.
For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the left lane.
pickup_from_right_lane | :: RW boolean | For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the right lane.
For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the right lane.
segmented_unit | :: R LuaSegmentedUnit? | The segmented unit object that the segment entity is a part of.
The segmented unit object that the segment entity is a part of.
pumped_last_tick | :: R double | The amount of fluid moved by this offshore pump or normal pump in the last tick.
The amount of fluid moved by this offshore pump or normal pump in the last tick.
created_by_corpse | :: R LuaEntity? | The corpse that caused this entity ghost to be created, if any.
The corpse that caused this entity ghost to be created, if any.
priority_targets | :: R array[LuaEntityPrototype] | The priority targets for this turret (if any).
The priority targets for this turret (if any).
proxy_target_entity | :: RW LuaEntity? | Entity of which inventory is exposed by this ProxyContainer
Entity of which inventory is exposed by this ProxyContainer
proxy_target_inventory | :: RW defines.inventory | Inventory index of the inventory that is exposed by this ProxyContainer
Inventory index of the inventory that is exposed by this ProxyContainer
display_panel_text | :: RW LocalisedString | Text visible on the display panel. [...]
Text visible on the display panel. [...]
display_panel_icon | :: RW SignalID? | Icon visible on the display panel. [...]
Icon visible on the display panel. [...]
display_panel_always_show | :: RW boolean |
display_panel_show_in_chart | :: RW boolean |
valid | :: R boolean | Is this object valid? [...]
Is this object valid? [...]
object_name | :: R string | The class name of this object. [...]
The class name of this object. [...]

Inherited from LuaControl

get_inventory(inventory) | → LuaInventory? | Get an inventory belonging to this entity. [...]
Get an inventory belonging to this entity. [...]
get_inventory_name(inventory) | → string? | Get name of inventory. [...]
Get name of inventory. [...]
get_max_inventory_index() | → defines.inventory | The highest index of all inventories this entity can use. [...]
The highest index of all inventories this entity can use. [...]
get_main_inventory() | → LuaInventory? | Gets the main inventory for this character or player if this is a character or player.
Gets the main inventory for this character or player if this is a character or player.
can_insert(items) | → boolean | Can at least some items be inserted?
Can at least some items be inserted?
insert(items) | → uint32 | Insert items into this entity. [...]
Insert items into this entity. [...]
set_gui_arrow{margin=…, type=…} |  | Create an arrow which points at this entity. [...]
Create an arrow which points at this entity. [...]
clear_gui_arrow() |  | Removes the arrow created by `set_gui_arrow`.
Removes the arrow created by `set_gui_arrow`.
get_item_count(item?) | → uint32 | Get the number of all or some items in this entity.
Get the number of all or some items in this entity.
has_items_inside() | → boolean | Does this entity have any item inside it?
Does this entity have any item inside it?
can_reach_entity(entity) | → boolean | Can a given entity be opened or accessed?
Can a given entity be opened or accessed?
clear_items_inside() |  | Remove all items from this entity.
Remove all items from this entity.
remove_item(items) | → uint32 | Remove items from this entity.
Remove items from this entity.
teleport(position, surface?, raise_teleported?, snap_to_grid?, build_check_type?) | → boolean | Teleport the entity to a given position, possibly on another surface. [...]
Teleport the entity to a given position, possibly on another surface. [...]
update_selected_entity(position) |  | Select an entity, as if by hovering the mouse above it.
Select an entity, as if by hovering the mouse above it.
clear_selected_entity() |  | Unselect any selected entity.
Unselect any selected entity.
disable_flashlight() |  | Disable the flashlight. [...]
Disable the flashlight. [...]
enable_flashlight() |  | Enable the flashlight. [...]
Enable the flashlight. [...]
is_flashlight_enabled() | → boolean | Is the flashlight enabled for the current controller. [...]
Is the flashlight enabled for the current controller. [...]
get_craftable_count(recipe) | → uint32 | Gets the count of the given recipe that can be crafted.
Gets the count of the given recipe that can be crafted.
begin_crafting{count=…, recipe=…, silent?=…} | → uint32 | Begins crafting the given count of the given recipe.
Begins crafting the given count of the given recipe.
cancel_crafting{index=…, count=…} |  | Cancels the given amount of crafts at the given crafting queue position. [...]
Cancels the given amount of crafts at the given crafting queue position. [...]
mine_entity(entity, force?) | → boolean | Mines the given entity as if this player (or character) mined it.
Mines the given entity as if this player (or character) mined it.
mine_tile(tile) | → boolean | Mines the given tile as if this player (or character) mined it.
Mines the given tile as if this player (or character) mined it.
is_player() | → boolean | When `true` control adapter is a LuaPlayer object, `false` for entities including characters with players.
When `true` control adapter is a LuaPlayer object, `false` for entities including characters with players.
open_technology_gui(technology?) |  | Open the technology GUI and select a given technology.
Open the technology GUI and select a given technology.
open_factoriopedia_gui(prototype?) |  | Open the Factoriopedia GUI and select a given entry, if any valid ID is given.
Open the Factoriopedia GUI and select a given entry, if any valid ID is given.
close_factoriopedia_gui() |  | Closes the Factoriopedia GUI if it's open.
Closes the Factoriopedia GUI if it's open.
is_cursor_blueprint() | → boolean | Returns whether the player is holding a blueprint. [...]
Returns whether the player is holding a blueprint. [...]
is_cursor_empty() | → boolean | Returns whether the player is holding something in the cursor. [...]
Returns whether the player is holding something in the cursor. [...]
get_requester_point() | → LuaLogisticPoint? | Gets the requester logistic point for this entity if it has one.
Gets the requester logistic point for this entity if it has one.
set_driving(driving, force?) |  | Sets if this character or player is driving. [...]
Sets if this character or player is driving. [...]
can_place_entity{name=…, position=…, direction?=…} | → boolean | Checks if this character or player can build the given entity at the given location on the surface the character or player is on.
Checks if this character or player can build the given entity at the given location on the surface the character or player is on.
surface | :: R LuaSurface | The surface this entity is currently on.
The surface this entity is currently on.
surface_index | :: R uint32 | Unique index (ID) associated with the surface this entity is currently on.
Unique index (ID) associated with the surface this entity is currently on.
position | :: R MapPosition | The current position of the entity.
The current position of the entity.
render_position | :: R MapPosition | The current render position of the entity.
The current render position of the entity.
is_flying | :: R boolean | If this player or character entity is flying. [...]
If this player or character entity is flying. [...]
flight_height | :: R double | The current flight height for this player or character entity. [...]
The current flight height for this player or character entity. [...]
vehicle | :: R LuaEntity? | The vehicle the player is currently sitting in.
The vehicle the player is currently sitting in.
cargo_pod | :: R LuaEntity? | The cargo pod the player is currently sitting in or the cargo pod attached to this rocket silo.
The cargo pod the player is currently sitting in or the cargo pod attached to this rocket silo.
hub | :: R LuaEntity? | The space platform hub the player is currently sitting in.
The space platform hub the player is currently sitting in.
force | :: R LuaForce| W ForceID | The force of this entity. [...]
The force of this entity. [...]
force_index | :: R uint32 | Unique index (ID) associated with the force of this entity.
Unique index (ID) associated with the force of this entity.
selected | :: RW LuaEntity? | The currently selected entity. [...]
The currently selected entity. [...]
opened | :: RW LuaEntity or LuaItemStack or LuaEquipment or LuaEquipmentGrid or LuaPlayer or LuaGuiElement or LuaInventory or LuaLogisticNetwork or LuaItemStack or defines.gui_type? | The GUI the player currently has open. [...]
The GUI the player currently has open. [...]
crafting_queue_size | :: R uint32 | Size of the crafting queue.
Size of the crafting queue.
crafting_queue_progress | :: RW double | The crafting queue progress in the range `[0-1]`. [...]
The crafting queue progress in the range `[0-1]`. [...]
walking_state | :: RW table | Current walking state of the player, or the spider-vehicle the character is driving.
Current walking state of the player, or the spider-vehicle the character is driving.
riding_state | :: RW RidingState | Current riding state of this car, or of the car this player is riding in.
Current riding state of this car, or of the car this player is riding in.
mining_state | :: RW table | Current mining state. [...]
Current mining state. [...]
shooting_state | :: RW table | Current shooting state.
Current shooting state.
picking_state | :: RW boolean | Current item-picking state.
Current item-picking state.
repair_state | :: RW table | Current repair state.
Current repair state.
cursor_stack | :: R LuaItemStack? | The player's cursor stack. [...]
The player's cursor stack. [...]
cursor_ghost | :: R ItemIDAndQualityIDPair| W ItemWithQualityID? | The ghost prototype in the player's cursor. [...]
The ghost prototype in the player's cursor. [...]
cursor_record | :: R LuaRecord? | The blueprint record in the player's cursor.
The blueprint record in the player's cursor.
driving | :: RW boolean | `true` if the player is in a vehicle. [...]
`true` if the player is in a vehicle. [...]
crafting_queue | :: R array[CraftingQueueItem]? | The current crafting queue items.
The current crafting queue items.
following_robots | :: R array[LuaEntity] | The current combat robots following the character. [...]
The current combat robots following the character. [...]
cheat_mode | :: RW boolean | When `true` hand crafting is free and instant.
When `true` hand crafting is free and instant.
character_crafting_speed_modifier | :: RW double | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_mining_speed_modifier | :: RW double | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_additional_mining_categories | :: RW array[string] | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_running_speed_modifier | :: RW double | Modifies the running speed of this character by the given value as a percentage. [...]
Modifies the running speed of this character by the given value as a percentage. [...]
character_build_distance_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_item_drop_distance_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_reach_distance_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_resource_reach_distance_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_item_pickup_distance_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_loot_pickup_distance_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_inventory_slots_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_trash_slot_count_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_maximum_following_robot_count_bonus | :: RW uint32 | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
character_health_bonus | :: RW float | When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
opened_gui_type | :: R defines.gui_type? |
build_distance | :: R uint32 | The build distance of this character or max uint when not a character or player connected to a character.
The build distance of this character or max uint when not a character or player connected to a character.
drop_item_distance | :: R uint32 | The item drop distance of this character or max uint when not a character or player connected to a character.
The item drop distance of this character or max uint when not a character or player connected to a character.
reach_distance | :: R uint32 | The reach distance of this character or max uint when not a character or player connected to a character.
The reach distance of this character or max uint when not a character or player connected to a character.
item_pickup_distance | :: R double | The item pickup distance of this character or max double when not a character or player connected to a character.
The item pickup distance of this character or max double when not a character or player connected to a character.
loot_pickup_distance | :: R double | The loot pickup distance of this character or max double when not a character or player connected to a character.
The loot pickup distance of this character or max double when not a character or player connected to a character.
resource_reach_distance | :: R double | The resource reach distance of this character or max double when not a character or player connected to a character.
The resource reach distance of this character or max double when not a character or player connected to a character.
in_combat | :: R boolean | Whether this character entity is in combat.
Whether this character entity is in combat.
character_running_speed | :: R double | The current movement speed of this character, including effects from exoskeletons, tiles, stickers and shooting.
The current movement speed of this character, including effects from exoskeletons, tiles, stickers and shooting.
character_mining_progress | :: R double | The current mining progress between 0 and 1 of this character, or 0 if they aren't mining.
The current mining progress between 0 and 1 of this character, or 0 if they aren't mining.

## Methods

### get_output_inventory() → LuaInventory?

Gets the entity's output inventory if it has one.

#### Return values

→ LuaInventory? | A reference to the entity's output inventory.

### get_module_inventory() → LuaInventory?

Inventory for storing modules of this entity; `nil` if this entity has no module inventory.

### get_fuel_inventory() → LuaInventory?

The fuel inventory for this entity or `nil` if this entity doesn't have a fuel inventory.

### get_burnt_result_inventory() → LuaInventory?

The burnt result inventory for this entity or `nil` if this entity doesn't have a burnt result inventory.

### damage(damage, force, type?, source?, cause?) → float

Damages the entity.

#### Parameters

damage | :: float | The amount of damage to be done.
The amount of damage to be done.
force | :: ForceID | The force that will be doing the damage.
The force that will be doing the damage.
type | :: DamageTypeID? | The type of damage to be done, defaults to `"impact"`.
The type of damage to be done, defaults to `"impact"`.
source | :: LuaEntity? | The entity that is directly dealing the damage (e.g. the projectile, flame, sticker, grenade, laser beam, etc.). Needs to be on the same surface as the entity being damaged.
The entity that is directly dealing the damage (e.g. the projectile, flame, sticker, grenade, laser beam, etc.). Needs to be on the same surface as the entity being damaged.
cause | :: LuaEntity? | The entity that originally triggered the events that led to this damage being dealt (e.g. the character, turret, enemy, etc. that pulled the trigger). Does not need to be on the same surface as the entity being damaged.
The entity that originally triggered the events that led to this damage being dealt (e.g. the character, turret, enemy, etc. that pulled the trigger). Does not need to be on the same surface as the entity being damaged.

#### Return values

→ float | the total damage actually applied after resistances.

#### Raised events

on_entity_damaged instantly |

Can only be used if this is EntityWithHealth

### can_be_destroyed() → boolean

Whether the entity can be destroyed

### destroy{do_cliff_correction?=…, raise_destroy?=…, player?=…, undo_index?=…} → boolean

Destroys the entity.

Not all entities can be destroyed - things such as rails under trains cannot be destroyed until the train is moved or destroyed.

#### Parameters

Table (optional) with the following fields:

do_cliff_correction | :: boolean? | Whether neighbouring cliffs should be corrected. Defaults to `false`.
Whether neighbouring cliffs should be corrected. Defaults to `false`.
raise_destroy | :: boolean? | If `true`, script_raised_destroy will be called. Defaults to `false`.
If `true`, script_raised_destroy will be called. Defaults to `false`.
player | :: PlayerIdentification? | The player whose undo queue this action should be added to.
The player whose undo queue this action should be added to.
undo_index | :: uint32? | The index of the undo item to add this action to. An index of `0` creates a new undo item for it. Defaults to putting it into the appropriate undo item automatically if not specified.
The index of the undo item to add this action to. An index of `0` creates a new undo item for it. Defaults to putting it into the appropriate undo item automatically if not specified.

#### Return values

→ boolean | Returns `false` if the entity was valid and destruction failed, `true` in all other cases.

#### Raised events

script_raised_destroy? instantly | Raised if the `raise_destroy` flag was set and the entity was successfully destroyed.

### die(force?, cause?) → boolean

Immediately kills the entity. Does nothing if the entity doesn't have health.

Unlike LuaEntity::destroy, `die` will trigger the on_entity_died event and the entity will produce a corpse and drop loot if it has any.

#### Parameters

force | :: ForceID? | The force to attribute the kill to.
The force to attribute the kill to.
cause | :: LuaEntity? | The cause to attribute the kill to.
The cause to attribute the kill to.

#### Return values

→ boolean | Whether the entity was successfully killed.

#### Raised events

on_entity_died? instantly | Raised if the entity was successfully killed. If `force` is not specified, the event will blame the `"neutral"` force.
on_post_entity_died? instantly | Raised if the entity was successfully killed.

#### Example

    -- This function can be called with only the `cause` argument and no `force`:
    entity.die(nil, killer_entity)

### has_flag(flag) → boolean

Test whether this entity's prototype has a certain flag set.

`entity.has_flag(f)` is a shortcut for `entity.prototype.has_flag(f)`.

#### Parameters

flag | :: EntityPrototypeFlag | The flag to test.
The flag to test.

#### Return values

→ boolean | `true` if this entity has the given flag set.

### ghost_has_flag(flag) → boolean

Same as LuaEntity::has_flag, but targets the inner entity on a entity ghost.

#### Parameters

flag | :: EntityPrototypeFlag | The flag to test.
The flag to test.

#### Return values

→ boolean | `true` if the entity has the given flag set.

Can only be used if this is EntityGhost

### add_market_item(offer)

Offer a thing on the market.

#### Parameters

offer | :: Offer |

Can only be used if this is Market

#### Examples

    -- Adds market offer, 1 copper ore for 10 iron ore
    market.add_market_item{price={{name = "iron-ore", count = 10}}, offer={type="give-item", item="copper-ore"}}

    -- Adds market offer, 1 copper ore for 5 iron ore and 5 stone ore
    market.add_market_item{price={{name = "iron-ore", count = 5}, {name = "stone", count = 5}}, offer={type="give-item", item="copper-ore"}}

### remove_market_item(offer) → boolean

Remove an offer from a market.

The other offers are moved down to fill the gap created by removing the offer, which decrements the overall size of the offer array.

#### Parameters

offer | :: uint32 | Index of offer to remove.
Index of offer to remove.

#### Return values

→ boolean | `true` if the offer was successfully removed; `false` when the given index was not valid.

Can only be used if this is Market

### get_market_items() → array[Offer]

Get all offers in a market as an array.

Can only be used if this is Market

### clear_market_items()

Removes all offers from a market.

Can only be used if this is Market

### order_deconstruction(force, player?, undo_index?) → boolean

Sets the entity to be deconstructed by construction robots.

#### Parameters

force | :: ForceID | The force whose robots are supposed to do the deconstruction.
The force whose robots are supposed to do the deconstruction.
player | :: PlayerIdentification? | The player to set the last_user to, if any. Also the player whose undo queue this action should be added to.
The player to set the last_user to, if any. Also the player whose undo queue this action should be added to.
undo_index | :: uint32? | The index of the undo item to add this action to. An index of `0` creates a new undo item for it. An index of `1` adds the action to the latest undo action on the stack. Defaults to putting it into the appropriate undo item automatically if one is not specified.
The index of the undo item to add this action to. An index of `0` creates a new undo item for it. An index of `1` adds the action to the latest undo action on the stack. Defaults to putting it into the appropriate undo item automatically if one is not specified.

#### Return values

→ boolean | if the entity was marked for deconstruction.

#### Raised events

on_marked_for_deconstruction? instantly | Raised if the entity was successfully marked for deconstruction.

### cancel_deconstruction(force, player?)

Cancels deconstruction if it is scheduled, does nothing otherwise.

#### Parameters

force | :: ForceID | The force who did the deconstruction order.
The force who did the deconstruction order.
player | :: PlayerIdentification? | The player to set the `last_user` to if any.
The player to set the `last_user` to if any.

#### Raised events

on_cancelled_deconstruction? instantly | Raised if the entity's deconstruction was successfully cancelled.

### to_be_deconstructed() → boolean

Is this entity marked for deconstruction?

### order_upgrade{target=…, force=…, player?=…, undo_index?=…} → boolean

Sets the entity to be upgraded by construction robots.

#### Parameters

Table with the following fields:

target | :: EntityWithQualityID | The prototype of the entity to upgrade to.
The prototype of the entity to upgrade to.
force | :: ForceID | The force whose robots are supposed to do the upgrade.
The force whose robots are supposed to do the upgrade.
player | :: PlayerIdentification? | The player whose undo queue this action should be added to.
The player whose undo queue this action should be added to.
undo_index | :: uint32? | The index of the undo item to add this action to. An index of `0` creates a new undo item for it. Defaults to putting it into the appropriate undo item automatically if not specified.
The index of the undo item to add this action to. An index of `0` creates a new undo item for it. Defaults to putting it into the appropriate undo item automatically if not specified.

#### Return values

→ boolean | Whether the entity was marked for upgrade.

#### Raised events

on_marked_for_upgrade? instantly | Raised if the entity was successfully marked for upgrade.

### cancel_upgrade(force, player?) → boolean

Cancels upgrade if it is scheduled, does nothing otherwise.

#### Parameters

force | :: ForceID | The force who did the upgrade order.
The force who did the upgrade order.
player | :: PlayerIdentification? | The player to set the last_user to if any.
The player to set the last_user to if any.

#### Return values

→ boolean | Whether the cancel was successful.

#### Raised events

on_cancelled_upgrade? instantly | Raised if the entity was previously marked for upgrade.

### to_be_upgraded() → boolean

Is this entity marked for upgrade?

### apply_upgrade() → LuaEntity?, LuaEntity?

Upgrades this entity in place if it's marked to be upgraded.

#### Return values

→ LuaEntity? | The first upgraded entity - `nil` if this entity is not marked for upgrade.
→ LuaEntity? | When upgrading underground belts, the other underground belt end that was also upgraded - `nil` if this entity is not marked for upgrade.

#### Raised events

script_raised_destroy instantly | Raised for the old entity if the entity was actually upgraded.
script_raised_built instantly | Raised for the new entity if the entity was actually upgraded.

### is_crafting() → boolean

Returns whether a craft is currently in process. It does not indicate whether progress is currently being made, but whether a crafting process has been started in this machine.

Can only be used if this is CraftingMachine

### is_opened() → boolean

#### Return values

→ boolean | `true` if this gate is currently opened.

Can only be used if this is Gate

### is_opening() → boolean

#### Return values

→ boolean | `true` if this gate is currently opening.

Can only be used if this is Gate

### is_closed() → boolean

#### Return values

→ boolean | `true` if this gate is currently closed.

Can only be used if this is Gate

### is_closing() → boolean

#### Return values

→ boolean | `true` if this gate is currently closing

Can only be used if this is Gate

### request_to_open(force, extra_time?)

#### Parameters

force | :: ForceID | The force that requests the gate to be open.
The force that requests the gate to be open.
extra_time | :: uint32? | Extra ticks to stay open.
Extra ticks to stay open.

Can only be used if this is Gate

### request_to_close(force)

#### Parameters

force | :: ForceID | The force that requests the gate to be closed.
The force that requests the gate to be closed.

Can only be used if this is Gate

### get_transport_line(index) → LuaTransportLine

Get a transport line of a belt or belt connectable entity.

#### Parameters

index | :: defines.transport_line | Index of the requested transport line. Transport lines are 1-indexed.
Index of the requested transport line. Transport lines are 1-indexed.

Can only be used if this is TransportBeltConnectable

### get_item_insert_specification(position) → uint32, float

Get an item insert specification onto a belt connectable: for a given map position provides into which line at what position item should be inserted to be closest to the provided position.

#### Parameters

position | :: MapPosition | Position where the item is to be inserted.
Position where the item is to be inserted.

#### Return values

→ uint32 | Index of the transport line that is closest to the provided map position.
→ float | Position along the transport line where item should be dropped.

Can only be used if this is TransportBeltConnectable

### get_line_item_position(index, position) → MapPosition

Get a map position related to a position on a transport line.

#### Parameters

index | :: defines.transport_line | Index of the transport line. Transport lines are 1-indexed.
Index of the transport line. Transport lines are 1-indexed.
position | :: float | Linear position along the transport line. Clamped to the transport line range.
Linear position along the transport line. Clamped to the transport line range.

Can only be used if this is TransportBeltConnectable

### get_max_transport_line_index() → defines.transport_line

Get the maximum transport line index of a belt or belt connectable entity.

Can only be used if this is TransportBeltConnectable

### launch_rocket(destination?, character?) → boolean

#### Parameters

destination | :: CargoDestination? |
character | :: LuaEntity? | If provided, must be of `character` type.
If provided, must be of `character` type.

#### Return values

→ boolean | `true` if the rocket was successfully launched. Return value of `false` means the silo is not ready for launch.

#### Raised events

on_rocket_launch_ordered? instantly | Raised if the rocket launch was successfully initiated.

Can only be used if this is RocketSilo

### revive{raise_revive?=…, overflow?=…} → array[ItemWithQualityCount]?, LuaEntity?, LuaEntity?

Revive a ghost, which turns it from a ghost into a real entity or tile.

#### Parameters

Table (optional) with the following fields:

raise_revive | :: boolean? | If true, and an entity ghost; script_raised_revive will be called. Else if true, and a tile ghost; script_raised_set_tiles will be called.
If true, and an entity ghost; script_raised_revive will be called. Else if true, and a tile ghost; script_raised_set_tiles will be called.
overflow | :: LuaInventory? | Items that would be deleted will be transferred to this inventory. Must be a script inventory or inventory of other entity. Inventory references obtained from proxy container are not allowed.
Items that would be deleted will be transferred to this inventory. Must be a script inventory or inventory of other entity. Inventory references obtained from proxy container are not allowed.

#### Return values

→ array[ItemWithQualityCount]? | Any items the new real entity collided with or `nil` if the ghost could not be revived.
→ LuaEntity? | The revived entity if an entity ghost was successfully revived.
→ LuaEntity? | The item request proxy if one was created.

#### Raised events

script_raised_revive? instantly | Raised if this was an entity ghost and the `raise_revive` flag was set and the entity was successfully revived.
script_raised_set_tiles? instantly | Raised if this was a tile ghost and the `raise_revive` flag was set and the tile was successfully revived.

Can only be used if this is Ghost

### silent_revive{raise_revive?=…, overflow?=…} → array[ItemWithQualityCount], LuaEntity?, LuaEntity?

Revives a ghost silently, so the revival makes no sound and no smoke is created.

#### Parameters

Table (optional) with the following fields:

raise_revive | :: boolean? | If true, and an entity ghost; script_raised_revive will be called. Else if true, and a tile ghost; script_raised_set_tiles will be called.
If true, and an entity ghost; script_raised_revive will be called. Else if true, and a tile ghost; script_raised_set_tiles will be called.
overflow | :: LuaInventory? | Items that would be deleted will be transferred to this inventory. Must be a script inventory or inventory of other entity. Inventory references obtained from proxy container are not allowed.
Items that would be deleted will be transferred to this inventory. Must be a script inventory or inventory of other entity. Inventory references obtained from proxy container are not allowed.

#### Return values

→ array[ItemWithQualityCount] | Any items the new real entity collided with or `nil` if the ghost could not be revived.
→ LuaEntity? | The revived entity if an entity ghost was successfully revived.
→ LuaEntity? | The item request proxy if one was created.

#### Raised events

script_raised_revive? instantly | Raised if this was an entity ghost and the `raise_revive` flag was set and the entity was successfully revived.
script_raised_set_tiles? instantly | Raised if this was a tile ghost and the `raise_revive` flag was set and the tile was successfully revived.

Can only be used if this is Ghost

### get_connected_rail{rail_direction=…, rail_connection_direction=…} → LuaEntity?, defines.rail_direction?, defines.rail_connection_direction?

#### Parameters

Table with the following fields:

rail_direction | :: defines.rail_direction |
rail_connection_direction | :: defines.rail_connection_direction |

#### Return values

→ LuaEntity? | Rail connected in the specified manner to this one, `nil` if unsuccessful.
→ defines.rail_direction? | Rail direction of the returned rail which points to origin rail
→ defines.rail_connection_direction? | Turn to be taken when going back from returned rail to origin rail

Can only be used if this is Rail

### get_connected_rails() → array[LuaEntity]

Get the rails that this signal is connected to.

Can only be used if this is RailSignal or RailChainSignal

### get_rail_segment_signal(direction, in_else_out) → LuaEntity?

Get the rail signal at the start/end of the rail segment this rail is in.

A rail segment is a continuous section of rail with no branches, signals, nor train stops.

#### Parameters

direction | :: defines.rail_direction | The direction of travel relative to this rail.
The direction of travel relative to this rail.
in_else_out | :: boolean | If true, gets the signal at the entrance of the rail segment, otherwise gets the signal at the exit of the rail segment.
If true, gets the signal at the entrance of the rail segment, otherwise gets the signal at the exit of the rail segment.

#### Return values

→ LuaEntity? | `nil` if the rail segment doesn't start/end with a signal.

Can only be used if this is Rail

### get_rail_segment_stop(direction) → LuaEntity?

Get train stop at the start/end of the rail segment this rail is in.

A rail segment is a continuous section of rail with no branches, signals, nor train stops.

#### Parameters

direction | :: defines.rail_direction | The direction of travel relative to this rail.
The direction of travel relative to this rail.

#### Return values

→ LuaEntity? | `nil` if the rail segment doesn't start/end with a train stop.

Can only be used if this is Rail

### get_rail_segment_end(direction) → LuaEntity, defines.rail_direction

Get the rail at the end of the rail segment this rail is in.

A rail segment is a continuous section of rail with no branches, signals, nor train stops.

#### Parameters

direction | :: defines.rail_direction |

#### Return values

→ LuaEntity | The rail entity.
→ defines.rail_direction | A rail direction pointing out of the rail segment from the end rail.

Can only be used if this is Rail

### get_rail_segment_rails(direction) → array[LuaEntity]

Get all rails of a rail segment this rail is in

A rail segment is a continuous section of rail with no branches, signals, nor train stops.

#### Parameters

direction | :: defines.rail_direction | Selects end of this rail that points to a rail segment end from which to start returning rails
Selects end of this rail that points to a rail segment end from which to start returning rails

#### Return values

→ array[LuaEntity] | Rails of this rail segment

Can only be used if this is Rail

### get_rail_segment_length() → double

Get the length of the rail segment this rail is in.

A rail segment is a continuous section of rail with no branches, signals, nor train stops.

Can only be used if this is Rail

### get_rail_segment_overlaps() → array[LuaEntity]

Get a rail from each rail segment that overlaps with this rail's rail segment.

A rail segment is a continuous section of rail with no branches, signals, nor train stops.

Can only be used if this is Rail

### is_rail_in_same_rail_segment_as(other_rail) → boolean

Checks if this rail and other rail both belong to the same rail segment.

#### Parameters

other_rail | :: LuaEntity |

Can only be used if this is Rail

### is_rail_in_same_rail_block_as(other_rail) → boolean

Checks if this rail and other rail both belong to the same rail block.

#### Parameters

other_rail | :: LuaEntity |

Can only be used if this is Rail

### get_parent_signals() → array[LuaEntity]

Returns all parent signals. Parent signals are always RailChainSignal. Parent signals are those signals that are checking state of this signal to determine their own chain state.

Can only be used if this is RailSignal or RailChainSignal

### get_child_signals() → array[LuaEntity]

Returns all child signals. Child signals can be either RailSignal or RailChainSignal. Child signals are signals which are checked by this signal to determine a chain state.

Can only be used if this is RailChainSignal

### get_inbound_signals() → array[LuaEntity]

Returns all signals guarding entrance to a rail block this rail belongs to.

Can only be used if this is Rail

### get_outbound_signals() → array[LuaEntity]

Returns all signals guarding exit from a rail block this rail belongs to.

Can only be used if this is Rail

### get_filter(slot_index) → ItemFilter or EntityID or AsteroidChunkID?

Get the filter for a slot in an inserter, loader, mining drill, asteroid collector, or logistic storage container. The entity must allow filters.

#### Parameters

slot_index | :: uint32 | Index of the slot to get the filter for.
Index of the slot to get the filter for.

#### Return values

→ ItemFilter or EntityID or AsteroidChunkID? | The filter, or `nil` if the given slot has no filter.

### set_filter(index, filter?)

Set the filter for a slot in an inserter (ItemFilter), loader (ItemFilter), mining drill (EntityID), asteroid collector (AsteroidChunkID) or logistic storage container (ItemWithQualityID). The entity must allow filters.

#### Parameters

index | :: uint32 | Index of the slot to set the filter for.
Index of the slot to set the filter for.
filter | :: ItemFilter or ItemWithQualityID or EntityID or AsteroidChunkID? | The item or entity to filter, or `nil` to clear the filter.
The item or entity to filter, or `nil` to clear the filter.

### get_infinity_container_filter(index) → InfinityInventoryFilter?

Gets the filter for this infinity container at the given index, or `nil` if the filter index doesn't exist or is empty.

#### Parameters

index | :: uint32 | The index to get.
The index to get.

Can only be used if this is InfinityContainer or InfinityCargoWagon

### set_infinity_container_filter(index, filter)

Sets the filter for this infinity container at the given index.

#### Parameters

index | :: uint32 | The index to set.
The index to set.
filter | :: InfinityInventoryFilter or nil | The new filter, or `nil` to clear the filter.
The new filter, or `nil` to clear the filter.

Can only be used if this is InfinityContainer or InfinityCargoWagon

### get_infinity_pipe_filter() → InfinityPipeFilter?

Gets the filter for this infinity pipe, or `nil` if the filter is empty.

Can only be used if this is InfinityPipe

### set_infinity_pipe_filter(filter)

Sets the filter for this infinity pipe.

#### Parameters

filter | :: InfinityPipeFilter or nil | The new filter, or `nil` to clear the filter.
The new filter, or `nil` to clear the filter.

Can only be used if this is InfinityPipe

### get_heat_setting() → HeatSetting

Gets the heat setting for this heat interface.

Can only be used if this is HeatInterface

### set_heat_setting(filter)

Sets the heat setting for this heat interface.

#### Parameters

filter | :: HeatSetting | The new setting.
The new setting.

Can only be used if this is HeatInterface

### get_control_behavior() → LuaControlBehavior?

Gets the control behavior of the entity (if any).

#### Return values

→ LuaControlBehavior? | The control behavior or `nil`.

### get_or_create_control_behavior() → LuaControlBehavior?

Gets (and or creates if needed) the control behavior of the entity.

#### Return values

→ LuaControlBehavior? | The control behavior or `nil`.

### get_circuit_network(wire_connector_id) → LuaCircuitNetwork?

#### Parameters

wire_connector_id | :: defines.wire_connector_id | Wire connector to get circuit network for.
Wire connector to get circuit network for.

#### Return values

→ LuaCircuitNetwork? | The circuit network or nil.

### get_signal(signal, wire_connector_id, extra_wire_connector_id?) → int32

Read a single signal from the selected wire connector

#### Parameters

signal | :: SignalID | The signal to read.
The signal to read.
wire_connector_id | :: defines.wire_connector_id | Wire connector ID from which to get the signal
Wire connector ID from which to get the signal
extra_wire_connector_id | :: defines.wire_connector_id? | Additional wire connector ID. If specified, signal will be added to the result
Additional wire connector ID. If specified, signal will be added to the result

#### Return values

→ int32 | The current value of the signal.

### get_signals(wire_connector_id, extra_wire_connector_id?) → array[Signal]?

Read all signals from the selected wire connector.

#### Parameters

wire_connector_id | :: defines.wire_connector_id | Wire connector ID from which to get the signal
Wire connector ID from which to get the signal
extra_wire_connector_id | :: defines.wire_connector_id? | Additional wire connector ID. If specified, signals will be added to the result
Additional wire connector ID. If specified, signals will be added to the result

#### Return values

→ array[Signal]? | Current values of all signals.

### supports_backer_name() → boolean

Whether this entity supports a backer name.

### copy_settings(entity, by_player?) → array[ItemWithQualityCount]

Copies settings from the given entity onto this entity.

#### Parameters

entity | :: LuaEntity |
by_player | :: PlayerIdentification? | If provided, the copying is done 'as' this player and on_entity_settings_pasted is triggered.
If provided, the copying is done 'as' this player and on_entity_settings_pasted is triggered.

#### Return values

→ array[ItemWithQualityCount] | Any items removed from this entity as a result of copying the settings.

### get_logistic_point(index?) → LuaLogisticPoint or array[LuaLogisticPoint]?

Gets all the `LuaLogisticPoint`s that this entity owns. Optionally returns only the point specified by the index parameter.

#### Parameters

index | :: defines.logistic_member_index? | If provided, this method only returns the `LuaLogisticPoint` specified by this index, or `nil` if it doesn't exist.
If provided, this method only returns the `LuaLogisticPoint` specified by this index, or `nil` if it doesn't exist.

### play_note(instrument, note, stop_playing_sounds?) → boolean

Plays a note with the given instrument and note.

#### Parameters

instrument | :: uint32 |
note | :: uint32 |
stop_playing_sounds | :: boolean? |

#### Return values

→ boolean | Whether the request is valid. The sound may or may not be played depending on polyphony settings.

Can only be used if this is ProgrammableSpeaker

### connect_rolling_stock(direction) → boolean

Connects the rolling stock in the given direction.

#### Parameters

direction | :: defines.rail_direction |

#### Return values

→ boolean | Whether any connection was made

Can only be used if this is RollingStock

### disconnect_rolling_stock(direction) → boolean

Tries to disconnect this rolling stock in the given direction.

#### Parameters

direction | :: defines.rail_direction |

#### Return values

→ boolean | If anything was disconnected

Can only be used if this is RollingStock

### update_connections()

Reconnect loader, beacon, cliff and mining drill connections to entities that might have been teleported out or in by the script. The game doesn't do this automatically as we don't want to lose performance by checking this in normal games.

### get_recipe() → LuaRecipe?, LuaQualityPrototype?

Current recipe being assembled by this machine, if any.

Can only be used if this is CraftingMachine

### set_recipe(recipe?, quality?) → array[ItemWithQualityCount]

Sets the given recipe in this assembly machine.

#### Parameters

recipe | :: RecipeID? | The new recipe. Writing `nil` clears the recipe, if any.
The new recipe. Writing `nil` clears the recipe, if any.
quality | :: QualityID? | The quality. If not provided `normal` is used.
The quality. If not provided `normal` is used.

#### Return values

→ array[ItemWithQualityCount] | Any items removed from this entity as a result of setting the recipe.

Can only be used if this is AssemblingMachine

### rotate{reverse?=…, by_player?=…} → boolean

Rotates this entity as if the player rotated it.

#### Parameters

Table (optional) with the following fields:

reverse | :: boolean? | If `true`, rotate the entity in the counter-clockwise direction.
If `true`, rotate the entity in the counter-clockwise direction.
by_player | :: PlayerIdentification? |

#### Return values

→ boolean | Whether the rotation was successful.

#### Raised events

on_player_rotated_entity? instantly | Raised if the `by_player` argument was given and the rotation was successful.

### get_driver() → LuaEntity or LuaPlayer?

Gets the driver of this vehicle if any.

#### Return values

→ LuaEntity or LuaPlayer? | `nil` if the vehicle contains no driver. To check if there's a passenger see LuaEntity::get_passenger.

Can only be used if this is Vehicle

### set_driver(driver)

Sets the driver of this vehicle.

This differs from LuaEntity::set_passenger in that the passenger can't drive the vehicle.

#### Parameters

driver | :: LuaEntity or PlayerIdentification or nil | The new driver. Writing `nil` ejects the current driver, if any.
The new driver. Writing `nil` ejects the current driver, if any.

#### Raised events

on_player_driving_changed_state? instantly |

Can only be used if this is Vehicle

### get_passenger() → LuaEntity or LuaPlayer?

Gets the passenger of this car, spidertron, or cargo pod if any.

This differs over LuaEntity::get_driver in that for cars, the passenger can't drive the car.

#### Return values

→ LuaEntity or LuaPlayer? | `nil` if the vehicle contains no passenger. To check if there's a driver see LuaEntity::get_driver.

Can only be used if this is Car or SpiderVehicle or CargoPod

### set_passenger(passenger)

Sets the passenger of this car, spidertron, or cargo pod.

This differs from LuaEntity::get_driver in that the passenger can't drive the car.

#### Parameters

passenger | :: LuaEntity or PlayerIdentification or nil | The new passenger. Writing `nil` ejects the current passenger, if any.
The new passenger. Writing `nil` ejects the current passenger, if any.

#### Raised events

on_player_driving_changed_state? instantly |

Can only be used if this is Car or SpiderVehicle or CargoPod

### is_connected_to_electric_network() → boolean

Returns `true` if this entity produces or consumes electricity and is connected to an electric network that has at least one entity that can produce power.

### get_train_stop_trains() → array[LuaTrain]

The trains scheduled to stop at this train stop.

Can only be used if this is TrainStop

### get_stopped_train() → LuaTrain?

The train currently stopped at this train stop, if any.

Can only be used if this is TrainStop

### clone{position=…, surface?=…, force?=…, create_build_effect_smoke?=…} → LuaEntity?

Clones this entity.

#### Parameters

Table with the following fields:

position | :: MapPosition | The destination position
The destination position
surface | :: LuaSurface? | The destination surface
The destination surface
force | :: ForceID? |
create_build_effect_smoke | :: boolean? | If false, the building effect smoke will not be shown around the new entity.
If false, the building effect smoke will not be shown around the new entity.

#### Return values

→ LuaEntity? | The cloned entity or `nil` if this entity can't be cloned/can't be cloned to the given location.

#### Raised events

on_entity_cloned? instantly | Raised if the entity was successfully cloned.

### get_fluid_count(fluid?) → double

Get the amount of all or some fluid in this entity.

If information about fluid temperatures is required, LuaEntity::fluidbox should be used instead.

#### Parameters

fluid | :: string? | Prototype name of the fluid to count. If not specified, count all fluids.
Prototype name of the fluid to count. If not specified, count all fluids.

### get_fluid_contents() → dictionary[string → FluidAmount]

Get amounts of all fluids in this entity.

If information about fluid temperatures is required, LuaEntity::get_fluid or LuaEntity::fluidbox should be used instead.

#### Return values

→ dictionary[string → FluidAmount] | The amounts, indexed by fluid names.

### remove_fluid{name=…, amount=…, minimum_temperature?=…, maximum_temperature?=…, temperature?=…} → double

Remove fluid from this entity.

If temperature is given only fluid matching that exact temperature is removed. If minimum and maximum is given fluid within that range is removed.

#### Parameters

Table with the following fields:

name | :: string | Fluid prototype name.
Fluid prototype name.
amount | :: double | Amount to remove
Amount to remove
minimum_temperature | :: double? |
maximum_temperature | :: double? |
temperature | :: double? |

#### Return values

→ double | Amount of fluid actually removed.

### insert_fluid(fluid) → double

Insert fluid into this entity. Fluidbox is chosen automatically.

#### Parameters

fluid | :: Fluid | Fluid to insert.
Fluid to insert.

#### Return values

→ double | Amount of fluid actually inserted.

### clear_fluid_inside()

Remove all fluids from this entity.

### get_beam_source() → BeamTarget?

Get the source of this beam.

Can only be used if this is Beam

### set_beam_source(source)

Set the source of this beam.

#### Parameters

source | :: LuaEntity or MapPosition |

Can only be used if this is Beam

### get_beam_target() → BeamTarget?

Get the target of this beam.

Can only be used if this is Beam

### set_beam_target(target)

Set the target of this beam.

#### Parameters

target | :: LuaEntity or MapPosition |

Can only be used if this is Beam

### get_radius() → double

The radius of this entity. The radius is defined as half the distance between the top left corner and bottom right corner of the collision box.

### get_health_ratio() → float?

The health ratio of this entity between 1 and 0 (for full health and no health respectively).

#### Return values

→ float? | `nil` if this entity doesn't have health.

### create_build_effect_smoke()

Creates the same smoke that is created when you place a building by hand.

You can play the building sound to go with it by using LuaSurface::play_sound, eg: `entity.surface.play_sound{path="entity-build/"..entity.prototype.name, position=entity.position}`

### release_from_spawner()

Release the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.

Can only be used if this is Unit or SpiderUnit

### toggle_equipment_movement_bonus()

Toggle this entity's equipment movement bonus. Does nothing if the entity does not have an equipment grid.

This property can also be read and written on the equipment grid of this entity.

### can_shoot(target, position) → boolean

Whether this character can shoot the given entity or position.

#### Parameters

target | :: LuaEntity |
position | :: MapPosition |

Can only be used if this is Character

### start_fading_out()

Only works if the entity is a speech-bubble, with an "effect" defined in its wrapper_flow_style. Starts animating the opacity of the speech bubble towards zero, and destroys the entity when it hits zero.

Can only be used if this is SpeechBubble

### get_upgrade_target() → LuaEntityPrototype?, LuaQualityPrototype?

Returns the new entity prototype and its quality.

#### Return values

→ LuaEntityPrototype? | `nil` if this entity is not marked for upgrade.
→ LuaQualityPrototype? | `nil` if this entity is not marked for upgrade.

### get_damage_to_be_taken() → float?

Returns the amount of damage to be taken by this entity.

#### Return values

→ float? | `nil` if this entity does not have health.

### deplete()

Depletes and destroys this resource entity.

#### Raised events

on_resource_depleted instantly |

Can only be used if this is ResourceEntity

### mine{inventory?=…, force?=…, raise_destroyed?=…, ignore_minable?=…} → boolean

Mines this entity.

'Standard' operation is to keep calling `LuaEntity.mine` with an inventory until all items are transferred and the items dealt with.

The result of mining the entity (the item(s) it produces when mined) will be dropped on the ground if they don't fit into the provided inventory. If no inventory is provided, the items will be destroyed.

#### Parameters

Table (optional) with the following fields:

inventory | :: LuaInventory? | If provided the item(s) will be transferred into this inventory. If provided, this must be an inventory created with LuaGameScript::create_inventory or be a basic inventory owned by some entity.
If provided the item(s) will be transferred into this inventory. If provided, this must be an inventory created with LuaGameScript::create_inventory or be a basic inventory owned by some entity.
force | :: boolean? | If true, when the item(s) don't fit into the given inventory the entity is force mined. If false, the mining operation fails when there isn't enough room to transfer all of the items into the inventory. Defaults to false. This is ignored and acts as `true` if no inventory is provided.
If true, when the item(s) don't fit into the given inventory the entity is force mined. If false, the mining operation fails when there isn't enough room to transfer all of the items into the inventory. Defaults to false. This is ignored and acts as `true` if no inventory is provided.
raise_destroyed | :: boolean? | If true, script_raised_destroy will be raised. Defaults to `true`.
If true, script_raised_destroy will be raised. Defaults to `true`.
ignore_minable | :: boolean? | If true, the minable state of the entity is ignored. Defaults to `false`. If false, an entity that isn't minable (set as not-minable in the prototype or isn't minable for other reasons) will fail to be mined.
If true, the minable state of the entity is ignored. Defaults to `false`. If false, an entity that isn't minable (set as not-minable in the prototype or isn't minable for other reasons) will fail to be mined.

#### Return values

→ boolean | Whether mining succeeded.

#### Raised events

script_raised_destroy? instantly | Raised if the `raise_destroyed` flag was set and the entity was successfully mined.

### spawn_decorations()

Triggers spawn_decoration actions defined in the entity prototype or does nothing if entity is not "turret" or "unit-spawner".

### get_priority_target(index) → LuaEntityPrototype?

Get the entity ID at the specified position in the turret's priority list.

#### Parameters

index | :: uint32 | The index of the entry to fetch.
The index of the entry to fetch.

### set_priority_target(index, entity_id?)

Set the entity ID name at the specified position in the turret's priority list.

#### Parameters

index | :: uint32 | The index of the entry to set.
The index of the entry to set.
entity_id | :: EntityID? | The name of the entity prototype, or `nil` to clear the entry.
The name of the entity prototype, or `nil` to clear the entry.

### can_wires_reach(entity) → boolean

Can wires reach between these entities.

#### Parameters

entity | :: LuaEntity |

### get_connected_rolling_stock(direction) → LuaEntity?, defines.rail_direction?

Gets rolling stock connected to the given end of this stock.

#### Parameters

direction | :: defines.rail_direction |

#### Return values

→ LuaEntity? | The rolling stock connected at the given end, `nil` if none is connected there.
→ defines.rail_direction? | The rail direction of the connected rolling stock if any.

Can only be used if this is RollingStock

### is_registered_for_construction() → boolean

Is this entity or tile ghost or item request proxy registered for construction? If false, it means a construction robot has been dispatched to build the entity, or it is not an entity that can be constructed.

### is_registered_for_deconstruction(force) → boolean

Is this entity registered for deconstruction with this force? If false, it means a construction robot has been dispatched to deconstruct it, or it is not marked for deconstruction. The complexity is effectively O(1) - it depends on the number of objects targeting this entity which should be small enough.

#### Parameters

force | :: ForceID | The force construction manager to check.
The force construction manager to check.

### is_registered_for_upgrade() → boolean

Is this entity registered for upgrade? If false, it means a construction robot has been dispatched to upgrade it, or it is not marked for upgrade. This is worst-case O(N) complexity where N is the current number of things in the upgrade queue.

### is_registered_for_repair() → boolean

Is this entity registered for repair? If false, it means a construction robot has been dispatched to repair it, or it is not damaged. This is worst-case O(N) complexity where N is the current number of things in the repair queue.

### add_autopilot_destination(position)

Adds the given position to this spidertron's autopilot's queue of destinations.

#### Parameters

position | :: MapPosition | The position the spidertron should move to.
The position the spidertron should move to.

Can only be used if this is SpiderVehicle

### connect_linked_belts(neighbour?)

Connects current linked belt with another one.

Neighbours have to be of different type. If given linked belt is connected to something else it will be disconnected first. If provided neighbour is connected to something else it will also be disconnected first. Automatically updates neighbour to be connected back to this one.

#### Parameters

neighbour | :: LuaEntity? | Another linked belt or entity ghost containing linked belt to connect or nil to disconnect
Another linked belt or entity ghost containing linked belt to connect or nil to disconnect

Can only be used if this is LinkedBelt

### disconnect_linked_belts()

Disconnects linked belt from its neighbour.

Can only be used if this is LinkedBelt

### get_spider_legs() → array[LuaEntity]

Gets legs of given SpiderVehicle.

Can only be used if this is SpiderVehicle

### stop_spider()

Sets the speed of the given SpiderVehicle to zero. Notably does not clear its autopilot_destination, which it will continue moving towards if set.

Can only be used if this is SpiderVehicle

### get_wire_connector(wire_connector_id, or_create) → LuaWireConnector?

Gets a single wire connector of this entity, if any.

#### Parameters

wire_connector_id | :: defines.wire_connector_id | Identifier of a specific connector to get
Identifier of a specific connector to get
or_create | :: boolean | If true and connector does not exist, it will be allocated if possible
If true and connector does not exist, it will be allocated if possible

### get_wire_connectors(or_create) → dictionary[defines.wire_connector_id → LuaWireConnector]

Gets all wire connectors of this entity

#### Parameters

or_create | :: boolean | If true, it will try to create all connectors possible
If true, it will try to create all connectors possible

### get_rail_end(direction) → LuaRailEnd

Gets a LuaRailEnd object for specified end of this rail

#### Parameters

direction | :: defines.rail_direction |

Can only be used if this is Rail

### get_electric_input_flow_limit(quality?) → double?

The input flow limit for the electric energy source. `nil` if the entity doesn't have an electric energy source.

#### Parameters

quality | :: QualityID? |

### get_electric_output_flow_limit(quality?) → double?

The output flow limit for the electric energy source. `nil` if the entity doesn't have an electric energy source.

#### Parameters

quality | :: QualityID? |

### get_beacons() → array[LuaEntity]?

Returns a table with all beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)

### get_beacon_effect_receivers() → array[LuaEntity]

Returns a table with all entities affected by this beacon

Can only be used if this is Beacon

### force_finish_ascending()

Take an ascending cargo pod and safely make it skip all animation and immediately switch surface.

#### Raised events

on_cargo_pod_finished_ascending instantly |

Can only be used if this is CargoPod

### force_finish_descending()

Take a descending cargo pod and safely make it arrive and deposit cargo.

#### Raised events

on_cargo_pod_finished_descending instantly |
on_cargo_pod_delivered_cargo? instantly | Raised instantly if landing on the ground (i.e. destination type is surface. If landing in a station, event will be raised after parking is complete.

Can only be used if this is CargoPod

### create_cargo_pod(cargo_hatch?) → LuaEntity?

Creates a cargo pod if possible.

Cargo pod will be created with invalid destination type. Setting cargo_pod_destination will cause it to launch.

#### Parameters

cargo_hatch | :: LuaCargoHatch? | The hatch to create the pod at. A random (available) one is picked if not provided.
The hatch to create the pod at. A random (available) one is picked if not provided.

Can only be used if this is RocketSilo or CargoLandingPad or SpacePlatformHub

### get_cargo_bays() → array[LuaEntity]

Gets the cargo bays connected to this cargo landing pad or space platform hub.

Can only be used if this is CargoLandingPad or SpacePlatformHub

### inventory_supports_bar(inventory_index) → boolean

The same as LuaInventory::supports_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |

### get_inventory_bar(inventory_index) → uint32

The same as LuaInventory::get_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |

### set_inventory_bar(inventory_index, bar?)

The same as LuaInventory::set_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |
bar | :: uint32? | The new limit. Omitting this parameter or passing `nil` will clear the limit.
The new limit. Omitting this parameter or passing `nil` will clear the limit.

### inventory_supports_filters(inventory_index) → boolean

The same as LuaInventory::supports_filters but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |

### is_inventory_filtered(inventory_index) → boolean

The same as LuaInventory::is_filtered but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |

### can_set_inventory_filter(inventory_index, index, filter) → boolean

The same as LuaInventory::can_set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |
index | :: uint32 | The item stack index
The item stack index
filter | :: ItemFilter | The item filter
The item filter

### get_inventory_filter(inventory_index, index) → ItemFilter?

The same as LuaInventory::get_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |
index | :: uint32 | The item stack index
The item stack index

#### Return values

→ ItemFilter? | The current filter or `nil` if none.

### set_inventory_filter(inventory_index, index, filter) → boolean

The same as LuaInventory::set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.

#### Parameters

inventory_index | :: defines.inventory |
index | :: uint32 | The item stack index.
The item stack index.
filter | :: ItemFilter or nil | The new filter. `nil` erases any existing filter.
The new filter. `nil` erases any existing filter.

#### Return values

→ boolean | If the filter was allowed to be set.

### register_tree(tree) → boolean

Registers the given tree in this agricultural tower.

If the tree is not within range of the tower it will not be registered.

If the tree is already registered with a tower it will not be registered.

#### Parameters

tree | :: LuaEntity |

#### Return values

→ boolean | If the tree was registered.

Can only be used if this is AgriculturalTower

### get_movement() → Vector

Gets the combined movement vector (direction and speed) of this combat robot or asteroid. The entity moves by this vector each tick.

Note that for combat robots this does not include the constant drift in the direction they are facing.

Can only be used if this is CombatRobot or Asteroid

### set_movement(direction, speed)

Sets the movement direction and movement speed for this combat robot or asteroid.

Note that for combat robots this does not affect the constant drift in the direction they are facing.

#### Parameters

direction | :: Vector | This normalized form of this vector is used for the movement direction.
This normalized form of this vector is used for the movement direction.
speed | :: double | Speed in tiles per tick. Cannot be less than 0.
Speed in tiles per tick. Cannot be less than 0.

Can only be used if this is CombatRobot or Asteroid

### get_fluid(index) → Fluid?

Gets fluid of the index-th fluid storage. This includes fluidbox and non-fluidbox fluid storages like fluid wagon contents. Refer to LuaEntity::fluids_count for more information on available storages.

#### Parameters

index | :: uint32 | Fluid storage index. Valid values are from 1 up to LuaEntity::fluids_count.
Fluid storage index. Valid values are from 1 up to LuaEntity::fluids_count.

#### Return values

→ Fluid? | Fluid in this storage. `nil` if fluid storage is empty.

### set_fluid(index, fluid?) → Fluid?

Sets fluid to the index-th fluid storage. This includes fluidbox and non-fluidbox fluid storages like fluid wagon contents. Refer to LuaEntity::fluids_count for more information on available storages.

Fluid storages that are part of fluidboxes (also available through LuaFluidBox) may reject some fluids if they do not match filters or are above the fluidbox volume. To verify how much fluid was set a return value can be used which is the same as value that would be returned by LuaEntity::get_fluid.

#### Parameters

index | :: uint32 | Fluid storage index. Valid values are from 1 up to LuaEntity::fluids_count.
Fluid storage index. Valid values are from 1 up to LuaEntity::fluids_count.
fluid | :: Fluid? | Fluid to set. Fluid storage will be cleared if this is not provided.
Fluid to set. Fluid storage will be cleared if this is not provided.

#### Return values

→ Fluid? | Fluid in this storage after it was set. `nil` if fluid storage is empty.

### get_logistic_sections() → LuaLogisticSections?

Gives logistic sections of this entity if it uses logistic sections.

### set_inventory_size_override(inventory_index, size_override, overflow?)

Sets inventory size override. When set, supported entity will ignore inventory size from prototype and will instead keep inventory size equal to the override. Setting `nil` will restore default inventory size.

#### Parameters

inventory_index | :: defines.inventory |
size_override | :: uint16 or nil |
overflow | :: LuaInventory? | Items that would be deleted due to change of inventory size will be transferred to this inventory. Must be a script inventory or inventory of other entity. Inventory references obtained from proxy container are not allowed.
Items that would be deleted due to change of inventory size will be transferred to this inventory. Must be a script inventory or inventory of other entity. Inventory references obtained from proxy container are not allowed.

Can only be used if this is ContainerEntity or CargoWagon

### get_inventory_size_override(inventory_index) → uint16?

Gets the inventory size override of the selected inventory if size override was set using set_inventory_size_override.

#### Parameters

inventory_index | :: defines.inventory |

Can only be used if this is ContainerEntity or CargoWagon

### get_fluid_source_tile() → TilePosition

Gives TilePosition of a tile which this offshore pump uses to check what fluid should be produced.

Can only be used if this is OffshorePump

### get_fluid_source_fluid() → string?

Checks what is expected fluid to be produced from the offshore pump's source tile. It accounts for visible tile, hidden tile and double hidden tile. It ignores currently set fluid box filter.

#### Return values

→ string? | Name of fluid that should be produced by this offshore pump based on existing tiles.

Can only be used if this is OffshorePump

## Attributes

### rail_length :: Read double

Length of this rail piece.

Can only be used if this is Rail

### name :: Read string

Name of the entity prototype. E.g. "inserter" or "fast-inserter".

### ghost_name :: Read string

Name of the entity or tile contained in this ghost.

Can only be used if this is Ghost

### localised_name :: Read LocalisedString

Localised name of the entity.

### localised_description :: Read LocalisedString

### ghost_localised_name :: Read LocalisedString

Localised name of the entity or tile contained in this ghost.

Can only be used if this is Ghost

### ghost_localised_description :: Read LocalisedString

Can only be used if this is Ghost

### type :: Read string

The entity prototype type of this entity.

### ghost_type :: Read string

The prototype type of the entity or tile contained in this ghost.

Can only be used if this is Ghost

### use_filters :: Read|Write boolean

If set to 'true', this inserter will use filtering logic.

This has no effect if the prototype does not support filters.

Can only be used if this is Inserter

### active :: Read|Write boolean

Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will stop moving etc).

Reading from this returns `false` if the entity is deactivated in at least one of the following ways: by script, by circuit network, by recipe, by freezing, or by being marked for deconstruction.

Writing to this is deprecated and affects only the disabled_by_script state.

Entities that are not active naturally can't be set to be active (setting it to be active will do nothing). Some entities (Corpse, FireFlame, Roboport, RollingStock, dying entities) need to remain active and will ignore writes.

### destructible :: Read|Write boolean

If set to `false`, this entity can't be damaged and won't be attacked automatically. It can however still be mined.

Entities that are indestructible naturally (they have no health, like smoke, resource etc) can't be set to be destructible.

### minable :: Read|Write boolean

Not minable entities can still be destroyed.

Tells if entity reports as being minable right now. This takes into account `minable_flag` and entity specific conditions (for example rail under rolling stocks is not minable, vehicle with passenger is not minable).

Write to this field since 2.0.26 is deprecated and it will result in write to `minable_flag` instead.

### minable_flag :: Read|Write boolean

Script controlled flag that allows entity to be mined.

### rotatable :: Read|Write boolean

When entity is not to be rotatable (inserter, transport belt etc), it can't be rotated by player using the R key.

Entities that are not rotatable naturally (like chest or furnace) can't be set to be rotatable.

### operable :: Read|Write boolean

Player can't open gui of this entity and he can't quick insert/input stuff in to the entity when it is not operable.

### health :: Read|Write float?

The current health of the entity, if any. Health is automatically clamped to be between `0` and max health (inclusive). Entities with a health of `0` can not be attacked.

To get the maximum possible health of this entity, see LuaEntity::max_health.

### max_health :: Read float

Max health of this entity.

### direction :: Read|Write defines.direction

The current direction this entity is facing.

### mirroring :: Read|Write boolean

Whether the entity is currently mirrored. This state is referred to as `flipped` elsewhere, such as on the on_player_flipped_entity event.

If an entity is mirrored, it is flipped over the axis that is pointing in the entity's direction. For example if a mirrored entity is facing north, everything that was defined to be facing east in the prototype now faces west.

### supports_direction :: Read boolean

Whether the entity has direction. When it is false for this entity, it will always return north direction when asked for.

### orientation :: Read|Write RealOrientation

The smooth orientation of this entity. For turrets this is the orientation of the weapon.

### cliff_orientation :: Read CliffOrientation

The orientation of this cliff.

Can only be used if this is Cliff

### relative_turret_orientation :: Read|Write RealOrientation?

The relative orientation of the vehicle turret, artillery turret, artillery wagon. `nil` if this entity isn't a vehicle with a vehicle turret or artillery turret/wagon.

Writing does nothing if the vehicle doesn't have a turret.

For the turret orientation of non-artillery turrets, use LuaEntity::orientation.

### torso_orientation :: Read|Write RealOrientation

The torso orientation of this spider vehicle.

Can only be used if this is SpiderVehicle

### amount :: Read|Write uint32

Count of resource units contained.

Can only be used if this is ResourceEntity

### initial_amount :: Read|Write uint32?

Count of initial resource units contained. `nil` if this is not an infinite resource.

If this is not an infinite resource, writing will produce an error.

Can only be used if this is ResourceEntity

### effectivity_modifier :: Read|Write float

Multiplies the acceleration the car can create for one unit of energy. Defaults to `1`.

Can only be used if this is Car

### consumption_modifier :: Read|Write float

Multiplies the energy consumption.

Can only be used if this is Car

### friction_modifier :: Read|Write float

Multiplies the car friction rate.

Can only be used if this is Car

#### Example

    -- This will allow the car to go much faster
    game.player.vehicle.friction_modifier = 0.5

### driver_is_gunner :: Read|Write boolean?

Whether the driver of this car or spidertron is the gunner. If `false`, the passenger is the gunner. `nil` if this is neither a car or a spidertron.

Can only be used if this is Car or SpiderVehicle

### vehicle_automatic_targeting_parameters :: Read|Write VehicleAutomaticTargetingParameters

Read when this spidertron auto-targets enemies

Can only be used if this is SpiderVehicle

### speed :: Read|Write float?

The current speed if this is a car, rolling stock, projectile or spidertron, or the maximum speed if this is a unit. The speed is in tiles per tick. `nil` if this is not a car, rolling stock, unit, projectile or spidertron.

Only the speed of units, cars, and projectiles are writable.

### effective_speed :: Read float?

The current speed of this unit in tiles per tick, taking into account any walking speed modifier given by the tile the unit is standing on. `nil` if this is not a unit.

Can only be used if this is Unit

### stack :: Read LuaItemStack

Can only be used if this is ItemEntity

### prototype :: Read LuaEntityPrototype

The entity prototype of this entity.

### ghost_prototype :: Read LuaEntityPrototype or LuaTilePrototype

The prototype of the entity or tile contained in this ghost.

Can only be used if this is Ghost

### drop_position :: Read|Write MapPosition

Position where the entity puts its stuff.

Mining drills and crafting machines can't have their drop position changed; inserters must have `allow_custom_vectors` set to true on their prototype to allow changing the drop position.

Meaningful only for entities that put stuff somewhere, such as mining drills, crafting machines with a drop target or inserters.

### pickup_position :: Read|Write MapPosition

Where the inserter will pick up items from.

Inserters must have `allow_custom_vectors` set to true on their prototype to allow changing the pickup position.

Can only be used if this is Inserter

### drop_target :: Read|Write LuaEntity?

The entity this entity is putting its items to. If there are multiple possible entities at the drop-off point, writing to this attribute allows a mod to choose which one to drop off items to. The entity needs to collide with the tile box under the drop-off position. `nil` if there is no entity to put items to, or if this is not an entity that puts items somewhere.

### pickup_target :: Read|Write LuaEntity?

The entity this inserter will attempt to pick up items from. If there are multiple possible entities at the pick-up point, writing to this attribute allows a mod to choose which one to pick up items from. The entity needs to collide with the tile box under the pick-up position. `nil` if there is no entity to pull items from.

Can only be used if this is Inserter

### selected_gun_index :: Read|Write uint32?

Index of the currently selected weapon slot of this character, car, or spidertron. `nil` if this entity doesn't have guns.

Can only be used if this is Character or Car or SpiderVehicle

### energy :: Read|Write double

Energy stored in the entity's energy buffer (energy stored in electrical devices etc.). Always 0 for entities that don't have the concept of energy stored inside.

#### Example

    game.player.print("Machine energy: " .. game.player.selected.energy .. "J")
    game.player.selected.energy = 3000

### temperature :: Read|Write double?

The temperature of this entity's heat energy source. `nil` if this entity does not use a heat energy source.

### previous_recipe :: Read RecipeIDAndQualityIDPair?

The previous recipe this furnace was using, if any.

Can only be used if this is Furnace

### held_stack :: Read LuaItemStack

The item stack currently held in an inserter's hand.

Can only be used if this is Inserter

### held_stack_position :: Read MapPosition

Current position of the inserter's "hand".

Can only be used if this is Inserter

### train :: Read LuaTrain?

The train this rolling stock belongs to, if any. `nil` if this is not a rolling stock.

### neighbours :: Read dictionary[string → LuaEntity] or array[array[LuaEntity]] or LuaEntity?

A list of neighbours for certain types of entities. Applies to underground belts, walls, gates, reactors, heat pipes, cliffs, and pipe-connectable entities.

Differs depending on the type of entity: When called on a pipe-connectable entity, this is an array of entity arrays of all entities a given fluidbox is connected to. When called on an underground transport belt, this is the other end of the underground belt connection, or `nil` if none. When called on a wall-connectable entity, reactor or heat pipe, this is a dictionary of all connections indexed by the connection direction "north", "south", "east", and "west". When called on a cliff entity, this is a dictionary of all connections indexed by the connection direction "north", "south", "east", and "west".

### belt_neighbours :: Read table

The belt connectable neighbours of this belt connectable entity. Only entities that input to or are outputs of this entity. Does not contain the other end of an underground belt, see LuaEntity::neighbours for that.

#### Table fields

inputs | :: array[LuaEntity] | Array of transport belt connectable entities.
Array of transport belt connectable entities.
outputs | :: array[LuaEntity] | Array of transport belt connectable entities.
Array of transport belt connectable entities.

Can only be used if this is TransportBeltConnectable

### heat_neighbours :: Read array[LuaEntity]

The entities connected to this entities heat buffer.

### fluidbox :: Read LuaFluidBox

Fluidboxes of this entity.

### backer_name :: Read|Write string?

The backer name assigned to this entity. Entities that support backer names are labs, locomotives, radars, roboports, and train stops. `nil` if this entity doesn't support backer names.

While train stops get the name of a backer when placed down, players can rename them if they want to. In this case, `backer_name` returns the player-given name of the entity.

#### Raised events

on_entity_renamed instantly |

### entity_label :: Read|Write string?

The label on this spider-vehicle entity, if any. `nil` if this is not a spider-vehicle.

#### Raised events

on_entity_renamed instantly |

### time_to_live :: Read|Write uint64

The ticks left before a combat robot, highlight box, smoke, or sticker entity is destroyed.

Can only be used if this is CombatRobot or HighlightBox or Smoke or Sticker

### color :: Read|Write Color?

The color of this character, rolling stock, corpse, character corpse, train stop, simple-entity-with-owner, car, spider-vehicle, or lamp. `nil` if this entity doesn't use custom colors.

Car color is overridden by the color of the current driver/passenger, if there is one.

### signal_state :: Read defines.signal_state

The state of this rail signal.

Can only be used if this is RailSignal or RailChainSignal

### chain_signal_state :: Read defines.chain_signal_state

The state of this chain signal.

Can only be used if this is RailChainSignal

### to_be_looted :: Read|Write boolean

Will this item entity be picked up automatically when the player walks over it?

Can only be used if this is ItemEntity

### crafting_speed :: Read double

The current crafting speed, including speed bonuses from modules and beacons.

Can only be used if this is CraftingMachine or Character

### crafting_progress :: Read|Write float

The current crafting progress, as a number in range `[0, 1]`.

Can only be used if this is CraftingMachine

### bonus_progress :: Read|Write double

The current productivity bonus progress, as a number in range `[0, 1]`.

Can only be used if this is CraftingMachine

### result_quality :: Read LuaQualityPrototype| Write QualityID?

The quality produced when this crafting machine finishes crafting. `nil` when crafting is not in progress.

Note: Writing `nil` is not allowed.

Can only be used if this is CraftingMachine

### productivity_bonus :: Read double

The productivity bonus of this entity.

This includes force based bonuses as well as beacon/module bonuses.

### pollution_bonus :: Read double

The pollution bonus of this entity.

### speed_bonus :: Read double

The speed bonus of this entity.

This includes force based bonuses as well as beacon/module bonuses.

### consumption_bonus :: Read double

The consumption bonus of this entity.

### belt_to_ground_type :: Read BeltConnectionType

Whether this underground belt goes into or out of the ground.

Can only be used if this is UndergroundBelt

### loader_type :: Read|Write BeltConnectionType

Whether this loader gets items from or puts item into a container.

Can only be used if this is Loader

### use_transitional_requests :: Read|Write boolean

When true, the rocket silo will automatically request items for space platforms in orbit.

Setting the value will have no effect when the silo doesn't support logistics.

Can only be used if this is RocketSilo

### transitional_request_target :: Read LuaSpacePlatform?

The space platform in orbit this rocket silo is automatically requesting items for.

Can only be used if this is RocketSilo

### rocket_parts :: Read|Write uint32

Number of rocket parts in this rocket silo.

Can only be used if this is RocketSilo

### send_to_orbit_automatically :: Read|Write boolean

Whether this rocket silo is set to send items to orbit automatically. Only relevant if there is an item prototype with launch products with automated send_to_orbit_mode, such as the satellite in vanilla (without Space Age mod).

Can only be used if this is RocketSilo

### logistic_network :: Read|Write LuaLogisticNetwork

The logistic network this entity is a part of, or `nil` if this entity is not a part of any logistic network.

### logistic_cell :: Read LuaLogisticCell

The logistic cell this entity is a part of. Will be `nil` if this entity is not a part of any logistic cell.

### item_requests :: Read array[ItemWithQualityCount]

Items this ghost will request when revived or items this item request proxy is requesting.

### insert_plan :: Read|Write array[BlueprintInsertPlan]

The insert plan for this ghost or item request proxy.

Can only be used if this is EntityGhost or ItemRequestProxy

### removal_plan :: Read|Write array[BlueprintInsertPlan]

The removal plan for this item request proxy.

Can only be used if this is ItemRequestProxy

### player :: Read LuaPlayer?

The player connected to this character, if any.

Can only be used if this is Character

### damage_dealt :: Read|Write double

The damage dealt by this turret, artillery turret, or artillery wagon.

Can only be used if this is Turret

### kills :: Read|Write uint32

The number of units killed by this turret, artillery turret, or artillery wagon.

Can only be used if this is Turret

### ignore_unprioritised_targets :: Read|Write boolean

Whether this turret shoots at targets that are not on its priority list.

Can only be used if this is Turret

### last_user :: Read LuaPlayer| Write PlayerIdentification?

The last player that changed any setting on this entity. This includes building the entity, changing its color, or configuring its circuit network. `nil` if the last user is not part of the save anymore.

Can only be used if this is EntityWithOwner or DeconstructibleTileProxy or TileGhost

### electric_buffer_size :: Read|Write double?

The buffer size for the electric energy source. `nil` if the entity doesn't have an electric energy source.

Write access is limited to the ElectricEnergyInterface type.

### electric_drain :: Read double?

The electric drain for the electric energy source. `nil` if the entity doesn't have an electric energy source.

### electric_emissions_per_joule :: Read dictionary[string → double]?

The table of emissions of this energy source in `pollution/Joule`, indexed by pollutant type. `nil` if the entity doesn't have an electric energy source. Multiplying values in the returned table by energy consumption in `Watt` gives `pollution/second`.

### unit_number :: Read uint64?

A unique number identifying this entity for the lifetime of the save. These are allocated sequentially, and not re-used (until overflow).

Only entities inheriting from EntityWithOwnerPrototype, as well as ItemRequestProxyPrototype and EntityGhostPrototype are assigned a unit number. Returns `nil` otherwise.

### ghost_unit_number :: Read uint64?

The unit_number of the entity contained in this ghost. It is the same as the unit number of the EntityWithOwnerPrototype that was destroyed to create this ghost. If it was created by other means, or if the inner entity does not support unit numbers, this property is `nil`.

Can only be used if this is EntityGhost

### mining_progress :: Read|Write double?

The mining progress for this mining drill. Is a number in range [0, mining_target.prototype.mineable_properties.mining_time]. `nil` if this isn't a mining drill.

### bonus_mining_progress :: Read|Write double?

The bonus mining progress for this mining drill. Read yields a number in range [0, mining_target.prototype.mineable_properties.mining_time]. `nil` if this isn't a mining drill.

### mining_area :: Read BoundingBox

Area in which this mining drill looks for resources to mine.

Can only be used if this is MiningDrill

### power_production :: Read|Write double

The power production specific to the ElectricEnergyInterface entity type.

Can only be used if this is ElectricEnergyInterface

### power_usage :: Read|Write double

The power usage specific to the ElectricEnergyInterface entity type.

Can only be used if this is ElectricEnergyInterface

### bounding_box :: Read BoundingBox

LuaEntityPrototype::collision_box around entity's given position and respecting the current entity orientation.

### secondary_bounding_box :: Read BoundingBox?

The secondary bounding box of this entity or `nil` if it doesn't have one. This only exists for curved rails, and is automatically determined by the game.

### selection_box :: Read BoundingBox

LuaEntityPrototype::selection_box around entity's given position and respecting the current entity orientation.

### secondary_selection_box :: Read BoundingBox?

The secondary selection box of this entity or `nil` if it doesn't have one. This only exists for curved rails, and is automatically determined by the game.

### mining_target :: Read LuaEntity?

The mining target, if any.

Can only be used if this is MiningDrill

### filter_slot_count :: Read uint32

The number of filter slots this inserter, loader, mining drill, asteroid collector or logistic storage container has. 0 if not one of those entities.

### loader_container :: Read LuaEntity?

The container entity this loader is pointing at/pulling from depending on the LuaEntity::loader_type, if any.

Can only be used if this is Loader

### grid :: Read LuaEquipmentGrid?

This entity's equipment grid, if any.

### graphics_variation :: Read|Write uint8?

The graphics variation for this entity. `nil` if this entity doesn't use graphics variations.

### tree_color_index :: Read|Write uint8

Index of the tree color.

Can only be used if this is Tree

### tree_color_index_max :: Read uint8

Maximum index of the tree colors.

Can only be used if this is Tree

### tree_stage_index :: Read|Write uint8

Index of the tree stage.

Can only be used if this is Tree

### tree_stage_index_max :: Read uint8

Maximum index of the tree stages.

Can only be used if this is Tree

### tree_gray_stage_index :: Read|Write uint8

Index of the tree gray stage

Can only be used if this is Tree

### tree_gray_stage_index_max :: Read uint8

Maximum index of the tree gray stages.

Can only be used if this is Tree

### burner :: Read LuaBurner?

The burner energy source for this entity, if any.

### shooting_target :: Read|Write LuaEntity?

The shooting target for this turret, if any. Can't be set to `nil` via script.

Can only be used if this is Turret

### proxy_target :: Read LuaEntity?

The target entity for this item-request-proxy, if any.

Can only be used if this is ItemRequestProxy

### stickers :: Read array[LuaEntity]?

The sticker entities attached to this entity, if any.

### sticked_to :: Read LuaEntity

The entity this sticker is sticked to.

Can only be used if this is Sticker

### sticker_vehicle_modifiers :: Read table?

The vehicle modifiers applied to this entity through the attached stickers.

#### Table fields

speed_modifier | :: double |
speed_max | :: double |
friction_modifier | :: double |

### parameters :: Read|Write ProgrammableSpeakerParameters

Can only be used if this is ProgrammableSpeaker

### alert_parameters :: Read|Write ProgrammableSpeakerAlertParameters

Can only be used if this is ProgrammableSpeaker

### electric_network_statistics :: Read LuaFlowStatistics

The electric network statistics for this electric pole.

Can only be used if this is ElectricPole

### inserter_target_pickup_count :: Read uint32

Returns the current target pickup count of the inserter.

This considers the circuit network, manual override and the inserter stack size limit based on technology.

Can only be used if this is Inserter

### inserter_stack_size_override :: Read|Write uint32

Sets the stack size limit on this inserter.

Set to `0` to reset.

Can only be used if this is Inserter

### products_finished :: Read|Write uint32

The number of products this machine finished crafting in its lifetime.

Can only be used if this is CraftingMachine

### spawning_cooldown :: Read double

Can only be used if this is Spawner

### absorbed_pollution :: Read double

Can only be used if this is Spawner

### spawn_shift :: Read double

Can only be used if this is Spawner

### units :: Read array[LuaEntity]

The units associated with this spawner entity.

Can only be used if this is Spawner

### power_switch_state :: Read|Write boolean

The state of this power switch.

Can only be used if this is PowerSwitch

### combinator_description :: Read|Write string

The description on this combinator.

Can only be used if this is ArithmeticCombinator or DeciderCombinator or SelectorCombinator or ConstantCombinator

### effects :: Read ModuleEffects?

The effects being applied to this entity, if any. For beacons, this is the effect the beacon is broadcasting.

### beacons_count :: Read uint32?

Number of beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)

### infinity_container_filters :: Read|Write array[InfinityInventoryFilter]

The filters for this infinity container.

Can only be used if this is InfinityContainer or InfinityCargoWagon

### remove_unfiltered_items :: Read|Write boolean

Whether items not included in this infinity container filters should be removed from the container.

Can only be used if this is InfinityContainer or InfinityCargoWagon

### character_corpse_player_index :: Read|Write uint32

The player index associated with this character corpse.

The index is not guaranteed to be valid so it should always be checked first if a player with that index actually exists.

Can only be used if this is CharacterCorpse

### character_corpse_tick_of_death :: Read|Write uint32

The tick this character corpse died at.

Can only be used if this is CharacterCorpse

### character_corpse_death_cause :: Read|Write LocalisedString

The reason this character corpse character died. `""` if there is no reason.

Can only be used if this is CharacterCorpse

### associated_player :: Read LuaPlayer| Write PlayerIdentification?

The player this character is associated with, if any. Set to `nil` to clear.

The player will be automatically disassociated when a controller is set on the character. Also, all characters associated to a player will be logged off when the player logs off in multiplayer.

A character associated with a player is not directly controlled by any player.

Can only be used if this is Character

### tick_of_last_attack :: Read|Write uint32

The last tick this character entity was attacked.

Can only be used if this is Character

### tick_of_last_damage :: Read|Write uint32

The last tick this character entity was damaged.

Can only be used if this is Character

### splitter_filter :: Read|Write ItemFilter?

The filter for this splitter, if any is set.

Can only be used if this is Splitter or LaneSplitter

### inserter_filter_mode :: Read|Write `"whitelist"` or `"blacklist"`?

The filter mode for this filter inserter. `nil` if this inserter doesn't use filters.

Can only be used if this is Inserter

### loader_filter_mode :: Read|Write PrototypeFilterMode?

The filter mode for this loader. `nil` if this loader does not support filters.

Can only be used if this is Loader

### loader_belt_stack_size_override :: Read|Write uint8

The belt stack size override for this loader. Set to `0` to disable. Writing this value requires LoaderPrototype::adjustable_belt_stack_size to be `true`.

Can only be used if this is Loader

### mining_drill_filter_mode :: Read|Write `"whitelist"` or `"blacklist"`?

The filter mode for this mining drill. `nil` if this mining drill doesn't have filters.

Can only be used if this is MiningDrill

### splitter_input_priority :: Read|Write `"left"` or `"none"` or `"right"`

The input priority for this splitter.

Can only be used if this is Splitter or LaneSplitter

### splitter_output_priority :: Read|Write `"left"` or `"none"` or `"right"`

The output priority for this splitter.

Can only be used if this is Splitter or LaneSplitter

### inserter_spoil_priority :: Read|Write SpoilPriority

The spoil priority for this inserter.

Can only be used if this is Inserter

### armed :: Read boolean

Whether this land mine is armed.

Can only be used if this is LandMine

### recipe_locked :: Read|Write boolean

When locked; the recipe in this assembling machine can't be changed by the player.

Can only be used if this is AssemblingMachine

### connected_rail :: Read LuaEntity?

The rail entity this train stop is connected to, if any.

Can only be used if this is TrainStop

### connected_rail_direction :: Read defines.rail_direction

Rail direction to which this train stop is binding. This returns a value even when no rails are present.

Can only be used if this is TrainStop

### trains_in_block :: Read uint32

The number of trains in this rail block for this rail entity.

Can only be used if this is Rail

### timeout :: Read|Write uint32

The timeout that's left on this landmine in ticks. It describes the time between the landmine being placed and it being armed.

Can only be used if this is LandMine

### neighbour_bonus :: Read double

The current total neighbour bonus of this reactor.

Can only be used if this is Reactor

### ai_settings :: Read LuaAISettings

The ai settings of this unit.

Can only be used if this is Unit or SpiderUnit

### highlight_box_type :: Read|Write CursorBoxRenderType

The highlight box type of this highlight box entity.

Can only be used if this is HighlightBox

### highlight_box_blink_interval :: Read|Write uint32

The blink interval of this highlight box entity. `0` indicates no blink.

Can only be used if this is HighlightBox

### status :: Read defines.entity_status?

The status of this entity, if any.

This is always the actual status of the entity, even if LuaEntity::custom_status is set.

### custom_status :: Read|Write CustomEntityStatus?

A custom status for this entity that will be displayed in the GUI.

### enable_logistics_while_moving :: Read|Write boolean

Whether equipment grid logistics are enabled while this vehicle is moving.

Can only be used if this is Vehicle

### render_player :: Read LuaPlayer| Write PlayerIdentification?

The player that this `simple-entity-with-owner`, `simple-entity-with-force`, or `highlight-box` is visible to. `nil` when this entity is rendered for all players.

### render_to_forces :: Read array[LuaForce]| Write ForceSet?

The forces that this `simple-entity-with-owner` or `simple-entity-with-force` is visible to. `nil` or an empty array when this entity is rendered for all forces.

### pump_rail_target :: Read LuaEntity?

The rail target of this pump, if any.

Can only be used if this is Pump

### valve_threshold_override :: Read|Write float?

The threshold override of this valve, or `nil` if an override is not defined.

If no override is defined, the threshold is taken from LuaEntityPrototype::valve_threshold.

Can only be used if this is Valve

### electric_network_id :: Read uint32?

Returns the id of the electric network that this entity is connected to, if any.

### allow_dispatching_robots :: Read|Write boolean

Whether this character's personal roboports are allowed to dispatch robots.

Can only be used if this is Character

### energy_generated_last_tick :: Read double

How much energy this generator generated in the last tick.

Can only be used if this is Generator

### storage_filter :: Read ItemIDAndQualityIDPair| Write ItemWithQualityID?

The storage filter for this logistic storage container.

Useable only on logistic containers with the `"storage"` logistic_mode.

### request_from_buffers :: Read|Write boolean

Whether this requester chest is set to also request from buffer chests.

Useable only on entities that have requester slots.

### corpse_expires :: Read|Write boolean

Whether this corpse will ever fade away.

Can only be used if this is Corpse

### corpse_immune_to_entity_placement :: Read|Write boolean

If true, corpse won't be destroyed when entities are placed over it. If false, whether corpse will be removed or not depends on value of CorpsePrototype::remove_on_entity_placement.

Can only be used if this is Corpse

### tags :: Read|Write Tags?

The tags associated with this entity ghost. `nil` if this is not an entity ghost or when the ghost has no tags.

### time_to_next_effect :: Read|Write uint32

The ticks until the next trigger effect of this smoke-with-trigger.

Can only be used if this is SmokeWithTrigger

### autopilot_destination :: Read|Write MapPosition?

Destination of this spidertron's autopilot, if any. Writing `nil` clears all destinations.

Can only be used if this is SpiderVehicle

### autopilot_destinations :: Read array[MapPosition]

The queued destination positions of spidertron's autopilot.

Can only be used if this is SpiderVehicle

### trains_count :: Read uint32

Amount of trains related to this particular train stop. Includes train stopped at this train stop (until it finds a path to next target) and trains having this train stop as goal or waypoint.

Train may be included multiple times when braking distance covers this train stop multiple times.

Value may be read even when train stop has no control behavior.

Can only be used if this is TrainStop

### trains_limit :: Read|Write uint32

Amount of trains above which no new trains will be sent to this train stop. Writing nil will disable the limit (will set a maximum possible value).

When a train stop has a control behavior with wire connected and set_trains_limit enabled, this value will be overwritten by it.

Can only be used if this is TrainStop

### is_military_target :: Read|Write boolean

Whether this entity is a MilitaryTarget. Can be written to if LuaEntityPrototype::allow_run_time_change_of_is_military_target returns `true`.

### is_entity_with_owner :: Read boolean

If this entity is EntityWithOwner

### is_entity_with_health :: Read boolean

If this entity is EntityWithHealth

### combat_robot_owner :: Read|Write LuaEntity?

The owner of this combat robot, if any.

Can only be used if this is CombatRobot

### link_id :: Read|Write uint32

The link ID this linked container is using.

Can only be used if this is LinkedContainer

### follow_target :: Read|Write LuaEntity?

The follow target of this spidertron, if any.

Can only be used if this is SpiderVehicle

### follow_offset :: Read|Write Vector?

The follow offset of this spidertron, if any entity is being followed. This is randomized each time the follow entity is set.

Can only be used if this is SpiderVehicle

### linked_belt_type :: Read|Write BeltConnectionType

Type of linked belt. Changing type will also flip direction so the belt is out of the same side.

Can only be changed when linked belt is disconnected (has no neighbour set).

Can only be used if this is LinkedBelt

### linked_belt_neighbour :: Read LuaEntity?

Neighbour to which this linked belt is connected to, if any.

May return entity ghost which contains linked belt to which connection is made.

Can only be used if this is LinkedBelt

### quality :: Read LuaQualityPrototype

The quality of this entity.

Not all entities support quality and will give the "normal" quality back if they don't.

### rail_layer :: Read defines.rail_layer

Gets rail layer of a given signal

Can only be used if this is RailSignal or RailChainSignal

### radar_scan_progress :: Read float

The current radar scan progress, as a number in range `[0, 1]`.

Can only be used if this is Radar

### name_tag :: Read|Write string

Name tag of this entity. Returns `nil` if entity has no name tag. When name tag is already used by other entity, the name will be removed from the other entity. Entity name tags can also be set in the entity "extra settings" GUI in the map editor.

### rocket_silo_status :: Read defines.rocket_silo_status

The status of this rocket silo entity.

Can only be used if this is RocketSilo

### tile_width :: Read uint32

Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). Uses the current direction of the entity.

### tile_height :: Read uint32

Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). Uses the current direction of the entity.

### crane_end_position_3d :: Read Vector3D

Returns current position in 3D for the end of the crane of this entity.

Can only be used if this is AgriculturalTower

### crane_destination :: Read|Write MapPosition

Destination of the crane of this entity. Throws when trying to set the destination out of range.

Can only be used if this is AgriculturalTower

### crane_destination_3d :: Read|Write Vector3D

Destination of the crane of this entity in 3D. Throws when trying to set the destination out of range.

Can only be used if this is AgriculturalTower

### crane_grappler_destination :: Write MapPosition

Will set destination for the grappler of crane of this entity. The crane grappler will start moving to reach the destination, but the rest of the arm will remain stationary. Throws when trying to set the destination out of range.

Can only be used if this is AgriculturalTower

### crane_grappler_destination_3d :: Write Vector3D

Will set destination in 3D for the grappler of crane of this entity. The crane grappler will start moving to reach the destination, but the rest of the arm will remain stationary. Throws when trying to set the destination out of range.

Can only be used if this is AgriculturalTower

### owned_plants :: Read array[LuaEntity]

Plants registered by this agricultural tower. One plant can be registered in multiple agricultural towers.

Can only be used if this is AgriculturalTower

### copy_color_from_train_stop :: Read|Write boolean

If this rolling stock has 'copy color from train stop' enabled.

Can only be used if this is RollingStock

### is_headed_to_trains_front :: Read boolean

If the rolling stock is facing train's front.

Can only be used if this is RollingStock

### draw_data :: Read RollingStockDrawData

Gives a draw data of the given entity if it supports such data.

Can only be used if this is RollingStock

### train_stop_priority :: Read|Write uint8

Priority of this train stop.

Can only be used if this is TrainStop

### belt_shape :: Read `"straight"` or `"left"` or `"right"`

Gives what is the current shape of a transport-belt.

Can only be used if this is TransportBelt

### gps_tag :: Read string

Returns a rich text string containing this entity's position and surface name as a gps tag. Printing it will ping the location of the entity.

#### Example

    -- called on a LuaEntity on the default surface it returns:
    entity.gps_tag -- => "[gps=-4,-9]"

    -- called on a LuaEntity on "custom-surface" it returns:
    different_entity.gps_tag -- => "[gps=1,-5,custom-surface]"

### commandable :: Read LuaCommandable?

Returns a LuaCommandable for this entity or nil if entity is not commandable. Units and SpiderUnits are commandable.

### fluids_count :: Read uint32

Returns count of fluid storages. This includes fluid storages provided by fluidboxes but also covers other fluid storages like fluid turret's internal buffer and fluid wagon's fluid since they are not fluidbox and cannot be exposed through LuaFluidBox.

### tick_grown :: Read|Write MapTick

The tick when this plant is fully grown.

Can only be used if this is Plant

### always_on :: Read|Write boolean

If the lamp is always on when not driven by control behavior.

Can only be used if this is Lamp

### artillery_auto_targeting :: Read|Write boolean

If this artillery auto-targets enemies.

Can only be used if this is ArtilleryWagon or ArtilleryTurret

### robot_order_queue :: Read array[WorkerRobotOrder]

Get the current queue of robot orders.

Can only be used if this is ConstructionRobot or LogisticRobot

### procession_tick :: Read|Write MapTick

how far into the current procession the cargo pod is.

Can only be used if this is CargoPod

### is_updatable :: Read boolean

Whether the entity is updatable and considered an UpdatableEntity.

### disabled_by_script :: Read|Write boolean

If the updatable entity is disabled by script.

Note: Some entities (Corpse, FireFlame, Roboport, RollingStock, dying entities) need to remain active and will ignore writes.

If this entity is not considered updatable then this always returns `false` and writes will be ignored.

Can only be used if this is UpdatableEntity

### disabled_by_control_behavior :: Read boolean

If the updatable entity is disabled by control behavior.

Always returns `false` if this entity is not considered updatable.

Can only be used if this is UpdatableEntity

### disabled_by_recipe :: Read boolean

If the assembling machine is disabled by recipe, e.g. due to AssemblingMachinePrototype::disabled_when_recipe_not_researched.

Always returns `false` if this entity is not considered updatable.

Can only be used if this is UpdatableEntity

### is_freezable :: Read boolean

Whether the entity is freezable and considered a FreezableEntity.

### frozen :: Read boolean

Whether the freezable entity is currently frozen.

Always returns `false` if this entity is not considered freezable.

Can only be used if this is FreezableEntity

### cargo_hatches :: Read array[LuaCargoHatch]

The cargo hatches owned by this entity if any.

### cargo_pod_state :: Read `"awaiting_launch"` or `"ascending"` or `"surface_transition"` or `"descending"` or `"parking"`

The state of this cargo pod entity.

Can only be used if this is CargoPod

### cargo_pod_destination :: Read|Write CargoDestination

The destination of this cargo pod entity.

Use force_finish_ascending if you want it to only descend from orbit.

Can only be used if this is CargoPod

### cargo_pod_origin :: Read|Write LuaEntity?

The origin of this cargo pod entity. (Must be a silo, hub or pad)

Can only be used if this is CargoPod

### attached_cargo_pod :: Read LuaEntity?

The cargo pod attached to this rocket silo rocket if any.

Can only be used if this is RocketSiloRocket

### rocket :: Read LuaEntity?

The rocket silo rocket this cargo pod is attached to, or rocket silo rocket attached to this rocket silo - if any.

### item_request_proxy :: Read LuaEntity?

The first found item request proxy targeting this entity.

### base_damage_modifiers :: Read|Write TriggerModifierData

Can only be used if this is Projectile

### bonus_damage_modifiers :: Read|Write TriggerModifierData

Can only be used if this is Projectile

### cargo_bay_connection_owner :: Read LuaEntity?

The space platform hub or cargo landing pad this cargo bay is connected to if any.

Can only be used if this is CargoBay

### pickup_from_left_lane :: Read|Write boolean

For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the left lane.

Can only be used if this is Inserter

### pickup_from_right_lane :: Read|Write boolean

For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the right lane.

Can only be used if this is Inserter

### segmented_unit :: Read LuaSegmentedUnit?

The segmented unit object that the segment entity is a part of.

Can only be used if this is Segment

### pumped_last_tick :: Read double

The amount of fluid moved by this offshore pump or normal pump in the last tick.

Can only be used if this is OffshorePump or Pump

### created_by_corpse :: Read LuaEntity?

The corpse that caused this entity ghost to be created, if any.

Can only be used if this is EntityGhost

### priority_targets :: Read array[LuaEntityPrototype]

The priority targets for this turret (if any).

Can only be used if this is Turret

### proxy_target_entity :: Read|Write LuaEntity?

Entity of which inventory is exposed by this ProxyContainer

Can only be used if this is ProxyContainer

### proxy_target_inventory :: Read|Write defines.inventory

Inventory index of the inventory that is exposed by this ProxyContainer

Can only be used if this is ProxyContainer

### display_panel_text :: Read|Write LocalisedString

Text visible on the display panel. Can be written only when it is not set by control behavior.

Can only be used if this is DisplayPanel

### display_panel_icon :: Read|Write SignalID?

Icon visible on the display panel. Can be written only when it is not set by control behavior.

Can only be used if this is DisplayPanel

### display_panel_always_show :: Read|Write boolean

Can only be used if this is DisplayPanel

### display_panel_show_in_chart :: Read|Write boolean

Can only be used if this is DisplayPanel

### valid :: Read boolean

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

### object_name :: Read string

The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Class used in

- LuaBootstrap::raise_player_fast_transferred()
- LuaBootstrap::raise_biter_base_built()
- LuaBootstrap::raise_market_item_purchased()
- LuaBootstrap::raise_script_built()
- LuaBootstrap::raise_script_destroy()
- LuaBootstrap::raise_script_revive()
- LuaBootstrap::raise_script_teleported()
- LuaBurner::owner
- LuaCargoHatch::create_cargo_pod()
- LuaCargoHatch::owner
- LuaCircuitNetwork::entity
- LuaCommandable::add_member()
- LuaCommandable::spawner
- LuaCommandable::members
- LuaCommandable::entity
- LuaControl::set_gui_arrow()
- LuaControl::can_reach_entity()
- LuaControl::mine_entity()
- LuaControl::vehicle
- LuaControl::cargo_pod
- LuaControl::hub
- LuaControl::selected
- LuaControl::opened
- LuaControl::following_robots
- LuaControlBehavior::entity
- LuaEntity::damage()
- LuaEntity::die()
- LuaEntity::apply_upgrade()
- LuaEntity::launch_rocket()
- LuaEntity::revive()
- LuaEntity::silent_revive()
- LuaEntity::get_connected_rail()
- LuaEntity::get_connected_rails()
- LuaEntity::get_rail_segment_signal()
- LuaEntity::get_rail_segment_stop()
- LuaEntity::get_rail_segment_end()
- LuaEntity::get_rail_segment_rails()
- LuaEntity::get_rail_segment_overlaps()
- LuaEntity::is_rail_in_same_rail_segment_as()
- LuaEntity::is_rail_in_same_rail_block_as()
- LuaEntity::get_parent_signals()
- LuaEntity::get_child_signals()
- LuaEntity::get_inbound_signals()
- LuaEntity::get_outbound_signals()
- LuaEntity::copy_settings()
- LuaEntity::get_driver()
- LuaEntity::set_driver()
- LuaEntity::get_passenger()
- LuaEntity::set_passenger()
- LuaEntity::clone()
- LuaEntity::set_beam_source()
- LuaEntity::set_beam_target()
- LuaEntity::can_shoot()
- LuaEntity::can_wires_reach()
- LuaEntity::get_connected_rolling_stock()
- LuaEntity::connect_linked_belts()
- LuaEntity::get_spider_legs()
- LuaEntity::get_beacons()
- LuaEntity::get_beacon_effect_receivers()
- LuaEntity::create_cargo_pod()
- LuaEntity::get_cargo_bays()
- LuaEntity::register_tree()
- LuaEntity::drop_target
- LuaEntity::pickup_target
- LuaEntity::neighbours
- LuaEntity::belt_neighbours
- LuaEntity::heat_neighbours
- LuaEntity::mining_target
- LuaEntity::loader_container
- LuaEntity::shooting_target
- LuaEntity::proxy_target
- LuaEntity::stickers
- LuaEntity::sticked_to
- LuaEntity::units
- LuaEntity::connected_rail
- LuaEntity::pump_rail_target
- LuaEntity::combat_robot_owner
- LuaEntity::follow_target
- LuaEntity::linked_belt_neighbour
- LuaEntity::owned_plants
- LuaEntity::cargo_pod_origin
- LuaEntity::attached_cargo_pod
- LuaEntity::rocket
- LuaEntity::item_request_proxy
- LuaEntity::cargo_bay_connection_owner
- LuaEntity::created_by_corpse
- LuaEntity::proxy_target_entity
- LuaEquipmentGrid::entity_owner
- LuaFluidBox::add_linked_connection()
- LuaFluidBox::get_linked_connection()
- LuaFluidBox::owner
- LuaGameScript::get_entity_by_tag()
- LuaGameScript::get_vehicles()
- LuaGameScript::get_entity_by_unit_number()
- LuaGuiElement::entity
- LuaInventory::entity_owner
- LuaItemCommon::build_blueprint()
- LuaItemCommon::create_blueprint()
- LuaItemStack::use_capsule()
- LuaLogisticCell::owner
- LuaLogisticCell::charging_robots
- LuaLogisticCell::to_charge_robots
- LuaLogisticNetwork::providers
- LuaLogisticNetwork::empty_providers
- LuaLogisticNetwork::requesters
- LuaLogisticNetwork::storages
- LuaLogisticNetwork::logistic_members
- LuaLogisticNetwork::robots
- LuaLogisticNetwork::construction_robots
- LuaLogisticNetwork::logistic_robots
- LuaLogisticPoint::owner
- LuaLogisticSection::owner
- LuaMiningDrillControlBehavior::resource_read_targets
- LuaPlayer::set_controller()
- LuaPlayer::add_alert()
- LuaPlayer::add_custom_alert()
- LuaPlayer::remove_alert()
- LuaPlayer::get_alerts()
- LuaPlayer::add_pin()
- LuaPlayer::get_associated_characters()
- LuaPlayer::associate_character()
- LuaPlayer::disassociate_character()
- LuaPlayer::physical_vehicle
- LuaPlayer::character
- LuaPlayer::cutscene_character
- LuaPlayer::spidertron_remote_selection
- LuaPlayer::centered_on
- LuaPlayer::entity_copy_source
- LuaRailEnd::rail
- LuaRailPath::rails
- LuaRecord::build_blueprint()
- LuaRecord::create_blueprint()
- LuaSegment::entity
- LuaSegmentedUnit::die()
- LuaSegmentedUnit::damage()
- LuaSpacePlatform::apply_starter_pack()
- LuaSpacePlatform::damage_tile()
- LuaSpacePlatform::hub
- LuaSurface::find_entity()
- LuaSurface::find_entities()
- LuaSurface::find_entities_filtered()
- LuaSurface::spill_item_stack()
- LuaSurface::spill_inventory()
- LuaSurface::find_enemy_units()
- LuaSurface::find_units()
- LuaSurface::find_nearest_enemy()
- LuaSurface::find_nearest_enemy_entity_with_owner()
- LuaSurface::create_entity()
- LuaSurface::clone_entities()
- LuaSurface::request_path()
- LuaSurface::get_closest()
- LuaSurface::get_entities_with_force()
- LuaTile::order_deconstruction()
- LuaTile::get_tile_ghosts()
- LuaTrain::get_rails()
- LuaTrain::carriages
- LuaTrain::locomotives
- LuaTrain::cargo_wagons
- LuaTrain::fluid_wagons
- LuaTrain::front_stock
- LuaTrain::back_stock
- LuaTrain::station
- LuaTrain::path_end_rail
- LuaTrain::path_end_stop
- LuaTrain::signal
- LuaTrainManager::get_train_stops()
- LuaTransportLine::owner
- LuaWireConnector::can_wire_reach()
- LuaWireConnector::owner
- AddRecordData
- Alert
- BeamTarget
- CargoDestination
- Command
- CutsceneWaypoint
- DragTarget
- EntityID
- EntityWithQualityID
- FluidBoxConnectionRecord
- GuiArrowSpecification
- ItemLocationData
- RailEndGoal
- RailEndStart
- RegistrationTarget
- ScheduleRecord
- ScriptRenderTarget
- ScriptRenderTargetTable
- SegmentedUnitAIState
- TrainPathFinderGoal
- TrainPathFinderOneGoalResult
- TrainStopGoal
- WorkerRobotOrder
- on_biter_base_built
- on_build_base_arrived
- on_built_entity
- on_cancelled_deconstruction
- on_cancelled_upgrade
- on_cargo_pod_delivered_cargo
- on_cargo_pod_finished_ascending
- on_cargo_pod_finished_descending
- on_cargo_pod_started_ascending
- on_character_corpse_expired
- on_combat_robot_expired
- on_entity_cloned
- on_entity_color_changed
- on_entity_damaged
- on_entity_died
- on_entity_logistic_slot_changed
- on_entity_renamed
- on_entity_settings_pasted
- on_entity_spawned
- on_gui_closed
- on_gui_opened
- on_land_mine_armed
- on_marked_for_deconstruction
- on_marked_for_upgrade
- on_market_item_purchased
- on_player_alt_reverse_selected_area
- on_player_alt_selected_area
- on_player_died
- on_player_driving_changed_state
- on_player_dropped_item
- on_player_dropped_item_into_entity
- on_player_fast_transferred
- on_player_flipped_entity
- on_player_flushed_fluid
- on_player_mined_entity
- on_player_repaired_entity
- on_player_respawned
- on_player_reverse_selected_area
- on_player_rotated_entity
- on_player_selected_area
- on_player_setup_blueprint
- on_post_entity_died
- on_pre_entity_settings_pasted
- on_pre_ghost_deconstructed
- on_pre_ghost_upgraded
- on_pre_player_died
- on_pre_player_mined_item
- on_pre_robot_exploded_cliff
- on_resource_depleted
- on_robot_built_entity
- on_robot_built_tile
- on_robot_exploded_cliff
- on_robot_mined
- on_robot_mined_entity
- on_robot_mined_tile
- on_robot_pre_mined
- on_rocket_launch_ordered
- on_rocket_launched
- on_script_trigger_effect
- on_sector_scanned
- on_segment_entity_created
- on_segmented_unit_damaged
- on_segmented_unit_died
- on_selected_entity_changed
- on_space_platform_built_entity
- on_space_platform_mined_entity
- on_space_platform_pre_mined
- on_spider_command_completed
- on_tower_mined_plant
- on_tower_planted_seed
- on_tower_pre_mined_plant
- on_trigger_created_entity
- on_trigger_fired_artillery
- on_unit_added_to_group
- on_unit_removed_from_group
- on_worker_robot_expired
- script_raised_built
- script_raised_destroy
- script_raised_revive
- script_raised_teleported