How I can see that my mod was already registered before control.lua runtime etc?
Posted: Sat Apr 03, 2021 8:33 am
I want to know more about the state of a mod before any call of defined.events in order to sync variables/events.
on_init, on_load, on_configuration_changed from LuaBootstrap works if the mod isn't registered to the save file yet, or it's another version of the mod.
However, in other cases, I don't see any way to notice that the mod won't call on_init, on_load, on_configuration_changed and thus the mod won't get access to some variables/changes before the runtime stage without workarounds like "settings".
It's the case when players will be desync if the mod changed events/variables at runtime stage, but the mod can't check "environment" without using another ways, because the mod is registered already and there's no other "events"/adaptation to other cases.
I can avoid the global table by creating settings at settings stage and operating with them through scripts at events etc thus it'd be a possibility for the mod in order to check changes... or I might even use event filters for my particular cases with events, changing them sometimes, but it'd be weird.
So, if I'm changing events/variables at runtime stage, I can sync them by using setting created at settings stage or don't change them by using event filters with additional scripts and, probably, with new events. Those ways/workarounds are kinda dirty in some cases and not always suitable.
Also, how I can know that a map initializing first time? (on_nth_tick calls immediately at runtime stage, but the global table is not initialized yet)
(such dynamic events is the only way for overloaded events with dynamic reaction/environment)
on_init, on_load, on_configuration_changed from LuaBootstrap works if the mod isn't registered to the save file yet, or it's another version of the mod.
However, in other cases, I don't see any way to notice that the mod won't call on_init, on_load, on_configuration_changed and thus the mod won't get access to some variables/changes before the runtime stage without workarounds like "settings".
It's the case when players will be desync if the mod changed events/variables at runtime stage, but the mod can't check "environment" without using another ways, because the mod is registered already and there's no other "events"/adaptation to other cases.
I can avoid the global table by creating settings at settings stage and operating with them through scripts at events etc thus it'd be a possibility for the mod in order to check changes... or I might even use event filters for my particular cases with events, changing them sometimes, but it'd be weird.
So, if I'm changing events/variables at runtime stage, I can sync them by using setting created at settings stage or don't change them by using event filters with additional scripts and, probably, with new events. Those ways/workarounds are kinda dirty in some cases and not always suitable.
Also, how I can know that a map initializing first time? (on_nth_tick calls immediately at runtime stage, but the global table is not initialized yet)
(such dynamic events is the only way for overloaded events with dynamic reaction/environment)