Page 1 of 1

Subscribing to on_tick for 1 tick - is it OK?

Posted: Fri May 01, 2020 1:29 pm
by moon69
I want to do some light maintenence of my mod (using game object) once on every game load, so I do this by subscribing to on_tick and then unsubscribing in it's handler.

Is this the recommended method? Are there any pitfalls I need to look out for? Particularly wrt to multiplayer?

Cheers

Re: Subscribing to on_tick for 1 tick - is it OK?

Posted: Fri May 01, 2020 1:31 pm
by Klonan
You shouldn't really be doing things on game load, other than setting up metatable and things

What are you doing on load?

Subscribing to events on load is a very typical way to causing desyncs

Re: Subscribing to on_tick for 1 tick - is it OK?

Posted: Fri May 01, 2020 1:57 pm
by moon69
Current intent is to close all mod guis that are saved open, remove custom selection-tool from hand, enable personal roboport and such things to give a clean start on resuming play.

Re: Subscribing to on_tick for 1 tick - is it OK?

Posted: Fri May 01, 2020 4:37 pm
by Klonan
moon69 wrote: Fri May 01, 2020 1:57 pm Current intent is to close all mod guis that are saved open, remove custom selection-tool from hand, enable personal roboport and such things to give a clean start on resuming play.
These things will definitely cause a desync

Re: Subscribing to on_tick for 1 tick - is it OK?

Posted: Fri May 01, 2020 4:44 pm
by moon69
Thanks for advice.