Electric Grid Enforcer

by _-_-_

Enforces 90° angles for auto-connections when electric poles are placed.

Utilities
9 hours ago
1.1 - 2.0
4.47K

b [Optional behavior] Removes too many wires when deleting a pole

20 days ago

This mod is great except that it has a very annoying and base-breaking side effect. Let's say you have an existing set of poles, some of which are connected at odd angles (for example, you manually connected them with the wire tool). If you place a new pole, it will correctly only connect it to the existing poles are at 90 degree angles from the new pole. But then if you delete the new pole, it will delete the previous non-90-degree wires from the previous poles.

I've accidentally found large sections of my base without power due to this "bug". There should be a rule in this mod that it never deletes existing wire connections from existing poles.

20 days ago

Hi Identifier,

This is due to strange base-game behavior around rewiring when removing poles (gif: https://forums.factorio.com/images/ext/56e542a24a12552861980210e0556a79.gif), which is the reason I started writing this mod. There's no nice flag to differentiate manual or blueprint connections from automatic connections, so the mod currently cleans all neighbours on removal.

Honestly, it annoys me as well, there's plenty of cases where it has caused me issues. If anyone has ideas for a good algorithm/approach to dealing with such cases, I'm all ears.

20 days ago

You said “the mod currently cleans all neighbors on removal”. Could we have an option to never clean any neighbors on removal? In other words, only do your cleaning on placement of new poles, never on removal?

20 days ago

Sure, that's straightforward. I'll have that out today or tomorrow as time allows.

20 days ago

Released, let me know if you encounter any issues.

20 days ago

Trying now. The new option works as expected, and is helpful, but now I realize that even with this option, it's still possible to accidentally disconnect sections of a factory even during placement. Here's an example: https://imgur.com/a/2Jqqmg5 Maybe this is really an impossible problem to solve?

20 days ago

That's the tougher one. Poles clean their neighbours on placement, primarily to remove any now-redundant connections (the algorithm is simple and relatively naive). Think placing a pole in between two already-connected poles.

I have an idea for another method, but it'll take some trial and error to see if I can work it out correctly.

New response