A wire connector of a given entity. Allows to find wires, add or remove wires and do some basic operations specific to those connectors.
LuaEntityunknownfalseThe entity this wire connector belongs to. May return entity ghost instead if this wire connector belongs to inner entity.
defines.wire_typeunknownfalseThe type of wires that can be connected to this connector.
defines.wire_connector_idunknownfalseIdentifier of this connector in the entity this connector belongs to.
booleanunknownfalseIf this connector is owned by an entity inside of a ghost. If any of 2 ends of a wire attaches to a ghost connector, then a wire is considered to be a ghost.
uint32unknownfalseAmount of wires going out of this connector. It includes all wires (ghost wires and real wires).
Array<WireConnection>unknownfalseAll wire connectors this connector is connected to. It includes all wires (ghost wires and real wires).
uint32unknownfalseAmount of real wires going out of this connector. It only includes wires for which both wire connectors are real (not ghosts).
Array<WireConnection>unknownfalseAll wire connectors this connector is connected to with real wires. It only includes wires that are between two non-ghost entities.
uint32unknownfalseIndex of a CircuitNetwork or ElectricSubNetwork which is going through this wire connector. Returns 0 if there is no network associated with this wire connector right now. CircuitNetwork indexes are independent of indexes of ElectricSubNetwork so they may collide with each other.
booleanunknownfalseIs this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
stringunknownfalseThe class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
LuaWireConnector.is_connected_to(target: LuaWireConnector, origin?: defines.wire_origin) -> boolean
wireConnector.is_connected_to(target, origin)
takes_table: falsetable_optional: falseChecks if this connector has any wire going to the other connector.
target: LuaWireConnector — Other connector to check for a connection to.origin?: defines.wire_origin — Origin of the wire. Defaults to defines.wire_origin.player.booleanLuaWireConnector.connect_to(target: LuaWireConnector, reach_check?: boolean, origin?: defines.wire_origin) -> boolean
wireConnector.connect_to(target, true)
takes_table: falsetable_optional: falseConnects this connector to other wire connector.
target: LuaWireConnector — Other connector to which a wire should be added.reach_check?: boolean — True by default. For wires out of reach or on different surfaces, false must be provided.origin?: defines.wire_origin — Origin of the wire. Defaults to defines.wire_origin.player.boolean — Whether a connection was made.LuaWireConnector.disconnect_from(target: LuaWireConnector, origin?: defines.wire_origin) -> boolean
wireConnector.disconnect_from(target, origin)
takes_table: falsetable_optional: falseDisconnects this connector from other wire connector.
target: LuaWireConnector — Other connector to which wire to be removed should be removed.origin?: defines.wire_origin — Origin of the wire. Defaults to defines.wire_origin.player.boolean — Whether a connection was removed.LuaWireConnector.disconnect_all(origin?: defines.wire_origin) -> boolean
wireConnector.disconnect_all()
takes_table: falsetable_optional: falseRemoves all wires going out of this wire connector.
origin?: defines.wire_origin — Origin of the wires to remove. Defaults to defines.wire_origin.player.boolean — True if any wire was removed.LuaWireConnector.can_wire_reach(other_connector: LuaWireConnector | LuaEntity) -> boolean
wireConnector.can_wire_reach(other_connector)
takes_table: falsetable_optional: falseChecks if a wire can reach from this connector to the other connector.
other_connector: LuaWireConnector | LuaEntity — Target to which a wire reach is to be checked.booleanLuaWireConnector.have_common_neighbour(other_connector: LuaWireConnector, ignore_ghost_neighbours?: boolean) -> boolean
wireConnector.have_common_neighbour(other_connector, true)
takes_table: falsetable_optional: falseChecks if this and other wire connector have a common neighbour.
other_connector: LuaWireConnector — Other connector to check for common neighbour.ignore_ghost_neighbours?: booleanboolean