Hi,
what is the best way to execute some code that may change the sim periodically during a game,
say once a second or every n'th beat?
(context: I'd like to destroy units periodically that are outside of the map boundary)
Currently I am using ForkThread at the end of BeginSession in simInit.lua and WaitSeconds
in the thread function but altering the sim in another thread feels unsafe.
Is there a better way to execute code that affects the sim every n'th sim beat?
I've seen OnBeat and AddBeatFunction in ui\game\gamemain.lua but it seems to be only used in UI related stuff?