Let old saves through the player left guard

on_pre_player_left_game runs before on_server_startup when an old autosave
with connected players is loaded, so the data is still under inventory_sync.
The guard returned before get_script_data() could move it, and the recovery
upload was never sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-14 16:39:27 +00:00
1 parent 8363c5f0ef
commit 03ff234f0f
1 file changed
+2 -1
+2 -1
View File
@@ -379,7 +379,8 @@ end
-- Upload inventory when a player leaves the game. Triggers on restart after crash if player was online during crash.
player_sync.events[defines.events.on_pre_player_left_game] = function(event)
-- for some reason, on_pre_player_left_game gets called before on_server_startup so script_data isn't ready yet
if not compat.script_data.player_sync then
-- migrate: saves from before the rename still have their data under inventory_sync
if not compat.script_data.player_sync and not compat.script_data.inventory_sync then
log("ERROR: script data for player sync is not defined")
return
end