Tools for working with entities.
local Entity = require('stdlib/entity/entity')
_are_equal (entity_a, entity_b) | Tests if two entities are equal. |
get_data (entity) | Gets the user data that is associated with an entity. |
has (entity, field_name) | Tests whether an entity has access to a given field. |
set_data (entity, data) | Associates the user data to an entity. |
set_frozen (entity[, mode=true]) | Freezes an entity, by making it inactive, inoperable, and non-rotatable, or unfreezes by doing the reverse. |
set_indestructible (entity[, mode=true]) | Makes an entity indestructible so that it cannot be damaged or mined neither by the player nor by their enemy factions. |
to_collision_area () | Deprecated see LuaEntity.bounding_box
Converts an entity and its collision_box to the area around it. |
to_selection_area () | Converts an entity and its selection_box to the area around it. |
create_entity (surface, settings[, player_index][, raise_script_event]) | Create an entity and raise a build event. |
destroy_entity (entity[, died=false][, cause][, force]) | Destroy an entity by first raising the event. |
revive (ghost[, player_index][, raise_script_event]) | Revivie an entity ghost and raise the on_built or on_robot_built event. |
Tests if two entities are equal.
If they don't have a reference equality and entity_a has equals function, it will be called with entity_b as its first argument.
Parameters: Returns:Gets the user data that is associated with an entity.
The user data is stored in the global object and it persists between loads.
Parameters:The user data will be removed from an entity when the entity becomes invalid.
Tests whether an entity has access to a given field.
Parameters: Returns:
Associates the user data to an entity.
The user data will be stored in the global object and it will persist between loads.
Parameters:The user data will be removed from an entity when the entity becomes invalid.
Freezes an entity, by making it inactive, inoperable, and non-rotatable, or unfreezes by doing the reverse.
Parameters:
Makes an entity indestructible so that it cannot be damaged or mined neither by the player nor by their enemy factions.
Parameters:
Deprecated see LuaEntity.bounding_box
Converts an entity and its collision_box to the area around it.
See also:
Converts an entity and its selection_box to the area around it.
See also:
Create an entity and raise a build event.
Parameters:
Destroy an entity by first raising the event.
Parameters:Some entities can't be destroyed, such as the rails with trains on them.
Revivie an entity ghost and raise the on_built
or on_robot_built
event.
Parameters: Returns: