diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index a4a8636be..02cfebc0e 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index f1a43ef60..ee85598ce 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -1626,7 +1626,7 @@ public class EquippedCargoBay : EquippedItem // For simple commodities, search for existing item stacks to add to foreach (var cargoItem in Cargo.Keys) { - if (item.Data != cargoItem.Data) continue; + if (item.ItemId != cargoItem.ItemId) continue; var cargoCommodity = (SimpleCommodity) cargoItem; if (cargoCommodity.Quantity >= maxStack) continue; @@ -1722,7 +1722,7 @@ public class EquippedCargoBay : EquippedItem ItemsOfType[item.ItemId] = new List(); ItemsOfType[item.ItemId].Add(item); } - else if (Occupancy[cargoCoord.x, cargoCoord.y] is SimpleCommodity cargoCommodity && cargoCommodity.Data == item.Data) + else if (Occupancy[cargoCoord.x, cargoCoord.y] is SimpleCommodity cargoCommodity && cargoCommodity.ItemId == item.ItemId) { if (cargoCommodity.Quantity + item.Quantity <= maxStack) { @@ -1799,7 +1799,7 @@ public class EquippedCargoBay : EquippedItem item.Quantity -= quantity; Mass -= GetUnitMass(item) * quantity; ThermalMass -= GetUnitThermalMass(item) * quantity; - return new SimpleCommodity{Data = item.Data, Quantity = quantity, Rotation = item.Rotation}; + return new SimpleCommodity{Reference = item.Reference, Quantity = quantity, Rotation = item.Rotation}; } public void Remove(CraftedItemInstance item) diff --git a/Assets/Scripts/ServerShared/ItemInstance.cs b/Assets/Scripts/ServerShared/ItemInstance.cs index 57ace52ec..55b2b9bc5 100644 --- a/Assets/Scripts/ServerShared/ItemInstance.cs +++ b/Assets/Scripts/ServerShared/ItemInstance.cs @@ -14,6 +14,12 @@ public abstract class ItemInstance { public RuntimeItemReference Data; public ItemRotation Rotation; + public RuntimeItemReference Reference + { + get => Data; + set => Data = value; + } + public Guid ItemId => Data?.ItemId ?? Guid.Empty; } diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index 87ca94297..b439e8b0d 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -398,7 +398,7 @@ public class ItemManager { return new SimpleCommodity { - Data = CreateReference(itemId), + Reference = CreateReference(itemId), Quantity = count }; } @@ -444,14 +444,14 @@ public class ItemManager { return new ConsumableItem { - Data = CreateReference(itemId), + Reference = CreateReference(itemId), Quality = quality }; } return new CompoundCommodity { - Data = CreateReference(itemId), + Reference = CreateReference(itemId), Quality = quality }; } @@ -471,7 +471,7 @@ public class ItemManager return new EquippableItem { - Data = CreateReference(itemId), + Reference = CreateReference(itemId), Quality = quality, Durability = item.Durability > 0 ? (float)item.Durability : 1f }; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 8c689faed..5217dcd1a 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -545,10 +545,12 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. escape `ItemManager`; gameplay stat modifiers target live behavior instances and package-owned behavior metadata instead of rebuilding config DTOs for lookup. - `ItemInstance.ItemId` is the runtime identity surface; `RuntimeItemReference` - remains only the backing compatibility reference until native typed item - instances replace it. The reader interface for this bridge is named - `IRuntimeItemCatalogReader` and exposes only typed catalog row lookup. Behavior + `ItemInstance.ItemId` is the runtime identity surface and + `ItemInstance.Reference` is the explicit item-reference API; + `RuntimeItemReference Data` remains only the backing compatibility field + until native typed item instances replace it. The reader interface for this + bridge is named `IRuntimeItemCatalogReader` and exposes only typed catalog + row lookup. Behavior type selection now uses an explicit runtime catalog map instead of `UnionAttribute` reflection, and the temporary behavior config constructor map is keyed by typed behavior payload kind rather than legacy union key. @@ -1057,6 +1059,10 @@ First Aetheria surfaces to publish: move live runtime/UI/catalog lookup call sites off `.Data.ItemId`. The old `Data` field is now compatibility backing state rather than the identity API callers use. + - Done: add `ItemInstance.Reference` as the explicit item-reference API and + move factories/cargo stacking off direct `.Data` comparisons and + assignments. `Data` remains only the serialized/backing compatibility + field. - Done: delete the dead `ItemManager.GetRuntimeItemProjection` bridge after loadout generation stopped hydrating selected typed rows into `EquippableItemData` merely to instantiate equipment. @@ -1124,7 +1130,8 @@ First Aetheria surfaces to publish: - `rg ".Data.Value|SetValue|GetCatalogEntry|IRuntimeItemCatalogReader|BindRuntimeItemCatalog|ResolveRuntimeItemCatalog|private static IRuntimeItemCatalogReader"` in `Assets/Scripts` is zero for the old item value/catalog-entry/resolver path. - Live Unity source has no `RuntimeCatalogLink` or `RuntimeCatalogLinkBase`; - item instances use `RuntimeItemReference` and expose `Data.ItemId`. + item instances expose `ItemId` and `Reference`; direct `Data.ItemId` reads are + contained inside the `ItemInstance.ItemId` bridge. - Live Unity source has no `RuntimeCatalogEntry` or `RuntimeItemProjectionEntry`. - Live Unity source has no `InspectableRuntimeCatalogLinkAttribute`; `LegacyPayloadKeyAttribute` remains only as the temporary mapper key.