LuaEntity

class LuaEntity extends LuaControl - sort
get_output_inventory() → LuaInventory Gets the entities output inventory if it has one.
get_module_inventory() → LuaInventory
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) → float Damages the entity.
can_be_destroyed() → boolean Checks if the entity can be destroyed
destroy(opts) → boolean Destroys the entity.
set_command(command) Give the entity a command.
has_command() → boolean Has this unit been assigned a command?
die(force, cause) → boolean Immediately kills the entity.
has_flag(flag) → boolean Test whether this entity's prototype has a flag set.
ghost_has_flag(flag) → boolean Same as LuaEntity::has_flag but targets the inner entity on a entity ghost.
add_market_item(offer) Offer a thing on the market.
remove_market_item(offer) → boolean Remove an offer from a market.
get_market_items() → array of Offer Get all offers in a market as an array.
clear_market_items() Removes all offers from a market.
connect_neighbour(target) → boolean Connect two devices with wire or cable.
disconnect_neighbour(target) Disconnect wires or cables.
order_deconstruction(force, player) → boolean Sets the entity to be deconstructed by construction robots.
cancel_deconstruction(force, player) Cancels deconstruction if it is scheduled, does nothing otherwise.
to_be_deconstructed(force) → boolean Is this entity marked for deconstruction?
order_upgrade{force=…, target=…, player=…} → boolean Sets the entity to be upgraded by construction robots.
cancel_upgrade(force, player) → boolean Cancels upgrade if it is scheduled, does nothing otherwise.
to_be_upgraded() → boolean Is this entity marked for upgrade?
get_request_slot(slot) → SimpleItemStack Get a logistic requester slot.
set_request_slot(request, slot) Set a logistic requester slot.
clear_request_slot(slot) Clear a logistic requester slot.
is_crafting() → boolean
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_max_transport_line_index() → uint Get the maximum transport line index of a belt or belt connectable entity.
launch_rocket() → boolean
revive(opts) → dictionary stringuint Revive a ghost.
silent_revive(opts) → dictionary stringuint Revives a ghost silently.
get_connected_rail{rail_direction=…, rail_connection_direction=…} → LuaEntity
get_connected_rails() → array of LuaEntity Get the rails that this signal is connected to.
get_rail_segment_entity(direction, in_else_out) → LuaEntity Get the rail signal or train stop at the start/end of the rail segment this rail is in, or nil if the rail segment doesn't start/end with a signal nor a train stop.
get_rail_segment_end(direction) → LuaEntity Get the rail at the end of the rail segment this rail is in.
get_rail_segment_length() → double Get the length of the rail segment this rail is in.
get_rail_segment_overlaps() → array of LuaEntity Get a rail from each rail segment that overlaps with this rail's rail segment.
get_filter(uint) → string Get the filter for a slot in an inserter or a loader.
set_filter(uint, string) Set the filter for a slot in an inserter or a loader
get_infinity_container_filter(index) → InfinityContainerFilter 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.
get_infinity_pipe_filter() → InfinityPipeFilter 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.
get_heat_setting() → HeatSetting Gets the heat setting for this heat interface.
set_heat_setting(filter) Sets the heat setting for this heat interface.
get_control_behavior() → LuaControlBehavior 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.
get_circuit_network(wire, circuit_connector) → LuaCircuitNetwork
get_merged_signals(circuit_connector) → array of Signal The merged circuit network signals or nil if there are no signals.
supports_backer_name() → boolean
copy_settings(entity) → dictionary stringuint Copies settings from the given entity onto this entity.
get_logistic_point(defines.logistic_member_index) → LuaLogisticPoint or array of LuaLogisticPoint Gets the LuaLogisticPoint specified by the given index or if not given returns all of the points this entity owns.
play_note(instrument, note) → boolean Plays a note with the given instrument and note.
connect_rolling_stock(direction) → boolean Connects the rolling stock in the given direction.
disconnect_rolling_stock(direction) → boolean 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.
get_recipe() → LuaRecipe Current recipe being assembled by this machine or nil if no recipe is set.
set_recipe(recipe) → dictionary stringuint Sets the current recipe in this assembly machine.
rotate(options) → boolean Rotates this entity as if the player rotated it
get_driver() → LuaEntity or LuaPlayer Gets the driver of this vehicle if any.
set_driver(driver) Sets the driver of this vehicle.
get_passenger() → LuaEntity or LuaPlayer Gets the passenger of this car if any.
set_passenger(passenger) Sets the passenger of this car.
is_connected_to_electric_network() → boolean Returns true if this entity is connected to an electric network.
get_train_stop_trains() → array of LuaTrain The trains scheduled to stop at this train stop.
get_stopped_train() → LuaTrain The train currently stopped at this train stop or nil if none.
clone{position=…, surface=…, force=…} → LuaEntity Clones this entity.
get_fluid_count(fluid) → double Get the amount of all or some fluid in this entity.
get_fluid_contents() → dictionary stringdouble Get amounts of all fluids in this entity.
remove_fluid{name=…, amount=…, minimum_temperature=…, maximum_temperature=…, temperature=…} → double Remove fluid from this entity.
insert_fluid(fluid) → double Insert fluid into this entity.
clear_fluid_inside() Remove all fluids from this entity.
get_beam_source() → BeamTarget Get the source of this beam.
set_beam_source(source) Set the source of this beam.
get_beam_target() → BeamTarget Get the target of this beam.
set_beam_target(target) Set the target of this beam.
get_radius() → double 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).
create_build_effect_smoke() 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.
toggle_equipment_movement_bonus() Toggle this entity's equipment movement bonus.
can_shoot(target, position) → boolean If 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.
name :: string [R] Name of the entity prototype.
ghost_name :: string [R] Name of the entity or tile contained in this ghost
localised_name :: LocalisedString [R] Localised name of the entity.
localised_description :: LocalisedString [R]
ghost_localised_name :: LocalisedString [R] Localised name of the entity or tile contained in this ghost.
ghost_localised_description :: LocalisedString [R]
type :: string [R] The entity prototype type of this entity.
ghost_type :: string [R] The prototype type of the entity or tile contained in this ghost.
active :: boolean [RW] Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will stop moving etc).
destructible :: boolean [RW] When the entity is not destructible it can't be damaged.
minable :: boolean [RW]
rotatable :: boolean [RW] When entity is not to be rotatable (inserter, transport belt etc), it can't be rotated by player using the R key.
operable :: boolean [RW] 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 :: float [RW] Health of the entity.
direction :: defines.direction [RW] The current direction this entity is facing.
supports_direction :: boolean [R] Whether the entity has direction.
orientation :: float [RW] The smooth orientation.
cliff_orientation :: string [R] The orientation of this cliff.
amount :: uint [RW] Count of resource units contained.
initial_amount :: uint [RW] Count of initial resource units contained.
effectivity_modifier :: float [RW] Multiplies the acceleration the vehicle can create for one unit of energy.
consumption_modifier :: float [RW] Multiplies the energy consumption.
friction_modifier :: float [RW] Multiplies the car friction rate.
speed :: float [RW] The current speed of the car or rolling stock, or current max speed of the unit.
stack :: LuaItemStack [R]
prototype :: LuaEntityPrototype [R] The entity prototype of this entity.
ghost_prototype :: LuaEntityPrototype or LuaTilePrototype [R] The prototype of the entity or tile contained in this ghost.
drop_position :: Position [RW] Position where the entity puts its stuff.
pickup_position :: Position [RW] Where the inserter will pick up items from.
drop_target :: LuaEntity [RW] The entity this entity is putting its stuff to or nil if there is no such entity.
pickup_target :: LuaEntity [RW] The entity the inserter will attempt to pick up from.
selected_gun_index :: uint [RW] Index of the currently selected weapon slot of this character or car, or nil if the car doesn't have guns.
energy :: double [RW] Energy stored in the entity (heat in furnace, energy stored in electrical devices etc.
temperature :: double [RW] The temperature of this entities heat energy source if this entity uses a heat energy source or nil.
previous_recipe :: LuaRecipe [R] The previous recipe this furnace was using or nil if the furnace had no previous recipe.
held_stack :: LuaItemStack [R] The item stack currently held in an inserter's hand.
held_stack_position :: Position [R] Current position of the inserter's "hand".
train :: LuaTrain [R] The train this rolling stock belongs to or nil if not rolling stock.
neighbours :: dictionary stringarray of LuaEntity or array of array of LuaEntity or LuaEntity [R]
belt_neighbours :: dictionary stringarray of LuaEntity [R] The belt connectable neighbours of this belt connectable entity.
fluidbox :: LuaFluidBox [RW] Fluidboxes of this entity.
backer_name :: string [RW] The name of a backer (of Factorio) assigned to a lab or train station / stop.
time_to_live :: uint [RW] The ticks left before a ghost, combat robot or highlight box is destroyed.
color :: Color [RW] The character, rolling stock, train stop, flying text, or simple-entity-with-owner color.
text :: LocalisedString [RW] The text of this flying-text entity.
signal_state :: defines.signal_state [R] The state of this rail signal.
chain_signal_state :: defines.chain_signal_state [R] The state of this chain signal.
to_be_looted :: boolean [RW] Will this entity be picked up automatically when the player walks over it?
crafting_speed :: double [R] The current crafting speed, including speed bonuses from modules and beacons.
crafting_progress :: float [RW] The current crafting progress, as a number in range [0, 1].
bonus_progress :: double [RW] The current productivity bonus progress, as a number in range [0, 1].
belt_to_ground_type :: string [R] "input" or "output", depending on whether this underground belt goes down or up.
loader_type :: string [RW] "input" or "output", depending on whether this loader puts to or gets from a container.
rocket_parts :: uint [RW] Number of rocket parts in the silo.
logistic_network :: LuaLogisticNetwork [R] The logistic network this entity is a part of.
logistic_cell :: LuaLogisticCell [R] The logistic cell this entity is a part of.
item_requests :: dictionary stringuint [RW] Items this ghost will request when revived or items this item request proxy is requesting.
player :: LuaPlayer [R] The player connected to this character or nil if none.
unit_group :: LuaUnitGroup [R] The unit group this unit is a member of, or nil if none.
damage_dealt :: double [RW] The damage dealt by this turret, artillery turret, or artillery wagon.
kills :: uint [RW] The number of units killed by this turret, artillery turret, or artillery wagon.
last_user :: LuaPlayer [RW] The player who built the entity
electric_buffer_size :: double [RW] The buffer size for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_input_flow_limit :: double [R] The input flow limit for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_output_flow_limit :: double [R] The output flow limit for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_drain :: double [R] The electric drain for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_emissions :: double [R] The emissions for the electric energy source or nil if the entity doesn't have an electric energy source.
unit_number :: uint [R] The unit number or nil if the entity doesn't have one.
ghost_unit_number :: uint [R] The unit number of the entity contained in this ghost or nil if the entity doesn't have one.
mining_progress :: double [RW] The mining progress for this mining drill or nil if this isn't a mining drill.
bonus_mining_progress :: double [RW] The bonus mining progress for this mining drill or nil if this isn't a mining drill.
power_production :: double [RW] The power production specific to the ElectricEnergyInterface entity type.
power_usage :: double [RW] The power usage specific to the ElectricEnergyInterface entity type.
bounding_box :: BoundingBox [R] LuaEntityPrototype::collision_box around entity's given position and respecting the current entity orientation.
secondary_bounding_box :: BoundingBox [R] The secondary bounding box of this entity or nil if it doesn't have one.
selection_box :: BoundingBox [R] LuaEntityPrototype::selection_box around entity's given position and respecting the current entity orientation.
secondary_selection_box :: BoundingBox [R] The secondary selection box of this entity or nil if it doesn't have one.
mining_target :: LuaEntity [R] The mining target or nil if none
circuit_connected_entities :: table [R] Entities connected to this entity via the circuit network.
circuit_connection_definitions :: array of CircuitConnectionDefinition [R] The connection definition for entities connected to this entity via the circuit network.
request_slot_count :: uint [R] The number of request slots this entity has.
filter_slot_count :: uint [R] The number of filter slots this inserter or loader has.
loader_container :: LuaEntity [R] The container entity this loader is pointing at/pulling from depending on the LuaEntity::loader_type.
grid :: LuaEquipmentGrid [R] The equipment grid or nil if this entity doesn't have an equipment grid.
graphics_variation :: uint8 [RW] The graphics variation for this entity or nil if this entity doesn't use graphics variations.
tree_color_index :: uint8 [RW] Index of the tree color.
tree_color_index_max :: uint8 [R] Maximum index of the tree colors.
tree_stage_index :: uint8 [RW] Index of the tree stage.
tree_stage_index_max :: uint8 [R] Maximum index of the tree stages.
burner :: LuaBurner [R] The burner energy source for this entity or nil if there isn't one.
shooting_target :: LuaEntity [RW] The shooting target for this turret or nil.
proxy_target :: LuaEntity [R] The target entity for this item-request-proxy or nil
stickers :: array of LuaEntity [R] The sticker entities attached to this entity.
sticked_to :: LuaEntity [R] The entity this sticker is sticked to.
parameters :: ProgrammableSpeakerParameters [RW]
alert_parameters :: ProgrammableSpeakerAlertParameters [RW]
electric_network_statistics :: LuaFlowStatistics [R] The electric network statistics for this electric pole.
inserter_stack_size_override :: uint [RW] Sets the stack size limit on this inserter.
products_finished :: uint [RW]
spawner :: LuaEntity [R] The spawner associated with this unit entity or nil if the unit has no associated spawner.
units :: array of LuaEntity [R] The units associated with this spawner entity.
power_switch_state :: boolean [RW] The state of this power switch.
relative_turret_orientation :: float [RW] The relative orientation of the vehicle turret or nil if this entity isn't a vehicle or have a vehicle turret.
effects :: Effects [R] The effects being applied to this entity or nil.
infinity_container_filters :: array of InfinityContainerFilter [RW] The filters for this infinity container.
remove_unfiltered_items :: boolean [RW] If items not included in this infinity container filters should be removed from the container.
character_corpse_player_index :: uint [RW] The player index associated with this character corpse.
character_corpse_tick_of_death :: uint [RW] The tick this character corpse died at.
character_corpse_death_cause :: LocalisedString [RW] The reason this character corpse character died (if any).
associated_player :: LuaPlayer [RW] The player this character is associated with or nil if none.
tick_of_last_attack :: uint [R] The last tick this character entity was attacked.
tick_of_last_damage :: uint [R] The last tick this character entity was damaged.
splitter_filter :: LuaItemPrototype [RW] The filter for this splitter or nil if no filter is set.
inserter_filter_mode :: string [RW] The filter mode for this filter inserter: "whitelist", "blacklist", or nil if this inserter doesn't use filters.
splitter_input_priority :: string [RW] The input priority for this splitter : "left", "none", or "right".
splitter_output_priority :: string [RW] The output priority for this splitter : "left", "none", or "right".
armed :: boolean [R] If this land mine is armed.
recipe_locked :: boolean [RW] When locked; the recipe in this assembling machine can't be changed by the player.
connected_rail :: LuaEntity [R] The rail entity this train stop is connected to or nil if there is none.
trains_in_block :: uint [R] The number of trains in this rail block for this rail entity.
timeout :: uint [RW] The timeout left on this landmine in ticks.
neighbour_bonus :: double [R] The current total neighbour bonus of this reactor.
ai_settings :: LuaAISettings [R] The ai settings of this unit.
highlight_box_type :: string [RW] The hightlight box type of this highlight box entity.
highlight_box_blink_interval :: uint [RW] The blink interval of this highlight box entity.
status :: defines.entity_status [R] The status of this entity or nil if no status.
enable_logistics_while_moving :: boolean [RW] If equipment grid logistics are enabled while this vehicle is moving.
render_player :: LuaPlayer [RW] The player that this simple-entity-with-owner, simple-entity-with-force, flying-text or highlight-box is visible to or nil.
render_to_forces :: array of ForceSpecification [RW] The forces that this simple-entity-with-owner, simple-entity-with-force or flying-text is visible to or nil.
pump_rail_target :: LuaEntity [R] The rail target of this pump or nil.
moving :: LuaEntity [R] Returns true if this unit is moving.
electric_network_id :: uint [R] Returns the id of the electric network that this entity is connected to or nil.
allow_dispatching_robots :: boolean [RW] Whether this character's personal roboports are allowed to dispatch robots.
auto_launch :: boolean [RW] Whether this rocket silo automatically launches the rocket when cargo is inserted.
energy_generated_last_tick :: double [R] How much energy this generator generated in the last tick.
storage_filter :: LuaItemPrototype [RW] The storage filter for this logistic storage container.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.

The primary interface for interacting with entities through the Lua API. Entity is everything on the map except tiles.

get_output_inventory() → LuaInventory

Gets the entities output inventory if it has one.

Return value
a reference to the entities output inventory.
get_module_inventory() → LuaInventory

Return value
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) → float

