Page 1 of 1

Why does WireConnectionDefinition have fields source_wire_id and target_wire_id?

Posted: Tue Mar 15, 2022 6:49 pm
by thesixthroc
The API definition for WireConnectionDefinition states that the field wire should be "either defines.wire_type.red or defines.wire_type.green." IE, not copper.

But also listed are two fields source_wire_id and target_wire_id, and it seems to be stated that these are to specify the type of copper wire connection.

If wire cannot be used, what are these fields supposed to do?

https://lua-api.factorio.com/latest/Con ... Definition

Re: Why does WireConnectionDefinition have fields source_wire_id and target_wire_id?

Posted: Tue Mar 15, 2022 7:31 pm
by boskid
This looks like an issue with documentation because in case of a copper wire you have to specify a wire value equal to `defines.wire_type.copper` to make parser to look for the `source_wire_id` and `target_wire_id` fields. When a wire is `defines.wire_type.red` or `defines.wire_type.green` it will look for `source_circuit_id` and `target_circuit_id` instead.

Re: Why does WireConnectionDefinition have fields source_wire_id and target_wire_id?

Posted: Tue Mar 15, 2022 10:06 pm
by thesixthroc
Indeed. For the dev's information, I came across this inconsistency when the following error was obtained during a .connect_neighbour() call in my scenario:

"Expected source_wire_id for entities with more than one wire connection."

The parameters for .connect_neighbour() were taken as exactly those four parameters obtained by a call of .circuit_connected_entities on another entity — yet this call claims to only spit out red or green wires, not copper. Which entities in particular I do not know, but something unexpected is afoot. (EDIT: I think they were ghost entities.)