From 9dde85a2008ec1e6553f3fffa1780c688b8e8b81 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 21 Jun 2026 20:25:00 +0100 Subject: [PATCH] Detach zone renderer from item manager --- Aetheria.State.Verify/Program.cs | 17 +++++++++++++++-- Assets/Scripts/Gameplay/ActionGameManager.cs | 1 - Assets/Scripts/Zone Display/ZoneRenderer.cs | 7 +++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 74d5b7a87..2e965469a 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -1801,6 +1801,10 @@ static void RequireDaemonRenderQueryAuthority(string root) var zoneRenderer = File.Exists(zoneRendererPath) ? File.ReadAllText(zoneRendererPath) : throw new InvalidOperationException("Cannot verify daemon render query authority; ZoneRenderer.cs is missing."); + var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs"); + var actionGameManager = File.Exists(actionGameManagerPath) + ? File.ReadAllText(actionGameManagerPath) + : throw new InvalidOperationException("Cannot verify daemon render query authority; ActionGameManager.cs is missing."); var canonicalSnapshotPath = Path.Combine(root, "Aetheria.State", "Documents", "AetheriaRuntimeStateDocuments.cs"); var canonicalSnapshot = File.Exists(canonicalSnapshotPath) @@ -1919,10 +1923,19 @@ static void RequireDaemonRenderQueryAuthority(string root) if (zoneRenderer.Contains("public Zone Zone", StringComparison.Ordinal) || zoneRenderer.Contains("public void LoadZone(", StringComparison.Ordinal) || - zoneRenderer.Contains("public Dictionary Planets", StringComparison.Ordinal)) + zoneRenderer.Contains("public Dictionary Planets", StringComparison.Ordinal) || + zoneRenderer.Contains("public ItemManager ItemManager", StringComparison.Ordinal) || + actionGameManager.Contains("ZoneRenderer.ItemManager", StringComparison.Ordinal)) { throw new InvalidOperationException( - "ZoneRenderer must expose daemon-view rendering concepts instead of public mirrored Zone ownership."); + "ZoneRenderer must expose daemon-view rendering concepts instead of public mirrored Zone/ItemManager ownership."); + } + + if (zoneRenderer.Contains("ItemManager.Log(", StringComparison.Ordinal) || + zoneRenderer.Contains("ItemManager.Get", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "ZoneRenderer must not depend on ItemManager for renderer diagnostics or item projection."); } if (zoneRenderer.Contains("Zone.PowerPulse(", StringComparison.Ordinal)) diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 0bec9967d..e8936f8e6 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -1915,7 +1915,6 @@ public class ActionGameManager : MonoBehaviour Settings.GameplaySettings, Debug.Log); LoadRuntimeLoadoutTemplates(stateBoot.StateFilePath); - ZoneRenderer.ItemManager = ItemManager; // If hiding minimap asteroids, turn them off to start with if (!RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap) diff --git a/Assets/Scripts/Zone Display/ZoneRenderer.cs b/Assets/Scripts/Zone Display/ZoneRenderer.cs index c2c1747b8..27994b84a 100644 --- a/Assets/Scripts/Zone Display/ZoneRenderer.cs +++ b/Assets/Scripts/Zone Display/ZoneRenderer.cs @@ -107,7 +107,6 @@ public class ZoneRenderer : MonoBehaviour public IReadOnlyDictionary DaemonEntityInstances => _entityInstancesByDaemonIndex; public IReadOnlyList ActiveLoot => _loot; - public ItemManager ItemManager { get; set; } public Entity PerspectiveEntity { @@ -332,7 +331,7 @@ public class ZoneRenderer : MonoBehaviour var typedHull = FindTypedZoneItem(entity.Hull); if (typedHull == null || string.IsNullOrWhiteSpace(typedHull.HullPrefab)) { - ItemManager.Log($"Failed to instantiate {entity.Name} with missing typed hull prefab."); + Debug.LogWarning($"Failed to instantiate {entity.Name} with missing typed hull prefab."); return; } @@ -342,7 +341,7 @@ public class ZoneRenderer : MonoBehaviour instance = Instantiate(UnityHelpers.LoadAsset(typedHull.HullPrefab), ZoneRoot).GetComponent(); if (instance == null) { - ItemManager.Log($"Failed to instantiate {typedHull.Name} ship with invalid prefab: no ShipInstance component!"); + Debug.LogWarning($"Failed to instantiate {typedHull.Name} ship with invalid prefab: no ShipInstance component!"); return; } } @@ -351,7 +350,7 @@ public class ZoneRenderer : MonoBehaviour instance = Instantiate(UnityHelpers.LoadAsset(typedHull.HullPrefab), ZoneRoot).GetComponent(); if (instance == null) { - ItemManager.Log($"Failed to instantiate {typedHull.Name} entity with invalid prefab: no EntityInstance component!"); + Debug.LogWarning($"Failed to instantiate {typedHull.Name} entity with invalid prefab: no EntityInstance component!"); return; } if (string.Equals(typedHull.HullType, nameof(HullType.Station), StringComparison.Ordinal))