Damages the entity.

Parameters
damage :: float: The amount of damage to be done
force :: ForceSpecification: The force that will be doing the damage.
type :: string (optional): The type of damage to be done.
Return value
the total damage actually applied after resistances.
Can only be used if this is EntityWithHealth
can_be_destroyed() → boolean

Checks if the entity can be destroyed

Return value
if the entity can be destroyed.
destroy(opts) → boolean

Destroys the entity.

Parameters
opts (optional): Table with the following fields:
Return value
if the entity was actually destroyed.
Note: Not all entities can be destroyed - things such as rails under trains cannot be destroyed until the train is moved or destroyed.
set_command(command)

Give the entity a command.

Parameters
command :: Command
Can only be used if this is Unit
has_command() → boolean

Has this unit been assigned a command?

Can only be used if this is Unit
die(force, cause) → boolean

Immediately kills the entity. Doesn't care whether the entity is destroyable or damageable. Does nothing if the entity doesn't have health. Unlike LuaEntity::destroy, die will trigger on_entity_died and the entity will drop loot and corpse if it have any.

Parameters
force :: ForceSpecification: The force to attribute the kill to.
cause :: LuaEntity (optional): The cause to attribute the kill to.
Return value
If the entity was killed.
Note: Pass nil for force if you just want to provide the cause entity.
has_flag(flag) → boolean

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

