Detecting belts stopped by circuit conditions

Place to get help with not working mods / modding interface.
sparr
Smart Inserter
Smart Inserter
Posts: 1521
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Detecting belts stopped by circuit conditions

Post by sparr »

I need to know when a belt stops due to a circuit condition.

My best idea so far is thus:

First, keep track of which belts are connected to the circuit network by...
A) Poll entities near the player cursor if the player is holding a wire, to find out if circuit connections are created or removed. I saw code to do this recently and have lost it.
B) Events to detect entity destruction, entity and wire creation via bots, etc
C) Being sad if a mod creates a wire connection that we can't detect, or adds a controlbehavior to a belt with no wires. maybe poll all belts in the game every minute or two if we suspect this could happen?

Then every tick poll all the belts connected to the circuit network to see if they are on/off.

I'm hoping someone here can recommend a better approach.
Post Reply

Return to “Modding help”