Adding an on_gate_changed_state event

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Galdoc
Inserter
Inserter
Posts: 47
Joined: Wed May 11, 2016 9:43 pm
Contact:

Adding an on_gate_changed_state event

Post by Galdoc »

What:
I'd like to have an event fire when a gate starts / ends an opening / closing animation or reverses direction mid-animation. If possible, it'd be cool to have a property to have a gate sign up to have this behavior, with the behavior being 'off' by default, but I don't know if that's possible.

Why:
We are currently working on 'effect areas.' Basically, we're implementing a script that Does Stuff to things in an area connected by tiles or enclosed by walls based on rules and metrics we set up. I'd like to be able to have the scripts that govern this behavior react to the doors of that area opening and closing. This could capture behaviors like opening an airlock in space, letting 'dust' into a cleanroom, stopping the ambient air temp of a room, or whatever effects that we can gamify and make fun. Germanely, this would include specific Gate entities -- Airlock Hatch, Cleanroom Door, whatever -- that would be able to fire these events. We would be able to apply arbitrary rules to the functioning of these effect areas that could essentially keep the player from going ham with them -- like, gates must be X tiles apart from one another, or you can only have X in a given area, or whatever.

Known workarounds:
Possibly doing some sort of compound entity thing with turrets. I'm not yet clear on the details, but there may be a way to sorta gerry rig something that exhibits this sort of behavior.
Post Reply

Return to “Modding interface requests”