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?
How to handle manual copper-wire connections?
Re: How to handle manual copper-wire connections?
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.
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?
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?
Relevant post: viewtopic.php?f=6&t=91100
Due to a change in Factorio v2.0.7 this is no longer possible.
Due to a change in Factorio v2.0.7 this is no longer possible.
Re: How to handle manual copper-wire connections?
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?
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.
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.