diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 53b83a914..dfcec6b9f 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index c80297163..ecf026533 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -60,6 +60,9 @@ Dead legacy catalog roots for user records and galaxy map-layer resources have been deleted from live Unity source. Surviving runtime DTOs no longer carry legacy catalog group/table annotations; their remaining metadata is projection and inspection metadata for the typed runtime bridge. +Item instances now carry `RuntimeItemReference`, a narrow item-id/value holder. +The old generic `RuntimeCatalogLink` abstraction has been deleted; item data +projection is routed through `ItemManager` and the typed runtime catalog reader. `Aetheria.State.Import` captures the legacy catalog files into typed quarantine state: path, size, and SHA-256 fingerprint for `AetherDB.msgpack` plus diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index 4a0513e14..d068b4199 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -377,7 +377,7 @@ public abstract class Entity public void GenerateWeaponGroups() { foreach (var group in Weapons - .GroupBy(w => w.Item.EquippableItem.Data.LinkID) + .GroupBy(w => w.Item.EquippableItem.Data.ItemId) .OrderBy(wg=>wg.Average(w=>w.Range)) .Select((weapons, index) => (weapons, index))) { @@ -1523,9 +1523,9 @@ public class EquippedCargoBay : EquippedItem } Cargo[item] = cargoCoord; - if(!ItemsOfType.ContainsKey(item.Data.LinkID)) - ItemsOfType[item.Data.LinkID] = new List(); - ItemsOfType[item.Data.LinkID].Add(item); + if(!ItemsOfType.ContainsKey(item.Data.ItemId)) + ItemsOfType[item.Data.ItemId] = new List(); + ItemsOfType[item.Data.ItemId].Add(item); } else if (Occupancy[cargoCoord.x, cargoCoord.y] is SimpleCommodity cargoCommodity && cargoCommodity.Data == item.Data) { @@ -1567,9 +1567,9 @@ public class EquippedCargoBay : EquippedItem } Cargo[item] = cargoCoord; - if(!ItemsOfType.ContainsKey(item.Data.LinkID)) - ItemsOfType[item.Data.LinkID] = new List(); - ItemsOfType[item.Data.LinkID].Add(item); + if(!ItemsOfType.ContainsKey(item.Data.ItemId)) + ItemsOfType[item.Data.ItemId] = new List(); + ItemsOfType[item.Data.ItemId].Add(item); Mass += ItemManager.GetMass(item); ThermalMass += ItemManager.GetThermalMass(item); @@ -1592,9 +1592,9 @@ public class EquippedCargoBay : EquippedItem Occupancy[v.x, v.y] = null; Cargo.Remove(item); - ItemsOfType[item.Data.LinkID].Remove(item); - if (!ItemsOfType[item.Data.LinkID].Any()) - ItemsOfType.Remove(item.Data.LinkID); + ItemsOfType[item.Data.ItemId].Remove(item); + if (!ItemsOfType[item.Data.ItemId].Any()) + ItemsOfType.Remove(item.Data.ItemId); Mass -= ItemManager.GetMass(item); ThermalMass -= ItemManager.GetThermalMass(item); @@ -1621,9 +1621,9 @@ public class EquippedCargoBay : EquippedItem Occupancy[v.x, v.y] = null; Cargo.Remove(item); - ItemsOfType[item.Data.LinkID].Remove(item); - if (!ItemsOfType[item.Data.LinkID].Any()) - ItemsOfType.Remove(item.Data.LinkID); + ItemsOfType[item.Data.ItemId].Remove(item); + if (!ItemsOfType[item.Data.ItemId].Any()) + ItemsOfType.Remove(item.Data.ItemId); Mass -= ItemManager.GetMass(item); ThermalMass -= ItemManager.GetThermalMass(item); diff --git a/Assets/Scripts/ServerShared/ItemInstance.cs b/Assets/Scripts/ServerShared/ItemInstance.cs index 014017315..a6c3ee869 100644 --- a/Assets/Scripts/ServerShared/ItemInstance.cs +++ b/Assets/Scripts/ServerShared/ItemInstance.cs @@ -12,7 +12,7 @@ using static Unity.Mathematics.math; public abstract class ItemInstance { - public RuntimeCatalogLink Data; + public RuntimeItemReference Data; public ItemRotation Rotation; } diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index bef248f21..fb237f8eb 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -57,9 +57,9 @@ public class ItemManager return _itemData.Get(id); } - public RuntimeCatalogLink CreateLink(ItemData item) + public RuntimeItemReference CreateReference(ItemData item) { - return new RuntimeCatalogLink(item); + return new RuntimeItemReference(item); } public ItemData GetData(ItemInstance item) @@ -75,10 +75,10 @@ public class ItemManager return; } - var data = _itemData.Get(item.Data.LinkID); + var data = _itemData.Get(item.Data.ItemId); if (data == null) { - _logger($"Attempted to hydrate missing item id {item.Data.LinkID}"); + _logger($"Attempted to hydrate missing item id {item.Data.ItemId}"); return; } @@ -155,7 +155,7 @@ public class ItemManager { var newItem = new SimpleCommodity { - Data = CreateLink(item), + Data = CreateReference(item), Quantity = count }; //ItemData.Add(newItem); @@ -190,13 +190,13 @@ public class ItemManager { return new EquippableItem { - Data = CreateLink(item), Quality = quality, Durability = equippableItemData.Durability + Data = CreateReference(item), Quality = quality, Durability = equippableItemData.Durability }; } var newCommodity = new CompoundCommodity { - Data = CreateLink(item), + Data = CreateReference(item), Quality = quality }; return newCommodity; diff --git a/Assets/Scripts/ServerShared/RuntimeProjection/RuntimeCatalogEntry.cs b/Assets/Scripts/ServerShared/RuntimeProjection/RuntimeCatalogEntry.cs index fd4f059b7..85b300a1a 100644 --- a/Assets/Scripts/ServerShared/RuntimeProjection/RuntimeCatalogEntry.cs +++ b/Assets/Scripts/ServerShared/RuntimeProjection/RuntimeCatalogEntry.cs @@ -26,31 +26,27 @@ public abstract class RuntimeCatalogEntry } } -public class RuntimeCatalogLink : RuntimeCatalogLinkBase where T : ItemData +public class RuntimeItemReference { - public T Value { get; private set; } + public ItemData Value { get; private set; } + public Guid ItemId; - public RuntimeCatalogLink() + public RuntimeItemReference() { } - public RuntimeCatalogLink(T value) + public RuntimeItemReference(ItemData value) { SetValue(value); } - public void SetValue(T value) + public void SetValue(ItemData value) { Value = value; - LinkID = value?.ID ?? Guid.Empty; + ItemId = value?.ID ?? Guid.Empty; } } -public class RuntimeCatalogLinkBase -{ - public Guid LinkID; -} - public interface ITintInspector { float3 TintColor { get; } diff --git a/Assets/Scripts/UI/Menu/TradeMenu.cs b/Assets/Scripts/UI/Menu/TradeMenu.cs index 1cefdcc62..8212f200d 100644 --- a/Assets/Scripts/UI/Menu/TradeMenu.cs +++ b/Assets/Scripts/UI/Menu/TradeMenu.cs @@ -289,7 +289,7 @@ public class TradeMenu : MonoBehaviour x => () => { if (x.data is HullData) - return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.LinkID == x.data.ID && s is Ship {IsPlayerShip: true}).ToString(); + return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.ItemId == x.data.ID && s is Ship {IsPlayerShip: true}).ToString(); if(x.data is SimpleCommodityData) return (_targetCargo.ItemsOfType.ContainsKey(x.data.ID) ? _targetCargo.ItemsOfType[x.data.ID].Cast().Sum(s=>s.Quantity) : 0).ToString(); return (_targetCargo.ItemsOfType.ContainsKey(x.data.ID) ? _targetCargo.ItemsOfType[x.data.ID].Count : 0).ToString(); @@ -297,7 +297,7 @@ public class TradeMenu : MonoBehaviour data => { if (data is HullData) - return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.LinkID == data.ID && s is Ship {IsPlayerShip: true}); + return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.ItemId == data.ID && s is Ship {IsPlayerShip: true}); if(data is SimpleCommodityData) return _targetCargo.ItemsOfType.ContainsKey(data.ID) ? _targetCargo.ItemsOfType[data.ID].Cast().Sum(s=>s.Quantity) : 0; return _targetCargo.ItemsOfType.ContainsKey(data.ID) ? _targetCargo.ItemsOfType[data.ID].Count : 0; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 41ec30080..3cdbb8650 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -92,13 +92,14 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. in-memory list remains a UI/session cache, not durable authority. - `ActionGameManager` opens `AetheriaRuntimeCatalogStore` over `aetheria-world.cc`, projects it through `AetheriaRuntimeItemCatalog`, and - gives `ItemManager` explicit item lookup authority. `RuntimeCatalogLink` - is now a hydrated identifier/value holder, not a process-global catalog - resolver. The old `LegacyItemCatalogBoundary`, `LegacyItemCatalogCache`, and - runtime MessagePack deserializer path have been deleted. The old - `DatabaseEntry`/`DatabaseLink` names have been demoted to - `RuntimeCatalogEntry`/`RuntimeCatalogLink` runtime projection helpers, not - MessagePack objects or a global union root. + gives `ItemManager` explicit item lookup authority. Item instances carry + `RuntimeItemReference`, a hydrated item-id/value holder, not a process-global + catalog resolver. The old `LegacyItemCatalogBoundary`, + `LegacyItemCatalogCache`, and runtime MessagePack deserializer path have been + deleted. The old `DatabaseEntry` name has been demoted to + `RuntimeCatalogEntry` for surviving runtime DTOs, and the old generic + `DatabaseLink`/`RuntimeCatalogLink` path has collapsed into the + item-specific runtime reference. - `ItemManager` no longer exposes the raw runtime item catalog reader as public gameplay/UI API. Temporary item instantiation bridges now go through the narrow `ItemManager.GetCatalogEntry` method. `ItemManager` no longer @@ -123,10 +124,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. `Faction` DTOs, including allegiance edges, for the existing simulation shape and resolves full name arrays from `aetheria.name_file.v2` records. The runtime no longer opens the old `GameData/NameFile/*.msgpack` directory. -- `RuntimeCatalogLink.Value` can resolve legacy links only after - `ActionGameManager` binds the typed runtime item catalog projected from - `aetheria-world.cc`. MessagePack catalog construction no longer grabs global - link-resolution authority. +- Item instances carry `RuntimeItemReference`, a narrow item-id/value holder + resolved by `ItemManager` against the typed runtime item catalog projected + from `aetheria-world.cc`. MessagePack catalog construction no longer grabs + global link-resolution authority, and the old generic `RuntimeCatalogLink` + abstraction is gone. - `Economy.Server` now starts the modern `Aetheria.State` CultMesh node, drains pending Unity runtime commits through the typed state applicator, and no longer owns RethinkDB/LiteNetLib state. @@ -333,7 +335,7 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. typed state file path plus the boot-time state-file probe, and is the landing zone for future typed catalog boot. `ActionGameManager` opens the package-owned typed runtime catalog snapshot - and binds `RuntimeCatalogLink` resolution through `AetheriaRuntimeItemCatalog`. + and binds item reference resolution through `AetheriaRuntimeItemCatalog`. Runtime code receives narrow `ItemManager` catalog methods where gameplay only needs item lookups. `Galaxy`, entity restore, and faction-distance loadout weighting have been moved off legacy faction catalog reads. @@ -539,10 +541,9 @@ First Aetheria surfaces to publish: - Done: demote `DatabaseEntry` and `DatabaseLink` from MessagePack union/object shapes to plain runtime identity/link helpers. - Done: rename live Unity projection helpers from `DatabaseEntry`, - `DatabaseLink`, and `InspectableDatabaseLinkAttribute` to - `RuntimeCatalogEntry`, `RuntimeCatalogLink`, and - `InspectableRuntimeCatalogLinkAttribute`, and move the old - `ServerShared/CultCache` folder to `ServerShared/RuntimeProjection`. + `DatabaseLink`, and `InspectableDatabaseLinkAttribute` to runtime + projection names, and move the old `ServerShared/CultCache` folder to + `ServerShared/RuntimeProjection`. - Done: replace behavior union reflection with an explicit runtime catalog behavior map and remove all live `Union(...)` annotations. - Done: demote agent task runtime shapes from MessagePack object/key/union @@ -644,6 +645,9 @@ First Aetheria surfaces to publish: - Done: delete the process-global runtime catalog resolver from `RuntimeCatalogLink`; item instances now carry hydrated identifiers and `ItemManager` owns resolution through the typed runtime catalog reader. + - Done: collapse the old generic `RuntimeCatalogLink` abstraction into + `RuntimeItemReference`, an item-specific runtime projection reference owned + by `ItemManager`. - Done: quarantine the vendored Unity `MessagePack` assembly by disabling asmdef auto-reference; only explicit state-spine assemblies should see it while the Unity CultCache bridge still needs a low-level `.cc` codec. @@ -699,6 +703,8 @@ First Aetheria surfaces to publish: error hits. - `rg ".Data.Value|BindRuntimeItemCatalog|ResolveRuntimeItemCatalog|private static IRuntimeItemCatalogReader"` in `Assets/Scripts` now finds only `ItemManager` checking its own hydrated value. +- Live Unity source has no `RuntimeCatalogLink` or `RuntimeCatalogLinkBase`; + item instances use `RuntimeItemReference` and expose `Data.ItemId`. - Unity batchmode compile also returned cleanly after disabling `MessagePack` auto-reference; `Assets/Scripts` and `Assets/Editor` have no `using MessagePack`, `MessagePackSerializer`, `[MessagePackObject]`, or