Method to prevent certain automatic power pole connections

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Method to prevent certain automatic power pole connections

Post by Xorimuth »

When a power pole is placed it is automatically connected to some nearby poles. In my mod I want a pole to only automatically connect to certain other types of poles. I do this by listening to the on_build/revive events and then disconnecting the pole from certain neighbours. You can see my implementation here: https://github.com/tburrows13/PowerOver ... lua#L9-L20

My problem is that the electric networks are momentarily joined so they are 'polluted' for 5 seconds (the minimum precision time for accessing usage data). I can see several ways of mitigating this (in rough order of preference):
  • Add a way to list compatible entities in the power pole prototype
  • Don't momentarily merge electric networks if they are disconnected again on the same tick
  • Add a prototype flag to disable automatic connections entirely
(For related reading, see viewtopic.php?f=28&t=94959&p=536012#p536012, which I've been told wouldn't be easy to implement into the API)
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Post Reply

Return to “Modding interface requests”