diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 37bfed062..41f5505c7 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -3712,7 +3712,7 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root) "AetheriaEveUnitySurfaceHost.Hide(_zoneDetailsSurfaceDocument)", "AetheriaRuntimeZoneDetailsSurfaceBuilder.Build(ProjectZoneDetailsSurfaceState(", "ProjectZoneDetailsSurfaceState(", - "GameManager?.FindDaemonZoneSnapshot(zone)", + "GameManager?.FindDaemonZoneSnapshot(zone?.ZoneIndex ?? -1)", "daemonZone.Bodies ?? Array.Empty()", "daemonZone.Entities ?? Array.Empty()", "typedHull.HullType", @@ -8060,9 +8060,9 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root) { "ApplyLatestAuthoritativeDaemonFrame()", "ResolveDaemonObserver()", - "public AetheriaRuntimeZoneSnapshotCommit FindDaemonZoneSnapshot(GalaxyZone zone)", + "public AetheriaRuntimeZoneSnapshotCommit FindDaemonZoneSnapshot(int daemonZoneIndex)", "public GalaxyZone CurrentDaemonGalaxyZone", - "zone?.ZoneIndex ?? -1", + "snapshot.ZoneIndex == daemonZoneIndex", "FindObservedGalaxyZone(run.CurrentZoneIndex)", "observed.IsAuthoritative", "TryRestoreEntityGraphFromDaemonRun(observed.Run)", @@ -8152,6 +8152,13 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root) "Unity gameplay must resolve observed zones by daemon zone identity, not projected array slot."); } + if (actionGameManager.Contains("FindDaemonZoneSnapshot(GalaxyZone", StringComparison.Ordinal) || + sectorRenderer.Contains("FindDaemonZoneSnapshot(zone)", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Unity UI must query daemon zone snapshots by daemon zone identity instead of passing projected zone objects."); + } + if (galaxy.Contains("public Zone Contents", StringComparison.Ordinal)) { throw new InvalidOperationException( diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 112086563..906ccebbf 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -851,11 +851,6 @@ public class ActionGameManager : MonoBehaviour return RuntimeCatalog?.FindItem(item?.ItemKey ?? ""); } - private static int ZoneIndex(GalaxyZone zone) - { - return zone?.ZoneIndex ?? -1; - } - private static GalaxyZone FindObservedGalaxyZone(int daemonZoneIndex) { return daemonZoneIndex < 0 @@ -863,15 +858,14 @@ public class ActionGameManager : MonoBehaviour : ObservedGalaxy?.Zones?.FirstOrDefault(zone => zone != null && zone.ZoneIndex == daemonZoneIndex); } - public AetheriaRuntimeZoneSnapshotCommit FindDaemonZoneSnapshot(GalaxyZone zone) + public AetheriaRuntimeZoneSnapshotCommit FindDaemonZoneSnapshot(int daemonZoneIndex) { - var zoneIndex = ZoneIndex(zone); - if (zoneIndex < 0) + if (daemonZoneIndex < 0) return null; var run = ResolveDaemonObserver()?.LastObservedState?.Run; return (run?.Zones ?? Array.Empty()) - .FirstOrDefault(snapshot => snapshot != null && snapshot.ZoneIndex == zoneIndex); + .FirstOrDefault(snapshot => snapshot != null && snapshot.ZoneIndex == daemonZoneIndex); } public GalaxyZone CurrentDaemonGalaxyZone diff --git a/Assets/Scripts/UI/Menu/SectorRenderer.cs b/Assets/Scripts/UI/Menu/SectorRenderer.cs index 4af39ba09..ac653f3cb 100644 --- a/Assets/Scripts/UI/Menu/SectorRenderer.cs +++ b/Assets/Scripts/UI/Menu/SectorRenderer.cs @@ -151,7 +151,7 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS .Where(name => !string.IsNullOrWhiteSpace(name)) .ToArray(); - var daemonZone = GameManager?.FindDaemonZoneSnapshot(zone); + var daemonZone = GameManager?.FindDaemonZoneSnapshot(zone?.ZoneIndex ?? -1); if (daemonZone == null) { return new AetheriaRuntimeZoneDetailsSurfaceState(