But every time when on_load fired - you get actual data.Nexela wrote:Bilka wrote:Interesting, that means it won't even get reset by loading the file (which is what I thought would happen), so that should be completely fine. The more you knoweradicator wrote:So...that bit should behave pretty much the same as setting default values via "global.key = global.key or value" in on_init. And as such it might not actually be invalid. If it was written like that intentionally (ok, not very likely :p) i might actually consider it clever api usage..... hm... think think thing.... but... it'll break when a new version introduces new values. *scratches head*. But then why are the values even persisted...?!Data Lifecycle wrote:Note, although the global table has not been setup if a mod does populate the table with some data it will be overwritten by any loaded data.
The problem with doing it outside of an event is this
edit:
global.a = 1
save and edit:
global.a = 2
load:
global.a == 1
This is because during init "global" is saved to the map and during load the data from "global" that is stored in the savefile overwrites whatever you have for global.
on_init and and on_configuration_changed are the best places to populate and edit your "global"
In MP when someone is connecting to the game, game is halting to save/share/load actual data with all current changes in global, isn't it?
In SP, you continue your progress from last save.
In all cases you getting actual globals.