Page 1 of 1
Event raised when LuaGenericOnOffControlBehavior entity is disabled/enabled
Posted: Thu Jan 17, 2019 7:42 pm
by Fractaliste
I'm currently implementing this functionnality with a on_nth_tick handler which call someSurface.find_entities_filtered() with a filter over train-stop entities, and then checking state throught control behaviour associated....
But I think this state change is already detected into C++ code to trigger the activated state, and raising a new event here would be much more efficient that my current implementation...
Re: Event raised when LuaGenericOnOffControlBehavior entity is disabled/enabled
Posted: Thu Jan 17, 2019 11:19 pm
by Rseding91
Fractaliste wrote: ↑Thu Jan 17, 2019 7:42 pm
But I think this state change is already detected into C++ code to trigger the activated state, and raising a new event here would be much more efficient that my current implementation...
While true, it would have too much overhead and be fired too frequently compared to not having the event at all (as it is now).
Re: Event raised when LuaGenericOnOffControlBehavior entity is disabled/enabled
Posted: Thu Jan 17, 2019 11:32 pm
by DaveMcW
Fractaliste wrote: ↑Thu Jan 17, 2019 7:42 pmcall
someSurface.find_entities_filtered() with a filter over
train-stop entities, and then checking state throught control behaviour associated...
You can improve your implementation by creating a global table of train stops indexed by unit_number and updated on built/destroyed events. This skips the find_entities_filtered() overhead.