Parameters
flag :: string: The flag to test
Return value
true if the entity has the given flag set.
Note: entity.has_flag(f) is a shortcut for entity.prototype.has_flag(f).
ghost_has_flag(flag) → boolean

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

Parameters
flag :: string: The flag to test
Return value
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
Example
Adds market offer, 1 copper ore for 10 iron ore.
market.add_market_item{price={{"iron-ore", 10}}, offer={type="give-item", item="copper-ore"}}
Example
Adds market offer, 1 copper ore for 5 iron ore and 5 stone ore.
market.add_market_item{price={{"iron-ore", 5}, {"stone", 5}}, offer={type="give-item", item="copper-ore"}}
Can only be used if this is Market
remove_market_item(offer) → boolean

Remove an offer from a market.

Parameters
offer :: uint: Index of offer to remove.
Return value
true if the offer was successfully removed; false when the given index was not valid.
Note: The other offers are moved down to fill the gap created by removing the offer, which decrements the overall size of the offer array.
Can only be used if this is Market
get_market_items() → array of 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
connect_neighbour(target) → boolean

Connect two devices with wire or cable.

Parameters
target :: LuaEntity or table:
  • To connect two electric poles, target has to be a LuaEntity specifying another electric pole. This will connect them with copper cable.
  • To connect two devices with wire, this parameter is a table:
