entitylike
- class EntityLike
Bases:
SpatialLike
Abstract base class for a blueprintable entity. Allows the user to specify custom entity analogues that can be passed into Blueprint instances. Group and RailPlanner are examples of custom EntityLike classes.
All EntityLike subclasses must implement the following properties:
name
type
id
tile_width
tile_height
position
collision_set
collision_mask
- get_world_bounding_box()
Gets the world-space coordinates AABB that completely encompasses the
collision_set
of this SpatialLike. Behaves similarly to the old function get_area(), except now it correctly handles non-AABB collision shapes.
- get_world_collision_set() CollisionSet
Get’s the world-space coordinate CollisionSet of the object, or the collection of all shapes that this EntityLike interacts with.
- Returns:
A new
CollisionSet
with it’s content’s copied.
- abstract mergable_with(other: EntityLike) bool
Checks to see if an entity is “mergable” with another entity. This means that if a certain set of criteria is met, the attributes of
other
will be combined to the attributes of this entity. This is useful for mimicking cases where entities of the same name and type are placed on top of each other, merging them together into a single entity with shared attributes.For the full list of all merging rules, see (TODO).
Note
This function does not actually merge the two, it simply checks to see if such a merge is considered valid. To actually merge two entities use
merge()
.- Parameters:
other – The other
EntityLike
to check against.- Returns:
True
if they can be merged,False
otherwise.
- abstract merge(other: EntityLike) None
Changes the attributes of the calling entity with the attributes of the passed in entity. The attributes of
other
take precedence over the attributes of the calling entity. They can be either copied or merged together, depending on the specific attribute being merged.For the full list of all merging rules, see (TODO).
- Parameters:
other – The other
EntityLike
to merge with.
- on_insert(parent: EntityCollection) None
TODO
- on_remove(parent: EntityCollection) None
TODO
- property circuit_connectable: bool
Whether or not this EntityLike can be connected using circuit wires. Not exported; read only.
- Type:
bool
- abstract property collision_mask: set
A set of strings representing the collision layers that this object collides with.
- abstract property collision_set: CollisionSet
Set of
CollisionShape
where the Entity’s position acts as their origin.
- property double_grid_aligned: bool
Whether or not this EntityLike is “double-grid-aligned”, which applies to a number of rail entities. Not exported; read only.
- Type:
bool
- property dual_circuit_connectable: bool
Whether or not this EntityLike has two circuit connection points. Not exported; read only.
- Type:
bool
- property dual_power_connectable: bool
Whether or not this EntityLike has two power connection points. Not exported; read only.
- Type:
bool
- abstract property global_position: Vector
Position of the object, expressed in global space (world space).
- property parent: EntityCollection
The parent
EntityCollection
object that contains the entity, orNone
if the entity does not currently exist within anEntityCollection
. Not exported; read only.- Type:
EntityCollection
- abstract property position: Vector
Position of the object, expressed in local space. Local space can be either global space (if the EntityLike exists in a Blueprint at a root level) or local to it’s parent Group.
- property power_connectable: bool
Whether or not this EntityLike can be connected using power wires. Not exported; read only.
- Type:
bool
- property rotatable: bool
Whether or not this EntityLike can be rotated. Note that this does not mean that the entity will prevent a blueprint from rotating; more, that this EntityLike does not have a concept of different rotation angles. For example, any
Reactor
entity will always returnrotatable
asFalse
when queried. Not exported; read only.- Type:
bool