From 03ff234f0fa704040bd0638be88f391fdad3b26a Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Wed, 14 Oct 2026 16:39:27 +0000 Subject: [PATCH] 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 --- plugins/player_sync/module/player_sync.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/player_sync/module/player_sync.lua b/plugins/player_sync/module/player_sync.lua index 28346ffe..473b6e5e 100644 --- a/plugins/player_sync/module/player_sync.lua +++ b/plugins/player_sync/module/player_sync.lua @@ -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