Page 1 of 1

circuit connections via neighbours interfaces?

Posted: Fri Aug 14, 2015 2:07 am
by GopherAtl
It would be super-convenient connect_neighbours and disconnect_neighbours methods supported a 2nd argument - wire type - and supported all circuit network-able entities instead of just power poles. Currently disconnect_wire works with red/green cables, but only in a "disconnect from all" way, and it would be nice if you could connect or disconnect a single connection between two objects of any of the types, and in the case of red/green, if they worked with things like smart chests and inserters rather than just electric poles...

entity.connect_neighbour(entity2[, connectortype])

entity.disconnect_neighbor(entity2[,connectortype])

It seems particularly odd that disconnect, and only disconnect, supports circuit net wires at present, but hopefully that means they're on the same basic underlying system and the feature might be easy to slip in to an update soon-ish...? :hopeful look:

Re: circuit connections via neighbours interfaces?

Posted: Fri Aug 14, 2015 2:26 am
by Rseding91
It already works that way:

Code: Select all

entity1.disconnect_neighbour({wire=defines.wire.green, target_entity=entity2})
Optionally you can also define the source and or target circuit IDs to remove (for combinators that have more than one circuit ID) using: source_circuit_id=id, target_circuit_id=id

Re: circuit connections via neighbours interfaces?

Posted: Fri Aug 14, 2015 2:28 am
by GopherAtl
ah, this is excellent news! I will update the wiki after testing the limits of this for myself. :D

Re: circuit connections via neighbours interfaces?

Posted: Fri Aug 14, 2015 4:47 pm
by GopherAtl
Rseding91 wrote:It already works that way:

Code: Select all

entity1.disconnect_neighbour({wire=defines.wire.green, target_entity=entity2})
Optionally you can also define the source and or target circuit IDs to remove (for combinators that have more than one circuit ID) using: source_circuit_id=id, target_circuit_id=id

Ok, been poking at this and got it worked out, works as you said, so the wiki will be updated properly shortly.

A follow-up request, though; the neighbours field still seems accessible only on power poles, for inspecting the current circuit connections from mods; could we get that added to all circuit devices that can be wired?

:edit: oh, but there doesn't seem to be a defines.wire, the old wiki docs were showing circuitconnector.red/green, but there is no circuitconnector.copper, and circuticonnector.logistic doesn't apply here; is there a wire/cable defines that should be used instead, and would work with both copper cables and circuit connectors?