diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 54d048ce2..ce6050a15 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Aetheria.State.Unity/Aetheria.State.Unity.csproj b/Aetheria.State.Unity/Aetheria.State.Unity.csproj index f3c8bcf79..0cf936df8 100644 --- a/Aetheria.State.Unity/Aetheria.State.Unity.csproj +++ b/Aetheria.State.Unity/Aetheria.State.Unity.csproj @@ -11,6 +11,7 @@ + diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index b86c4998b..e091c5519 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -765,7 +765,7 @@ public class ActionGameManager : MonoBehaviour { var typedItem = FindTypedActionBarItem(item); return typedItem != null && - string.Equals(typedItem.Category, nameof(ConsumableItemData), StringComparison.Ordinal) + string.Equals(typedItem.Category, AetheriaRuntimeItemCategories.Consumable, StringComparison.Ordinal) ? typedItem : null; } diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index 43ff1841c..96ca3bfa4 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -613,13 +613,13 @@ public abstract class Entity private static bool IsCargoBay(AetheriaRuntimeCatalogItem typedItem) { return typedItem != null && - (string.Equals(typedItem.Category, "CargoBayData", StringComparison.Ordinal) || - string.Equals(typedItem.Category, "DockingBayData", StringComparison.Ordinal)); + (string.Equals(typedItem.Category, AetheriaRuntimeItemCategories.CargoBay, StringComparison.Ordinal) || + string.Equals(typedItem.Category, AetheriaRuntimeItemCategories.DockingBay, StringComparison.Ordinal)); } private static bool IsDockingBay(AetheriaRuntimeCatalogItem typedItem) { - return typedItem != null && string.Equals(typedItem.Category, "DockingBayData", StringComparison.Ordinal); + return typedItem != null && string.Equals(typedItem.Category, AetheriaRuntimeItemCategories.DockingBay, StringComparison.Ordinal); } private static Shape ToShape(int width, int height, IReadOnlyList cells) diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index 0ebb9fbeb..35fe300e1 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -227,7 +227,7 @@ public class ItemManager throw new NullReferenceException("Attempted to create crafted item instance using missing typed item data!"); } - if (string.Equals(item.Category, nameof(ConsumableItemData), StringComparison.Ordinal)) + if (string.Equals(item.Category, AetheriaRuntimeItemCategories.Consumable, StringComparison.Ordinal)) { return new ConsumableItem { @@ -292,7 +292,7 @@ public class ItemManager private static bool IsEquippable(AetheriaRuntimeCatalogItem item) { return !string.IsNullOrWhiteSpace(item?.HardpointType) || - string.Equals(item?.Category, nameof(HullData), StringComparison.Ordinal); + string.Equals(item?.Category, AetheriaRuntimeItemCategories.Hull, StringComparison.Ordinal); } public (RarityTier tier, int upgrades) GetTier(CraftedItemInstance item) diff --git a/Assets/Scripts/ServerShared/LoadoutGenerator.cs b/Assets/Scripts/ServerShared/LoadoutGenerator.cs index 9339f8ff7..1927cf08e 100644 --- a/Assets/Scripts/ServerShared/LoadoutGenerator.cs +++ b/Assets/Scripts/ServerShared/LoadoutGenerator.cs @@ -17,12 +17,6 @@ public class LoadoutGenerator Hull } - private const string GearCategory = "GearData"; - private const string WeaponCategory = "WeaponItemData"; - private const string CargoBayCategory = "CargoBayData"; - private const string DockingBayCategory = "DockingBayData"; - private const string HullCategory = "HullData"; - public Random Random; public ItemManager ItemManager { get; } public AetheriaRuntimeCatalogSnapshot RuntimeCatalog { get; } @@ -122,8 +116,8 @@ public class LoadoutGenerator var cargo = entity.CargoBays.First(); IEnumerable inventory = RandomCatalogItems(RuntimeItemCandidateKind.Equipment, 16, 1, - item => item.Category != CargoBayCategory && item.Category != DockingBayCategory && - (item.Category != HullCategory || item.HullType == nameof(HullType.Ship))); + item => item.Category != AetheriaRuntimeItemCategories.CargoBay && item.Category != AetheriaRuntimeItemCategories.DockingBay && + (item.Category != AetheriaRuntimeItemCategories.Hull || item.HullType == nameof(HullType.Ship))); inventory = inventory .Where(item => item != null); inventory = inventory @@ -190,13 +184,13 @@ public class LoadoutGenerator case RuntimeItemCandidateKind.Equipment: return !string.IsNullOrWhiteSpace(item.HardpointType); case RuntimeItemCandidateKind.Gear: - return item.Category == GearCategory || item.Category == WeaponCategory; + return item.Category == AetheriaRuntimeItemCategories.Gear || item.Category == AetheriaRuntimeItemCategories.Weapon; case RuntimeItemCandidateKind.CargoBay: - return item.Category == CargoBayCategory || item.Category == DockingBayCategory; + return item.Category == AetheriaRuntimeItemCategories.CargoBay || item.Category == AetheriaRuntimeItemCategories.DockingBay; case RuntimeItemCandidateKind.DockingBay: - return item.Category == DockingBayCategory; + return item.Category == AetheriaRuntimeItemCategories.DockingBay; case RuntimeItemCandidateKind.Hull: - return item.Category == HullCategory; + return item.Category == AetheriaRuntimeItemCategories.Hull; default: throw new ArgumentOutOfRangeException(nameof(candidateKind), candidateKind, null); } @@ -365,7 +359,7 @@ public class LoadoutGenerator var emptyShape = entity.UnoccupiedSpace; - var cargoRow = RandomCatalogItem(RuntimeItemCandidateKind.CargoBay, 3, item => item.Category != DockingBayCategory && FitsWithin(item, emptyShape)); + var cargoRow = RandomCatalogItem(RuntimeItemCandidateKind.CargoBay, 3, item => item.Category != AetheriaRuntimeItemCategories.DockingBay && FitsWithin(item, emptyShape)); if (cargoRow == null) throw new InvalidLoadoutException("No compatible cargo bay found for entity!"); ToShape(cargoRow).FitsWithin(emptyShape, out var cargoRotation, out var cargoPosition); diff --git a/Assets/Scripts/Zone Display/ZoneRenderer.cs b/Assets/Scripts/Zone Display/ZoneRenderer.cs index 8eb0ddd59..74bd497c4 100644 --- a/Assets/Scripts/Zone Display/ZoneRenderer.cs +++ b/Assets/Scripts/Zone Display/ZoneRenderer.cs @@ -606,7 +606,7 @@ public class ZoneRenderer : MonoBehaviour private static bool IsWeaponPickup(AetheriaRuntimeCatalogItem typedItem) { - return typedItem != null && string.Equals(typedItem.Category, nameof(WeaponItemData), StringComparison.Ordinal); + return typedItem != null && string.Equals(typedItem.Category, AetheriaRuntimeItemCategories.Weapon, StringComparison.Ordinal); } private static AetheriaRuntimeCatalogItem FindTypedZoneItem(ItemInstance item) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeItemCategories.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeItemCategories.cs new file mode 100644 index 000000000..d910cc236 --- /dev/null +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeItemCategories.cs @@ -0,0 +1,12 @@ +namespace GameCult.Aetheria.State.Unity +{ + public static class AetheriaRuntimeItemCategories + { + public const string CargoBay = "CargoBayData"; + public const string Consumable = "ConsumableItemData"; + public const string DockingBay = "DockingBayData"; + public const string Gear = "GearData"; + public const string Hull = "HullData"; + public const string Weapon = "WeaponItemData"; + } +} diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 2760872e4..27236fed4 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -529,7 +529,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. interface for this bridge is named `IRuntimeItemCatalogReader` so callers see typed catalog row ownership rather than old DTO projection ownership. Behavior type selection now uses an explicit runtime catalog map instead of - `UnionAttribute` reflection. + `UnionAttribute` reflection. Runtime item category classification uses + package-owned `AetheriaRuntimeItemCategories` tokens; gameplay code should not + ask C# legacy DTO class names to classify typed catalog rows. Item/behavior DTO field layout for the temporary projection bridge is now marked with project-owned `LegacyPayloadKeyAttribute`, not MessagePack metadata. Item properties @@ -711,6 +713,10 @@ First Aetheria surfaces to publish: private typed candidate-kind selectors, so loadout code no longer asks for `HullData`, `GearData`, `CargoBayData`, or `EquippableItemData` as candidate-selection authority. + - Done: add package-owned `AetheriaRuntimeItemCategories` tokens and move + runtime category checks off `nameof(ConsumableItemData)`, + `nameof(HullData)`, `nameof(WeaponItemData)`, and scattered raw category + strings in gameplay/loadout/docking classification. - Done: delete unused `TradeMenuDebug`; the old debug uGUI trade path no longer hydrates typed trade rows back into legacy `ItemData` objects. - Done: move surviving trade menu size, hardpoint, and behavior filters onto