How to handle manual copper-wire connections?

Place to get help with not working mods / modding interface.
0n0w1c
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Sep 09, 2023 1:43 pm
Contact:

How to handle manual copper-wire connections?

Post 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?
0n0w1c
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Sep 09, 2023 1:43 pm
Contact:

Re: How to handle manual copper-wire connections?

Post 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.
0n0w1c
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Sep 09, 2023 1:43 pm
Contact:

Re: How to handle manual copper-wire connections?

Post 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.
User avatar
jamiechi1
Filter Inserter
Filter Inserter
Posts: 272
Joined: Wed Jan 03, 2018 10:12 pm

Re: How to handle manual copper-wire connections?

Post by jamiechi1 »

Relevant post: viewtopic.php?f=6&t=91100
Due to a change in Factorio v2.0.7 this is no longer possible.
0n0w1c
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Sep 09, 2023 1:43 pm
Contact:

Re: How to handle manual copper-wire connections?

Post 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.
User avatar
jamiechi1
Filter Inserter
Filter Inserter
Posts: 272
Joined: Wed Jan 03, 2018 10:12 pm

Re: How to handle manual copper-wire connections?

Post 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. :(
Post Reply

Return to “Modding help”