Detach zone renderer from item manager

This commit is contained in:
Meta Vens 2026-06-21 20:25:00 +01:00
commit 9dde85a200
3 changed files with 18 additions and 7 deletions

View file

@ -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<string, PlanetObject> Planets", StringComparison.Ordinal))
zoneRenderer.Contains("public Dictionary<string, PlanetObject> 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))

View file

@ -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)

View file

@ -107,7 +107,6 @@ public class ZoneRenderer : MonoBehaviour
public IReadOnlyDictionary<int, EntityInstance> DaemonEntityInstances => _entityInstancesByDaemonIndex;
public IReadOnlyList<ItemPickup> 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<GameObject>(typedHull.HullPrefab), ZoneRoot).GetComponent<ShipInstance>();
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<GameObject>(typedHull.HullPrefab), ZoneRoot).GetComponent<EntityInstance>();
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))