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 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-17 15:25:06 +00:00
1 parent 45fedf28a0
commit 93ead85e5d
1 file changed
+15 -8
+15 -8
View File
@@ -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