Return value
Whether the connection was formed.
disconnect_neighbour(target)

Disconnect wires or cables.

Parameters
target :: defines.wire_type or LuaEntity or table (optional):
order_deconstruction(force, player) → boolean

Sets the entity to be deconstructed by construction robots.

Parameters
force :: ForceSpecification: The force whose robots are supposed to do the deconstruction.
player :: PlayerSpecification (optional): The player to set the last_user to if any.
Return value
if the entity was marked for deconstruction.
cancel_deconstruction(force, player)

Cancels deconstruction if it is scheduled, does nothing otherwise.

Parameters
force :: ForceSpecification: The force who did the deconstruction order.
player :: PlayerSpecification (optional): The player to set the last_user to if any.
to_be_deconstructed(force) → boolean

Is this entity marked for deconstruction?

Parameters
force :: ForceSpecification: The force which ordered the deconstruction. This parameter is currently unused; it exists only for forward compatibility of the API.
order_upgrade{force=…, target=…, player=…} → boolean

Sets the entity to be upgraded by construction robots.

Parameters
Table with the following fields:
Return value
if the entity was marked for upgrade.
cancel_upgrade(force, player) → boolean

Cancels upgrade if it is scheduled, does nothing otherwise.

Parameters
force :: ForceSpecification: The force who did the upgrade order.
player :: PlayerSpecification (optional): The player to set the last_user to if any.
Return value
If the cancel was successful.
to_be_upgraded() → boolean

Is this entity marked for upgrade?

get_request_slot(slot) → SimpleItemStack

Get a logistic requester slot.

Parameters
slot :: uint: The slot index.
Return value
Contents of the specified slot; nil if the given slot contains no request.
Note: Useable only on entities that have requester slots.
set_request_slot(request, slot)

Set a logistic requester slot.

Parameters
request :: ItemStackSpecification: What to request.
slot :: uint: The slot index.
Note: Useable only on entities that have requester slots.
clear_request_slot(slot)

Clear a logistic requester slot.

Parameters
slot :: uint: The slot index.
Note: Useable only on entities that have requester slots.
is_crafting() → boolean

Return value
true if this machine is currently crafting.
Can only be used if this is CraftingMachine
is_opened() → boolean

Return value
true if this gate is currently opened.
Can only be used if this is Gate
is_opening() → boolean

Return value
true if this gate is currently opening.
Can only be used if this is Gate
is_closed() → boolean

Return value
true if this gate is currently closed.
Can only be used if this is Gate
is_closing() → boolean

Return value
true if this gate is currently closing
Can only be used if this is Gate
request_to_open(force, extra_time)

Parameters
force :: ForceSpecification: The force that requests the gate to be open.
extra_time :: uint (optional): Extra ticks to stay open.
Can only be used if this is Gate
request_to_close(force)

Parameters
force :: ForceSpecification: 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 :: uint: Index of the requested transport line.
Can only be used if this is TransportBeltConnectable
get_max_transport_line_index() → uint

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

Can only be used if this is TransportBeltConnectable
launch_rocket() → boolean

Return value
true if the rocket was successfully launched. Return value of false means the silo is not ready for launch.
Can only be used if this is RocketSilo
revive(opts) → dictionary stringuint

Revive a ghost. I.e. turn it from a ghost to a real entity or tile.

Parameters
opts (optional): Table with the following fields:
Return value
Any items the new real entity collided with or nil if the ghost could not be revived.
Note: If this is an entity ghost and it is successfully revived this will also return the revived entity or nil as a second return value and possibly item request proxy as the third parameter depending on value of return_item_request_proxy.
silent_revive(opts) → dictionary stringuint

Revives a ghost silently.

