mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
Validate supplied components in imported player data
An import with `crafting_queue: {}` passed the schema and broke the
next restore in deserialize_crafting_queue. The import schema now
checks the members module/serialize.lua reads from the crafting queue,
quick bar, personal logistic slots and character stats, while still
allowing a component to be left out.
Character stats missing from the data are left as they are instead of
being set to nil.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5634651de1
commit
c06555c5da
4 files changed
+137
-18
No files matched your search
@@ -69,7 +69,10 @@ end
|
||||
--- Restore the stats of a character, the inventories are restored with place_items
|
||||
function serialize.deserialize_character(character, serialized)
|
||||
for _, key in pairs(character_stat_keys) do
|
||||
character[key] = serialized[key]
|
||||
-- Missing from imports and from data saved by another Factorio version
|
||||
if serialized[key] ~= nil then
|
||||
character[key] = serialized[key]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user