Place synced items from a list of stacks instead of script inventories

place_items no longer creates script inventories for what does not fit. Each serialized inventory is split at the size of its destination: the slots that fit are restored slot for slot and the rest become serialized stacks, which are inserted into the free space of the same inventory and then main, guns, ammo and armor. What is still left over is returned as a list and spill_items puts it into a corpse sized to hold it. This keeps 1.0 out of reach of game.create_inventory.

The armor-first fill order is gone, as the bonus slots from armor equipment only apply on the next tick anyway (#1106). Filters are no longer stripped for destinations, they are the same inventory type the data came from.

deserialize_inventory concatenated the filter table in its error print on 2.0, which errored out the whole restore when an inventory did not support filters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-17 15:36:22 +00:00
1 parent 923ba10d2a
commit a1a57b8c97
2 files changed
+125 -120

No files matched your search

@@ -292,10 +292,10 @@ function serialize.deserialize_inventory(inventory, serialized)
if entry.f then
local call_success, call_return = pcall(inventory.set_filter, index, entry.f)
if not call_success then
print("Error: '" .. call_return .. "' thrown setting filter " .. entry.f)
print("Error: '" .. call_return .. "' thrown setting filter " .. serpent.line(entry.f))
elseif not call_return then
print("Error: Failed to set filter " .. entry.f)
print("Error: Failed to set filter " .. serpent.line(entry.f))
end
end