Keep observed zone context off galaxy model
This commit is contained in:
parent
62cb95d807
commit
c7c539e3b7
2 changed files with 15 additions and 3 deletions
|
|
@ -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(" })
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
private int _lastAppliedAuthoritativeDaemonZoneIndex = -1;
|
||||
private readonly Dictionary<string, Entity> _observedEntityFacadesByRecordKey = new Dictionary<string, Entity>(StringComparer.Ordinal);
|
||||
private readonly Dictionary<int, Entity> _observedEntityFacadesByDaemonIndex = new Dictionary<int, Entity>();
|
||||
private readonly Dictionary<int, Zone> _observedZoneContextsByDaemonIndex = new Dictionary<int, Zone>();
|
||||
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}");
|
||||
|
|
|
|||
Loading…
Reference in a new issue