Parameters
opts (optional): Table with the following fields:
Return value
Any items the new real entity collided with or nil if the ghost could not be revived.
Note: If this is an entity ghost and it is successfully revived this will also return the revived entity or nil as a second return value and possibly item request proxy as the third parameter depending on value of return_item_request_proxy.
get_connected_rail{rail_direction=…, rail_connection_direction=…} → LuaEntity

Parameters
Table with the following fields:
Return value
Rail connected in the specified manner to this one.
Can only be used if this is Rail
get_connected_rails() → array of LuaEntity

Get the rails that this signal is connected to.

Can only be used if this is RailSignal
get_rail_segment_entity(direction, in_else_out) → LuaEntity

Get the rail signal or train stop at the start/end of the rail segment this rail is in, or nil if the rail segment doesn't start/end with a signal nor a train stop.

Parameters
direction :: defines.rail_direction: The direction of travel relative to this rail.
in_else_out :: boolean: If true, gets the entity at the entrance of the rail segment, otherwise gets the entity at the exit of the rail segment.
Note: 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_end(direction) → LuaEntity

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

Parameters
Note: A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Note: This function has a second return value. A defines.rail_direction that points out of the rail segment from the end rail.
Can only be used if this is Rail
get_rail_segment_length() → double

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

Note: 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 of LuaEntity

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

Note: 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_filter(uint) → string

Get the filter for a slot in an inserter or a loader.

Parameters
uint: Slot to get the filter of.
Return value
Prototype name of the item being filtered; nil if the given slot has no filter.
Note: The inserter/loader must allow filters.
set_filter(uint, string)

Set the filter for a slot in an inserter or a loader

Parameters
uint: Slot to set the filter of.
string: Prototype name of the item to filter.
Note: The inserter/loader must allow filters.
get_infinity_container_filter(index) → InfinityContainerFilter

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 :: uint: The index to get.
Can only be used if this is InfinityContainer
set_infinity_container_filter(index, filter)

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

Parameters
index :: uint: The index to set.
filter :: InfinityContainerFilter: The new filter or nil to clear the filter.
Can only be used if this is InfinityContainer
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: 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.
Can only be used if this is HeatInterface
get_control_behavior() → LuaControlBehavior

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

Return value
The control behavior or nil.
get_or_create_control_behavior() → LuaControlBehavior

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

Return value
The control behavior or nil.
get_circuit_network(wire, circuit_connector) → LuaCircuitNetwork

Parameters
wire :: defines.wire_type: Wire color of the network connected to this entity.
circuit_connector :: defines.circuit_connector_id (optional): The connector to get circuit network for. Must be specified for entities with more than one circuit network connector.
Return value
The circuit network or nil.
get_merged_signals(circuit_connector) → array of Signal

The merged circuit network signals or nil if there are no signals.

Parameters
circuit_connector :: defines.circuit_connector_id (optional): The connector to get signals for. Must be specified for entities with more than one circuit network connector.
Return value
The sum of signals on both the red and green networks, or nil if it doesn't have a circuit connector.
supports_backer_name() → boolean

Return value
true if this entity supports a backer name.
copy_settings(entity) → dictionary stringuint

Copies settings from the given entity onto this entity.

Parameters
entity :: LuaEntity
Return value
Any items removed from this entity as a result of copying the settings.
get_logistic_point(defines.logistic_member_index) → LuaLogisticPoint or array of LuaLogisticPoint

Gets the LuaLogisticPoint specified by the given index or if not given returns all of the points this entity owns.

Parameters
defines.logistic_member_index (optional)
Note: When the index is not given for most entities this will be a single entry. For some (such as the player character) this can be zero or more.
play_note(instrument, note) → boolean

Plays a note with the given instrument and note.

Parameters
instrument :: uint
note :: uint
Return value
If 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
Return value
If any connection was made
disconnect_rolling_stock(direction) → boolean

Tries to disconnect this rolling stock in the given direction.

Parameters
Return value
If anything was disconnected
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 loose performance by checking this in normal games.

get_recipe() → LuaRecipe

Current recipe being assembled by this machine or nil if no recipe is set.

Can only be used if this is CraftingMachine
set_recipe(recipe) → dictionary stringuint

Sets the current recipe in this assembly machine.

Parameters
recipe :: string or LuaRecipe: The new recipe or nil to clear the recipe.
Return value
Any items removed from this entity as a result of setting the recipe.
Can only be used if this is CraftingMachine
rotate(options) → boolean

Rotates this entity as if the player rotated it

Parameters
options (optional): Table with the following fields:
  • reverse :: boolean (optional)
  • by_player :: LuaPlayer (optional)
  • spill_items :: boolean (optional): If the player is not given should extra items be spilled or returned as a second return value from this.
  • enable_looted :: boolean (optional): When true, each spilled item will be flagged with the LuaEntity::to_be_looted flag.
  • force :: LuaForce or string (optional): When provided the spilled items will be marked for deconstruction by this force.
Return value
If the rotation was successful.
get_driver() → LuaEntity or LuaPlayer

Gets the driver of this vehicle if any.

Note: May be 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.

Parameters
driver :: LuaEntity or LuaPlayer: The new passenger or nil to eject the current driver if any.
Note: This differs over LuaEntity::set_passenger in that the passenger can't drive the vehicle.
Can only be used if this is Vehicle
get_passenger() → LuaEntity or LuaPlayer

Gets the passenger of this car if any.

Note: May be nil if the vehicle contains no passenger. To check if there's a driver see LuaEntity::get_driver.
Note: This differs over LuaEntity::get_driver in that the passenger can't drive the car.
Can only be used if this is Car
set_passenger(passenger)

Sets the passenger of this car.

Parameters
passenger :: LuaEntity or LuaPlayer
Note: This differs over LuaEntity::get_driver in that the passenger can't drive the car.
Can only be used if this is Car
is_connected_to_electric_network() → boolean

Returns true if this entity is connected to an electric network.

