Page 1 of 1

How to handle manual copper-wire connections?

Posted: Sun Nov 10, 2024 12:43 pm
by 0n0w1c
With the 1.1 API, I would watch the cursor stack, if it the stack was copper-cable and it decreased, a manual copper connection likely occurred.
However, with 2.0 changes, the copper-wire appears to always have a stack count of 1.

How best to recognize and take action when a manual copper-wire connection is made?

Re: How to handle manual copper-wire connections?

Posted: Sun Nov 10, 2024 1:17 pm
by 0n0w1c
I have a work-around, but it is fairly wonky.
Track if an electric-pole has been selected, when selection changes and the electric-pole is no longer selected, check the wire connections of the previously selected electric pole.
Works but is weak sauce, there must be a better way.

Re: How to handle manual copper-wire connections?

Posted: Mon Nov 11, 2024 5:54 am
by 0n0w1c
If any devs happen by, it would be nice if a wire connection raised an on_player_built event on the LuaWireConnector creation.

Re: How to handle manual copper-wire connections?

Posted: Sat Nov 16, 2024 3:22 am
by jamiechi1
Relevant post: viewtopic.php?f=6&t=91100
Due to a change in Factorio v2.0.7 this is no longer possible.

Re: How to handle manual copper-wire connections?

Posted: Sun Nov 17, 2024 12:35 pm
by 0n0w1c
I opened a request in the Modding Interface section. I do not think anything will come of it but might as well try.

Re: How to handle manual copper-wire connections?

Posted: Sun Nov 17, 2024 8:10 pm
by jamiechi1
Found out how to do this thanks to darkfrei.
In Entity code: auto_connect_up_to_n_wires = 0 -- for Factorio 2.0 - Space Age
see https://mods.factorio.com/mod/Connectio ... a362eb2894

Problem with the new method, is that now one cannot tell if new power pole is placed close enough to any existing poles. Connection wire not shown if auto_connect_up_to_n_wires = 0. I think this is bad. :(