That's fine to put them there. The game overwrites the global values on load so it's save/load safe.Zaflis wrote:Current start of the script is now:Unless you convince me to put first 3 lines inside on_init, i'd consider it solved It worked in all test cases i could think of, but obviously i cannot test multiplayer sync.Code: Select all
global.lastorientation = {} global.player_ticks = {} global.tick = 2 script.on_configuration_changed(function(data) if data.mod_changes == nil then return end if global.lastorientation == nil then global.lastorientation = {} end if global.player_ticks == nil then global.player_ticks = {} end if global.tick == nil then global.tick = 2 end end)
Also the mod is using the game.players directly. Say your player index is 4 and you're driving a car. If player index 3 leaves the game, you will now be index 3, no? If that happens you might see your snap variable reset.
It wouldn't hurt to put them in on_init but it doesn't hurt to have them here either.