#You can register and unregister on the

1 messages · Page 1 of 1 (latest)

low jewel
#

I have a few sequential functions that don't need to be continually called unless the previous function has given it something to do..
But I first need a way to trigger it so I was thinking of registering pre_on_built to set a global var and deregistering it when the first function runs out of stuff to do

#

perhaps my performance standards are far too high..

#

¯_(ツ)_/¯

quick aurora
#

Yeah I think that is a bit overkill

#

Just make sure you're using event filters if possible

#

And return as early as possible if you don't care about the event

low jewel
#
script.on_nth_tick(60, job_proc.process_job_queue)

job_proc.process_job_queue = function()
    job_proc.get_job() -- job creation
    job_proc.do_job(global.job_bundles) -- job opteration
end
#

that should paint the picture

#

do_job returns immediately is next(t) is false

#

but get_job does a similar thing for all surfaces 😐

#

and before that, only they need to be called if the entity processor was active

#

I can deactivate the entity_processor if I set a global var

#

but the only way to activate it again then becomes setting a variable for every entity that is placed in a blue print 🤯