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.
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; |
Inventory for storing modules of this entity; |
||
get_fuel_inventory() | → LuaInventory? |
The fuel inventory for this entity or |
The fuel inventory for this entity or |
||
get_burnt_result_inventory() | → LuaInventory? |
The burnt result inventory for this entity or |
The burnt result inventory for this entity or |
||
damage(damage, force, type?, dealer?) | → float |
Damages the entity. |
Damages the entity. |
||
can_be_destroyed() | → boolean |
Checks if the entity can be destroyed |
Checks if the entity can be destroyed |
||
destroy{do_cliff_correction?=…, raise_destroy?=…} | → boolean |
Destroys the entity. |
Destroys the entity. |
||
set_command(command) |
Give the entity a command. |
|
Give the entity a command. |
||
set_distraction_command(command) |
Give the entity a distraction command. |
|
Give the entity a distraction command. |
||
has_command() | → boolean |
Has this unit been assigned a command? |
Has this unit been assigned a command? |
||
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. |
||
connect_neighbour(target) | → boolean |
Connect two devices with a circuit wire or copper cable. |
Connect two devices with a circuit wire or copper cable. |
||
disconnect_neighbour(target?) |
Disconnect circuit wires or copper cables between devices. |
|
Disconnect circuit wires or copper cables between devices. |
||
order_deconstruction(force, player?) | → 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{force=…, target=…, player?=…, direction?=…} | → 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? |
||
get_request_slot(slot) | → SimpleItemStack? |
Get a logistic requester slot. |
Get a logistic requester slot. |
||
set_request_slot(request, slot) | → boolean |
Set a logistic requester slot. |
Set a logistic requester slot. |
||
clear_request_slot(slot) |
Clear a logistic requester slot. |
|
Clear a logistic requester slot. |
||
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_max_transport_line_index() | → uint |
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() | → boolean |
|
revive{return_item_request_proxy?=…, raise_revive?=…} | → dictionary[string → uint]?, LuaEntity?, LuaEntity? |
Revive a ghost. |
Revive a ghost. |
||
silent_revive{return_item_request_proxy?=…, raise_revive?=…} | → dictionary[string → uint]?, LuaEntity?, LuaEntity? |
Revives a ghost silently. |
Revives a ghost silently. |
||
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_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. |
Get the rail signal or 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 |
Get all rails of a rail segment this rail is in |
||
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) | → string? |
Get the filter for a slot in an inserter, loader, or logistic storage container. |
Get the filter for a slot in an inserter, loader, or logistic storage container. |
||
set_filter(slot_index, item) |
Set the filter for a slot in an inserter, loader, or logistic storage container. |
|
Set the filter for a slot in an inserter, loader, or logistic storage container. |
||
get_infinity_container_filter(index) | → InfinityInventoryFilter? |
Gets the filter for this infinity container at the given index, or |
Gets the filter for this infinity container at the given index, or |
||
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 |
Gets the filter for this infinity pipe, or |
||
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, circuit_connector?) | → LuaCircuitNetwork? |
|
get_merged_signal(signal, circuit_connector?) | → int |
Read a single signal from the combined circuit networks. |
Read a single signal from the combined circuit networks. |
||
get_merged_signals(circuit_connector?) | → array[Signal]? |
The merged circuit network signals or |
The merged circuit network signals or |
||
supports_backer_name() | → boolean |
Whether this entity supports a backer name. |
Whether this entity supports a backer name. |
||
copy_settings(entity, by_player?) | → dictionary[string → uint] |
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 |
Gets all the |
||
play_note(instrument, note) | → 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? |
Current recipe being assembled by this machine or |
Current recipe being assembled by this machine or |
||
set_recipe(recipe) | → dictionary[string → uint] |
Sets the current recipe in this assembly machine. |
Sets the current recipe in this assembly machine. |
||
rotate{reverse?=…, by_player?=…, spill_items?=…, enable_looted?=…, force?=…} | → boolean, dictionary[string → uint]? |
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 or spidertron if any. |
Gets the passenger of this car or spidertron if any. |
||
set_passenger(passenger) |
Sets the passenger of this car or spidertron. |
|
Sets the passenger of this car or spidertron. |
||
is_connected_to_electric_network() | → boolean |
Returns |
Returns |
||
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 → double] |
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? |
Returns the new entity prototype. |
Returns the new entity prototype. |
||
get_upgrade_direction() | → defines.direction? |
Returns the new entity direction after upgrading. |
Returns the new entity direction after upgrading. |
||
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". |
||
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_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 |
||
help() | → string |
All methods and properties that this object supports. |
All methods and properties that this object supports. |
||
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. |
||
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 |
If set to |
||
minable [RW] | :: boolean |
|
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. |
||
direction [RW] | :: defines.direction |
The current direction this entity is facing. |
The current direction this entity is facing. |
||
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] | :: uint |
Count of resource units contained. |
Count of resource units contained. |
||
initial_amount [RW] | :: uint? |
Count of initial resource units contained. |
Count of initial resource units contained. |
||
effectivity_modifier [RW] | :: float |
Multiplies the acceleration the vehicle can create for one unit of energy. |
Multiplies the acceleration the vehicle 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] | :: uint? |
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 (heat in furnace, energy stored in electrical devices etc.). |
Energy stored in the entity (heat in furnace, 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] | :: LuaRecipe? |
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 → array[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] | :: dictionary[string → array[LuaEntity]] |
The belt connectable neighbours of this belt connectable entity. |
The belt connectable neighbours of this belt connectable entity. |
||
fluidbox [RW] | :: 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 entity, if any. |
The label on this entity, if any. |
||
time_to_live [RW] | :: uint |
The ticks left before a ghost, combat robot, highlight box or smoke with trigger is destroyed. |
The ticks left before a ghost, combat robot, highlight box or smoke with trigger is destroyed. |
||
color [RW] | :: Color? |
The color of this character, rolling stock, train stop, car, spider-vehicle, flying text, corpse or simple-entity-with-owner. |
The color of this character, rolling stock, train stop, car, spider-vehicle, flying text, corpse or simple-entity-with-owner. |
||
text [RW] | :: LocalisedString |
The text of this flying-text entity. |
The text of this flying-text entity. |
||
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 entity be picked up automatically when the player walks over it? |
Will this 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]. |
||
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] | :: string |
|
|
||
loader_type [RW] | :: string |
|
|
||
rocket_parts [RW] | :: uint |
Number of rocket parts in the silo. |
Number of rocket parts in the silo. |
||
logistic_network [RW] | :: LuaLogisticNetwork |
The logistic network this entity is a part of, or |
The logistic network this entity is a part of, or |
||
logistic_cell [R] | :: LuaLogisticCell |
The logistic cell this entity is a part of. |
The logistic cell this entity is a part of. |
||
item_requests [RW] | :: dictionary[string → uint] |
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. |
||
player [R] | :: LuaPlayer? |
The player connected to this character, if any. |
The player connected to this character, if any. |
||
unit_group [R] | :: LuaUnitGroup? |
The unit group this unit is a member of, if any. |
The unit group this unit is a member of, 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] | :: uint |
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. |
||
last_user [RW] | :: LuaPlayer or 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_input_flow_limit [R] | :: double? |
The input flow limit for the electric energy source. |
The input flow limit for the electric energy source. |
||
electric_output_flow_limit [R] | :: double? |
The output flow limit for the electric energy source. |
The output flow limit 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 [R] | :: double? |
The emissions for the electric energy source. |
The emissions for the electric energy source. |
||
unit_number [R] | :: uint? |
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] | :: uint? |
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. |
||
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 |
The secondary bounding box of this entity or |
||
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 |
The secondary selection box of this entity or |
||
mining_target [R] | :: LuaEntity? |
The mining target, if any. |
The mining target, if any. |
||
circuit_connected_entities [R] | :: table? |
Entities that are directly connected to this entity via the circuit network. |
Entities that are directly connected to this entity via the circuit network. |
||
circuit_connection_definitions [R] | :: array[CircuitConnectionDefinition]? |
The connection definition for entities that are directly connected to this entity via the circuit network. |
The connection definition for entities that are directly connected to this entity via the circuit network. |
||
request_slot_count [R] | :: uint |
The index of the configured request with the highest index for this entity. |
The index of the configured request with the highest index for this entity. |
||
filter_slot_count [R] | :: uint |
The number of filter slots this inserter, loader, or logistic storage container has. |
The number of filter slots this inserter, loader, 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. |
||
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] | :: uint |
Returns the current target pickup count of the inserter. |
Returns the current target pickup count of the inserter. |
||
inserter_stack_size_override [RW] | :: uint |
Sets the stack size limit on this inserter. |
Sets the stack size limit on this inserter. |
||
products_finished [RW] | :: uint |
The number of products this machine finished crafting in its lifetime. |
The number of products this machine finished crafting in its lifetime. |
||
spawner [R] | :: LuaEntity? |
The spawner associated with this unit entity, if any. |
The spawner associated with this unit entity, if any. |
||
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. |
||
effects [R] | :: ModuleEffects? |
The effects being applied to this entity, if any. |
The effects being applied to this entity, if any. |
||
beacons_count [R] | :: uint? |
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] | :: uint |
The player index associated with this character corpse. |
The player index associated with this character corpse. |
||
character_corpse_tick_of_death [RW] | :: uint |
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 [RW] | :: LuaPlayer or PlayerIdentification? |
The player this character is associated with, if any. |
The player this character is associated with, if any. |
||
tick_of_last_attack [RW] | :: uint |
The last tick this character entity was attacked. |
The last tick this character entity was attacked. |
||
tick_of_last_damage [RW] | :: uint |
The last tick this character entity was damaged. |
The last tick this character entity was damaged. |
||
splitter_filter [RW] | :: LuaItemPrototype? |
The filter for this splitter, if any is set. |
The filter for this splitter, if any is set. |
||
inserter_filter_mode [RW] | :: string? |
The filter mode for this filter inserter. |
The filter mode for this filter inserter. |
||
splitter_input_priority [RW] | :: string |
The input priority for this splitter. |
The input priority for this splitter. |
||
splitter_output_priority [RW] | :: string |
The output priority for this splitter. |
The output priority for this splitter. |
||
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] | :: uint |
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] | :: uint |
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] | :: string |
The hightlight box type of this highlight box entity. |
The hightlight box type of this highlight box entity. |
||
highlight_box_blink_interval [RW] | :: uint |
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. |
||
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 [RW] | :: LuaPlayer or PlayerIdentification? |
The player that this |
The player that this |
||
render_to_forces [RW] | :: array[ForceIdentification]? |
The forces that this |
The forces that this |
||
pump_rail_target [R] | :: LuaEntity? |
The rail target of this pump, if any. |
The rail target of this pump, if any. |
||
moving [R] | :: boolean |
Returns true if this unit is moving. |
Returns true if this unit is moving. |
||
electric_network_id [R] | :: uint? |
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. |
||
auto_launch [RW] | :: boolean |
Whether this rocket silo automatically launches the rocket when cargo is inserted. |
Whether this rocket silo automatically launches the rocket when cargo is inserted. |
||
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 [RW] | :: LuaItemPrototype |
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. |
||
command [R] | :: Command? |
The command given to this unit, if any. |
The command given to this unit, if any. |
||
distraction_command [R] | :: Command? |
The distraction command given to this unit, if any. |
The distraction command given to this unit, if any. |
||
time_to_next_effect [RW] | :: uint |
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] | :: uint |
Amount of trains related to this particular train stop. |
Amount of trains related to this particular train stop. |
||
trains_limit [RW] | :: uint |
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_entity_with_force [R] | :: boolean |
(deprecated by 1.1.51) If this entity is a MilitaryTarget. |
(deprecated by 1.1.51) If this entity is a MilitaryTarget. |
||
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] | :: uint |
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] | :: string |
Type of linked belt: it is either |
Type of linked belt: it is either |
||
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. |
||
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]. |
||
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] | :: uint |
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] | :: uint |
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). |
||
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. |
Gets the entity's output inventory if it has one.
→ LuaInventory? |
A reference to the entity's output inventory. |
Inventory for storing modules of this entity; nil
if this entity has no module inventory.
The fuel inventory for this entity or nil
if this entity doesn't have a fuel inventory.
The burnt result inventory for this entity or nil
if this entity doesn't have a burnt result inventory.
Damages the entity.
damage | :: float |
The amount of damage to be done. |
The amount of damage to be done. |
||
force | :: ForceIdentification |
The force that will be doing the damage. |
The force that will be doing the damage. |
||
type | :: string? |
The type of damage to be done, defaults to "impact". Can't be |
The type of damage to be done, defaults to "impact". Can't be |
||
dealer | :: LuaEntity? |
The entity to consider as the damage dealer. Needs to be on the same surface as the entity being damaged. |
The entity to consider as the damage dealer. Needs to be on the same surface as the entity being damaged. |
→ float |
the total damage actually applied after resistances. |
on_entity_damaged instantly |
|
Destroys the entity.
do_cliff_correction | :: boolean? |
Whether neighbouring cliffs should be corrected. Defaults to |
Whether neighbouring cliffs should be corrected. Defaults to |
||
raise_destroy | :: boolean? |
If |
If |
→ boolean |
Returns |
script_raised_destroy? instantly |
Raised if the |
Not all entities can be destroyed - things such as rails under trains cannot be destroyed until the train is moved or destroyed.
Give the entity a distraction command.
command | :: Command |
|
Has this unit been assigned a command?
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.
force | :: ForceIdentification? |
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. |
→ boolean |
Whether the entity was successfully killed. |
on_entity_died? instantly |
Raised if the entity was successfully killed. If |
on_post_entity_died? instantly |
Raised if the entity was successfully killed. |
This function can be called with only the
|
Test whether this entity's prototype has a certain flag set.
flag | :: string |
The flag to test. See EntityPrototypeFlags for a list of flags. |
The flag to test. See EntityPrototypeFlags for a list of flags. |
→ boolean |
|
entity.has_flag(f)
is a shortcut for entity.prototype.has_flag(f)
.
Same as LuaEntity::has_flag, but targets the inner entity on a entity ghost.
flag | :: string |
The flag to test. See EntityPrototypeFlags for a list of flags. |
The flag to test. See EntityPrototypeFlags for a list of flags. |
→ boolean |
|
Offer a thing on the market.
offer | :: Offer |
|
Adds market offer, 1 copper ore for 10 iron ore.
|
Adds market offer, 1 copper ore for 5 iron ore and 5 stone ore.
|
Remove an offer from a market.
offer | :: uint |
Index of offer to remove. |
Index of offer to remove. |
→ boolean |
|
The other offers are moved down to fill the gap created by removing the offer, which decrements the overall size of the offer array.
Get all offers in a market as an array.
Connect two devices with a circuit wire or copper cable. Depending on which type of connection should be made, there are different procedures:
target
must be a LuaEntity that specifies another electric pole. This will connect them with copper cable.target
must be a table of type WireConnectionDefinition.target | :: LuaEntity or WireConnectionDefinition |
The target with which to establish a connection. |
The target with which to establish a connection. |
→ boolean |
Whether the connection was successfully formed. |
Disconnect circuit wires or copper cables between devices. Depending on which type of connection should be cut, there are different procedures:
target
parameter blank: pole.disconnect_neighbour()
.target
to defines.wire_type.red or defines.wire_type.green.target
must be a LuaEntity that specifies the other pole: pole1.disconnect_neighbour(pole2)
.target
must be a table of type WireConnectionDefinition.target | :: defines.wire_type or LuaEntity or WireConnectionDefinition? |
The target with which to cut a connection. |
The target with which to cut a connection. |
Sets the entity to be deconstructed by construction robots.
force | :: ForceIdentification |
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 |
The player to set the |
→ boolean |
if the entity was marked for deconstruction. |
on_marked_for_deconstruction? instantly |
Raised if the entity was successfully marked for deconstruction. |
Cancels deconstruction if it is scheduled, does nothing otherwise.
force | :: ForceIdentification |
The force who did the deconstruction order. |
The force who did the deconstruction order. |
||
player | :: PlayerIdentification? |
The player to set the |
The player to set the |
on_cancelled_deconstruction? instantly |
Raised if the entity's deconstruction was successfully cancelled. |
Is this entity marked for deconstruction?
Sets the entity to be upgraded by construction robots.
force | :: ForceIdentification |
The force whose robots are supposed to do the upgrade. |
The force whose robots are supposed to do the upgrade. |
||
target | :: EntityPrototypeIdentification |
The prototype of the entity to upgrade to. |
The prototype of the entity to upgrade to. |
||
player | :: PlayerIdentification? |
|
direction | :: defines.direction? |
The new direction if any. |
The new direction if any. |
→ boolean |
Whether the entity was marked for upgrade. |
on_marked_for_upgrade? instantly |
Raised if the entity was successfully marked for upgrade. |
Cancels upgrade if it is scheduled, does nothing otherwise.
force | :: ForceIdentification |
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. |
→ boolean |
Whether the cancel was successful. |
on_cancelled_upgrade? instantly |
Raised if the entity way previously marked for upgrade. |
Is this entity marked for upgrade?
Get a logistic requester slot.
slot | :: uint |
The slot index. |
The slot index. |
→ SimpleItemStack? |
Contents of the specified slot; |
Useable only on entities that have requester slots.
Set a logistic requester slot.
request | :: ItemStackIdentification |
What to request. |
What to request. |
||
slot | :: uint |
The slot index. |
The slot index. |
→ boolean |
Whether the slot was set. |
Useable only on entities that have requester slots.
Clear a logistic requester slot.
slot | :: uint |
The slot index. |
The slot index. |
Useable only on entities that have requester slots.
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.
force | :: ForceIdentification |
The force that requests the gate to be open. |
The force that requests the gate to be open. |
||
extra_time | :: uint? |
Extra ticks to stay open. |
Extra ticks to stay open. |
force | :: ForceIdentification |
The force that requests the gate to be closed. |
The force that requests the gate to be closed. |
Get a transport line of a belt or belt connectable entity.
index | :: uint |
Index of the requested transport line. Transport lines are 1-indexed. |
Index of the requested transport line. Transport lines are 1-indexed. |
Get the maximum transport line index of a belt or belt connectable entity.
→ boolean |
|
on_rocket_launch_ordered? instantly |
Raised if the rocket launch was successfully initiated. |
Revive a ghost. I.e. turn it from a ghost to a real entity or tile.
return_item_request_proxy | :: boolean? |
If |
If |
||
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. |
→ dictionary[string → uint]? |
Any items the new real entity collided with or |
→ LuaEntity? |
The revived entity if an entity ghost was successfully revived. |
→ LuaEntity? |
The item request proxy if it was requested with |
script_raised_revive? instantly |
Raised if this was an entity ghost and the |
script_raised_set_tiles? instantly |
Raised if this was a tile ghost and the |
Revives a ghost silently.
return_item_request_proxy | :: boolean? |
If |
If |
||
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. |
→ dictionary[string → uint]? |
Any items the new real entity collided with or |
→ LuaEntity? |
The revived entity if an entity ghost was successfully revived. |
→ LuaEntity? |
The item request proxy if it was requested with |
script_raised_revive? instantly |
Raised if this was an entity ghost and the |
script_raised_set_tiles? instantly |
Raised if this was a tile ghost and the |
rail_direction | :: defines.rail_direction |
|
rail_connection_direction | :: defines.rail_connection_direction |
|
→ LuaEntity? |
Rail connected in the specified manner to this one, |
→ 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 |
Get the rails that this signal is connected to.
Get the rail signal or train stop at the start/end of the rail segment this rail is in.
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 entity at the entrance of the rail segment, otherwise gets the entity at the exit of the rail segment. |
If true, gets the entity at the entrance of the rail segment, otherwise gets the entity at the exit of the rail segment. |
→ LuaEntity? |
|
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Get the rail at the end of the rail segment this rail is in.
direction | :: defines.rail_direction |
|
→ LuaEntity |
The rail entity. |
→ defines.rail_direction |
A rail direction pointing out of the rail segment from the end rail. |
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
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 |
→ array[LuaEntity] |
Rails of this rail segment |
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
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.
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.
Checks if this rail and other rail both belong to the same rail segment.
other_rail | :: LuaEntity |
|
Checks if this rail and other rail both belong to the same rail block.
other_rail | :: 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.
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.
Returns all signals guarding entrance to a rail block this rail belongs to.
Returns all signals guarding exit from a rail block this rail belongs to.
Get the filter for a slot in an inserter, loader, or logistic storage container.
slot_index | :: uint |
Index of the slot to get the filter for. |
Index of the slot to get the filter for. |
→ string? |
Prototype name of the item being filtered. |
The entity must allow filters.
Set the filter for a slot in an inserter, loader, or logistic storage container.
slot_index | :: uint |
Index of the slot to set the filter for. |
Index of the slot to set the filter for. |
||
item | :: string or nil |
Prototype name of the item to filter, or |
Prototype name of the item to filter, or |
The entity must allow filters.
Gets the filter for this infinity container at the given index, or nil
if the filter index doesn't exist or is empty.
index | :: uint |
The index to get. |
The index to get. |
Sets the filter for this infinity container at the given index.
index | :: uint |
The index to set. |
The index to set. |
||
filter | :: InfinityInventoryFilter or nil |
The new filter, or |
The new filter, or |
Gets the filter for this infinity pipe, or nil
if the filter is empty.
Sets the filter for this infinity pipe.
filter | :: InfinityPipeFilter or nil |
The new filter, or |
The new filter, or |
Gets the heat setting for this heat interface.
Sets the heat setting for this heat interface.
filter | :: HeatSetting |
The new setting. |
The new setting. |
Gets the control behavior of the entity (if any).
→ LuaControlBehavior? |
The control behavior or |
Gets (and or creates if needed) the control behavior of the entity.
→ LuaControlBehavior? |
The control behavior or |
wire | :: defines.wire_type |
Wire color of the network connected to this entity. |
Wire color of the network connected to this entity. |
||
circuit_connector | :: defines.circuit_connector_id? |
The connector to get circuit network for. Must be specified for entities with more than one circuit network connector. |
The connector to get circuit network for. Must be specified for entities with more than one circuit network connector. |
→ LuaCircuitNetwork? |
The circuit network or nil. |
Read a single signal from the combined circuit networks.
signal | :: SignalID |
The signal to read. |
The signal to read. |
||
circuit_connector | :: defines.circuit_connector_id? |
The connector to get signals for. Must be specified for entities with more than one circuit network connector. |
The connector to get signals for. Must be specified for entities with more than one circuit network connector. |
→ int |
The current value of the signal. |
The merged circuit network signals or nil
if there are no signals.
circuit_connector | :: defines.circuit_connector_id? |
The connector to get signals for. Must be specified for entities with more than one circuit network connector. |
The connector to get signals for. Must be specified for entities with more than one circuit network connector. |
→ array[Signal]? |
The sum of signals on both the red and green networks, or |
Whether this entity supports a backer name.
Copies settings from the given entity onto this entity.
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. |
→ dictionary[string → uint] |
Any items removed from this entity as a result of copying the settings. |
Gets all the LuaLogisticPoint
s that this entity owns. Optionally returns only the point specified by the index parameter.
index | :: defines.logistic_member_index? |
If provided, only returns the |
If provided, only returns the |
When index
is not given, this will be a single LuaLogisticPoint
for most entities. For some (such as the player character), it can be zero or more.
Connects the rolling stock in the given direction.
direction | :: defines.rail_direction |
|
→ boolean |
Whether any connection was made |
Tries to disconnect this rolling stock in the given direction.
direction | :: defines.rail_direction |
|
→ boolean |
If anything was disconnected |
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.
Current recipe being assembled by this machine or nil
if no recipe is set.
Sets the current recipe in this assembly machine.
recipe | :: string or LuaRecipe |
The new recipe or |
The new recipe or |
→ dictionary[string → uint] |
Any items removed from this entity as a result of setting the recipe. |
Rotates this entity as if the player rotated it.
reverse | :: boolean? |
If |
If |
||
by_player | :: PlayerIdentification? |
If not specified, the on_player_rotated_entity event will not be fired. |
If not specified, the on_player_rotated_entity event will not be fired. |
||
spill_items | :: boolean? |
If the player is not given should extra items be spilled or returned as a second return value from this. |
If the player is not given should extra items be spilled or returned as a second return value from this. |
||
enable_looted | :: boolean? |
When true, each spilled item will be flagged with the LuaEntity::to_be_looted flag. |
When true, each spilled item will be flagged with the LuaEntity::to_be_looted flag. |
||
force | :: LuaForce or string? |
When provided the spilled items will be marked for deconstruction by this force. |
When provided the spilled items will be marked for deconstruction by this force. |
→ boolean |
Whether the rotation was successful. |
→ dictionary[string → uint]? |
Count of spilled items indexed by their prototype names if |
on_player_rotated_entity? instantly |
Raised if the |
Gets the driver of this vehicle if any.
→ LuaEntity or LuaPlayer? |
|
Sets the driver of this vehicle.
driver | :: LuaEntity or PlayerIdentification |
The new driver or |
The new driver or |
on_player_driving_changed_state? instantly |
|
This differs over LuaEntity::set_passenger in that the passenger can't drive the vehicle.
Gets the passenger of this car or spidertron if any.
→ LuaEntity or LuaPlayer? |
|
This differs over LuaEntity::get_driver in that the passenger can't drive the car.
Sets the passenger of this car or spidertron.
passenger | :: LuaEntity or PlayerIdentification |
|
on_player_driving_changed_state? instantly |
|
This differs over LuaEntity::get_driver in that the passenger can't drive the car.
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.
The trains scheduled to stop at this train stop.
The train currently stopped at this train stop, if any.
Clones this entity.
position | :: MapPosition |
The destination position |
The destination position |
||
surface | :: LuaSurface? |
The destination surface |
The destination surface |
||
force | :: ForceIdentification? |
|
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. |
→ LuaEntity? |
The cloned entity or |
on_entity_cloned? instantly |
Raised if the entity was successfully cloned. |
Get the amount of all or some fluid in this entity.
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. |
If information about fluid temperatures is required, LuaEntity::fluidbox should be used instead.
Get amounts of all fluids in this entity.
→ dictionary[string → double] |
The amounts, indexed by fluid names. |
If information about fluid temperatures is required, LuaEntity::fluidbox should be used instead.
Remove fluid from this entity.
name | :: string |
Fluid prototype name. |
Fluid prototype name. |
||
amount | :: double |
Amount to remove |
Amount to remove |
||
minimum_temperature | :: double? |
|
maximum_temperature | :: double? |
|
temperature | :: double? |
|
→ double |
Amount of fluid actually removed. |
If temperature is given only fluid matching that exact temperature is removed. If minimum and maximum is given fluid within that range is removed.
Get the source of this beam.
Set the source of this beam.
source | :: LuaEntity or MapPosition |
|
Get the target of this beam.
Set the target of this beam.
target | :: LuaEntity or MapPosition |
|
The radius of this entity.
The health ratio of this entity between 1 and 0 (for full health and no health respectively).
→ float? |
|
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 the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.
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.
Whether this character can shoot the given entity or position.
target | :: LuaEntity |
|
position | :: MapPosition |
|
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.
Returns the new entity prototype.
→ LuaEntityPrototype? |
|
Returns the new entity direction after upgrading.
→ defines.direction? |
|
Returns the amount of damage to be taken by this entity.
→ float? |
|
Depletes and destroys this resource entity.
on_resource_depleted instantly |
|
Mines this entity.
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 |
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 |
||
raise_destroyed | :: boolean? |
If true, script_raised_destroy will be raised. Defaults to |
If true, script_raised_destroy will be raised. Defaults to |
||
ignore_minable | :: boolean? |
If true, the minable state of the entity is ignored. Defaults to |
If true, the minable state of the entity is ignored. Defaults to |
→ boolean |
Whether mining succeeded. |
script_raised_destroy? instantly |
Raised if the |
'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.
Triggers spawn_decoration actions defined in the entity prototype or does nothing if entity is not "turret" or "unit-spawner".
Gets rolling stock connected to the given end of this stock.
direction | :: defines.rail_direction |
|
→ LuaEntity? |
The rolling stock connected at the given end, |
→ defines.rail_direction? |
The rail direction of the connected rolling stock if any. |
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 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.
force | :: ForceIdentification |
The force construction manager to check. |
The force construction manager to check. |
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 this entity registered for repair? If false, it means a construction robot has been dispatched to upgrade 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.
Adds the given position to this spidertron's autopilot's queue of destinations.
position | :: MapPosition |
The position the spidertron should move to. |
The position the spidertron should move to. |
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.
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 also be used on entity ghost if it contains linked-belt
Disconnects linked belt from its neighbour.
Can also be used on entity ghost if it contains linked-belt
Gets legs of given SpiderVehicle.
Sets the speed of the given SpiderVehicle to zero. Notably does not clear its autopilot_destination, which it will continue moving towards if set.
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)
Returns a table with all entities affected by this beacon
All methods and properties that this object supports.
Name of the entity prototype. E.g. "inserter" or "filter-inserter".
Name of the entity or tile contained in this ghost
Localised name of the entity.
Localised name of the entity or tile contained in this ghost.
The entity prototype type of this entity.
The prototype type of the entity or tile contained in this ghost.
Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will stop moving etc).
Entities that are not active naturally can't be set to be active (setting it to be active will do nothing)
Ghosts, simple smoke, and corpses can't be modified at this time.
It is even possible to set the character to not be active, so he can't move and perform most of the tasks.
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.
Not minable entities can still be destroyed.
Entities that are not minable naturally (like smoke, character, enemy units etc) can't be set to minable.
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.
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.
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 LuaEntityPrototype::max_health on its prototype.
The current direction this entity is facing.
Whether the entity has direction. When it is false for this entity, it will always return north direction when asked for.
The smooth orientation of this entity.
The orientation of this cliff.
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.
The torso orientation of this spider vehicle.
Count of resource units contained.
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.
Multiplies the acceleration the vehicle can create for one unit of energy. Defaults to 1
.
Multiplies the energy consumption.
Multiplies the car friction rate.
This will allow the car to go much faster
|
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.
Read when this spidertron auto-targets enemies
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.
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.
The entity prototype of this entity.
The prototype of the entity or tile contained in this ghost.
Position where the entity puts its stuff.
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.
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.
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.
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.
Index of the currently selected weapon slot of this character, car, or spidertron. nil
if this entity doesn't have guns.
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.
|
The temperature of this entity's heat energy source. nil
if this entity does not use a heat energy source.
The previous recipe this furnace was using, if any.
The item stack currently held in an inserter's hand.
Current position of the inserter's "hand".
The train this rolling stock belongs to, if any. nil
if this is not a rolling stock.
A list of neighbours for certain types of entities. Applies to electric poles, power switches, underground belts, walls, gates, reactors, cliffs, and pipe-connectable entities.
"copper"
, "red"
, and "green"
.nil
if none.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.
Fluidboxes of this entity.
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.
The label on this entity, if any. nil
if this is not a spider-vehicle.
on_entity_renamed instantly |
|
The ticks left before a ghost, combat robot, highlight box or smoke with trigger is destroyed.
The color of this character, rolling stock, train stop, car, spider-vehicle, flying text, corpse or simple-entity-with-owner. 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.
The text of this flying-text entity.
The state of this rail signal.
The state of this chain signal.
Will this entity be picked up automatically when the player walks over it?
The current crafting speed, including speed bonuses from modules and beacons.
The current crafting progress, as a number in range [0, 1].
The current productivity bonus progress, as a number in range [0, 1].
The productivity bonus of this entity.
This includes force based bonuses as well as beacon/module bonuses.
The pollution bonus of this entity.
The speed bonus of this entity.
This includes force based bonuses as well as beacon/module bonuses.
The consumption bonus of this entity.
"input"
or "output"
, depending on whether this underground belt goes down or up.
"input"
or "output"
, depending on whether this loader puts to or gets from a container.
Number of rocket parts in the silo.
The logistic network this entity is a part of, or nil
if this entity is not a part of any logistic network.
The logistic cell this entity is a part of. Will be nil
if this entity is not a part of any logistic cell.
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.
The player connected to this character, if any.
The unit group this unit is a member of, if any.
The damage dealt by this turret, artillery turret, or artillery wagon.
The number of units killed by this turret, artillery turret, or artillery wagon.
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.
Reading this property will return a LuaPlayer, while PlayerIdentification can be used when writing.
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
The input flow limit for the electric energy source. nil
if the entity doesn't have an electric energy source.
The output flow limit for the electric energy source. nil
if the entity doesn't have an electric energy source.
The electric drain for the electric energy source. nil
if the entity doesn't have an electric energy source.
The emissions for the electric energy source. nil
if the entity doesn't have an electric energy source.
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 EntityWithOwner, as well as ItemRequestProxy and EntityGhost are assigned a unit number. Returns nil
otherwise.
The unit_number of the entity contained in this ghost. It is the same as the unit number of the EntityWithOwner 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
.
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.
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.
The power production specific to the ElectricEnergyInterface entity type.
The power usage specific to the ElectricEnergyInterface entity type.
LuaEntityPrototype::collision_box around entity's given position and respecting the current entity orientation.
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.
LuaEntityPrototype::selection_box around entity's given position and respecting the current entity orientation.
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.
The mining target, if any.
Entities that are directly connected to this entity via the circuit network. nil
if this entity can't be connected to the circuit network.
red | :: array[LuaEntity] |
Entities connected via the red wire. |
Entities connected via the red wire. |
||
green | :: array[LuaEntity] |
Entities connected via the green wire. |
Entities connected via the green wire. |
The connection definition for entities that are directly connected to this entity via the circuit network. nil
if this entity can't be connected to the circuit network.
The index of the configured request with the highest index for this entity. This means 0 if no requests are set and e.g. 20 if the 20th request slot is configured.
The number of filter slots this inserter, loader, or logistic storage container has. 0 if not one of those entities.
The container entity this loader is pointing at/pulling from depending on the LuaEntity::loader_type, if any.
This entity's equipment grid, if any.
The graphics variation for this entity. nil
if this entity doesn't use graphics variations.
Index of the tree color.
Maximum index of the tree colors.
Index of the tree stage.
Maximum index of the tree stages.
Index of the tree gray stage
Maximum index of the tree gray stages.
The burner energy source for this entity, if any.
The shooting target for this turret, if any. Can't be set to nil
via script.
The target entity for this item-request-proxy, if any.
The sticker entities attached to this entity, if any.
The entity this sticker is sticked to.
The electric network statistics for this electric pole.
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.
Sets the stack size limit on this inserter. If the stack size is > than the force stack size limit the value is ignored.
Set to 0 to reset.
The number of products this machine finished crafting in its lifetime.
The spawner associated with this unit entity, if any.
The units associated with this spawner entity.
The state of this power switch.
The effects being applied to this entity, if any. For beacons, this is the effect the beacon is broadcasting.
Number of beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
The filters for this infinity container.
Whether items not included in this infinity container filters should be removed from the container.
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.
The tick this character corpse died at.
The reason this character corpse character died. ""
if there is no reason.
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.
Reading this property will return a LuaPlayer, while PlayerIdentification can be used when writing.
A character associated with a player is not directly controlled by any player.
The last tick this character entity was attacked.
The last tick this character entity was damaged.
The filter for this splitter, if any is set.
The filter mode for this filter inserter. Either "whitelist"
or "blacklist"
. nil
if this inserter doesn't use filters.
The input priority for this splitter. Either "left"
, "none"
, or "right"
.
The output priority for this splitter. Either "left"
, "none"
, or "right"
.
Whether this land mine is armed.
When locked; the recipe in this assembling machine can't be changed by the player.
The rail entity this train stop is connected to, if any.
Rail direction to which this train stop is binding. This returns a value even when no rails are present.
The number of trains in this rail block for this rail entity.
The timeout that's left on this landmine in ticks. It describes the time between the landmine being placed and it being armed.
The current total neighbour bonus of this reactor.
The ai settings of this unit.
The hightlight box type of this highlight box entity.
The blink interval of this highlight box entity. 0 indicates no blink.
The status of this entity, if any.
Whether equipment grid logistics are enabled while this vehicle is moving.
The player that this simple-entity-with-owner
, simple-entity-with-force
, flying-text
, or highlight-box
is visible to. nil
when this entity is rendered for all players.
Reading this property will return a LuaPlayer, while PlayerIdentification can be used when writing.
The forces that this simple-entity-with-owner
, simple-entity-with-force
, or flying-text
is visible to. nil
or an empty array when this entity is rendered for all forces.
Reading will always give an array of LuaForce
The rail target of this pump, if any.
Returns true if this unit is moving.
Returns the id of the electric network that this entity is connected to, if any.
Whether this character's personal roboports are allowed to dispatch robots.
Whether this rocket silo automatically launches the rocket when cargo is inserted.
How much energy this generator generated in the last tick.
The storage filter for this logistic storage container.
Whether this requester chest is set to also request from buffer chests.
Useable only on entities that have requester slots.
Whether this corpse will ever fade away.
Useable only on corpses.
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.
Useable only on corpses.
The tags associated with this entity ghost. nil
if this is not an entity ghost.
The command given to this unit, if any.
The distraction command given to this unit, if any.
The ticks until the next trigger effect of this smoke-with-trigger.
Destination of this spidertron's autopilot, if any.
The queued destination positions of spidertron's autopilot.
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
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
(deprecated by 1.1.51) If this entity is a MilitaryTarget. Returns same value as LuaEntity::is_military_target
Whether this entity is a MilitaryTarget. Can be written to if LuaEntityPrototype::allow_run_time_change_of_is_military_target returns true
.
If this entity is EntityWithOwner
If this entity is EntityWithHealth
The owner of this combat robot, if any.
The link ID this linked container is using.
The follow target of this spidertron, if any.
The follow offset of this spidertron, if any entity is being followed. This is randomized each time the follow entity is set.
Type of linked belt: it is either "input"
or "output"
. 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 also be used on entity ghost if it contains linked-belt
Neighbour to which this linked belt is connected to, if any.
Can also be used on entity ghost if it contains linked-belt
May return entity ghost which contains linked belt to which connection is made
The current radar scan progress, as a number in range [0, 1].
The status of this rocket silo entity.
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.
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.
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.
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.