diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index ff63ed55e..92e2cc499 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Aetheria.State.Smoke/Program.cs b/Aetheria.State.Smoke/Program.cs index 281a65ae3..edea6dc19 100644 --- a/Aetheria.State.Smoke/Program.cs +++ b/Aetheria.State.Smoke/Program.cs @@ -206,7 +206,10 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s new AetheriaEntityItemSlot { Position = new AetheriaGridCoord { X = 0, Y = 0 }, - ItemKey = AetheriaCatalogKeys.ItemDefinitionFromLegacyId(itemLegacyId).ToString() + ItemKey = AetheriaCatalogKeys.ItemDefinitionFromLegacyId(itemLegacyId).ToString(), + Quality = 0.9, + Durability = 0.8, + Quantity = 1 } ], WeaponGroups = @@ -465,6 +468,9 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether if (entitySnapshot?.Kind != "ship" || entitySnapshot.Equipment.Length != 1 || + entitySnapshot.Equipment[0].Quality != 0.9 || + entitySnapshot.Equipment[0].Durability != 0.8 || + entitySnapshot.Equipment[0].Quantity != 1 || entitySnapshot.WeaponGroups.Length != 1 || entitySnapshot.StatGrids.Length != 1 || entitySnapshot.StatGrids[0].Values.Length != 4) diff --git a/Aetheria.State.Unity.Smoke/Program.cs b/Aetheria.State.Unity.Smoke/Program.cs index bec8bb386..b08a4750f 100644 --- a/Aetheria.State.Unity.Smoke/Program.cs +++ b/Aetheria.State.Unity.Smoke/Program.cs @@ -529,6 +529,9 @@ try zone.Bodies[0].Resources[0].ItemKey == "aetheria.item_definition:legacy:smoke:ore" && zone.Bodies[0].Asteroids.Length == 1 && entity?.Equipment.Length == 1 && + entity.Equipment[0].Quality == 0.9 && + entity.Equipment[0].Durability == 0.8 && + entity.Equipment[0].Quantity == 1 && entity.Velocity.X == 4.0 && entity.Velocity.Y == -2.0 && entity.TargetEntityKey == "global:aetheria.run_state.smoke-run.zone.0.entity.0.v1" && @@ -611,6 +614,9 @@ try packageZones[0].Bodies[0].AsteroidCount != 1 || packageEntities.Count != 1 || packageEntities[0].Name != "Unity Smoke Ship" || + packageEntities[0].Equipment[0].Quality != 0.9 || + packageEntities[0].Equipment[0].Durability != 0.8 || + packageEntities[0].Equipment[0].Quantity != 1 || packageEntities[0].VelocityX != 4.0 || packageEntities[0].VelocityY != -2.0 || packageEntities[0].TargetEntityKey != "global:aetheria.run_state.smoke-run.zone.0.entity.0.v1" || diff --git a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs index d6648999d..0c1836c47 100644 --- a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs +++ b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs @@ -191,11 +191,22 @@ public static class AetheriaRuntimeCommitLogApplier private static AetheriaEntityItemSlot[] ToEntityItemSlots( IReadOnlyList? slots) { - return ToItemSlots(slots) - .Select(slot => new AetheriaEntityItemSlot + return (slots ?? Array.Empty()) + .Select(slot => { - Position = slot.Position, - ItemKey = slot.Item.ItemKey + var item = ToLoadoutItem(slot.Item); + return new AetheriaEntityItemSlot + { + Position = new AetheriaGridCoord + { + X = slot.X, + Y = slot.Y + }, + ItemKey = item.ItemKey, + Quality = item.Quality, + Durability = item.Durability, + Quantity = item.Quantity + }; }) .ToArray(); } diff --git a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs index bfe0ca8d3..7325e39a9 100644 --- a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs +++ b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs @@ -504,6 +504,15 @@ public sealed class AetheriaEntityItemSlot [Key(1)] public string ItemKey { get; set; } = ""; + + [Key(2)] + public double Quality { get; set; } = 1.0; + + [Key(3)] + public double Durability { get; set; } = 1.0; + + [Key(4)] + public int Quantity { get; set; } = 1; } [MessagePackObject] diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs index d12d89bfc..43b29d93c 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs @@ -923,16 +923,22 @@ namespace GameCult.Aetheria.State.Unity public sealed class AetheriaRuntimeEntityItemSlotSnapshot { - public AetheriaRuntimeEntityItemSlotSnapshot(int x, int y, string itemKey) + public AetheriaRuntimeEntityItemSlotSnapshot(int x, int y, string itemKey, double quality, double durability, int quantity) { X = x; Y = y; ItemKey = itemKey; + Quality = quality; + Durability = durability; + Quantity = quantity; } public int X { get; } public int Y { get; } public string ItemKey { get; } + public double Quality { get; } + public double Durability { get; } + public int Quantity { get; } } public sealed class AetheriaRuntimeEntityStatGridSnapshot diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index 87ac8401e..52e6fabde 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -696,8 +696,17 @@ namespace GameCult.Aetheria.State.Unity var slotFields = reader.ReadArrayHeader(); var position = ReadFieldGridCoord(ref reader, slotFields, 0); var itemKey = ReadFieldString(ref reader, slotFields, 1); - SkipRemaining(ref reader, slotFields, 2); - slots[slot] = new AetheriaRuntimeEntityItemSlotSnapshot(position.X, position.Y, itemKey); + var quality = ReadFieldDouble(ref reader, slotFields, 2, 1); + var durability = ReadFieldDouble(ref reader, slotFields, 3, 1); + var quantity = ReadFieldInt32(ref reader, slotFields, 4); + SkipRemaining(ref reader, slotFields, 5); + slots[slot] = new AetheriaRuntimeEntityItemSlotSnapshot( + position.X, + position.Y, + itemKey, + quality, + durability, + quantity <= 0 ? 1 : quantity); } return slots; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 6ffe1aca2..350bc437a 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -153,6 +153,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. They also carry public runtime session state: velocity, target entity reference, active flag, heatsink toggle, shutdown override, tractor power, heatstroke/hypothermia accumulators, and active consumable item/timer rows. + Entity equipment, cargo-bay, and docking-bay slot rows preserve item-instance + facts needed for restore: item key, quality, durability, and quantity. Those + facts are no longer discarded when pending checkpoint commands become + canonical `AetheriaEntitySnapshot` documents or package readback DTOs. Equipped-item and active-consumable behaviors that intentionally expose `IProgressBehavior` now publish typed progress rows keyed by owner kind, owner index, behavior index, behavior kind, and progress value. @@ -800,6 +804,9 @@ First Aetheria surfaces to publish: - Done: persist the actual galaxy generation seed in typed run state, so future Continue/restore work has a reproducible topology body before applying current-zone/entity snapshots. + - Done: preserve entity snapshot item-instance facts for equipment, + cargo-bay, and docking-bay slot rows: item key, quality, durability, and + quantity now survive canonical state and Unity package readback. - Remaining: add typed documents/mappers for runtime object graphs, typed behavior factory construction, remaining behavior-private state not covered by progress, weapon, sensor, radiator, reactor, or capacitor rows,