power_connectable

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

Enables the Entity to be connected to power networks.

property maximum_wire_distance: float

The maximum distance that this entity can reach for power connections. Not exported; read only.

Type:

float

property neighbours: list

The power pole neighbours that this entity connects to.

neighbours is traditionally specified as a list of ints, each one representing the index of the entity in the parent blueprint that this Entity connects to, in 1-indexed notation. For example, if entity.neighbours == [2, 3], then entity would have power wires to blueprint.entities[1] and blueprint.entities[2]. If you’re importing from an already existing blueprint string, then this is the format you should expect.

Draftsman implements a more sophisticated neighbours format, where entities themselves (or rather, references to them) are used as the entries of the neighbours list. This makes connections independent of their location in the parent blueprint, so you can specify power connections even before you’ve placed all the entities in one. Draftsman uses this format when making connections, is still compatible with simple integers.

Warning

Int-based neighbours lists are fragile; if you want to preserve connections in integer format, you have to preserve entity order. Any new entities must be added to the end. Keep this in mind when importing an already-made blueprint string with connections already made.

Note

Power switch wire connections are abnormal; they are not treated as neighbours and instead as special copper circuit connections. Inspect an Entity’s connections attribute if you’re looking for those wires.

Getter:

Gets the neighbours of the Entity.

Setter:

Sets the neighbours of the Entity. Defaults to an empty list if set to None.

Type:

See draftsman.signatures.NEIGHBOURS

Raises:

DataFormatError – If set to anything that does not match the specification above.