diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 5482f7a46..5eef8e44f 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Assets/Scripts/UI/Menu/SectorRenderer.cs b/Assets/Scripts/UI/Menu/SectorRenderer.cs index b0f89e1ab..eee41cf9f 100644 --- a/Assets/Scripts/UI/Menu/SectorRenderer.cs +++ b/Assets/Scripts/UI/Menu/SectorRenderer.cs @@ -1,6 +1,8 @@ +using System; using System.Collections; using System.Collections.Generic; using System.Linq; +using GameCult.Aetheria.State.Unity; using UniRx; using UnityEngine; using UnityEngine.EventSystems; @@ -90,17 +92,17 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS Properties.AddProperty("Stars", () => starCount); var stationCount = zone.RuntimeBlueprint.Entities - .Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Station) + .Count(entity => HasHullType(entity, HullType.Station)) .ToString(); Properties.AddProperty("Stations", () => stationCount); var turretCount = zone.RuntimeBlueprint.Entities - .Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Turret) + .Count(entity => HasHullType(entity, HullType.Turret)) .ToString(); Properties.AddProperty("Turrets", () => turretCount); var shipCount = zone.RuntimeBlueprint.Entities - .Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Ship) + .Count(entity => HasHullType(entity, HullType.Ship)) .ToString(); Properties.AddProperty("Ships", () => shipCount); } @@ -112,6 +114,24 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS // }); } + private bool HasHullType(RuntimeEntityBlueprint entity, HullType hullType) + { + var typedItem = FindTypedHull(entity); + if (typedItem != null) + return string.Equals(typedItem.HullType, hullType.ToString(), StringComparison.Ordinal); + + return GameManager.ItemManager.GetData(entity.Hull) is HullData hullData && + hullData.HullType == hullType; + } + + private static AetheriaRuntimeCatalogItem FindTypedHull(RuntimeEntityBlueprint entity) + { + var itemId = entity?.Hull?.Data?.ItemId ?? Guid.Empty; + return itemId == Guid.Empty + ? null + : ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(itemId.ToString("D")); + } + // private IEnumerator AnimatePath() // { // var pathZones = ActionGameManager.CurrentSector.ExitPath; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 08e780ee0..5ddd65721 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -130,7 +130,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. now comes from typed state, not `AetherDB.msgpack`. The surviving trade menu applies typed row prefilters for size, hardpoint type, and behavior kind before hydrating `ItemData` projections for legacy commodity filters, columns, and - buy actions. + buy actions. The sector properties UI also resolves station/turret/ship + counts through typed hull classifications from the runtime catalog before + falling back to legacy `HullData` projection for missing rows. - `Galaxy` generation no longer accepts a runtime item catalog reader or `ItemManager`. Sector and tutorial generation receive the package-owned typed runtime catalog. `Galaxy` projects typed corporation v2 records into temporary legacy