Use typed hull classes in sector summaries

This commit is contained in:
Meta Vens 2026-06-13 23:46:18 +01:00
commit 87f9adf4d9
3 changed files with 26 additions and 4 deletions

Binary file not shown.

View file

@ -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;

View file

@ -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