From c7c539e3b708f8e31a3318909e985dfc27de2b6e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 21 Jun 2026 18:54:33 +0100 Subject: [PATCH] Keep observed zone context off galaxy model --- Aetheria.State.Verify/Program.cs | 8 ++++++++ Assets/Scripts/Gameplay/ActionGameManager.cs | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 6b194684e..341a67806 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -7756,6 +7756,7 @@ static void RequireMainMenuContinueRunState(string root) "ZoneRenderer?.ApplyDaemonFrame(daemonZone, run)", "ApplyDaemonEntitySnapshotsInPlace", "PrepareObservedDaemonZoneContext(targetZone, daemonZone)", + "_observedZoneContextsByDaemonIndex", "ReplaceObservedEntityFacadesFromTypedSnapshots", "RestoreCurrentEntityBinding", "RestoreCurrentEntityBinding(currentEntity, actionBarBindings)", @@ -8065,6 +8066,7 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root) "TryRestoreEntityGraphFromDaemonRun(observed.Run)", "CreateDaemonZoneConstructionBlueprint(daemonZone)", "PrepareObservedDaemonZoneContext(targetZone, daemonZone)", + "_observedZoneContextsByDaemonIndex", "ZoneRenderer?.LoadDaemonZoneView(_observedEntityFacadesByDaemonIndex, daemonZone, run)", "ZoneRenderer?.ApplyDaemonFrame(daemonZone, run)", "CreateDaemonEntitySnapshots(runId, daemonZone)", @@ -8136,6 +8138,12 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root) "Unity frame application must project observed daemon state, not instantiate authoritative gameplay entities."); } + if (actionGameManager.Contains("galaxyZone.Contents", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Unity gameplay must not cache observed runtime zone context on the projected GalaxyZone model."); + } + var contextPrepRendererLoads = FindMethodScopedLineHits( actionGameManager, new[] { "LoadDaemonZoneView(", "BindToEntity(" }) diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 8604e57df..99618054a 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -68,6 +68,7 @@ public class ActionGameManager : MonoBehaviour private int _lastAppliedAuthoritativeDaemonZoneIndex = -1; private readonly Dictionary _observedEntityFacadesByRecordKey = new Dictionary(StringComparer.Ordinal); private readonly Dictionary _observedEntityFacadesByDaemonIndex = new Dictionary(); + private readonly Dictionary _observedZoneContextsByDaemonIndex = new Dictionary(); private static DirectoryInfo _gameDataDirectory; public static DirectoryInfo GameDataDirectory { @@ -2087,12 +2088,15 @@ public class ActionGameManager : MonoBehaviour return; } - if (galaxyZone.Contents == null) + var zoneIndex = daemonZone.ZoneIndex; + if (!_observedZoneContextsByDaemonIndex.TryGetValue(zoneIndex, out var observedZoneContext)) { var constructionBlueprint = CreateDaemonZoneConstructionBlueprint(daemonZone); - galaxyZone.Contents = new Zone(ItemManager, Settings.PlanetSettings, constructionBlueprint, galaxyZone, ObservedGalaxy); + observedZoneContext = new Zone(ItemManager, Settings.PlanetSettings, constructionBlueprint, galaxyZone, ObservedGalaxy); + _observedZoneContextsByDaemonIndex[zoneIndex] = observedZoneContext; } - Zone = galaxyZone.Contents; + + Zone = observedZoneContext; PlayMusic(MusicType.Overworld); Zone.Log = s => Debug.Log($"Zone: {s}");