Issue
- It is currently expensive and complex to track when electric networks merge or split- There are edge cases where this cannot be tracked (manual cable connection/disconnection, blueprint paste that changes only cables, electric-switch changing state)
Use case
- Managing scripted entities that are tied to a single electric network (this is the case in pY with aerial turbines, also applies to many uses of electric-energy-interface)- Tracking which poles belong to which network (this is the case in my own mod, electric grid enforcer)
Request
- Events firing when an electric network is created/split (i.e. new ID), merged (i.e. an ID is merged with a currently existing ID), or removed (i.e. the ID is now unused)- Arguments including the relevant network IDs and, if possible, the entity (or position?) causing the event (e.g. electric pole)
Alternatives
- A trigger property on electric entities (most important: electric-pole, power-switch, electric-energy-interfac) that triggers on electric network ID change- A "read-only" event where only storage can be modified and API calls cannot be made (i.e. data is stored and acted on in a future tick event) would be fine, too, but this does not currently have precedent in the codebase.
I don't have a strong opinion about the method of implementation, the issue is primarily that the API does not provide the tools to solve the issue as it stands.