double_grid_aligned

class DoubleGridAlignedMixin(name: str, similar_entities: list[str], **kwargs: dict)

Makes the Entity issue warnings if set to an odd tile-position coordinate. Sets the double_grid_aligned attribute to True.

property position: dict

The “canonical” position of the Entity, or the one that Factorio uses. Positions of most entities are located at their center, which can either be in the middle of a tile or on it’s transition, depending on the Entity’s tile_width and tile_height.

position can be specified as a dict with "x" and "y" keys, or more succinctly as a sequence of floats, usually a list or tuple.

This property is updated in tandem with tile_position, so using them both interchangeably is both allowed and encouraged.

Raises RailAlignmentWarning if the x or y position is odd.

Getter:

Gets the position of the Entity.

Setter:

Sets the position of the Entity.

Type:

dict{"x": float, "y": float}

Raises:
  • IndexError – If the set value does not match the above specification.

  • DraftsmanError – If the entities position is modified when inside a EntityCollection, which is forbidden.

property tile_position: dict

The tile-position of the Entity. The tile position is the position according the the LuaSurface tile grid, and is the top left corner of the top-leftmost tile of the Entity.

tile_position can be specified as a dict with "x" and "y" keys, or more succinctly as a sequence of floats, usually a list or tuple.

This property is updated in tandem with position, so using them both interchangeably is both allowed and encouraged.

Raises RailAlignmentWarning if the x or y position is odd.

Getter:

Gets the tile position of the Entity.

Setter:

Sets the tile position of the Entity.

Type:

dict{"x": int, "y": int}

Raises:
  • IndexError – If the set value does not match the above specification.

  • DraftsmanError – If the entities position is modified when inside a EntityCollection, which is forbidden.