tile
- class Tile(name: str, position: Tuple[int, int] = (0, 0))
Bases:
SpatialLike
Tile class. Used for keeping track of tiles in Blueprints.
- 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.
- mergable_with(other: Tile) bool
Determines if two entities are mergeable, or that they can be combined into a single tile. Two tiles are considered mergable if they have the same
name
and exist at the sameposition
- Parameters:
other – The other
Tile
to check against.- Returns:
True
if the tiles are mergable,False
otherwise.
- merge(other: Tile) None
Merges this tile with another one. Due to the simplicity of tiles, this does nothing, and is simply added for compatibility with entity merging.
- Parameters:
other – The other tile to inherit data from, if such a thing were to happen.
- to_dict() dict
Converts the Tile to its JSON-dict representation.
- Returns:
The exported JSON-dict representation of the Tile.
- property collision_mask
A set of strings representing the collision layers that this object collides with.
- property collision_set
Set of
CollisionShape
where the Entity’s position acts as their origin.
- property global_position
Position of the object, expressed in global space (world space).
- property name: str
The name of the Tile.
Must be one of the entries in
draftsman.data.tiles.raw
in order for the tile to be recognized as valid.- Getter:
Gets the name of the Tile.
- Setter:
Sest the name of the Tile.
- Type:
str
- Raises:
InvalidTileError – If the set name is not a valid Factorio tile id.
- property position: dict
The position of the tile, in tile-grid coordinates.
position
can be specified as adict
with"x"
and"y"
keys, or more succinctly as a sequence of floats, usually alist
ortuple
.This property is updated in tandem with
position
, so using them both interchangeably is both allowed and encouraged.- Getter:
Gets the position of the Entity.
- Setter:
Sets the position of the Entity.
- Type:
dict{"x": int, "y": int}
- Raises:
IndexError – If the set value does not match the above specification.