get_train_stop_trains() → array of 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 or nil if none.

Can only be used if this is TrainStop
clone{position=…, surface=…, force=…} → LuaEntity

Clones this entity.

Parameters
Table with the following fields:
Return value
The cloned entity or nil if this entity can't be cloned/can't be cloned to the given location.
get_fluid_count(fluid) → double

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

Parameters
fluid :: string (optional): Prototype name of the fluid to count. If not specified, count all fluids.
get_fluid_contents() → dictionary stringdouble

Get amounts of all fluids in this entity.

Return value
The amounts, indexed by fluid names.
remove_fluid{name=…, amount=…, minimum_temperature=…, maximum_temperature=…, temperature=…} → double

Remove fluid from this entity.

Parameters
Table with the following fields:
  • name :: string: Fluid prototype name.
  • amount :: double: Amount to remove
  • minimum_temperature :: double (optional)
  • maximum_temperature :: double (optional)
  • temperature :: double (optional)
Return value
Amount of fluid actually removed.
Note: If temperature is given only fluid matching that exact temperature is removed. If minimum and maximum is given fluid within that range is removed.
insert_fluid(fluid) → double

Insert fluid into this entity. Fluidbox is chosen automatically.

Parameters
fluid :: Fluid: Fluid to insert.
Return value
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 Position
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 Position
Can only be used if this is Beam
get_radius() → double

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

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
toggle_equipment_movement_bonus()

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

Note: This property can also be read and written on the equipment grid of this entity.
can_shoot(target, position) → boolean

If this character can shoot the given entity or position.

Parameters
target :: LuaEntity
position :: Position
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.

name :: string [Read-only]

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

ghost_name :: string [Read-only]

Name of the entity or tile contained in this ghost

Can only be used if this is Ghost
localised_name :: LocalisedString [Read-only]

Localised name of the entity.

localised_description :: LocalisedString [Read-only]

ghost_localised_name :: LocalisedString [Read-only]

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

Can only be used if this is Ghost
ghost_localised_description :: LocalisedString [Read-only]

Can only be used if this is Ghost
type :: string [Read-only]

The entity prototype type of this entity.

ghost_type :: string [Read-only]

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

Can only be used if this is Ghost
active :: boolean [Read-Write]

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

Note: Entities that are not active naturally can't be set to be active (setting it to be active will do nothing)
Note: Ghosts, simple smoke, and corpses can't be modified at this time.
Note: It is even possible to set the character to not be active, so he can't move and perform most of the tasks.
destructible :: boolean [Read-Write]

When the entity is not destructible it can't be damaged.

Note: An indestructible entity can still be mined.
Note: Entities that are indestructible naturally (they have no health, like smoke, resource etc) can't be set to be destructible.
minable :: boolean [Read-Write]

Note: Not minable entities can still be destroyed.
Note: Entities that are not minable naturally (like smoke, character, enemy units etc) can't be set to minable.
rotatable :: boolean [Read-Write]

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

Note: Entities that are not rotatable naturally (like chest or furnace) can't be set to be rotatable.
operable :: boolean [Read-Write]

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 :: float [Read-Write]

Health of the entity. Setting health to less than 0 will set health to 0, entities with 0 health can not be attacked. Setting health to higher than max health will set health to max health.

Note: If used on an entity that doesn't support health, this field will be nil.
direction :: defines.direction [Read-Write]

The current direction this entity is facing.

supports_direction :: boolean [Read-only]

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

orientation :: float [Read-Write]

The smooth orientation.

cliff_orientation :: string [Read-only]

The orientation of this cliff.

amount :: uint [Read-Write]

Count of resource units contained.

Can only be used if this is ResourceEntity
initial_amount :: uint [Read-Write]

Count of initial resource units contained.

Note: If this is not an infinite resource reading will give nil and writing will give an error.
Can only be used if this is ResourceEntity
effectivity_modifier :: float [Read-Write]

Multiplies the acceleration the vehicle can create for one unit of energy. By default is 1.

Can only be used if this is Car
consumption_modifier :: float [Read-Write]

Multiplies the energy consumption.

Can only be used if this is Car
friction_modifier :: float [Read-Write]

Multiplies the car friction rate.

Example
This will allow the car to go much faster
game.player.vehicle.friction_modifier = 0.5
Can only be used if this is Car
speed :: float [Read-Write]

The current speed of the car or rolling stock, or current max speed of the unit. Only the speed of units and cars is writable.

stack :: LuaItemStack [Read-only]

Can only be used if this is ItemEntity
prototype :: LuaEntityPrototype [Read-only]

The entity prototype of this entity.

ghost_prototype :: LuaEntityPrototype or LuaTilePrototype [Read-only]

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

Can only be used if this is Ghost
drop_position :: Position [Read-Write]

Position where the entity puts its stuff.

Note: Meaningful only for entities that put stuff somewhere, such as mining drills or inserters. Mining drills 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.
pickup_position :: Position [Read-Write]

Where the inserter will pick up items from.

Note: 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 :: LuaEntity [Read-Write]

The entity this entity is putting its stuff to or nil if there is no such entity.

Note: Meaningful only for entities that put stuff somewhere, such as mining drills or inserters.
pickup_target :: LuaEntity [Read-Write]

The entity the inserter will attempt to pick up from. For example, this can be a transport belt or a storage chest.

Can only be used if this is Inserter
selected_gun_index :: uint [Read-Write]

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

Can only be used if this is Character or Car
energy :: double [Read-Write]

