Save roots: every crafted item roots at Lot 0 too; pin zero-draw mint guard and both root sides

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Nibu 2026-11-13 03:55:32 +00:00
commit d3572c0190
2 changed files with 48 additions and 8 deletions

View file

@ -222,10 +222,12 @@ public static class RunSave
.Select(stored => stored.Key)
.ToArray();
game.Zones = keys.Select(key => new CultRecordRef<SavedZone>(key)).ToArray();
// Every crafted item roots, Lot 0 included: a crafted item with no lot is corruption and Reachable throws on it.
// A SimpleCommodity roots only when it names a lot; Lot 0 is bought, staged or loadout stock.
var roots = zones
.SelectMany(zone => zone.Contents?.Entities ?? new List<EntityPack>())
.SelectMany(EntitySerializer.Items)
.Where(item => item != null && item.Lot != 0)
.Where(item => item != null && (item is CraftedItemInstance || item.Lot != 0))
.Select(item => item.Lot);
cache.Commit(batch =>
{