circuit connections via neighbours interfaces?

Things that already exist in the current mod API
Post Reply
GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

circuit connections via neighbours interfaces?

Post 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:
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections

Rseding91
Factorio Staff
Factorio Staff
Posts: 13213
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: circuit connections via neighbours interfaces?

Post 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
If you want to get ahold of me I'm almost always on Discord.

GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: circuit connections via neighbours interfaces?

Post by GopherAtl »

ah, this is excellent news! I will update the wiki after testing the limits of this for myself. :D
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections

GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: circuit connections via neighbours interfaces?

Post 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?
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections

Post Reply

Return to “Already exists”