Page 1 of 1

Circuit/production controllable events?

Posted: Tue May 30, 2017 8:30 pm
by aaargha
I'm wondering if there is any way to trigger events, that I can listen for in a mod, that is controllable by circuits/recipe completion.

What I'm trying to do is create an entity that can deploy trains by copying settings from an existing train. The whole copying and deploying part I'm pretty sure I can figure out, I just can't seem to find a good trigger for when to do so. Looking at other mods, like Robot army, it seems that keeping lists of all the entities that need to do script work when done and then checking intermittently using on_tick is the way to go? This just feels really inefficient/hacky way of doing it.

The only other alternative I currently have is using the on_resource_depleted event and hooking it up to a circuit controlled pumpjack/mining drill and then running my code and refilling the ore/oil when the event triggers. Basically I'd allow the player to place an "Endless well/heap of trains". I'm leaning towards using ore as then I can let the player mine it and use on_player_mined_item to remove the ore patch? This is also super hacky but at least it does not have the constant performance cost that using on_tick does.

It may also be possible to use on_sector_scanned with a power switch and a custom radar but it's not possible to add circuit connections to a radar is it?

Is there a proper, non-roundabout way of doing this, or do I just need to get hacking?