From e78f1586295659c0817969b7d816980cd8e12cb9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 10:42:52 +0100 Subject: [PATCH] Project daemon designer surfaces from managed catalog --- Aetheria.State.Verify/Program.cs | 9 +++-- .../Runtime/AetheriaRuntimeCatalogStore.cs | 34 +++++++++++++------ .../AetheriaRuntimeDaemonTickRunner.cs | 10 ++++-- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 58d7561b7..50219f4e6 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -9993,9 +9993,10 @@ static void RequireDaemonVersePublication(string root) "AetheriaRuntimeStarbridgeProjection.ProjectSessionSummary(", "StarbridgeScenario", "StarbridgeSession", + "var catalog = options.Catalog ?? new AetheriaRuntimeCatalogSnapshot(", "AetheriaRuntimeDaemonGameSurfaceBuilder.Build", - "AetheriaRuntimeCatalogStore.ProjectStatRecipeSurfaceDocument(stateFilePath)", - "AetheriaRuntimeCatalogStore.ProjectTradeValuePolicySurfaceDocument(stateFilePath)", + "AetheriaRuntimeCatalogStore.ProjectStatRecipeSurfaceDocument(catalog)", + "AetheriaRuntimeCatalogStore.ProjectTradeValuePolicySurfaceDocument(catalog)", "AetheriaRuntimeDaemonEditorSurfaceBuilder.Build", "SoaView = soaView", "ProviderAdvertisement = providerAdvertisement", @@ -10032,7 +10033,9 @@ static void RequireDaemonVersePublication(string root) "AetheriaRuntimeDaemonPublicationStore.PublishGameSurface(", "AetheriaRuntimeDaemonPublicationStore.PublishGameTuiSurface(", "AetheriaRuntimeDaemonPublicationStore.PublishEditorSurface(", - "AetheriaRuntimeDaemonPublicationStore.PublishEditorTuiSurface(" + "AetheriaRuntimeDaemonPublicationStore.PublishEditorTuiSurface(", + "AetheriaRuntimeCatalogStore.ProjectStatRecipeSurfaceDocument(stateFilePath)", + "AetheriaRuntimeCatalogStore.ProjectTradeValuePolicySurfaceDocument(stateFilePath)" }; var forbiddenTickPublicationHits = forbiddenTickPublicationSymbols .Where(symbol => daemonTickRunner.Contains(symbol, StringComparison.Ordinal)) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index 8885f8021..c37f32f4c 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -73,36 +73,48 @@ namespace GameCult.Aetheria.State.Verse surfaces.Add(ReadEveSurface(record.Payload)); } + var catalogSnapshot = OpenReadOnly(stateFilePath); surfaces.Add(AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument( - ProjectStatRecipeSurfaceDocument(stateFilePath))); + ProjectStatRecipeSurfaceDocument(catalogSnapshot))); surfaces.Add(AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument( - ProjectTradeValuePolicySurfaceDocument(stateFilePath))); + ProjectTradeValuePolicySurfaceDocument(catalogSnapshot))); return surfaces; } public static AetheriaRuntimeSurfaceDocument ProjectStatRecipeSurfaceDocument(string stateFilePath) { - var state = ProjectStatRecipeSurfaceState(stateFilePath); - return AetheriaRuntimeStatRecipeSurfaceBuilder.Build(state); + return ProjectStatRecipeSurfaceDocument(OpenReadOnly(stateFilePath)); + } + + public static AetheriaRuntimeSurfaceDocument ProjectStatRecipeSurfaceDocument( + AetheriaRuntimeCatalogSnapshot? catalog) + { + return AetheriaRuntimeStatRecipeSurfaceBuilder.Build(ProjectStatRecipeSurfaceState(catalog)); } public static AetheriaRuntimeSurfaceDocument ProjectTradeValuePolicySurfaceDocument(string stateFilePath) { - var state = ProjectTradeValuePolicySurfaceState(stateFilePath); - return AetheriaRuntimeTradeValuePolicySurfaceBuilder.Build(state); + return ProjectTradeValuePolicySurfaceDocument(OpenReadOnly(stateFilePath)); } - private static AetheriaRuntimeTradeValuePolicySurfaceState ProjectTradeValuePolicySurfaceState(string stateFilePath) + public static AetheriaRuntimeSurfaceDocument ProjectTradeValuePolicySurfaceDocument( + AetheriaRuntimeCatalogSnapshot? catalog) + { + return AetheriaRuntimeTradeValuePolicySurfaceBuilder.Build(ProjectTradeValuePolicySurfaceState(catalog)); + } + + private static AetheriaRuntimeTradeValuePolicySurfaceState ProjectTradeValuePolicySurfaceState( + AetheriaRuntimeCatalogSnapshot? catalog) { return new AetheriaRuntimeTradeValuePolicySurfaceState( - ReadTradeValuePolicy(stateFilePath), + catalog?.TradeValueSettings ?? AetheriaRuntimeTradeValueSettings.Default, DateTime.UtcNow.ToString("O")); } - private static AetheriaRuntimeStatRecipeSurfaceState ProjectStatRecipeSurfaceState(string stateFilePath) + private static AetheriaRuntimeStatRecipeSurfaceState ProjectStatRecipeSurfaceState( + AetheriaRuntimeCatalogSnapshot? catalog) { - var catalog = OpenReadOnly(stateFilePath); - var recipes = catalog.Items + var recipes = (catalog?.Items ?? Array.Empty()) .SelectMany(ProjectStatRecipeRows) .OrderBy(recipe => recipe.StatName, StringComparer.Ordinal) .ToArray(); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs index 3f85dd1b4..736bed9eb 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonTickRunner.cs @@ -199,11 +199,15 @@ namespace GameCult.Aetheria.State.Verse Transport = "cultmesh-managed", CommandBoundaryPath = AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary.ToString() }; + var catalog = options.Catalog ?? new AetheriaRuntimeCatalogSnapshot( + Array.Empty(), + Array.Empty(), + Array.Empty()); var starbridgeSummary = AetheriaRuntimeStarbridgeProjection.ProjectSessionSummary( frame, options.StarbridgeScenario, options.StarbridgeSession, - options.Catalog); + catalog); var gameSurface = AetheriaRuntimeDaemonGameSurfaceBuilder.Build( frame, health, @@ -211,8 +215,8 @@ namespace GameCult.Aetheria.State.Verse starbridgeSummary); var designerSurfaces = new[] { - AetheriaRuntimeCatalogStore.ProjectStatRecipeSurfaceDocument(stateFilePath), - AetheriaRuntimeCatalogStore.ProjectTradeValuePolicySurfaceDocument(stateFilePath) + AetheriaRuntimeCatalogStore.ProjectStatRecipeSurfaceDocument(catalog), + AetheriaRuntimeCatalogStore.ProjectTradeValuePolicySurfaceDocument(catalog) }; var editorSurface = AetheriaRuntimeDaemonEditorSurfaceBuilder.Build( providerAdvertisement,