Restore pre-2.0 logistic slots and bound imported stats

Logistic slots saved before 2.0 are keyed by index strings, which
json_to_table keeps as strings, so the migration branch never ran and
the 2.0 branch failed on the missing sections. Detect the old format by
the missing sections and convert the keys to numbers.

The import schema now uses the minimums Factorio enforces for character
stats, checks the filter value type and the quick bar comparator, and
allows filters without quality or comparator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-17 20:25:29 +00:00
1 parent c06555c5da
commit 5ca10d579d
3 files changed
+34 -16

No files matched your search

+3 -3
View File
@@ -346,13 +346,13 @@ function serialize.deserialize_personal_logistic_slots(player, serialized)
logistic_point.remove_section(i)
end
-- If this is an array instead of a table, migrate to v2 format
-- Data from before 2.0 maps slot indices to requests, migrate it to a section
if next(serialized) == nil then
return
elseif serialized[1] ~= nil then
elseif serialized.sections == nil then
local section = logistic_point.add_section()
for i, slot in pairs(serialized) do
section.set_slot(i, {
section.set_slot(tonumber(i), {
value = {
name = slot.name,
quality = "normal",