Energy stored in the entity (heat in furnace, 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 :: double [Read-Write]

The temperature of this entities heat energy source if this entity uses a heat energy source or nil.

previous_recipe :: LuaRecipe [Read-only]

The previous recipe this furnace was using or nil if the furnace had no previous recipe.

Can only be used if this is Furnace
held_stack :: LuaItemStack [Read-only]

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

Can only be used if this is Inserter
held_stack_position :: Position [Read-only]

Current position of the inserter's "hand".

Can only be used if this is Inserter
train :: LuaTrain [Read-only]

The train this rolling stock belongs to or nil if not rolling stock.

Can only be used if this is RollingStock
neighbours :: dictionary stringarray of LuaEntity or array of array of LuaEntity or LuaEntity [Read-only]

  • When called on an electric pole, this is a dictionary of all connections, indexed by the strings "copper", "red", and "green".
  • 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 or reactor, this is a dictionary of all connections indexed by the connection direction "north", "south", "east", and "west".

belt_neighbours :: dictionary stringarray of LuaEntity [Read-only]

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. This is a dictionary with "inputs", "outputs" entries that are arrays of transport belt connectable entities, or empty tables if no entities.

Can only be used if this is TransportBeltConnectable
fluidbox :: LuaFluidBox [Read-Write]

Fluidboxes of this entity.

backer_name :: string [Read-Write]

The name of a backer (of Factorio) assigned to a lab or train station / stop.

Note: Only useable on entities that support backer names. Returns nil when the entity doesn't support a backer name.
time_to_live :: uint [Read-Write]

The ticks left before a ghost, combat robot or highlight box is destroyed.

  • for ghosts set to uint32 max (4,294,967,295) to never expire.
  • for ghosts Cannot be set higher than LuaForce::ghost_time_to_live of the entity's force.

color :: Color [Read-Write]

The character, rolling stock, train stop, flying text, or simple-entity-with-owner color. Returns nil if this entity doesn't use custom colors.

text :: LocalisedString [Read-Write]

The text of this flying-text entity.

Can only be used if this is FlyingText
signal_state :: defines.signal_state [Read-only]

The state of this rail signal.

Can only be used if this is RailSignal
chain_signal_state :: defines.chain_signal_state [Read-only]

The state of this chain signal.

Can only be used if this is RailChainSignal
to_be_looted :: boolean [Read-Write]

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

Can only be used if this is ItemEntity
crafting_speed :: double [Read-only]

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

Can only be used if this is CraftingMachine
crafting_progress :: float [Read-Write]

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

Can only be used if this is CraftingMachine
bonus_progress :: double [Read-Write]

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

Can only be used if this is CraftingMachine
belt_to_ground_type :: string [Read-only]

"input" or "output", depending on whether this underground belt goes down or up.

Can only be used if this is TransportBeltToGround
loader_type :: string [Read-Write]

"input" or "output", depending on whether this loader puts to or gets from a container.

Can only be used if this is Loader
rocket_parts :: uint [Read-Write]

Number of rocket parts in the silo.

Can only be used if this is RocketSilo
logistic_network :: LuaLogisticNetwork [Read-only]

The logistic network this entity is a part of.

logistic_cell :: LuaLogisticCell [Read-only]

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 :: dictionary stringuint [Read-Write]

Items this ghost will request when revived or items this item request proxy is requesting. Result is a dictionary mapping each item prototype name to the required count.

player :: LuaPlayer [Read-only]

The player connected to this character or nil if none.

Can only be used if this is Character
unit_group :: LuaUnitGroup [Read-only]

The unit group this unit is a member of, or nil if none.

Can only be used if this is Unit
damage_dealt :: double [Read-Write]

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

Can only be used if this is Turret
kills :: uint [Read-Write]

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

Can only be used if this is Turret
last_user :: LuaPlayer [Read-Write]

The player who built the entity

Can only be used if this is EntityWithOwner
electric_buffer_size :: double [Read-Write]

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

Note: Write access is limited to the ElectricEnergyInterface type
electric_input_flow_limit :: double [Read-only]

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

electric_output_flow_limit :: double [Read-only]

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

electric_drain :: double [Read-only]

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

electric_emissions :: double [Read-only]

The emissions for the electric energy source or nil if the entity doesn't have an electric energy source.

unit_number :: uint [Read-only]

The unit number or nil if the entity doesn't have one. This is universally unique for every entity that has one, for the lifetime of a whole game.

ghost_unit_number :: uint [Read-only]

The unit number of the entity contained in this ghost or nil if the entity doesn't have one.

Can only be used if this is EntityGhost
mining_progress :: double [Read-Write]

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

bonus_mining_progress :: double [Read-Write]

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

power_production :: double [Read-Write]

The power production specific to the ElectricEnergyInterface entity type.

Can only be used if this is ElectricEnergyInterface
power_usage :: double [Read-Write]

The power usage specific to the ElectricEnergyInterface entity type.

Can only be used if this is ElectricEnergyInterface
bounding_box :: BoundingBox [Read-only]

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

secondary_bounding_box :: BoundingBox [Read-only]

The secondary bounding box of this entity or nil if it doesn't have one.

selection_box :: BoundingBox [Read-only]

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

secondary_selection_box :: BoundingBox [Read-only]

The secondary selection box of this entity or nil if it doesn't have one.

mining_target :: LuaEntity [Read-only]

The mining target or nil if none

Can only be used if this is MiningDrill
circuit_connected_entities :: table [Read-only]

Entities connected to this entity via the circuit network.

It is a table:

  • red :: array of LuaEntity: Entities connected via the red wire.
  • green :: array of LuaEntity: Entities connected via the green wire.

circuit_connection_definitions :: array of CircuitConnectionDefinition [Read-only]

The connection definition for entities connected to this entity via the circuit network.

Each CircuitConnectionDefinition is a table:

request_slot_count :: uint [Read-only]

The number of request slots this entity has.

filter_slot_count :: uint [Read-only]

The number of filter slots this inserter or loader has. 0 if not an inserter or loader.

loader_container :: LuaEntity [Read-only]

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

Can only be used if this is Loader
grid :: LuaEquipmentGrid [Read-only]

The equipment grid or nil if this entity doesn't have an equipment grid.

graphics_variation :: uint8 [Read-Write]

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

tree_color_index :: uint8 [Read-Write]

Index of the tree color.

tree_color_index_max :: uint8 [Read-only]

Maximum index of the tree colors.

tree_stage_index :: uint8 [Read-Write]

Index of the tree stage.

tree_stage_index_max :: uint8 [Read-only]

Maximum index of the tree stages.

burner :: LuaBurner [Read-only]

The burner energy source for this entity or nil if there isn't one.

shooting_target :: LuaEntity [Read-Write]

The shooting target for this turret or nil.

proxy_target :: LuaEntity [Read-only]

The target entity for this item-request-proxy or nil

stickers :: array of LuaEntity [Read-only]

The sticker entities attached to this entity.

sticked_to :: LuaEntity [Read-only]

The entity this sticker is sticked to.

parameters :: ProgrammableSpeakerParameters [Read-Write]

Can only be used if this is ProgrammableSpeaker
alert_parameters :: ProgrammableSpeakerAlertParameters [Read-Write]

Can only be used if this is ProgrammableSpeaker
electric_network_statistics :: LuaFlowStatistics [Read-only]

The electric network statistics for this electric pole.

Can only be used if this is ElectricPole
inserter_stack_size_override :: uint [Read-Write]

Sets the stack size limit on this inserter. If the stack size is > than the force stack size limit the value is ignored.

Note: Set to 0 to reset.
products_finished :: uint [Read-Write]

Can only be used if this is CraftingMachine
spawner :: LuaEntity [Read-only]

The spawner associated with this unit entity or nil if the unit has no associated spawner.

units :: array of LuaEntity [Read-only]

The units associated with this spawner entity.

power_switch_state :: boolean [Read-Write]

The state of this power switch.

relative_turret_orientation :: float [Read-Write]

The relative orientation of the vehicle turret or nil if this entity isn't a vehicle or have a vehicle turret.

Note: Writing does nothing if the vehicle doesn't have a turret.
Can only be used if this is Vehicle
effects :: Effects [Read-only]

The effects being applied to this entity or nil. For beacons this is the effect the beacon is broadcasting.

infinity_container_filters :: array of InfinityContainerFilter [Read-Write]

The filters for this infinity container.

Can only be used if this is InfinityContainer
remove_unfiltered_items :: boolean [Read-Write]

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

Can only be used if this is InfinityContainer
character_corpse_player_index :: uint [Read-Write]

The player index associated with this character corpse.

Note: 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 :: uint [Read-Write]

The tick this character corpse died at.

Can only be used if this is CharacterCorpse
character_corpse_death_cause :: LocalisedString [Read-Write]

The reason this character corpse character died (if any).

Can only be used if this is CharacterCorpse
associated_player :: LuaPlayer [Read-Write]

The player this character is associated with or nil if none. When the player logs off in multiplayer all of the associated characters will be logged off with him.

Note: A character associated with a player is not directly controlled by any player.
Note: Set to nil to clear. The player will be automatically disassociated when a controller is set on the character.
Can only be used if this is Character
tick_of_last_attack :: uint [Read-only]

The last tick this character entity was attacked.

Can only be used if this is Character
tick_of_last_damage :: uint [Read-only]

The last tick this character entity was damaged.

Can only be used if this is Character
splitter_filter :: LuaItemPrototype [Read-Write]

The filter for this splitter or nil if no filter is set.

Can only be used if this is Splitter
inserter_filter_mode :: string [Read-Write]

The filter mode for this filter inserter: "whitelist", "blacklist", or nil if this inserter doesn't use filters.

Can only be used if this is Inserter
splitter_input_priority :: string [Read-Write]

The input priority for this splitter : "left", "none", or "right".

Can only be used if this is Splitter
splitter_output_priority :: string [Read-Write]

The output priority for this splitter : "left", "none", or "right".

Can only be used if this is Splitter
armed :: boolean [Read-only]

If this land mine is armed.

Can only be used if this is LandMine
recipe_locked :: boolean [Read-Write]

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 :: LuaEntity [Read-only]

The rail entity this train stop is connected to or nil if there is none.

Can only be used if this is TrainStop
trains_in_block :: uint [Read-only]

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

Can only be used if this is Rail
timeout :: uint [Read-Write]

The timeout left on this landmine in ticks.

Can only be used if this is LandMine
neighbour_bonus :: double [Read-only]

The current total neighbour bonus of this reactor.

Can only be used if this is Reactor
ai_settings :: LuaAISettings [Read-only]

The ai settings of this unit.

Can only be used if this is Unit
highlight_box_type :: string [Read-Write]

The hightlight box type of this highlight box entity.

Can only be used if this is HighlightBox
status :: defines.entity_status [Read-only]

The status of this entity or nil if no status.

enable_logistics_while_moving :: boolean [Read-Write]

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

Can only be used if this is Vehicle
render_player :: LuaPlayer [Read-Write]

The player that this simple-entity-with-owner, simple-entity-with-force, flying-text or highlight-box is visible to or nil. Set to nil to clear.

render_to_forces :: array of ForceSpecification [Read-Write]

The forces that this simple-entity-with-owner, simple-entity-with-force or flying-text is visible to or nil. Set to nil to clear.

Note: Reading will always give an array of LuaForce
pump_rail_target :: LuaEntity [Read-only]

The rail target of this pump or nil.

Can only be used if this is Pump
moving :: LuaEntity [Read-only]

Returns true if this unit is moving.

Can only be used if this is Unit
electric_network_id :: uint [Read-only]

Returns the id of the electric network that this entity is connected to or nil.

allow_dispatching_robots :: boolean [Read-Write]

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

Can only be used if this is Character
auto_launch :: boolean [Read-Write]

Whether this rocket silo automatically launches the rocket when cargo is inserted.

Can only be used if this is RocketSilo
energy_generated_last_tick :: double [Read-only]

How much energy this generator generated in the last tick.

Can only be used if this is Generator
storage_filter :: LuaItemPrototype [Read-Write]

The storage filter for this logistic storage container.