Add the lot ledger and mint every crafted instance through it

Quality, Ingredients and Product leave CraftedItemInstance; a unit now
carries only a LotId into the run-scoped ProvenanceLedger. ItemManager
gains the one lot-minting path (CreateLot/CreateInstance(int)), GetLot,
and Brand(), which derives a maker and product from provenance instead
of a stored field. RunSave persists the ledger pruned to what the saved
zones' entities still reach; the live ledger is never pruned, so a
floor pickup collected after a save still resolves. CopyBuild is gone:
matching hardpoints now share the same lot instead of copying values.
PropertiesPanel shows the derived brand where the design's manufacturer
used to be. AetherDb's census flags duplicate (maker, design) products
and its save command checks every crafted instance's lot against a real
run store.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-17 04:16:23 +02:00
commit 415f8e1152
13 changed files with 305 additions and 92 deletions

View file

@ -145,6 +145,22 @@ public static class EntitySerializer
return (items.Select(i => i.GetBehavior<Weapon>()).ToList(), items.ToList());
}).ToArray();
}
// Every item instance an entity pack carries, recursively through its children: hull, equipment, cargo and
// docking bay units, and their stored contents. The provenance ledger's GC root walk.
public static IEnumerable<ItemInstance> Items(EntityPack pack)
{
yield return pack.Hull;
foreach (var (_, item) in pack.Equipment) yield return item;
foreach (var (_, item) in pack.CargoBays) yield return item;
foreach (var (_, item) in pack.DockingBays) yield return item;
foreach (var bay in pack.CargoContents)
foreach (var (_, item) in bay) yield return item;
foreach (var bay in pack.DockingBayContents)
foreach (var (_, item) in bay) yield return item;
foreach (var child in pack.Children)
foreach (var item in Items(child)) yield return item;
}
}
[MessagePackObject]