Demote observed galaxy ownership

This commit is contained in:
Meta Vens 2026-07-06 02:35:18 +01:00
commit f3eb81250c
3 changed files with 23 additions and 24 deletions

View file

@ -13888,10 +13888,10 @@ static void RequireMainMenuContinueRunState(string root)
"GameplayLoopShell.LateTick()",
"ApplyLatestZoneRender = () => ObservedFrameApplier.ApplyLatestZoneRender()",
"private AetheriaUnityObservedFrameApplier ObservedFrameApplier =>",
"private Galaxy ObservedGalaxy { get; set; }",
"ObservedGalaxy = boot.ObservedGalaxy",
"ObservedZoneContextFactory = new AetheriaUnityObservedZoneContextFactory(",
"boot.ObservedGalaxy",
"ObservedZoneContextFactory.ResolveGalaxyZone",
"private AetheriaUnityObservedZoneContextFactory ObservedZoneContextFactory =>",
"private AetheriaUnityObservedZoneContextFactory ObservedZoneContextFactory { get; set; }",
"entity => CurrentEntityBinder.RestoreBinding(entity)",
"ResolveObservedTarget = entity => _targetPresentation.GetObservedTarget(entity)",
"TargetPresentation = _targetPresentation",
@ -14916,10 +14916,10 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
"ApplyLatestZoneRender = () => ObservedFrameApplier.ApplyLatestZoneRender()",
"ResolveDaemonObserver()",
"private AetheriaUnityObservedFrameApplier ObservedFrameApplier =>",
"private Galaxy ObservedGalaxy { get; set; }",
"ObservedGalaxy = boot.ObservedGalaxy",
"ObservedZoneContextFactory = new AetheriaUnityObservedZoneContextFactory(",
"boot.ObservedGalaxy",
"ObservedZoneContextFactory.ResolveGalaxyZone",
"private AetheriaUnityObservedZoneContextFactory ObservedZoneContextFactory =>",
"private AetheriaUnityObservedZoneContextFactory ObservedZoneContextFactory { get; set; }",
"entity => CurrentEntityBinder.RestoreBinding(entity)",
"private AetheriaUnityEntityBlueprintMaterializer EntityBlueprintMaterializer =>",
"EntityBlueprintMaterializer.MaterializeObservedEntity",
@ -15317,10 +15317,15 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
string.Join(", ", observedReadShimHits));
}
if (actionGameManager.Contains("public static Galaxy ObservedGalaxy", StringComparison.Ordinal))
if (actionGameManager.Contains("private Galaxy ObservedGalaxy", StringComparison.Ordinal) ||
actionGameManager.Contains("ObservedGalaxy = boot.ObservedGalaxy", StringComparison.Ordinal) ||
actionGameManager.Contains("() => ObservedGalaxy", StringComparison.Ordinal) ||
observedZoneContextFactory.Contains("Func<Galaxy> resolveObservedGalaxy", StringComparison.Ordinal) ||
observedZoneContextFactory.Contains("_resolveObservedGalaxy", StringComparison.Ordinal) ||
observedZoneContextFactory.Contains("_observedGalaxy ??=", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"ActionGameManager must not expose the raw observed galaxy projection as public gameplay state; keep it as a private renderer adapter behind managed typed documents.");
"ActionGameManager must not own the raw observed galaxy projection; gameplay boot may pass it once into the legacy Zone construction adapter only.");
}
if (actionGameManager.Contains("public static void ProjectObservedDaemonRun(", StringComparison.Ordinal) ||

View file

@ -19,7 +19,6 @@ public class ActionGameManager : MonoBehaviour
private AetheriaUnityPilotCommandSender _pilotCommands;
private AetheriaUnityObservedEntityRestorer _observedEntityRestorer;
private AetheriaUnityCurrentEntityBinder _currentEntityBinder;
private AetheriaUnityObservedZoneContextFactory _observedZoneContextFactory;
private AetheriaUnityPilotFrameController _pilotFrameController;
private AetheriaUnityPilotOperationController _pilotOperationController;
private AetheriaUnityObservedFrameApplier _observedFrameApplier;
@ -45,13 +44,7 @@ public class ActionGameManager : MonoBehaviour
EntityBlueprintMaterializer.MaterializeObservedEntity,
_loadoutItemFactory.CreateLoadoutItem,
Debug.LogWarning);
private AetheriaUnityObservedZoneContextFactory ObservedZoneContextFactory =>
_observedZoneContextFactory ??= new AetheriaUnityObservedZoneContextFactory(
ItemManager,
Settings.PlanetSettings,
() => ObservedGalaxy,
Debug.LogWarning,
PlayMusic);
private AetheriaUnityObservedZoneContextFactory ObservedZoneContextFactory { get; set; }
private AetheriaUnityCurrentEntityBinder CurrentEntityBinder =>
_currentEntityBinder ??= new AetheriaUnityCurrentEntityBinder
{
@ -282,7 +275,6 @@ public class ActionGameManager : MonoBehaviour
private ItemManager ItemManager { get; set; }
private AetheriaUnityLoadoutItemFactory _loadoutItemFactory;
private Galaxy ObservedGalaxy { get; set; }
private Zone Zone { get; set; }
private readonly AetheriaUnityDragSession _dragSession = new AetheriaUnityDragSession();
@ -299,7 +291,12 @@ public class ActionGameManager : MonoBehaviour
var boot = GameplayBootShell.Boot();
ItemManager = boot.ItemManager;
_loadoutItemFactory = boot.LoadoutItemFactory;
ObservedGalaxy = boot.ObservedGalaxy;
ObservedZoneContextFactory = new AetheriaUnityObservedZoneContextFactory(
ItemManager,
Settings.PlanetSettings,
boot.ObservedGalaxy,
Debug.LogWarning,
PlayMusic);
SceneWiring.ConfigureCurrentEntityPresentation(_currentEntityPresentation, boot.RuntimeCatalog);
SceneWiring.ConfigureTargetPresentation(
_targetPresentation,

View file

@ -15,21 +15,20 @@ public sealed class AetheriaUnityObservedZoneContextFactory
private readonly Dictionary<int, Zone> _observedZoneContextsByDaemonIndex = new Dictionary<int, Zone>();
private readonly ItemManager _itemManager;
private readonly PlanetSettings _planetSettings;
private readonly Func<Galaxy> _resolveObservedGalaxy;
private readonly Action<string> _logWarning;
private readonly Action<MusicType> _playMusic;
private Galaxy _observedGalaxy;
private readonly Galaxy _observedGalaxy;
public AetheriaUnityObservedZoneContextFactory(
ItemManager itemManager,
PlanetSettings planetSettings,
Func<Galaxy> resolveObservedGalaxy,
Galaxy observedGalaxy,
Action<string> logWarning,
Action<MusicType> playMusic)
{
_itemManager = itemManager ?? throw new ArgumentNullException(nameof(itemManager));
_planetSettings = planetSettings ?? throw new ArgumentNullException(nameof(planetSettings));
_resolveObservedGalaxy = resolveObservedGalaxy ?? (() => null);
_observedGalaxy = observedGalaxy;
_logWarning = logWarning ?? (_ => { });
_playMusic = playMusic ?? (_ => { });
}
@ -50,7 +49,6 @@ public sealed class AetheriaUnityObservedZoneContextFactory
var zoneIndex = render.ZoneIndex;
if (!_observedZoneContextsByDaemonIndex.TryGetValue(zoneIndex, out var observedZoneContext))
{
_observedGalaxy = _resolveObservedGalaxy();
if (_observedGalaxy == null)
{
_logWarning($"Daemon-authoritative zone population suppressed for {galaxyZone.Name}; no observed sector projection is available.");
@ -72,7 +70,6 @@ public sealed class AetheriaUnityObservedZoneContextFactory
if (daemonZoneIndex < 0)
return null;
_observedGalaxy ??= _resolveObservedGalaxy();
return _observedGalaxy?.Zones?.FirstOrDefault(zone => zone != null && zone.ZoneIndex == daemonZoneIndex);
}