From 93ead85e5dde808f85f7e7a462713cd192873cec Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Fri, 16 Oct 2026 19:55:05 +0000 Subject: [PATCH] Upload cleared logistic requests on Factorio 1.1 A character without requests serialized to nil, which the controller reads as a player with nowhere to hold them, so with inventories off the stored requests came back. Serialize an empty table instead, clear old slots before restoring on 1.1, and fix the set_personal_logistic_slot typo that made any 1.1 restore fail. Co-Authored-By: Claude Opus 5.5 --- plugins/player_sync/module/serialize.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/player_sync/module/serialize.lua b/plugins/player_sync/module/serialize.lua index b0db1272..1bbb64b7 100644 --- a/plugins/player_sync/module/serialize.lua +++ b/plugins/player_sync/module/serialize.lua @@ -291,7 +291,8 @@ function serialize.serialize_personal_logistic_slots(player) return serialized end - local serialized = nil + -- Empty when there are no requests, nil means the player has nowhere to hold them + local serialized = {} -- Serialize personal logistic slots local last_valid = 0 @@ -299,9 +300,6 @@ function serialize.serialize_personal_logistic_slots(player) local slot = player.get_personal_logistic_slot(i) if slot.name then last_valid = i - if not serialized then - serialized = {} - end serialized[tostring(i)] = { name = slot.name, min = slot.min, @@ -341,7 +339,9 @@ function serialize.deserialize_personal_logistic_slots(player, serialized) end -- If this is an array instead of a table, migrate to v2 format - if serialized[1] ~= nil then + if next(serialized) == nil then + return + elseif serialized[1] ~= nil then local section = logistic_point.add_section() for i, slot in pairs(serialized) do section.set_slot(i, { @@ -376,11 +376,18 @@ function serialize.deserialize_personal_logistic_slots(player, serialized) end end else - for i, slot in pairs(serialized) do - if slot ~= nil then - player.set_personal_slogistic_slot(tonumber(i), slot) + local last_valid = 0 + for i = 1, 65536 do + if player.get_personal_logistic_slot(i).name then + last_valid = i + player.clear_personal_logistic_slot(i) + elseif last_valid + 100 <= i then + break end end + for i, slot in pairs(serialized) do + player.set_personal_logistic_slot(tonumber(i), slot) + end end end