diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs
index 6eff6000a..35618a89a 100644
--- a/Aetheria.State.Verify/Program.cs
+++ b/Aetheria.State.Verify/Program.cs
@@ -31,7 +31,7 @@ RequireTypedRuntimeBehaviorCoverage(root);
RequireEveRuntimeBootstrap(root);
RequireNoRendererLocalConsole(root);
RequireNoRendererLocalDebugPanels(root);
-RequireMainMenuSettingsCommit(root);
+RequireMainMenuSettingsCommands(root);
RequireMainMenuRootUsesEveSurface(root);
RequireMainMenuSettingsShellUsesEveSurface(root);
RequireConfirmationDialogOwnsMinimalPromptShell(root);
@@ -53,26 +53,36 @@ RequireVerseHostSettingsAuthority(root);
RequireClientTargetBootAuthority(root);
RequireVerseReplicaTool(root);
RequireVerseSettingsShellAndBridge(root);
+RequireTypedStatRecipeOperations(root);
+RequireTypedDaemonCommandPayloads(root);
+RequireUnityPublicRequestVocabulary(root);
+RequireDaemonVersePublication(root);
+RequireTypedEveCommandBodies(root);
RequireMainMenuVerseHostProjection(root);
RequireMainMenuContinueRunState(root);
+RequireUnityObserverDoesNotTickLocalSimulation(root);
+RequireUnityDoesNotCallSharedSimulationTicks(root);
+RequireUnityPhysicsIsNotGameplayAuthority(root);
RequireDeadPropertiesPanelShellDeleted(root);
RequireTypedBehaviorMetadataCoverage(root);
RequireNameToolsUsesUiToolkit(root);
RequireRuntimeStateReaderOwnsUnityStateAcquisition(root);
RequireNoDeadRuntimeProjectionCaches(root);
RequireNoDeadInspectorMetadata(root);
-RequireRuntimeSimulationTuningCommits(root);
-RequireHullConductivityCommitAuthority(root);
-RequireInventoryEntityRenameCommitAuthority(root);
-RequireWeaponGroupCommitAuthority(root);
-RequireActionBarBindingCommitAuthority(root);
-RequireInventoryDoubleClickTransferCommitAuthority(root);
-RequireLootPickupCommitAuthority(root);
-RequireEntityDestroyedCommitAuthority(root);
+RequireDaemonHostDoesNotDrainRuntimeCommits(root);
+RequireRuntimeSimulationTuningRequests(root);
+RequireHullConductivityRequestAuthority(root);
+RequireInventoryEntityRenameRequestAuthority(root);
+RequireWeaponGroupRequestAuthority(root);
+RequireActionBarBindingRequestAuthority(root);
+RequireInventoryDoubleClickTransferRequestAuthority(root);
+RequireLootPickupRequestAuthority(root);
+RequireEntityDestroyedRequestAuthority(root);
RequireDroppedPickupCheckpointState(root);
-RequireTradePurchaseCommitAuthority(root);
-RequireInventoryLoadoutRestoreCommitAuthority(root);
-RequireDockedCurrentShipCommitAuthority(root);
+RequireTradePurchaseRequestAuthority(root);
+RequireInventoryLoadoutSaveRequestAuthority(root);
+RequireInventoryLoadoutRestoreRequestAuthority(root);
+RequireDockedCurrentShipRequestAuthority(root);
await using var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-state-verify");
@@ -514,25 +524,25 @@ Console.WriteLine("Package serializer boundary: MessagePack symbols remain in na
Console.WriteLine("Shared Eve package ownership: generic Unity Eve packages import from the neighboring Eve repo instead of local staged copies");
Console.WriteLine("Typed runtime behavior coverage: live behavior kinds have typed factory plus progress/state restore coverage");
Console.WriteLine("Zone construction/runtime key authority: body/orbit wrappers and task shells retain typed keys instead of GUID sidecars");
-Console.WriteLine("Eve runtime bootstrap: operations surface mounts through UI Toolkit presenter");
+Console.WriteLine("Eve runtime bootstrap: daemon-published game surface mounts through UI Toolkit presenter");
Console.WriteLine("Renderer-local console authority: deleted; UI commands flow through Eve command documents");
Console.WriteLine("Renderer-local debug panels: obsolete uGUI field tester authority is deleted");
-Console.WriteLine("Main-menu settings authority: player name, gameplay, and graphics settings return through typed player-settings commits");
+Console.WriteLine("Main-menu settings authority: player name, gameplay, and graphics settings send typed Eve commands");
Console.WriteLine("Main-menu root shell: root navigation lowers through an Eve UI Toolkit surface instead of the legacy PropertiesPanel/fade shell");
Console.WriteLine("Main-menu settings shell: settings/input subpages lower through Eve UI Toolkit surfaces, and the fake audio page is deleted until a typed audio owner exists");
Console.WriteLine("Confirmation dialog shell: runtime prompts no longer inherit the generic PropertiesPanel machinery");
Console.WriteLine("Main-menu input shell: the Eve input page delegates to the live runtime remap screen when that owner exists");
Console.WriteLine("Runtime input screen shell: input rebinding lowers through an Eve UI Toolkit surface instead of the old drag/drop uGUI screen");
Console.WriteLine("Runtime input-screen authority: hotkey and menu handoff share the same fullscreen-menu primitive");
-Console.WriteLine("Sector-map zone details shell: zone inspection lowers through an Eve UI Toolkit surface instead of PropertiesPanel rows");
-Console.WriteLine("Runtime menu tab shell: MenuPanel owns tab metadata and lowers navigation through an Eve UI Toolkit surface");
-Console.WriteLine("Inventory ship-settings shell: background ship tuning lowers through an Eve UI Toolkit surface instead of PropertiesPanel.AddField");
-Console.WriteLine("Inventory cargo-item shell: cargo item inspection lowers through an Eve UI Toolkit surface instead of PropertiesPanel.Inspect");
-Console.WriteLine("Inventory equipped-item shell: equipped item inspection and weapon-group controls lower through an Eve UI Toolkit surface instead of PropertiesPanel.Inspect");
-Console.WriteLine("Trade cargo-selector shell: target cargo selection lowers through an Eve UI Toolkit surface instead of ContextMenu.AddOption");
-Console.WriteLine("Trade filter and row-action shells: filter selection and buy-quantity entry lower through Eve UI Toolkit surfaces instead of ContextMenu dropdowns");
-Console.WriteLine("Trade item-details shell: typed item inspection lowers through an Eve UI Toolkit surface instead of PropertiesPanel.Inspect");
-Console.WriteLine("Inventory dropdown shell: entity and loadout navigation lowers through an Eve UI Toolkit surface instead of ContextMenu.AddDropdown");
+Console.WriteLine("Sector-map zone details shell: shared zone detail surface lowers selected zone state through Eve UI Toolkit");
+Console.WriteLine("Runtime menu tab shell: shared runtime tab surface lowers MenuPanel tab metadata through Eve UI Toolkit");
+Console.WriteLine("Inventory ship-settings shell: shared ship settings surface lowers selected ship state through Eve UI Toolkit");
+Console.WriteLine("Inventory cargo-item shell: shared cargo detail surface lowers selected item state through Eve UI Toolkit");
+Console.WriteLine("Inventory equipped-item shell: shared equipped item surface lowers selected equipment state and controls through Eve UI Toolkit");
+Console.WriteLine("Trade cargo-selector shell: shared cargo selector surface lowers target cargo options through Eve UI Toolkit");
+Console.WriteLine("Trade filter and row-action shells: shared trade interaction surfaces lower filter and row actions through Eve UI Toolkit");
+Console.WriteLine("Trade item-details shell: shared trade item surface lowers selected market item state through Eve UI Toolkit");
+Console.WriteLine("Inventory dropdown shell: shared inventory dropdown surface lowers entity and loadout navigation through Eve UI Toolkit");
Console.WriteLine("Main-menu Continue authority: Continue selects typed run state instead of a null button");
Console.WriteLine("Generic popup inspector shell: PropertiesPanel, PropertiesList, and DropdownMenu are deleted from source and serialized assets");
Console.WriteLine("Typed behavior metadata authority: live heat/mining/thermotoggle payload kinds stay owned by package metadata");
@@ -543,18 +553,21 @@ Console.WriteLine("Client target boot authority: Unity boot resolves the active
Console.WriteLine("Verse replica authority: remote client targets resolve to cache-only replica .cc files fed from the daemon");
Console.WriteLine("Verse settings shell: client target edits and Verse-host visibility commands lower through typed Eve surfaces");
Console.WriteLine("Main-menu Verse projection: the Unity Eve shell lowers daemon-owned verse identity instead of ad-libbing local menu copy");
-Console.WriteLine("Runtime simulation tuning authority: UI writes flow through gameplay checkpoint commits");
-Console.WriteLine("Hull conductivity authority: inventory UI toggles flow through gameplay checkpoint commits");
-Console.WriteLine("Inventory entity rename authority: UI rename flows through gameplay checkpoint commits");
-Console.WriteLine("Weapon group authority: UI assignment flows through gameplay checkpoint commits");
-Console.WriteLine("Action-bar binding authority: drag/drop updates and typed run restore flow through gameplay checkpoint state");
-Console.WriteLine("Inventory transfer authority: UI transfer and drag/drop requests flow through gameplay checkpoint commits");
-Console.WriteLine("Loot pickup authority: collision pickup requests flow through gameplay checkpoint commits");
-Console.WriteLine("Entity destruction authority: hull-death observers flow through gameplay checkpoint commits");
-Console.WriteLine("Dropped pickup state: zone checkpoints carry typed dropped-pickup snapshots and keyed live lowering");
-Console.WriteLine("Trade purchase authority: UI buy requests flow through gameplay checkpoint commits");
-Console.WriteLine("Inventory loadout restore authority: UI restore requests flow through gameplay checkpoint commits");
-Console.WriteLine("Docked current-ship authority: UI selection requests flow through gameplay checkpoint commits");
+Console.WriteLine("Unity observer authority: gameplay scenes restore daemon frames and do not tick local simulation");
+Console.WriteLine("Shared simulation authority: Zone/Entity/Agent ticks stay out of Unity gameplay callers");
+Console.WriteLine("Ymir physics authority: gameplay code uses Ymir queries and has no Unity collision callback fallback");
+Console.WriteLine("Runtime simulation tuning authority: UI sends daemon operations instead of local simulation mutation");
+Console.WriteLine("Hull conductivity authority: inventory UI sends daemon operations for toggles instead of checkpoint rewrites");
+Console.WriteLine("Inventory entity rename authority: UI sends daemon operations for renames instead of local graph edits");
+Console.WriteLine("Weapon group authority: UI sends daemon operations for assignments instead of checkpoint rewrites");
+Console.WriteLine("Action-bar binding authority: drag/drop sends daemon operations and restores from daemon frames");
+Console.WriteLine("Inventory transfer authority: UI transfer and drag/drop send daemon operations");
+Console.WriteLine("Loot pickup authority: collision pickup sends daemon operations instead of local pickup disposal");
+Console.WriteLine("Entity destruction authority: hull-death observers send daemon operations instead of local graph deletion");
+Console.WriteLine("Dropped pickup state: daemon frames carry typed dropped-pickup snapshots and keyed live lowering");
+Console.WriteLine("Trade purchase authority: UI buy requests send daemon operations instead of checkpoint rewrites");
+Console.WriteLine("Inventory loadout restore authority: UI restore requests send daemon operations instead of local mutation");
+Console.WriteLine("Docked current-ship authority: UI selection requests send daemon operations instead of checkpoint rewrites");
static void RequireCount(AetheriaMigrationLedger ledger, string documentType, int actual)
{
@@ -616,7 +629,13 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root)
{
var manifestPath = Path.Combine(root, "Packages", "manifest.json");
var lockPath = Path.Combine(root, "Packages", "packages-lock.json");
- var unityFacadeProjectPath = Path.Combine(root, "Aetheria.State.Unity", "Aetheria.State.Unity.csproj");
+ var unityGeneratedProjectPath = Path.Combine(root, "GameCult.Aetheria.State.Unity.csproj");
+ var unityAsmdefPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "GameCult.Aetheria.State.Unity.asmdef");
var localSurfacePath = Path.Combine(root, "Packages", "org.gamecult.eve.surface");
var localUnityUiToolkitPath = Path.Combine(root, "Packages", "org.gamecult.eve.unity-uitoolkit");
var evePackagesRoot = Path.GetFullPath(Path.Combine(root, "..", "Eve", "packages"));
@@ -629,9 +648,12 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root)
var packageLock = File.Exists(lockPath)
? File.ReadAllText(lockPath)
: throw new InvalidOperationException("Cannot verify shared Eve package ownership; packages-lock.json is missing.");
- var unityFacadeProject = File.Exists(unityFacadeProjectPath)
- ? File.ReadAllText(unityFacadeProjectPath)
- : throw new InvalidOperationException("Cannot verify shared Eve package ownership; Aetheria.State.Unity.csproj is missing.");
+ var unityGeneratedProject = File.Exists(unityGeneratedProjectPath)
+ ? File.ReadAllText(unityGeneratedProjectPath)
+ : throw new InvalidOperationException("Cannot verify shared Eve package ownership; GameCult.Aetheria.State.Unity.csproj is missing.");
+ var unityAsmdef = File.Exists(unityAsmdefPath)
+ ? File.ReadAllText(unityAsmdefPath)
+ : throw new InvalidOperationException("Cannot verify shared Eve package ownership; GameCult.Aetheria.State.Unity.asmdef is missing.");
var requiredManifestSymbols = new[]
{
@@ -680,10 +702,12 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root)
"The neighboring Eve repo is missing the shared Unity package roots Aetheria imports.");
}
- if (!unityFacadeProject.Contains(@"..\..\Eve\packages\org.gamecult.eve.surface\Runtime\EveSurfaceDocument.cs", StringComparison.Ordinal))
+ if (!unityGeneratedProject.Contains("GameCult.Eve.Surface.csproj", StringComparison.Ordinal) ||
+ !unityGeneratedProject.Contains("GameCult.Eve.Surface", StringComparison.Ordinal) ||
+ !unityAsmdef.Contains("\"GameCult.Eve.Surface\"", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Aetheria.State.Unity still points at the deleted local Eve surface package path.");
+ "Aetheria.State.Unity no longer references the shared Eve surface package assembly.");
}
}
@@ -699,9 +723,12 @@ static void RequirePackageSerializerBoundary(string root)
{
"AetheriaRuntimeCatalogStore.cs",
"AetheriaRuntimeClientTargetStore.cs",
- "AetheriaRuntimePendingCultCacheStore.cs",
- "AetheriaRuntimeStateCommitDocument.cs",
- "AetheriaRuntimeEveCommandDocument.cs"
+ "AetheriaRuntimeCultCacheDocumentStore.cs",
+ "AetheriaRuntimeCommandPort.cs",
+ "AetheriaRuntimeSnapshotDocuments.cs",
+ "AetheriaRuntimeEveCommandDocument.cs",
+ "AetheriaRuntimeDaemonDocuments.cs",
+ "AetheriaRuntimeDaemonSoaDocuments.cs"
};
var serializerSymbols = new[]
@@ -737,8 +764,7 @@ static void RequireTypedPendingCommitKeys(string root)
{
var checkedFiles = new[]
{
- Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateCommitDocument.cs"),
- Path.Combine(root, "Aetheria.State", "AetheriaRuntimeCommitLogApplier.cs")
+ Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeSnapshotDocuments.cs")
};
var forbiddenSymbols = new[]
@@ -898,7 +924,6 @@ static void RequireTypedBehaviorBodyKeys(string root)
var checkedFiles = new[]
{
Path.Combine(root, "Aetheria.State", "Documents", "AetheriaRuntimeStateDocuments.cs"),
- Path.Combine(root, "Aetheria.State", "AetheriaRuntimeCommitLogApplier.cs"),
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs"),
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs"),
Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs"),
@@ -1401,15 +1426,6 @@ static void RequireTypedOrbitConsumerKeys(string root)
var requiredSymbols = new Dictionary
{
- [Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs")] = new[]
- {
- "Zone.Orbits.Values.MinBy(orbit => lengthsq(Zone.GetOrbitPosition(orbit.OrbitKey) - entityPosition))",
- "planet => planet.OrbitKey == followOrbit.OrbitKey",
- "planet => planet.OrbitKey == rootOrbit.OrbitKey",
- "Zone.TryGetOrbit(rootOrbit.ParentOrbitKey, out var parentOrbit)",
- "Zone.GetOrbitPosition(followOrbit.OrbitKey)",
- "Zone.GetOrbitPosition(rootOrbit.OrbitKey)"
- },
[Path.Combine(root, "Assets", "Scripts", "Zone Display", "ZoneRenderer.cs")] = new[]
{
"body => body.OrbitKey == orbit.OrbitKey",
@@ -1777,7 +1793,6 @@ static void RequireTypedZoneStateSnapshotKeys(string root)
var checkedFiles = new[]
{
Path.Combine(root, "Aetheria.State", "Documents", "AetheriaRuntimeStateDocuments.cs"),
- Path.Combine(root, "Aetheria.State", "AetheriaRuntimeCommitLogApplier.cs"),
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs"),
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs")
};
@@ -1822,13 +1837,6 @@ static void RequireTypedZoneStateSnapshotKeys(string root)
"public string ParentOrbitKey { get; set; } = \"\";",
"public string BodyKey { get; set; } = \"\";"
},
- [Path.Combine(root, "Aetheria.State", "AetheriaRuntimeCommitLogApplier.cs")] = new[]
- {
- "OrbitKey = orbit.OrbitKey ?? \"\",",
- "ParentOrbitKey = orbit.ParentOrbitKey ?? \"\",",
- "BodyKey = body.BodyKey ?? \"\",",
- "OrbitKey = body.OrbitKey ?? \"\","
- },
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs")] = new[]
{
"public AetheriaRuntimeOrbitSnapshot(string orbitKey, string parentOrbitKey",
@@ -2058,10 +2066,6 @@ static void RequireTypedRuntimeBehaviorCoverage(string root)
var requiredWeaponStateCoverage = new[]
{
- "if (weapon is InstantWeapon instant)",
- "if (weapon is ChargedWeapon charged)",
- "if (weapon is ConstantWeapon constant)",
- "if (weapon is LockWeapon lockWeapon)",
"if (weapon is LockWeapon lockWeapon)",
"else if (weapon is ChargedWeapon chargedWeapon)",
"else if (weapon is ConstantWeapon constantWeapon)",
@@ -2081,22 +2085,6 @@ static void RequireTypedRuntimeBehaviorCoverage(string root)
var requiredBehaviorStateCoverage = new[]
{
- "if (!(behaviors[behaviorIndex] is IProgressBehavior progressBehavior))",
- "if (behavior is Sensor sensor)",
- "else if (behavior is Radiator radiator)",
- "else if (behavior is Reactor reactor)",
- "else if (behavior is Capacitor capacitor)",
- "else if (behavior is AetherDrive drive)",
- "else if (behavior is ResourceScanner resourceScanner)",
- "else if (behavior is MiningTool miningTool)",
- "else if (behavior is Thruster thruster)",
- "else if (behavior is Shield shield)",
- "else if (behavior is VelocityLimit velocityLimit)",
- "else if (behavior is Thermotoggle thermotoggle)",
- "else if (behavior is Switch switchBehavior)",
- "else if (behavior is Trigger trigger)",
- "else if (behavior is StatModifier statModifier)",
- "else if (behavior is TurretController turretController)",
"case Sensor sensor:",
"case Radiator radiator:",
"case Reactor reactor:",
@@ -2140,6 +2128,12 @@ static void RequireEveRuntimeBootstrap(string root)
"org.gamecult.aetheria.eve-runtime",
"Runtime",
"AetheriaEveSurfacePresenter.cs");
+ var daemonSurfaceCommandsPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeDaemonSurfaceCommands.cs");
if (!File.Exists(bootstrapPath))
{
@@ -2151,21 +2145,109 @@ static void RequireEveRuntimeBootstrap(string root)
throw new InvalidOperationException("Aetheria Eve surface presenter is missing.");
}
+ if (!File.Exists(daemonSurfaceCommandsPath))
+ {
+ throw new InvalidOperationException("Aetheria daemon surface command router is missing.");
+ }
+
var bootstrap = File.ReadAllText(bootstrapPath);
if (!bootstrap.Contains("RuntimeInitializeOnLoadMethod", StringComparison.Ordinal) ||
- !bootstrap.Contains("DefaultSurfaceId = \"aetheria.operations\"", StringComparison.Ordinal) ||
+ !bootstrap.Contains("DefaultSurfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId", StringComparison.Ordinal) ||
!bootstrap.Contains("AetheriaEveSurfacePresenter", StringComparison.Ordinal) ||
!bootstrap.Contains("UIDocument", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Aetheria Eve runtime bootstrap no longer mounts the operations surface through the UI Toolkit presenter.");
+ "Aetheria Eve runtime bootstrap no longer mounts the daemon-published game surface through the UI Toolkit presenter.");
}
var presenter = File.ReadAllText(presenterPath);
- if (!presenter.Contains("AetheriaRuntimeEveCommandLog.QueueCommand", StringComparison.Ordinal))
+ var daemonSurfaceCommands = File.ReadAllText(daemonSurfaceCommandsPath);
+ var requiredPresenterSymbols = new[]
+ {
+ "private string surfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId",
+ "AetheriaRuntimeStateReader.ReadEveSurface(statePath, surfaceId)",
+ "AetheriaRuntimeStateReader.ReadEveSurface(stateBoot.StateFilePath, surfaceId)",
+ "private bool ShouldMountSurface(",
+ "_mountedSurfaceVersion != surface.Version",
+ "private static readonly AetheriaEveUnitySurfaceChrome RootOnlyChrome",
+ "UseShell = false",
+ "MountSurface(string statePath, EveSurfaceDocument surface)",
+ "AetheriaEveUnitySurfaceHost.Render(",
+ "AetheriaRuntimeDaemonSurfaceCommands.TrySubmit(statePath, request, out var daemonEnvelope)",
+ "AetheriaRuntimeEveCommands.TrySendKnownSurfaceCommand("
+ };
+ var missingPresenterSymbols = requiredPresenterSymbols
+ .Where(symbol => !presenter.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingPresenterSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Aetheria Eve presenter no longer queues renderer commands through the typed Eve command log.");
+ "Aetheria Eve presenter no longer lowers refreshed daemon/CultMesh surfaces through typed Eve commands: " +
+ string.Join(", ", missingPresenterSymbols));
+ }
+
+ if (presenter.Contains("new EveUiToolkitSurfaceLowerer", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria Eve presenter still lowers daemon-published surfaces directly instead of delegating to the shared Unity Eve surface host.");
+ }
+
+ var daemonSubmitIndex = presenter.IndexOf(
+ "AetheriaRuntimeDaemonSurfaceCommands.TrySubmit(statePath, request, out var daemonEnvelope)",
+ StringComparison.Ordinal);
+ var eveSubmitIndex = presenter.IndexOf(
+ "AetheriaRuntimeEveCommands.TrySendKnownSurfaceCommand(",
+ StringComparison.Ordinal);
+ if (daemonSubmitIndex < 0 || eveSubmitIndex < 0 || daemonSubmitIndex > eveSubmitIndex)
+ {
+ throw new InvalidOperationException(
+ "Aetheria Eve presenter must route daemon-published surface commands to the typed daemon boundary before falling back to Eve requests.");
+ }
+
+ var requiredDaemonSurfaceCommandSymbols = new[]
+ {
+ "public static class AetheriaRuntimeDaemonSurfaceCommands",
+ "private const string CommandPrefix = \"aetheria.daemon.commands.\"",
+ "EveSurfaceCommandRequest request",
+ "request.ProviderId, \"aetheria.daemon\"",
+ "AetheriaRuntimeStateReader.TryReadObservedDaemonState(stateFilePath, out var observed)",
+ "new AetheriaRuntimeDaemonOperationClient(",
+ "var command = client.Create(kind, observed)",
+ "client.TrySend(command, out envelope, out _)"
+ };
+ var missingDaemonSurfaceCommandSymbols = requiredDaemonSurfaceCommandSymbols
+ .Where(symbol => !daemonSurfaceCommands.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDaemonSurfaceCommandSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon Eve surface command routing no longer submits typed daemon operations: " +
+ string.Join(", ", missingDaemonSurfaceCommandSymbols));
+ }
+
+ var forbiddenDaemonSurfaceCommandSymbols = new[]
+ {
+ "request.Payload.TryGetValue",
+ "ApplyPayload(",
+ "ReadInt(",
+ "ReadDouble(",
+ "ReadString(",
+ "\"commandKind\""
+ };
+ var daemonSurfaceCommandHits = forbiddenDaemonSurfaceCommandSymbols
+ .Where(symbol => daemonSurfaceCommands.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (daemonSurfaceCommandHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon Eve surface command routing must lower command ids to typed daemon documents, not decode string payload maps: " +
+ string.Join(", ", daemonSurfaceCommandHits));
+ }
+
+ if (daemonSurfaceCommands.Contains("AetheriaRuntimeCommandSubmitter.TrySubmitDaemonCommand(", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Daemon Eve surface command routing still calls the generic daemon submitter instead of the typed daemon operation client.");
}
}
@@ -2255,7 +2337,7 @@ static void RequireNoRendererLocalDebugPanels(string root)
}
}
-static void RequireMainMenuSettingsCommit(string root)
+static void RequireMainMenuSettingsCommands(string root)
{
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
var sharedCommandsPath = Path.Combine(
@@ -2272,7 +2354,7 @@ static void RequireMainMenuSettingsCommit(string root)
"AetheriaRuntimePlayerSettingsSurfaceBuilder.cs");
if (!File.Exists(mainMenuPath))
{
- throw new InvalidOperationException("Cannot verify main-menu settings commit path; MainMenu.cs is missing.");
+ throw new InvalidOperationException("Cannot verify main-menu settings command path; MainMenu.cs is missing.");
}
if (!File.Exists(sharedCommandsPath))
{
@@ -2293,52 +2375,54 @@ static void RequireMainMenuSettingsCommit(string root)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify main-menu settings authority; ActionGameManager.cs is missing.");
- var requiredCommits = new[]
- {
- "CommitRuntimePlayerName",
- "CommitRuntimeTemperatureUnit",
- "CommitRuntimeSignificantDigits",
- "CommitRuntimeNebulaQuality",
- "CommitRuntimeShowAsteroidsInMinimap",
- "CommitRuntimePlayerSettingsCommand"
- };
-
- var missingCommits = requiredCommits
- .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
- .ToArray();
-
- if (missingCommits.Length > 0)
- {
- throw new InvalidOperationException(
- "ActionGameManager no longer owns complete runtime player-settings commit primitives: " +
- string.Join(", ", missingCommits));
- }
-
var forbiddenSymbols = new[]
{
"ActionGameManager.RuntimePlayerSettings.Name =",
"ActionGameManager.RuntimePlayerSettings.GameplaySettings.TemperatureUnit =",
"ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits =",
"ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality =",
- "ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap ="
+ "ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap =",
+ "ActionGameManager.RequestRuntimePlayerSettingsCommand",
+ "ActionGameManager.RequestRuntimePlayerName",
+ "ActionGameManager.RequestRuntimeTemperatureUnit",
+ "ActionGameManager.RequestRuntimeSignificantDigits",
+ "ActionGameManager.RequestRuntimeNebulaQuality",
+ "ActionGameManager.RequestRuntimeShowAsteroidsInMinimap"
+ };
+
+ var actionGameManagerForbiddenSymbols = new[]
+ {
+ "RequestRuntimePlayerSettingsCommand",
+ "RequestRuntimePlayerName",
+ "RequestRuntimeTemperatureUnit",
+ "RequestRuntimeSignificantDigits",
+ "RequestRuntimeNebulaQuality",
+ "RequestRuntimeShowAsteroidsInMinimap"
};
var hits = File.ReadLines(mainMenuPath)
- .Select((line, index) => new { LineNumber = index + 1, Line = line })
+ .Select((line, index) => new { Path = mainMenuPath, LineNumber = index + 1, Line = line })
.Where(line => forbiddenSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
- .Select(line => $"{Path.GetRelativePath(root, mainMenuPath)}:{line.LineNumber}: {line.Line.Trim()}")
+ .Concat(File.ReadLines(actionGameManagerPath)
+ .Select((line, index) => new { Path = actionGameManagerPath, LineNumber = index + 1, Line = line })
+ .Where(line => actionGameManagerForbiddenSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal))))
+ .Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}")
.ToArray();
if (hits.Length > 0)
{
throw new InvalidOperationException(
- "MainMenu still owns direct RuntimePlayerSettings mutation: " +
+ "Unity still owns direct player-settings mutation instead of sending Eve commands: " +
string.Join("; ", hits));
}
var requiredMainMenuAuthoritySymbols = new[]
{
- "ActionGameManager.CommitRuntimePlayerSettingsCommand"
+ "TrySendPlayerSettingsCommand(request, command.Command)",
+ "AetheriaRuntimeMainMenuCommandKind.PlayerSettingsCommand",
+ "AetheriaRuntimeEveCommands.TrySendPlayerSettingsCommand(",
+ "stateBoot.StateFilePath",
+ "\"unity-main-menu\""
};
var missingUiCalls = requiredMainMenuAuthoritySymbols
@@ -2348,10 +2432,17 @@ static void RequireMainMenuSettingsCommit(string root)
if (missingUiCalls.Length > 0)
{
throw new InvalidOperationException(
- "MainMenu no longer routes settings changes through ActionGameManager: " +
+ "MainMenu no longer routes settings changes through the Aetheria Eve command boundary: " +
string.Join(", ", missingUiCalls));
}
+ if (source.Contains("TrySendPlayerSettingsCommand(request.Command, request.Payload)", StringComparison.Ordinal) ||
+ source.Contains("new AetheriaRuntimePlayerSettingsCommandBody", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "MainMenu still decodes player-settings Eve payloads locally instead of delegating to the typed command client.");
+ }
+
var requiredSharedCommands = new[]
{
"SetPlayerName",
@@ -2399,8 +2490,9 @@ static void RequireMainMenuSettingsCommit(string root)
var requiredMainMenuSymbols = new[]
{
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build",
- "new EveUiToolkitSurfaceLowerer",
- "ActionGameManager.CommitRuntimePlayerSettingsCommand(request.Command, request.Payload)"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaRuntimeMainMenuCommandKind.PlayerSettingsCommand",
+ "TrySendPlayerSettingsCommand(request, command.Command)"
};
var missingMainMenuSymbols = requiredMainMenuSymbols
@@ -2417,7 +2509,14 @@ static void RequireMainMenuSettingsCommit(string root)
var forbiddenMainMenuSymbols = new[]
{
"new TextField(\"Name\")",
- "ActionGameManager.CommitRuntimePlayerName(evt.newValue)"
+ "ActionGameManager.RequestRuntimePlayerName(evt.newValue)",
+ "TryQueuePlayerSettingsCommand(",
+ "TryQueueAetheriaEveCommand(",
+ "AetheriaRuntimeEveCommandLog.QueueCommand(",
+ "ResolveMenuSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer",
+ "host.AddComponent",
+ "new EveSurfaceCommandRequest("
};
var mainMenuHits = forbiddenMainMenuSymbols
@@ -2458,27 +2557,44 @@ static void RequireMainMenuSettingsCommit(string root)
static void RequireMainMenuSettingsShellUsesEveSurface(string root)
{
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
+ var mainMenuSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.cs");
if (!File.Exists(mainMenuPath))
{
throw new InvalidOperationException("Cannot verify main-menu settings shell; MainMenu.cs is missing.");
}
+ if (!File.Exists(mainMenuSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify main-menu settings shell; AetheriaRuntimeMainMenuSurfaceBuilder.cs is missing.");
+ }
var source = File.ReadAllText(mainMenuPath);
+ var mainMenuSurfaceBuilder = File.ReadAllText(mainMenuSurfaceBuilderPath);
var requiredSymbols = new[]
{
"RenderMenuSurface(",
- "BuildSettingsSurfaceDefinition()",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildSettings(",
"BuildVerseSettingsSurfaceDefinition()",
- "BuildInputSettingsSurfaceDefinition(",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings(",
"HandleSettingsSurfaceCommand(",
"HandleVerseSettingsSurfaceCommand(",
"HandleInputSettingsSurfaceCommand(",
- "WithBackAction(",
- "ShowPlayerSettingsCommand",
- "ShowVerseSettingsCommand",
- "ShowInputSettingsCommand",
- "BackToMainCommand",
- "BackToSettingsCommand"
+ "AetheriaRuntimeMainMenuSurfaceBuilder.WithBackAction(",
+ "AetheriaRuntimeMainMenuSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeMainMenuCommandKind.ShowPlayerSettings",
+ "AetheriaRuntimeMainMenuCommandKind.ShowVerseSettings",
+ "AetheriaRuntimeMainMenuCommandKind.ShowInputSettings",
+ "AetheriaRuntimeMainMenuCommandKind.BackToMain",
+ "AetheriaRuntimeMainMenuCommandKind.BackToSettings",
+ "AetheriaRuntimeMainMenuCommandKind.OpenRuntimeInputScreen",
+ "AetheriaRuntimeMainMenuCommands.BackToSettings",
+ "ProjectMainMenuSurfaceState(",
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_menuSurfaceDocument)"
};
var missingSymbols = requiredSymbols
@@ -2494,6 +2610,10 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
var forbiddenSymbols = new[]
{
+ "BuildSettingsSurfaceDefinition(",
+ "BuildInputSettingsSurfaceDefinition(",
+ "private static EveSurfaceComponent Button(",
+ "private static EveSurfaceComponent Card(",
"_nextMenu.panel.AddButton(\"Player Settings\"",
"_nextMenu.panel.AddButton(\"Verse\"",
"_nextMenu.panel.AddButton(\"Input\"",
@@ -2501,6 +2621,14 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
"BuildAudioSettingsSurfaceDefinition(",
"HandleAudioSettingsSurfaceCommand(",
"ShowAudioSettingsCommand",
+ "ResolveMenuSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer",
+ "host.AddComponent",
+ "switch (request.Command)",
+ "string.Equals(request.Command, AetheriaRuntimeMainMenuCommands.BackToSettings",
+ "string.Equals(request.Command, AetheriaRuntimeMainMenuCommands.OpenRuntimeInputScreen",
+ "TrySendVerseHostCommand(request.Command)",
+ "AetheriaRuntimeClientTargetCommands.IsKnown(request.Command",
"_nextMenu.panel.Title.text = \"settings\"",
"_nextMenu.panel.Title.text = TitleSubtitle(\"input\", \"settings\")",
"_nextMenu.panel.Title.text = TitleSubtitle(\"audio\", \"settings\")"
@@ -2516,28 +2644,65 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
"MainMenu still keeps a fake audio/settings shell or old PropertiesPanel settings shell alive: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeMainMenuSurfaceBuilder",
+ "public static class AetheriaRuntimeMainMenuCommands",
+ "BuildSettings(",
+ "BuildInputSettings(",
+ "WithBackAction(",
+ "public enum AetheriaRuntimeMainMenuCommandKind",
+ "public readonly struct AetheriaRuntimeMainMenuCommand",
+ "public static class AetheriaRuntimeMainMenuSurfaceCommands",
+ "public static bool TryRead(",
+ "AetheriaRuntimeMainMenuCommands.ShowPlayerSettings",
+ "AetheriaRuntimeMainMenuCommands.ShowVerseSettings",
+ "AetheriaRuntimeMainMenuCommands.ShowInputSettings",
+ "AetheriaRuntimeMainMenuCommands.BackToSettings"
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !mainMenuSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared main-menu surface builder no longer owns the settings/input shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireMainMenuRootUsesEveSurface(string root)
{
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
+ var mainMenuSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.cs");
if (!File.Exists(mainMenuPath))
{
throw new InvalidOperationException("Cannot verify main-menu root shell; MainMenu.cs is missing.");
}
+ if (!File.Exists(mainMenuSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify main-menu root shell; AetheriaRuntimeMainMenuSurfaceBuilder.cs is missing.");
+ }
var source = File.ReadAllText(mainMenuPath);
+ var mainMenuSurfaceBuilder = File.ReadAllText(mainMenuSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "MainSurfaceId",
- "ContinueRunCommand",
- "NewGameCommand",
- "ShowSettingsCommand",
- "QuitCommand",
- "BuildMainSurfaceDefinition(",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot(",
+ "ProjectMainMenuSurfaceState(",
+ "AetheriaRuntimeMainMenuSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeMainMenuCommandKind.ContinueRun",
+ "AetheriaRuntimeMainMenuCommandKind.NewGame",
+ "AetheriaRuntimeMainMenuCommandKind.ShowSettings",
+ "AetheriaRuntimeMainMenuCommandKind.Quit",
"HandleMainSurfaceCommand(",
- "BuildMainSurfaceDefinition(",
- "LatestContinueRun(stateBoot)",
+ "LatestDaemonFrame(stateBoot)",
"LatestVerseHostSettings(stateBoot)",
"HideMenuSurface();"
};
@@ -2572,6 +2737,9 @@ static void RequireMainMenuRootUsesEveSurface(string root)
"_nextMenu.panel.AddButton(\"New Game\"",
"_nextMenu.panel.AddButton(\"Settings\"",
"_nextMenu.panel.AddButton(\"Quit\"",
+ "BuildMainSurfaceDefinition(",
+ "private static EveSurfaceDocument BuildMenuSurfaceDocument(",
+ "switch (request.Command)",
"Fade(true)",
"Fade(false)"
};
@@ -2613,6 +2781,30 @@ static void RequireMainMenuRootUsesEveSurface(string root)
"Main-menu prefab still serializes the dead root shell: " +
string.Join(", ", prefabHits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "BuildRoot(",
+ "AetheriaRuntimeMainMenuCommands.RootSurfaceId",
+ "AetheriaRuntimeMainMenuCommands.ContinueRun",
+ "AetheriaRuntimeMainMenuCommands.NewGame",
+ "AetheriaRuntimeMainMenuCommands.ShowSettings",
+ "AetheriaRuntimeMainMenuCommands.Quit",
+ "AetheriaRuntimeMainMenuSurfaceState",
+ "public enum AetheriaRuntimeMainMenuCommandKind",
+ "public readonly struct AetheriaRuntimeMainMenuCommand",
+ "public static class AetheriaRuntimeMainMenuSurfaceCommands",
+ "public static bool TryRead("
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !mainMenuSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared main-menu surface builder no longer owns the root shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireConfirmationDialogOwnsMinimalPromptShell(string root)
@@ -2758,18 +2950,30 @@ static string ReadSerializedMonoBehaviourBlock(string path, string scriptGuid)
static void RequireMainMenuInputSettingsDelegateToRuntimeScreen(string root)
{
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
+ var mainMenuSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.cs");
if (!File.Exists(mainMenuPath))
{
throw new InvalidOperationException("Cannot verify main-menu input delegation; MainMenu.cs is missing.");
}
+ if (!File.Exists(mainMenuSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify main-menu input delegation; AetheriaRuntimeMainMenuSurfaceBuilder.cs is missing.");
+ }
var source = File.ReadAllText(mainMenuPath);
+ var mainMenuSurfaceBuilder = File.ReadAllText(mainMenuSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "OpenRuntimeInputScreenCommand",
+ "AetheriaRuntimeMainMenuCommandKind.OpenRuntimeInputScreen",
"CanOpenRuntimeInputScreen()",
"TryOpenRuntimeInputScreen()",
- "BuildInputSettingsSurfaceDefinition(CanOpenRuntimeInputScreen(), InGame)",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings(",
+ "ProjectMainMenuSurfaceState(",
"ActionGameManager.Instance.ShowInputScreenFromMenu();"
};
@@ -2800,6 +3004,13 @@ static void RequireMainMenuInputSettingsDelegateToRuntimeScreen(string root)
"MainMenu input page still reports the live remap owner as future work instead of delegating to it: " +
string.Join(", ", hits));
}
+
+ if (!mainMenuSurfaceBuilder.Contains("AetheriaRuntimeMainMenuCommands.OpenRuntimeInputScreen", StringComparison.Ordinal) ||
+ !mainMenuSurfaceBuilder.Contains("CanOpenRuntimeInputScreen", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Shared main-menu input surface no longer exposes the runtime input-screen handoff.");
+ }
}
static void RequireRuntimeInputScreenUsesEveSurface(string root)
@@ -2836,12 +3047,14 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root)
var requiredInputScreenSymbols = new[]
{
"AetheriaRuntimeInputSettingsSurfaceBuilder.Build(",
- "AetheriaRuntimeInputSettingsCommands.BeginCapture",
- "AetheriaRuntimeInputSettingsCommands.ToggleActionBar",
- "new EveUiToolkitSurfaceLowerer()",
+ "AetheriaRuntimeInputSettingsSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeInputSettingsCommandKind.BeginCapture",
+ "AetheriaRuntimeInputSettingsCommandKind.ToggleActionBar",
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_surfaceDocument)",
"UIDocument",
- "ActionGameManager.CommitRuntimeInputBindingOverride",
- "ActionGameManager.CommitRuntimeActionBarInput",
+ "ActionGameManager.RequestRuntimeInputBindingOverride",
+ "ActionGameManager.RequestRuntimeActionBarInput",
"action.ApplyBindingOverride",
"new InputAction(\"Aetheria Input Capture\")",
"HideLegacyChildren()"
@@ -2867,7 +3080,18 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root)
"LayoutRebuilder",
"UILineRenderer",
"Observable.NextFrame()",
- "DisplayLayout(_inputLayout)"
+ "DisplayLayout(_inputLayout)",
+ "EnsureSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
+ "AetheriaRuntimeStateCommitLog.QueuePlayerSettings",
+ "ActionGameManager.CommitRuntimeInputBindingOverride",
+ "ActionGameManager.CommitRuntimeActionBarInput",
+ "BeginCapture(request.Payload)",
+ "ToggleActionBarInput(request.Payload)",
+ "private void BeginCapture(IReadOnlyDictionary payload)",
+ "private void ToggleActionBarInput(IReadOnlyDictionary payload)",
+ "request.Payload"
};
var survivingLegacySymbols = forbiddenInputScreenSymbols
@@ -2884,6 +3108,8 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root)
if (!commands.Contains("SurfaceId = \"aetheria.input_settings\"", StringComparison.Ordinal) ||
!commands.Contains("BeginCapture", StringComparison.Ordinal) ||
!commands.Contains("ToggleActionBar", StringComparison.Ordinal) ||
+ !commands.Contains("SetBindingOverride", StringComparison.Ordinal) ||
+ !commands.Contains("SetActionBarEnabled", StringComparison.Ordinal) ||
!commands.Contains("public static bool IsKnown", StringComparison.Ordinal))
{
throw new InvalidOperationException(
@@ -2895,9 +3121,17 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root)
"public sealed class AetheriaRuntimeInputSettingsSurfaceState",
"public sealed class AetheriaRuntimeInputBindingSurfaceState",
"public sealed class AetheriaRuntimeActionBarInputSurfaceState",
+ "public enum AetheriaRuntimeInputSettingsCommandKind",
+ "public readonly struct AetheriaRuntimeInputSettingsSurfaceCommand",
+ "public static class AetheriaRuntimeInputSettingsSurfaceCommands",
+ "public static bool TryRead(",
"AetheriaRuntimeInputSettingsCommands.BeginCapture",
"AetheriaRuntimeInputSettingsCommands.ToggleActionBar",
- "\"Low-level InputSystem edits flow through this Eve surface and queue typed player-settings commits.\""
+ "ReadString(request, \"actionName\")",
+ "ReadInt(request, \"bindingIndex\", -1)",
+ "ReadString(request, \"inputPath\")",
+ "ReadBool(request, \"enabled\", false)",
+ "\"Low-level InputSystem edits flow through this Eve surface as typed input-setting requests.\""
};
var missingBuilderSymbols = requiredBuilderSymbols
@@ -2910,6 +3144,48 @@ static void RequireRuntimeInputScreenUsesEveSurface(string root)
"Shared input-settings Eve surface builder is incomplete: " +
string.Join(", ", missingBuilderSymbols));
}
+
+ var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
+ var actionGameManager = File.Exists(actionGameManagerPath)
+ ? File.ReadAllText(actionGameManagerPath)
+ : throw new InvalidOperationException("Cannot verify runtime input-screen authority; ActionGameManager.cs is missing.");
+
+ var requiredActionGameManagerSymbols = new[]
+ {
+ "AetheriaRuntimeEveCommands.TrySendInputSettingsCommand",
+ "AetheriaRuntimeInputSettingsCommands.SetBindingOverride",
+ "AetheriaRuntimeInputSettingsCommands.SetActionBarEnabled"
+ };
+
+ var missingActionGameManagerSymbols = requiredActionGameManagerSymbols
+ .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingActionGameManagerSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Runtime input writes no longer send explicit Eve input-setting commands: " +
+ string.Join(", ", missingActionGameManagerSymbols));
+ }
+
+ var forbiddenActionGameManagerSymbols = new[]
+ {
+ "public static void CommitRuntimeInputBindingOverride",
+ "public static void CommitRuntimeActionBarInput",
+ "RuntimePlayerSettings.InputSettings.SetBindingOverride(actionName, bindingIndex, inputSystemPath)",
+ "RuntimePlayerSettings.InputSettings.SetActionBarInputEnabled(inputSystemPath, enabled)"
+ };
+
+ var survivingActionGameManagerSymbols = forbiddenActionGameManagerSymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (survivingActionGameManagerSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Runtime input settings are still using Unity-local mutation authority instead of typed Eve requests: " +
+ string.Join(", ", survivingActionGameManagerSymbols));
+ }
}
static void RequireActionGameManagerInputScreenUsesSharedFullscreenPrimitive(string root)
@@ -2946,22 +3222,34 @@ static void RequireActionGameManagerInputScreenUsesSharedFullscreenPrimitive(str
static void RequireSectorMapZoneDetailsUseEveSurface(string root)
{
var sectorRendererPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "SectorRenderer.cs");
+ var zoneDetailsSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeZoneDetailsSurfaceBuilder.cs");
if (!File.Exists(sectorRendererPath))
{
throw new InvalidOperationException("Cannot verify sector-map zone details shell; SectorRenderer.cs is missing.");
}
+ if (!File.Exists(zoneDetailsSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify sector-map zone details shell; shared runtime zone details surface builder is missing.");
+ }
var source = File.ReadAllText(sectorRendererPath);
+ var zoneDetailsSurfaceBuilder = File.ReadAllText(zoneDetailsSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "ZoneDetailsSurfaceId",
- "CloseZoneDetailsCommand",
"RenderZoneDetailsSurface(",
"HandleZoneDetailsSurfaceCommand(",
"HideZoneDetailsSurface(",
- "ResolveZoneDetailsSurfaceDocument(",
- "BuildZoneDetailsSurfaceDefinition(",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_zoneDetailsSurfaceDocument)",
+ "AetheriaRuntimeZoneDetailsSurfaceBuilder.Build(ProjectZoneDetailsSurfaceState(",
+ "ProjectZoneDetailsSurfaceState(",
+ "AetheriaRuntimeZoneDetailsSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeZoneDetailsCommandKind.Close"
};
var missingSymbols = requiredSymbols
@@ -2977,6 +3265,12 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root)
var forbiddenSymbols = new[]
{
+ "BuildZoneDetailsSurfaceDefinition(",
+ "ZoneDetailsSurfaceId",
+ "CloseZoneDetailsCommand",
+ "private const string ZoneDetailsSurfaceType",
+ "ResolveZoneDetailsSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
"Properties.Clear();",
"Properties.Title.text = zone.Name;",
"Properties.AddProperty(\"Owner\"",
@@ -2988,7 +3282,8 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root)
"Properties.AddProperty(\"Stars\"",
"Properties.AddProperty(\"Stations\"",
"Properties.AddProperty(\"Turrets\"",
- "Properties.AddProperty(\"Ships\""
+ "Properties.AddProperty(\"Ships\"",
+ "string.Equals(request.Command, AetheriaRuntimeZoneDetailsSurfaceBuilder.Close"
};
var hits = forbiddenSymbols
@@ -3001,15 +3296,51 @@ static void RequireSectorMapZoneDetailsUseEveSurface(string root)
"SectorRenderer still owns zone details through the old PropertiesPanel path: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeZoneDetailsSurfaceBuilder",
+ "public const string SurfaceId = \"aetheria.sector_map.zone_details\"",
+ "public const string Close = \"aetheria.sector_map.zone_details.close\"",
+ "public enum AetheriaRuntimeZoneDetailsCommandKind",
+ "public readonly struct AetheriaRuntimeZoneDetailsCommand",
+ "public static class AetheriaRuntimeZoneDetailsSurfaceCommands",
+ "public static bool TryRead(",
+ "AetheriaRuntimeZoneDetailsSurfaceState",
+ "public static AetheriaRuntimeSurfaceDocument Build(",
+ "providerKind: \"sector.map\"",
+ "Factions Present",
+ "Has not been visited.",
+ "Asteroid Belts"
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !zoneDetailsSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime zone details surface builder no longer owns the sector-map zone shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireRuntimeMenuTabsUseEveSurface(string root)
{
var menuPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "MenuPanel.cs");
+ var menuTabsSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeMenuTabsSurfaceBuilder.cs");
if (!File.Exists(menuPanelPath))
{
throw new InvalidOperationException("Cannot verify runtime menu tab shell; MenuPanel.cs is missing.");
}
+ if (!File.Exists(menuTabsSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify runtime menu tab shell; AetheriaRuntimeMenuTabsSurfaceBuilder.cs is missing.");
+ }
var legacyTabButtonPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "MenuTabButton.cs");
if (File.Exists(legacyTabButtonPath))
@@ -3018,19 +3349,29 @@ static void RequireRuntimeMenuTabsUseEveSurface(string root)
}
var source = File.ReadAllText(menuPanelPath);
+ var surfaceHostPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.eve-runtime", "Runtime", "AetheriaEveUnitySurfaceHost.cs");
+ if (!File.Exists(surfaceHostPath))
+ {
+ throw new InvalidOperationException("Cannot verify runtime menu tab shell; AetheriaEveUnitySurfaceHost.cs is missing.");
+ }
+
+ var menuTabsSurfaceBuilder = File.ReadAllText(menuTabsSurfaceBuilderPath);
+ var surfaceHost = File.ReadAllText(surfaceHostPath);
var requiredSymbols = new[]
{
- "MenuTabsSurfaceId",
"MenuTabBinding",
"TabBindings = Array.Empty();",
"RenderTabSurface(",
"HandleTabSurfaceCommand(",
- "ResolveTabSurfaceDocument(",
- "BuildTabSurfaceDefinition(",
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_tabSurfaceDocument)",
+ "AetheriaRuntimeMenuTabsSurfaceBuilder.Build(ProjectTabSurfaceState())",
+ "ProjectTabSurfaceState(",
"ResolveVisibleTabs(",
"GetTabLabel(",
- "GetTabCommand(",
- "new EveUiToolkitSurfaceLowerer()",
+ "AetheriaRuntimeMenuTabsSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeMenuTabCommandKind.SelectTab",
+ "string.Equals(command.TabKey, TabKey(tab), StringComparison.Ordinal)",
"TabButtons.gameObject.SetActive(false)"
};
@@ -3045,12 +3386,38 @@ static void RequireRuntimeMenuTabsUseEveSurface(string root)
string.Join(", ", missingSymbols));
}
+ var requiredHostSymbols = new[]
+ {
+ "public static class AetheriaEveUnitySurfaceHost",
+ "public static UIDocument Render(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "shell.Add(lowerer.Lower(surface, commandHandler))"
+ };
+
+ var missingHostSymbols = requiredHostSymbols
+ .Where(symbol => !surfaceHost.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingHostSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "AetheriaEveUnitySurfaceHost no longer owns the shared Unity Eve lowering path: " +
+ string.Join(", ", missingHostSymbols));
+ }
+
var forbiddenSymbols = new[]
{
"MenuTabButton",
"tabButton.Button.onClick.AddListener(",
"tabButton.gameObject.SetActive(!tabButton.RequireDock || GameManager.DockedEntity != null);",
- "_tabs[MenuTab.Local].gameObject.SetActive("
+ "_tabs[MenuTab.Local].gameObject.SetActive(",
+ "BuildTabSurfaceDefinition(",
+ "private static EveSurfaceComponent Button(",
+ "private static EveSurfaceComponent Text(",
+ "private static EveSurfaceComponent Node(",
+ "ResolveTabSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "string.Equals(request.Command, AetheriaRuntimeMenuTabsSurfaceBuilder.CommandFor("
};
var hits = forbiddenSymbols
@@ -3063,29 +3430,64 @@ static void RequireRuntimeMenuTabsUseEveSurface(string root)
"MenuPanel still owns tab-shell behavior through the old MenuTabButton path: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeMenuTabsSurfaceBuilder",
+ "public const string SurfaceId = \"aetheria.runtime_menu.tabs\"",
+ "CommandFor(string tabKey)",
+ "public enum AetheriaRuntimeMenuTabCommandKind",
+ "public readonly struct AetheriaRuntimeMenuTabCommand",
+ "public static class AetheriaRuntimeMenuTabsSurfaceCommands",
+ "public static bool TryRead(",
+ "public static AetheriaRuntimeSurfaceDocument Build(",
+ "AetheriaRuntimeMenuTabsSurfaceState",
+ "AetheriaRuntimeMenuTabSurfaceEntry"
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !menuTabsSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime menu tab surface builder no longer owns the tab shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireInventoryShipSettingsUseEveSurface(string root)
{
var inventoryMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryMenu.cs");
+ var shipSettingsSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeShipSettingsSurfaceBuilder.cs");
if (!File.Exists(inventoryMenuPath))
{
throw new InvalidOperationException("Cannot verify inventory ship-settings shell; InventoryMenu.cs is missing.");
}
+ if (!File.Exists(shipSettingsSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify inventory ship-settings shell; shared runtime ship settings surface builder is missing.");
+ }
var source = File.ReadAllText(inventoryMenuPath);
+ var shipSettingsSurfaceBuilder = File.ReadAllText(shipSettingsSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "ShipSettingsSurfaceId",
"RenderCurrentShipSettingsSurface(",
"HandleCurrentShipSettingsSurfaceCommand(",
- "ResolveShipSettingsSurfaceDocument(",
- "BuildCurrentShipSettingsSurfaceDefinition(",
- "DecrementShutdownThresholdCommand",
- "IncrementShutdownThresholdCommand",
- "ResetShutdownThresholdCommand",
- "CloseShipSettingsCommand",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_shipSettingsSurfaceDocument)",
+ "AetheriaRuntimeShipSettingsSurfaceBuilder.Build(ProjectCurrentShipSettingsSurfaceState(",
+ "ProjectCurrentShipSettingsSurfaceState(",
+ "AetheriaRuntimeShipSettingsSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeShipSettingsCommandKind.DecrementShutdownThreshold",
+ "AetheriaRuntimeShipSettingsCommandKind.IncrementShutdownThreshold",
+ "AetheriaRuntimeShipSettingsCommandKind.ResetShutdownThreshold",
+ "AetheriaRuntimeShipSettingsCommandKind.Close"
};
var missingSymbols = requiredSymbols
@@ -3101,9 +3503,20 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
var forbiddenSymbols = new[]
{
+ "BuildCurrentShipSettingsSurfaceDefinition(",
+ "ShipSettingsSurfaceId",
+ "DecrementShutdownThresholdCommand",
+ "IncrementShutdownThresholdCommand",
+ "ResetShutdownThresholdCommand",
+ "CloseShipSettingsCommand",
+ "private const string ShipSettingsSurfaceType",
+ "ResolveShipSettingsSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
"PropertiesPanel.AddField(\"Shutdown Threshold\"",
"() => GameManager.CurrentEntity.Settings.ShutdownPerformance",
- "f => GameManager.CommitEntityShutdownPerformance(GameManager.CurrentEntity, f)"
+ "f => GameManager.RequestEntityShutdownPerformance(GameManager.CurrentEntity, f)",
+ "switch (request.Command)"
};
var hits = forbiddenSymbols
@@ -3116,28 +3529,65 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
"InventoryMenu still owns ship settings through the old PropertiesPanel field path: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeShipSettingsSurfaceBuilder",
+ "public const string SurfaceId = \"aetheria.inventory.current_ship_settings\"",
+ "public const string DecrementShutdownThreshold",
+ "public const string IncrementShutdownThreshold",
+ "public const string ResetShutdownThreshold",
+ "public const string Close",
+ "public enum AetheriaRuntimeShipSettingsCommandKind",
+ "public readonly struct AetheriaRuntimeShipSettingsCommand",
+ "public static class AetheriaRuntimeShipSettingsSurfaceCommands",
+ "public static bool TryRead(",
+ "AetheriaRuntimeShipSettingsSurfaceState",
+ "public static AetheriaRuntimeSurfaceDocument Build("
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !shipSettingsSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime ship settings surface builder no longer owns the ship-settings shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireInventoryCargoItemDetailsUseEveSurface(string root)
{
var inventoryMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryMenu.cs");
+ var cargoItemSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeCargoItemDetailsSurfaceBuilder.cs");
if (!File.Exists(inventoryMenuPath))
{
throw new InvalidOperationException("Cannot verify inventory cargo-item shell; InventoryMenu.cs is missing.");
}
+ if (!File.Exists(cargoItemSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify inventory cargo-item shell; AetheriaRuntimeCargoItemDetailsSurfaceBuilder.cs is missing.");
+ }
var source = File.ReadAllText(inventoryMenuPath);
+ var cargoItemSurfaceBuilder = File.ReadAllText(cargoItemSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "CargoItemDetailsSurfaceId",
"RenderCargoItemDetailsSurface(",
"HandleCargoItemDetailsSurfaceCommand(",
- "ResolveCargoItemDetailsSurfaceDocument(",
- "BuildCargoItemDetailsSurfaceDefinition(",
- "BuildCargoItemBehaviorCards(",
- "BuildCargoItemBehaviorMetric(",
- "CloseCargoItemDetailsCommand",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_cargoItemDetailsSurfaceDocument)",
+ "AetheriaRuntimeCargoItemDetailsSurfaceBuilder.Build(ProjectCargoItemDetailsSurfaceState(",
+ "AetheriaRuntimeCargoItemDetailsSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeCargoItemDetailsCommandKind.Close",
+ "ProjectCargoItemDetailsSurfaceState(",
+ "ProjectCargoItemBehaviorSections(",
+ "ProjectCargoItemBehaviorMetric("
};
var missingSymbols = requiredSymbols
@@ -3155,43 +3605,106 @@ static void RequireInventoryCargoItemDetailsUseEveSurface(string root)
{
throw new InvalidOperationException("InventoryMenu cargo click path no longer routes item inspection through the Eve surface.");
}
+
+ var forbiddenSymbols = new[]
+ {
+ "BuildCargoItemDetailsSurfaceDefinition(",
+ "BuildCargoItemBehaviorCards(",
+ "BuildCargoItemBehaviorMetric(",
+ "CargoItemDetailsSurfaceId",
+ "CloseCargoItemDetailsCommand",
+ "ResolveCargoItemDetailsSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
+ "string.Equals(request.Command, AetheriaRuntimeCargoItemDetailsSurfaceBuilder.Close"
+ };
+ var hits = forbiddenSymbols
+ .Where(symbol => source.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (hits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "InventoryMenu still owns cargo-item inspection surface construction instead of projecting shared runtime state: " +
+ string.Join(", ", hits));
+ }
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeCargoItemDetailsSurfaceBuilder",
+ "public const string SurfaceId = \"aetheria.inventory.cargo_item_details\"",
+ "public const string Close = \"aetheria.inventory.cargo_item_details.close\"",
+ "public enum AetheriaRuntimeCargoItemDetailsCommandKind",
+ "public readonly struct AetheriaRuntimeCargoItemDetailsCommand",
+ "public static class AetheriaRuntimeCargoItemDetailsSurfaceCommands",
+ "public static bool TryRead(",
+ "AetheriaRuntimeCargoItemDetailsSurfaceState",
+ "AetheriaRuntimeCargoItemSection",
+ "AetheriaRuntimeCargoItemMetric",
+ "public static AetheriaRuntimeSurfaceDocument Build("
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !cargoItemSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared cargo-item detail surface builder no longer owns the cargo inspection contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireInventoryEquippedItemDetailsUseEveSurface(string root)
{
var inventoryMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryMenu.cs");
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
- if (!File.Exists(inventoryMenuPath))
+ var equippedItemSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeEquippedItemDetailsSurfaceBuilder.cs");
+ var stateProjectPath = Path.Combine(root, "Aetheria.State", "Aetheria.State.csproj");
+ var unityProjectPath = Path.Combine(root, "GameCult.Aetheria.State.Unity.csproj");
+ var requiredFiles = new[]
{
- throw new InvalidOperationException("Cannot verify inventory equipped-item shell; InventoryMenu.cs is missing.");
- }
-
- if (!File.Exists(actionGameManagerPath))
+ inventoryMenuPath,
+ actionGameManagerPath,
+ equippedItemSurfaceBuilderPath,
+ stateProjectPath,
+ unityProjectPath
+ };
+ var missingFiles = requiredFiles
+ .Where(path => !File.Exists(path))
+ .Select(path => Path.GetRelativePath(root, path))
+ .ToArray();
+ if (missingFiles.Length > 0)
{
- throw new InvalidOperationException("Cannot verify inventory equipped-item shell; ActionGameManager.cs is missing.");
+ throw new InvalidOperationException(
+ "Cannot verify inventory equipped-item shell; required files are missing: " +
+ string.Join(", ", missingFiles));
}
var source = File.ReadAllText(inventoryMenuPath);
var requiredSymbols = new[]
{
- "EquippedItemDetailsSurfaceId",
"RenderEquippedItemDetailsSurface(",
"HandleEquippedItemDetailsSurfaceCommand(",
- "ResolveEquippedItemDetailsSurfaceDocument(",
- "BuildEquippedItemDetailsSurfaceDefinition(",
- "BuildEquippedItemControlCard(",
- "BuildEquippedItemWeaponGroupCard(",
- "BuildEquippedItemActionBarCards(",
- "BuildItemBehaviorCards(",
- "CommandButton(",
- "TextField(",
- "CloseEquippedItemDetailsCommand",
- "ToggleEquippedItemOverrideShutdownCommand",
- "SetEquippedItemTargetTemperatureCommand",
- "ToggleEquippedItemWeaponGroupCommand",
- "BindEquippedItemWeaponGroupCommand",
- "ClearEquippedItemActionBarBindingCommand",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_equippedItemDetailsSurfaceDocument)",
+ "AetheriaRuntimeEquippedItemDetailsSurfaceBuilder.Build(ProjectEquippedItemDetailsSurfaceState(",
+ "ProjectEquippedItemDetailsSurfaceState(",
+ "ProjectEquippedItemTemperatureControls(",
+ "ProjectEquippedItemBehaviorSections(",
+ "ProjectEquippedItemWeaponGroupControls(",
+ "ProjectEquippedItemActionBarSlots(",
+ "AetheriaRuntimeEquippedItemDetailsSurfaceCommands.TryRead(request, out var command)",
+ "switch (command.Kind)",
+ "AetheriaRuntimeEquippedItemDetailsCommandKind.Close",
+ "AetheriaRuntimeEquippedItemDetailsCommandKind.ToggleOverrideShutdown",
+ "AetheriaRuntimeEquippedItemDetailsCommandKind.SetTargetTemperature",
+ "AetheriaRuntimeEquippedItemDetailsCommandKind.ToggleWeaponGroup",
+ "AetheriaRuntimeEquippedItemDetailsCommandKind.BindWeaponGroup",
+ "AetheriaRuntimeEquippedItemDetailsCommandKind.ClearActionBarBinding"
};
var missingSymbols = requiredSymbols
@@ -3205,12 +3718,52 @@ static void RequireInventoryEquippedItemDetailsUseEveSurface(string root)
string.Join(", ", missingSymbols));
}
+ var forbiddenSymbols = new[]
+ {
+ "EquippedItemDetailsSurfaceId",
+ "BuildEquippedItemDetailsSurfaceDefinition(",
+ "BuildEquippedItemControlCard(",
+ "BuildEquippedItemWeaponGroupCard(",
+ "BuildEquippedItemActionBarCards(",
+ "BuildItemBehaviorCards(",
+ "BuildItemBehaviorMetric(",
+ "CloseEquippedItemDetailsCommand",
+ "ToggleEquippedItemOverrideShutdownCommand",
+ "SetEquippedItemTargetTemperatureCommand",
+ "ToggleEquippedItemWeaponGroupCommand",
+ "BindEquippedItemWeaponGroupCommand",
+ "ClearEquippedItemActionBarBindingCommand",
+ "ResolveEquippedItemDetailsSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
+ "private static EveSurfaceComponent Card(",
+ "private static EveSurfaceComponent Metric(",
+ "private static EveSurfaceComponent Text(",
+ "private static EveSurfaceComponent Button(",
+ "private static EveSurfaceComponent CommandButton(",
+ "private static EveSurfaceComponent TextField(",
+ "private static EveSurfaceComponent ButtonRow(",
+ "private static EveSurfaceComponent Node(",
+ "TryReadPayloadInt(",
+ "TryReadPayloadFloat(",
+ "request.Payload"
+ };
+ var forbiddenHits = forbiddenSymbols
+ .Where(symbol => source.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (forbiddenHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "InventoryMenu still owns the equipped-item surface contract locally: " +
+ string.Join(", ", forbiddenHits));
+ }
+
if (!source.Contains("RenderEquippedItemDetailsSurface(item);", StringComparison.Ordinal))
{
throw new InvalidOperationException("InventoryMenu equipped-item click path no longer routes inspection through the Eve surface.");
}
- var forbiddenSymbols = new[]
+ var legacyShellSymbols = new[]
{
"public PropertiesPanel PropertiesPanel;",
"PropertiesPanel.GameManager = GameManager;",
@@ -3218,7 +3771,7 @@ static void RequireInventoryEquippedItemDetailsUseEveSurface(string root)
"PropertiesPanel.Inspect(item);"
};
- var hits = forbiddenSymbols
+ var hits = legacyShellSymbols
.Where(symbol => source.Contains(symbol, StringComparison.Ordinal))
.ToArray();
@@ -3229,15 +3782,69 @@ static void RequireInventoryEquippedItemDetailsUseEveSurface(string root)
string.Join(", ", hits));
}
+ var equippedItemSurfaceBuilder = File.ReadAllText(equippedItemSurfaceBuilderPath);
+ var stateProject = File.ReadAllText(stateProjectPath);
+ var unityProject = File.ReadAllText(unityProjectPath);
+ var requiredBuilderSymbols = new[]
+ {
+ "public sealed class AetheriaRuntimeEquippedItemDetailsSurfaceState",
+ "public sealed class AetheriaRuntimeEquippedItemSection",
+ "public sealed class AetheriaRuntimeEquippedItemMetric",
+ "public sealed class AetheriaRuntimeEquippedItemControl",
+ "public sealed class AetheriaRuntimeEquippedItemTemperatureControl",
+ "public sealed class AetheriaRuntimeEquippedItemActionBarSlot",
+ "public enum AetheriaRuntimeEquippedItemDetailsCommandKind",
+ "public readonly struct AetheriaRuntimeEquippedItemDetailsCommand",
+ "public static class AetheriaRuntimeEquippedItemDetailsSurfaceCommands",
+ "public static bool TryRead(",
+ "public const string SurfaceId = \"aetheria.inventory.equipped_item_details\"",
+ "public const string Close = \"aetheria.inventory.equipped_item_details.close\"",
+ "public const string ToggleOverrideShutdown = \"aetheria.inventory.equipped_item_details.override_shutdown.toggle\"",
+ "public const string SetTargetTemperature = \"aetheria.inventory.equipped_item_details.target_temperature.set\"",
+ "public const string ToggleWeaponGroup = \"aetheria.inventory.equipped_item_details.weapon_group.toggle\"",
+ "public const string BindWeaponGroup = \"aetheria.inventory.equipped_item_details.weapon_group.bind\"",
+ "public const string ClearActionBarBinding = \"aetheria.inventory.equipped_item_details.action_bar.clear\"",
+ "public static AetheriaRuntimeSurfaceDocument Build(",
+ "new AetheriaRuntimeSurfaceCommandTemplate(Close",
+ "new AetheriaRuntimeSurfaceCommandTemplate(ToggleOverrideShutdown",
+ "new AetheriaRuntimeSurfaceCommandTemplate(SetTargetTemperature",
+ "new AetheriaRuntimeSurfaceCommandTemplate(ToggleWeaponGroup",
+ "new AetheriaRuntimeSurfaceCommandTemplate(BindWeaponGroup",
+ "new AetheriaRuntimeSurfaceCommandTemplate(ClearActionBarBinding",
+ "ReadInt(request, \"behaviorIndex\", -1)",
+ "ReadFloat(request, \"value\", 0f)",
+ "ReadInt(request, \"group\", -1)",
+ "ReadInt(request, \"slot\", -1)",
+ "\"control.text\"",
+ "\"inventory.menu\""
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !equippedItemSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared equipped-item detail surface builder no longer owns the equipped-item inspection contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
+
+ if (!stateProject.Contains("AetheriaRuntimeEquippedItemDetailsSurfaceBuilder.cs", StringComparison.Ordinal) ||
+ !unityProject.Contains("AetheriaRuntimeEquippedItemDetailsSurfaceBuilder.cs", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Shared equipped-item surface builder is not included in both runtime project surfaces.");
+ }
+
var actionGameManagerSource = File.ReadAllText(actionGameManagerPath);
var requiredActionBarSymbols = new[]
{
"GetActionBarSlotCount(",
"GetActionBarSlotLabel(",
"GetActionBarBindingLabel(",
- "CommitWeaponGroupActionBarBinding(",
- "CommitClearActionBarBinding(",
- "QueueRunCheckpoint(\"action-bar-binding\")"
+ "RequestWeaponGroupActionBarBinding(",
+ "RequestClearActionBarBinding(",
+ "TryRequestDaemonActionBarBinding(",
+ "TryRequestDaemonActionBarBindingClear("
};
var missingActionBarSymbols = requiredActionBarSymbols
@@ -3255,22 +3862,37 @@ static void RequireInventoryEquippedItemDetailsUseEveSurface(string root)
static void RequireTradeCargoSelectorUseEveSurface(string root)
{
var tradeMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "TradeMenu.cs");
+ var tradeCargoSelectorSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.cs");
if (!File.Exists(tradeMenuPath))
{
throw new InvalidOperationException("Cannot verify trade cargo-selector shell; TradeMenu.cs is missing.");
}
+ if (!File.Exists(tradeCargoSelectorSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify trade cargo-selector shell; shared runtime trade cargo selector surface builder is missing.");
+ }
var source = File.ReadAllText(tradeMenuPath);
+ var tradeCargoSelectorSurfaceBuilder = File.ReadAllText(tradeCargoSelectorSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "CargoSelectorSurfaceId",
"RenderCargoSelectorSurface(",
"BuildCargoSelectionCommands(",
"HandleCargoSelectorSurfaceCommand(",
- "ResolveCargoSelectorSurfaceDocument(",
- "BuildCargoSelectorSurfaceDefinition(",
- "CloseCargoSelectorCommand",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_cargoSelectorSurfaceDocument)",
+ "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Build(ProjectTradeCargoSelectorSurfaceState(",
+ "ProjectTradeCargoSelectorSurfaceState(",
+ "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.DockingBay",
+ "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.ShipBayCommand(",
+ "AetheriaRuntimeTradeCargoSelectorSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeTradeCargoSelectorCommandKind.Close",
+ "AetheriaRuntimeTradeCargoSelectorCommandKind.Select"
};
var missingSymbols = requiredSymbols
@@ -3286,8 +3908,17 @@ static void RequireTradeCargoSelectorUseEveSurface(string root)
var forbiddenSymbols = new[]
{
+ "private const string CargoSelectorSurfaceType",
+ "private const string CargoSelectorSurfaceId",
+ "CloseCargoSelectorCommand",
+ "BuildCargoSelectorSurfaceDefinition(",
+ "ResolveCargoSelectorSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
"ContextMenu.AddOption(\"Docking Bay\"",
- "ContextMenu.AddOption($\"{ship.Name} Bay {bay.index+1}\""
+ "ContextMenu.AddOption($\"{ship.Name} Bay {bay.index+1}\"",
+ "string.Equals(request.Command, AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Close",
+ "_cargoSelectionCommands.TryGetValue(request.Command"
};
var hits = forbiddenSymbols
@@ -3300,35 +3931,75 @@ static void RequireTradeCargoSelectorUseEveSurface(string root)
"TradeMenu still owns cargo selection through the old context-menu option path: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeTradeCargoSelectorSurfaceBuilder",
+ "public const string SurfaceId = \"aetheria.trade.target_cargo_selector\"",
+ "public const string Close = \"aetheria.trade.target_cargo_selector.close\"",
+ "public const string DockingBay = \"aetheria.trade.target_cargo_selector.docking_bay\"",
+ "public enum AetheriaRuntimeTradeCargoSelectorCommandKind",
+ "public readonly struct AetheriaRuntimeTradeCargoSelectorCommand",
+ "public static class AetheriaRuntimeTradeCargoSelectorSurfaceCommands",
+ "public static bool TryRead(",
+ "AetheriaRuntimeTradeCargoSelectorSurfaceState",
+ "AetheriaRuntimeTradeCargoTargetOption",
+ "public static string ShipBayCommand(",
+ "public static AetheriaRuntimeSurfaceDocument Build(",
+ "providerKind: \"trade.menu\"",
+ "Unity projects available cargo targets; the shared runtime surface owns the cargo selector contract."
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !tradeCargoSelectorSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime trade cargo selector surface builder no longer owns the trade cargo-selector shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
{
var tradeMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "TradeMenu.cs");
+ var tradeInteractionSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeTradeInteractionSurfaceBuilder.cs");
if (!File.Exists(tradeMenuPath))
{
throw new InvalidOperationException("Cannot verify trade filter and row-action shells; TradeMenu.cs is missing.");
}
+ if (!File.Exists(tradeInteractionSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify trade filter and row-action shells; shared runtime trade interaction surface builder is missing.");
+ }
var source = File.ReadAllText(tradeMenuPath);
+ var tradeInteractionSurfaceBuilder = File.ReadAllText(tradeInteractionSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "FilterSurfaceId",
- "RowActionSurfaceId",
"RenderFilterSurface(",
"BuildFilterSurfaceCommands(",
"HandleFilterSurfaceCommand(",
- "ResolveFilterSurfaceDocument(",
- "BuildFilterSurfaceDefinition(",
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_filterSurfaceDocument)",
+ "AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(ProjectTradeFilterSurfaceState(",
+ "ProjectTradeFilterSurfaceState(",
"RenderRowActionSurface(",
"BuildRowActionSurfaceCommands(",
"HandleRowActionSurfaceCommand(",
- "ResolveRowActionSurfaceDocument(",
- "BuildRowActionSurfaceDefinition(",
+ "AetheriaEveUnitySurfaceHost.Hide(_rowActionSurfaceDocument)",
+ "AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(ProjectTradeRowActionSurfaceState(",
+ "ProjectTradeRowActionSurfaceState(",
"ShowBuyQuantityDialog(",
- "CloseFilterSurfaceCommand",
- "CloseRowActionSurfaceCommand",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaRuntimeTradeInteractionSurfaceCommands.TryReadFilter(request, out var command)",
+ "AetheriaRuntimeTradeInteractionSurfaceCommands.TryReadRowAction(request, out var command)",
+ "AetheriaRuntimeTradeInteractionCommandKind.Close",
+ "AetheriaRuntimeTradeInteractionCommandKind.Select"
};
var missingSymbols = requiredSymbols
@@ -3344,11 +4015,25 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
var forbiddenSymbols = new[]
{
+ "private const string FilterSurfaceId",
+ "private const string RowActionSurfaceId",
+ "CloseFilterSurfaceCommand",
+ "CloseRowActionSurfaceCommand",
+ "BuildFilterSurfaceDefinition(",
+ "BuildRowActionSurfaceDefinition(",
+ "ResolveFilterSurfaceDocument(",
+ "ResolveRowActionSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
"public ContextMenu ContextMenu;",
"ContextMenu.Clear();",
"ContextMenu.AddDropdown(",
"ContextMenu.AddOption(",
- "ContextMenu.Show();"
+ "ContextMenu.Show();",
+ "string.Equals(request.Command, AetheriaRuntimeTradeInteractionSurfaceBuilder.CloseFilter",
+ "string.Equals(request.Command, AetheriaRuntimeTradeInteractionSurfaceBuilder.CloseRowAction",
+ "_filterSurfaceCommands.TryGetValue(request.Command",
+ "_rowActionSurfaceCommands.TryGetValue(request.Command"
};
var hits = forbiddenSymbols
@@ -3361,28 +4046,72 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
"TradeMenu still owns filter or row-action behavior through the old context-menu path: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeTradeInteractionSurfaceBuilder",
+ "public const string FilterSurfaceId = \"aetheria.trade.filter_selector\"",
+ "public const string CloseFilter = \"aetheria.trade.filter_selector.close\"",
+ "public const string RowActionSurfaceId = \"aetheria.trade.row_actions\"",
+ "public const string CloseRowAction = \"aetheria.trade.row_actions.close\"",
+ "public enum AetheriaRuntimeTradeInteractionCommandKind",
+ "public readonly struct AetheriaRuntimeTradeInteractionCommand",
+ "public static class AetheriaRuntimeTradeInteractionSurfaceCommands",
+ "public static bool TryReadFilter(",
+ "public static bool TryReadRowAction(",
+ "AetheriaRuntimeTradeFilterSurfaceState",
+ "AetheriaRuntimeTradeRowActionSurfaceState",
+ "AetheriaRuntimeTradeSurfaceGroup",
+ "AetheriaRuntimeTradeSurfaceOption",
+ "public static string HardpointFilterCommand(",
+ "public static string RowActionCommand(",
+ "public static AetheriaRuntimeSurfaceDocument BuildFilter(",
+ "public static AetheriaRuntimeSurfaceDocument BuildRowActions(",
+ "providerKind: \"trade.menu\""
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !tradeInteractionSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime trade interaction surface builder no longer owns the trade filter/row-action shell contracts: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireTradeItemDetailsUseEveSurface(string root)
{
var tradeMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "TradeMenu.cs");
+ var tradeItemDetailsSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeTradeItemDetailsSurfaceBuilder.cs");
if (!File.Exists(tradeMenuPath))
{
throw new InvalidOperationException("Cannot verify trade item-details shell; TradeMenu.cs is missing.");
}
+ if (!File.Exists(tradeItemDetailsSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify trade item-details shell; shared runtime trade item details surface builder is missing.");
+ }
var source = File.ReadAllText(tradeMenuPath);
+ var tradeItemDetailsSurfaceBuilder = File.ReadAllText(tradeItemDetailsSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "TradeItemSurfaceId",
"RenderTradeItemDetailsSurface(",
"HandleTradeItemDetailsSurfaceCommand(",
- "ResolveTradeItemDetailsSurfaceDocument(",
- "BuildTradeItemDetailsSurfaceDefinition(",
- "BuildTradeItemBehaviorCards(",
- "BuildTradeItemBehaviorMetric(",
- "CloseTradeItemDetailsCommand",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_tradeItemSurfaceDocument)",
+ "AetheriaRuntimeTradeItemDetailsSurfaceBuilder.Build(ProjectTradeItemDetailsSurfaceState(",
+ "ProjectTradeItemDetailsSurfaceState(",
+ "ProjectTradeItemBehaviorSections(",
+ "ProjectTradeItemBehaviorMetric(",
+ "AetheriaRuntimeTradeItemDetailsSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeTradeItemDetailsCommandKind.Close"
};
var missingSymbols = requiredSymbols
@@ -3398,8 +4127,17 @@ static void RequireTradeItemDetailsUseEveSurface(string root)
var forbiddenSymbols = new[]
{
+ "TradeItemSurfaceId",
+ "CloseTradeItemDetailsCommand",
+ "BuildTradeItemDetailsSurfaceDefinition(",
+ "BuildTradeItemBehaviorCards(",
+ "BuildTradeItemBehaviorMetric(",
+ "ResolveTradeItemDetailsSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
"public PropertiesPanel Properties;",
- "OnClick = () => Properties.Inspect(i.TypedItem)"
+ "OnClick = () => Properties.Inspect(i.TypedItem)",
+ "string.Equals(request.Command, AetheriaRuntimeTradeItemDetailsSurfaceBuilder.Close"
};
var hits = forbiddenSymbols
@@ -3412,28 +4150,69 @@ static void RequireTradeItemDetailsUseEveSurface(string root)
"TradeMenu still owns typed item inspection through the old PropertiesPanel path: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeTradeItemDetailsSurfaceBuilder",
+ "public const string SurfaceId = \"aetheria.trade.item_details\"",
+ "public const string Close = \"aetheria.trade.item_details.close\"",
+ "public enum AetheriaRuntimeTradeItemDetailsCommandKind",
+ "public readonly struct AetheriaRuntimeTradeItemDetailsCommand",
+ "public static class AetheriaRuntimeTradeItemDetailsSurfaceCommands",
+ "public static bool TryRead(",
+ "AetheriaRuntimeTradeItemDetailsSurfaceState",
+ "AetheriaRuntimeTradeItemSection",
+ "AetheriaRuntimeTradeItemMetric",
+ "public static AetheriaRuntimeSurfaceDocument Build(",
+ "providerKind: \"trade.menu\"",
+ "Unity supplies the selected market row; the shared runtime surface owns trade item inspection layout."
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !tradeItemDetailsSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime trade item details surface builder no longer owns the trade item-details shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireInventoryDropdownUseEveSurface(string root)
{
var inventoryPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryPanel.cs");
+ var inventoryDropdownSurfaceBuilderPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeInventoryDropdownSurfaceBuilder.cs");
if (!File.Exists(inventoryPanelPath))
{
throw new InvalidOperationException("Cannot verify inventory dropdown shell; InventoryPanel.cs is missing.");
}
+ if (!File.Exists(inventoryDropdownSurfaceBuilderPath))
+ {
+ throw new InvalidOperationException("Cannot verify inventory dropdown shell; shared runtime inventory dropdown surface builder is missing.");
+ }
var source = File.ReadAllText(inventoryPanelPath);
+ var inventoryDropdownSurfaceBuilder = File.ReadAllText(inventoryDropdownSurfaceBuilderPath);
var requiredSymbols = new[]
{
- "DropdownSurfaceId",
"RenderDropdownSurface(",
"BuildDropdownCommands(",
"HandleDropdownSurfaceCommand(",
- "ResolveDropdownSurfaceDocument(",
- "BuildDropdownSurfaceDefinition(",
- "SaveLoadoutCommand",
- "CloseDropdownSurfaceCommand",
- "new EveUiToolkitSurfaceLowerer()"
+ "AetheriaEveUnitySurfaceHost.RenderRuntime(",
+ "AetheriaEveUnitySurfaceHost.Hide(_dropdownSurfaceDocument)",
+ "AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build(ProjectDropdownSurfaceState(",
+ "ProjectDropdownSurfaceState(",
+ "AetheriaRuntimeInventoryDropdownSurfaceBuilder.SaveLoadout",
+ "AetheriaRuntimeInventoryDropdownSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeInventoryDropdownCommandKind.Close",
+ "AetheriaRuntimeInventoryDropdownCommandKind.Select",
+ "AetheriaRuntimeInventoryDropdownSurfaceBuilder.EntityEquipmentCommand(",
+ "AetheriaRuntimeInventoryDropdownSurfaceBuilder.LoadoutCommand("
};
var missingSymbols = requiredSymbols
@@ -3449,11 +4228,21 @@ static void RequireInventoryDropdownUseEveSurface(string root)
var forbiddenSymbols = new[]
{
+ "DropdownSurfaceId",
+ "CloseDropdownSurfaceCommand",
+ "SaveLoadoutCommand",
+ "BuildDropdownSurfaceDefinition(",
+ "private const string DropdownSurfaceType",
+ "ResolveDropdownSurfaceDocument(",
+ "new EveUiToolkitSurfaceLowerer()",
+ "host.AddComponent",
"ContextMenu.AddDropdown(entity.Name",
"ContextMenu.AddOption(GameManager.DockingBay.Name",
"ContextMenu.AddOption(\"Save Loadout\"",
"ContextMenu.AddDropdown(\"Restore Loadout\"",
- "ContextMenu.Show();"
+ "ContextMenu.Show();",
+ "string.Equals(request.Command, AetheriaRuntimeInventoryDropdownSurfaceBuilder.Close",
+ "_dropdownCommands.TryGetValue(request.Command"
};
var hits = forbiddenSymbols
@@ -3466,6 +4255,38 @@ static void RequireInventoryDropdownUseEveSurface(string root)
"InventoryPanel still owns dropdown behavior through the old ContextMenu path: " +
string.Join(", ", hits));
}
+
+ var requiredBuilderSymbols = new[]
+ {
+ "public static class AetheriaRuntimeInventoryDropdownSurfaceBuilder",
+ "public const string SurfaceId = \"aetheria.inventory.panel.dropdown\"",
+ "public const string Close = \"aetheria.inventory.panel.dropdown.close\"",
+ "public const string SaveLoadout = \"aetheria.inventory.panel.dropdown.save_loadout\"",
+ "public const string DockingBay = \"aetheria.inventory.panel.dropdown.docking_bay\"",
+ "public enum AetheriaRuntimeInventoryDropdownCommandKind",
+ "public readonly struct AetheriaRuntimeInventoryDropdownCommand",
+ "public static class AetheriaRuntimeInventoryDropdownSurfaceCommands",
+ "public static bool TryRead(",
+ "AetheriaRuntimeInventoryDropdownSurfaceState",
+ "AetheriaRuntimeInventoryDropdownGroup",
+ "AetheriaRuntimeInventoryDropdownOption",
+ "public static string EntityEquipmentCommand(",
+ "public static string EntityBayCommand(",
+ "public static string EntityCommand(",
+ "public static string LoadoutCommand(",
+ "public static AetheriaRuntimeSurfaceDocument Build(",
+ "providerKind: \"inventory.panel\"",
+ "Unity projects available inventory navigation; the shared runtime surface owns the dropdown contract."
+ };
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !inventoryDropdownSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime inventory dropdown surface builder no longer owns the inventory dropdown shell contract: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireNoDeadPopupShells(string root)
@@ -3567,7 +4388,7 @@ static void RequirePlayerSettingsEveSurface(string root)
var projectorPath = Path.Combine(root, "Aetheria.State", "AetheriaPlayerSettingsSurfaceProjector.cs");
var bridgePath = Path.Combine(root, "Aetheria.State", "AetheriaEveCommandBridge.cs");
var providerPath = Path.Combine(root, "Aetheria.State", "AetheriaProviderAdvertisementProjector.cs");
- var serverPath = Path.Combine(root, "Economy.Server", "Program.cs");
+ var daemonHostPath = Path.Combine(root, "Aetheria.State.Daemon", "Program.cs");
var sharedCommandsPath = Path.Combine(
root,
"Packages",
@@ -3612,9 +4433,9 @@ static void RequirePlayerSettingsEveSurface(string root)
var provider = File.Exists(providerPath)
? File.ReadAllText(providerPath)
: throw new InvalidOperationException("Player settings provider advertisement projector is missing.");
- var server = File.Exists(serverPath)
- ? File.ReadAllText(serverPath)
- : throw new InvalidOperationException("Economy.Server program is missing.");
+ var daemonHost = File.Exists(daemonHostPath)
+ ? File.ReadAllText(daemonHostPath)
+ : throw new InvalidOperationException("Aetheria.State.Daemon program is missing.");
var sharedCommands = File.Exists(sharedCommandsPath)
? File.ReadAllText(sharedCommandsPath)
: throw new InvalidOperationException("Shared player-settings Eve command contract is missing.");
@@ -3622,11 +4443,11 @@ static void RequirePlayerSettingsEveSurface(string root)
? File.ReadAllText(surfaceBuilderPath)
: throw new InvalidOperationException("Shared player-settings Eve surface builder is missing.");
- if (!bridge.Contains("AppliedPlayerSettingsCommands", StringComparison.Ordinal) ||
- !bridge.Contains("ApplyPlayerSettingsCommandAsync", StringComparison.Ordinal) ||
+ if (!bridge.Contains("AcceptedPlayerSettingsCommands", StringComparison.Ordinal) ||
+ !bridge.Contains("ExecutePlayerSettingsCommandAsync", StringComparison.Ordinal) ||
!bridge.Contains("PutPlayerSettingsSurfaceAsync", StringComparison.Ordinal) ||
!bridge.Contains("SetPlayerName", StringComparison.Ordinal) ||
- !bridge.Contains("command.Payload.TryGetValue(\"value\"", StringComparison.Ordinal))
+ !bridge.Contains("command.PlayerSettings.PlayerName", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"Eve command bridge no longer owns the typed player-settings surface mutation path.");
@@ -3639,11 +4460,11 @@ static void RequirePlayerSettingsEveSurface(string root)
"Provider advertisement no longer publishes the player-settings Eve surface and commands.");
}
- if (!server.Contains("PublishPlayerSettingsSurfaceAsync", StringComparison.Ordinal) ||
- !server.Contains("PutPlayerSettingsSurfaceAsync", StringComparison.Ordinal))
+ if (!daemonHost.Contains("PutPlayerSettingsSurfaceAsync", StringComparison.Ordinal) ||
+ !daemonHost.Contains("AetheriaPlayerSettingsSurfaceProjector.Build", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Economy.Server no longer republishes the provider-owned player-settings Eve surface.");
+ "Aetheria.State.Daemon no longer republishes the provider-owned player-settings Eve surface.");
}
if (!sharedCommands.Contains("SurfaceId = \"aetheria.player_settings\"", StringComparison.Ordinal) ||
@@ -3663,6 +4484,93 @@ static void RequirePlayerSettingsEveSurface(string root)
}
}
+static void RequireDaemonHostDoesNotDrainRuntimeCommits(string root)
+{
+ var economyServerPath = Path.Combine(root, "Economy" + ".Server", "Program.cs");
+ var economyServerProjectPath = Path.Combine(root, "Economy" + ".Server", "Economy" + ".Server.csproj");
+ var daemonHostPath = Path.Combine(root, "Aetheria.State.Daemon", "Program.cs");
+ var drainCommandsPath = Path.Combine(root, "Aetheria.State.DrainCommands", "Program.cs");
+ var packageCommitLogPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeStateCommitLog.cs");
+ var generatedUnityProjectPath = Path.Combine(root, "GameCult.Aetheria.State.Unity.csproj");
+ if (File.Exists(economyServerPath) || File.Exists(economyServerProjectPath))
+ {
+ throw new InvalidOperationException("Economy" + ".Server still exists beside the first-class Aetheria.State.Daemon host.");
+ }
+
+ var daemonHost = File.Exists(daemonHostPath)
+ ? File.ReadAllText(daemonHostPath)
+ : throw new InvalidOperationException("Cannot verify daemon host command authority; Aetheria.State.Daemon program is missing.");
+ var generatedUnityProject = File.Exists(generatedUnityProjectPath)
+ ? File.ReadAllText(generatedUnityProjectPath)
+ : throw new InvalidOperationException("Cannot verify daemon host command authority; GameCult.Aetheria.State.Unity.csproj is missing.");
+
+ if (File.Exists(drainCommandsPath) ||
+ File.Exists(Path.Combine(root, "Aetheria.State.DrainCommands", "Aetheria.State.DrainCommands.csproj")))
+ {
+ throw new InvalidOperationException(
+ "Aetheria.State.DrainCommands still exists as a sidecar command applicator; command acceptance belongs inside the Verse daemon.");
+ }
+
+ if (File.Exists(packageCommitLogPath) ||
+ generatedUnityProject.Contains("AetheriaRuntimeStateCommitLog.cs", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Unity package still exposes the legacy runtime state commit log instead of typed Eve/daemon requests.");
+ }
+
+ var forbiddenSymbols = new[]
+ {
+ "AetheriaLegacyRuntimeSnapshotImporter.ImportPendingAsync",
+ "DrainCommandsRuntimeCommitsAsync",
+ "CountPendingRuntimeCommits",
+ "Applied pending Aetheria runtime commits",
+ "AetheriaRuntimeCommitDrainStatus",
+ "PutRuntimeCommitDrainStatusAsync",
+ "GetRuntimeCommitDrainStatusAsync",
+ "PublishRuntimeCommitDrainDisabledAsync",
+ "disabled-daemon-authority"
+ };
+
+ var hits = forbiddenSymbols
+ .SelectMany(symbol => new[]
+ {
+ (Path: daemonHostPath, Symbol: symbol, Hit: daemonHost.Contains(symbol, StringComparison.Ordinal))
+ })
+ .Where(entry => entry.Hit)
+ .Select(entry => $"{Path.GetRelativePath(root, entry.Path)}: {entry.Symbol}")
+ .ToArray();
+
+ if (hits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "First-party daemon drains still apply legacy runtime commits instead of daemon/Eve command authority: " +
+ string.Join(", ", hits));
+ }
+
+ var requiredSymbols = new[]
+ {
+ "AetheriaEveCommandBridge.AcceptObservedAsync",
+ "AppliedInputSettingsCommands = report.AcceptedInputSettingsCommands",
+ "AppliedLoadoutTemplateCommands = report.AcceptedLoadoutTemplateCommands"
+ };
+
+ var missingSymbols = requiredSymbols
+ .Where(symbol => !daemonHost.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria.State.Daemon no longer advertises daemon authority while accepting observed Eve command documents: " +
+ string.Join(", ", missingSymbols));
+ }
+}
+
static void RequireVerseHostSettingsAuthority(string root)
{
var settingsPath = Path.Combine(root, "Aetheria.State", "Documents", "AetheriaVerseHostSettings.cs");
@@ -3673,9 +4581,7 @@ static void RequireVerseHostSettingsAuthority(string root)
var nodePath = Path.Combine(root, "Aetheria.State", "AetheriaStateNode.cs");
var providerPath = Path.Combine(root, "Aetheria.State", "AetheriaProviderAdvertisementProjector.cs");
var operationsPath = Path.Combine(root, "Aetheria.State", "AetheriaOperationsSurfaceProjector.cs");
- var serverPath = Path.Combine(root, "Economy.Server", "Program.cs");
- var serverSettingsPath = Path.Combine(root, "Economy.Server", "appsettings.json");
- var applyPendingPath = Path.Combine(root, "Aetheria.State.ApplyPending", "Program.cs");
+ var daemonHostPath = Path.Combine(root, "Aetheria.State.Daemon", "Program.cs");
var requiredFiles = new[]
{
@@ -3687,9 +4593,7 @@ static void RequireVerseHostSettingsAuthority(string root)
nodePath,
providerPath,
operationsPath,
- serverPath,
- serverSettingsPath,
- applyPendingPath
+ daemonHostPath
};
var missingFiles = requiredFiles
@@ -3710,9 +4614,7 @@ static void RequireVerseHostSettingsAuthority(string root)
var node = File.ReadAllText(nodePath);
var provider = File.ReadAllText(providerPath);
var operations = File.ReadAllText(operationsPath);
- var server = File.ReadAllText(serverPath);
- var serverSettings = File.ReadAllText(serverSettingsPath);
- var applyPending = File.ReadAllText(applyPendingPath);
+ var daemonHost = File.ReadAllText(daemonHostPath);
var requiredSettingsSymbols = new[]
{
@@ -3825,60 +4727,38 @@ static void RequireVerseHostSettingsAuthority(string root)
"Operations surface does not expose the typed daemon Verse-host telemetry card.");
}
- var requiredServerSymbols = new[]
+ var requiredDaemonHostSymbols = new[]
{
"EnsureVerseHostSettingsAsync",
"AetheriaVerseDiscoveryHost",
- "RefreshVerseDiscoveryAsync",
- "LoadVerseHostOverrides",
+ "discoveryHost.Update",
+ "ReadOption(args, \"--verse-id\")",
+ "ReadOption(args, \"--cultmesh-address\")",
"GetVerseHostSettingsAsync",
"PutVerseHostSettingsAsync",
- "AetheriaProviderAdvertisementProjector.Build(verseHostSettings, node.StatePath, updatedAtUtc)"
+ "AetheriaProviderAdvertisementProjector.Build(verseHost, node.StatePath, updatedAtUtc)"
};
- var missingServerSymbols = requiredServerSymbols
- .Where(symbol => !server.Contains(symbol, StringComparison.Ordinal))
+ var missingDaemonHostSymbols = requiredDaemonHostSymbols
+ .Where(symbol => !daemonHost.Contains(symbol, StringComparison.Ordinal))
.ToArray();
- if (missingServerSymbols.Length > 0)
+ if (missingDaemonHostSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Economy.Server is missing typed verse-host startup authority: " +
- string.Join(", ", missingServerSymbols));
- }
-
- var requiredServerSettingsSymbols = new[]
- {
- "\"Aetheria\"",
- "\"VerseHost\"",
- "\"VerseId\"",
- "\"CultMeshAddress\"",
- "\"Visibility\""
- };
- var missingServerSettingsSymbols = requiredServerSettingsSymbols
- .Where(symbol => !serverSettings.Contains(symbol, StringComparison.Ordinal))
- .ToArray();
- if (missingServerSettingsSymbols.Length > 0)
- {
- throw new InvalidOperationException(
- "Economy.Server appsettings are missing the daemon Verse-host section: " +
- string.Join(", ", missingServerSettingsSymbols));
- }
-
- if (!applyPending.Contains("EnsureVerseHostSettingsAsync", StringComparison.Ordinal) ||
- !applyPending.Contains("AetheriaProviderAdvertisementProjector.Build(verseHostSettings, statePath, now)", StringComparison.Ordinal))
- {
- throw new InvalidOperationException(
- "Aetheria.State.ApplyPending does not preserve typed verse-host projection authority.");
+ "Aetheria.State.Daemon is missing typed verse-host startup authority: " +
+ string.Join(", ", missingDaemonHostSymbols));
}
}
static void RequireClientTargetBootAuthority(string root)
{
- var unityFacadeProjectPath = Path.Combine(root, "Aetheria.State.Unity", "Aetheria.State.Unity.csproj");
+ var unityPackageProjectPath = Path.Combine(root, "GameCult.Aetheria.State.Unity.csproj");
var boundaryPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateBoundary.cs");
var bootPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateBoot.cs");
var clientTargetStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeClientTargetStore.cs");
+ var aetheriaStatePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaState.cs");
var verseDiscoveryPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeVerseDiscovery.cs");
var replicaBridgePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeVerseReplicaBridge.cs");
+ var mainMenuSurfaceBuilderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeMainMenuSurfaceBuilder.cs");
var bootstrapPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.eve-runtime", "Runtime", "AetheriaEveRuntimeBootstrap.cs");
var presenterPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.eve-runtime", "Runtime", "AetheriaEveSurfacePresenter.cs");
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
@@ -3886,12 +4766,14 @@ static void RequireClientTargetBootAuthority(string root)
var requiredFiles = new[]
{
- unityFacadeProjectPath,
+ unityPackageProjectPath,
boundaryPath,
bootPath,
clientTargetStorePath,
+ aetheriaStatePath,
verseDiscoveryPath,
replicaBridgePath,
+ mainMenuSurfaceBuilderPath,
bootstrapPath,
presenterPath,
actionGameManagerPath,
@@ -3909,33 +4791,36 @@ static void RequireClientTargetBootAuthority(string root)
string.Join(", ", missingFiles));
}
- var unityFacadeProject = File.ReadAllText(unityFacadeProjectPath);
+ var unityPackageProject = File.ReadAllText(unityPackageProjectPath);
var boundary = File.ReadAllText(boundaryPath);
var boot = File.ReadAllText(bootPath);
var clientTargetStore = File.ReadAllText(clientTargetStorePath);
+ var aetheriaState = File.ReadAllText(aetheriaStatePath);
var verseDiscovery = File.ReadAllText(verseDiscoveryPath);
var replicaBridge = File.ReadAllText(replicaBridgePath);
+ var mainMenuSurfaceBuilder = File.ReadAllText(mainMenuSurfaceBuilderPath);
var bootstrap = File.ReadAllText(bootstrapPath);
var presenter = File.ReadAllText(presenterPath);
var actionGameManager = File.ReadAllText(actionGameManagerPath);
var mainMenu = File.ReadAllText(mainMenuPath);
- var requiredUnityFacadeSymbols = new[]
+ var requiredUnityPackageProjectSymbols = new[]
{
"AetheriaRuntimeClientTargetStore.cs",
+ "AetheriaState.cs",
"AetheriaRuntimeVerseDiscovery.cs",
"AetheriaRuntimeStateBoundary.cs",
"AetheriaRuntimeStateBoot.cs",
"AetheriaRuntimeVerseReplicaBridge.cs"
};
- var missingUnityFacadeSymbols = requiredUnityFacadeSymbols
- .Where(symbol => !unityFacadeProject.Contains(symbol, StringComparison.Ordinal))
+ var missingUnityPackageProjectSymbols = requiredUnityPackageProjectSymbols
+ .Where(symbol => !unityPackageProject.Contains(symbol, StringComparison.Ordinal))
.ToArray();
- if (missingUnityFacadeSymbols.Length > 0)
+ if (missingUnityPackageProjectSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Aetheria.State.Unity.csproj no longer compiles the shared client-target boot files: " +
- string.Join(", ", missingUnityFacadeSymbols));
+ "GameCult.Aetheria.State.Unity.csproj no longer compiles the shared client-target boot files: " +
+ string.Join(", ", missingUnityPackageProjectSymbols));
}
var requiredBoundarySymbols = new[]
@@ -4040,6 +4925,88 @@ static void RequireClientTargetBootAuthority(string root)
string.Join(", ", missingVerseDiscoverySymbols));
}
+ var requiredAetheriaStateSymbols = new[]
+ {
+ "public readonly struct AetheriaState",
+ "public static AetheriaState At(DirectoryInfo gameDataDirectory)",
+ "public AetheriaClientTarget ClientTarget",
+ "public readonly struct AetheriaClientTarget",
+ "public AetheriaRuntimeClientTargetDocument Refresh()",
+ "public AetheriaRuntimeClientTargetDocument DiscoverVerses()",
+ "public AetheriaRuntimeClientTargetDocument SyncReplica()",
+ "public AetheriaRuntimeClientTargetDocument CycleTransport()",
+ "public AetheriaRuntimeClientTargetDocument RequestTitle(string title)",
+ "public AetheriaRuntimeClientTargetDocument RequestVerseId(string verseId)",
+ "public AetheriaRuntimeClientTargetDocument RequestCultMeshAddress(string cultMeshAddress)",
+ "public AetheriaRuntimeClientTargetDocument RequestStateFilePath(string stateFilePath)",
+ "public AetheriaRuntimeClientTargetDocument RequestDiscoveryEndpoints(IEnumerable? discoveryEndpoints)",
+ "public AetheriaRuntimeClientTargetDocument SelectDiscoveredVerse(",
+ "public bool TryRequest(AetheriaClientTargetOperation operation, out AetheriaRuntimeClientTargetDocument? document)",
+ "public AetheriaRuntimeClientTargetDocument Request(AetheriaClientTargetOperation operation)",
+ "AetheriaClientTargetOperationKind.SelectDiscoveredVerse",
+ "AetheriaRuntimeStateBoundary.GetClientTargetPath(_gameDataDirectory)",
+ "AetheriaRuntimeStateBoundary.GetStateFilePath(_gameDataDirectory)",
+ "AetheriaRuntimeVerseDiscovery.RefreshClientTarget(",
+ "AetheriaRuntimeVerseReplicaBridge.Sync(",
+ "AetheriaRuntimeClientTargetStore.Update(",
+ "NormalizeDiscoveryEndpoints(",
+ "GetReplicaStateFilePath(gameDataDirectory, document.VerseId)"
+ };
+ var missingAetheriaStateSymbols = requiredAetheriaStateSymbols
+ .Where(symbol => !aetheriaState.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingAetheriaStateSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar no longer owns typed client-target mutation: " +
+ string.Join(", ", missingAetheriaStateSymbols));
+ }
+
+ if (aetheriaState.Contains("public bool TryApply(AetheriaClientTargetOperation", StringComparison.Ordinal) ||
+ aetheriaState.Contains("public AetheriaRuntimeClientTargetDocument Apply(AetheriaClientTargetOperation", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar still exposes Apply vocabulary for client-target edits; Unity should request typed target changes.");
+ }
+
+ var forbiddenClientTargetSetters = new[]
+ {
+ "public AetheriaRuntimeClientTargetDocument SetTitle(",
+ "public AetheriaRuntimeClientTargetDocument SetVerseId(",
+ "public AetheriaRuntimeClientTargetDocument SetCultMeshAddress(",
+ "public AetheriaRuntimeClientTargetDocument SetStateFilePath(",
+ "public AetheriaRuntimeClientTargetDocument SetDiscoveryEndpoints("
+ };
+ var clientTargetSetterHits = forbiddenClientTargetSetters
+ .Where(symbol => aetheriaState.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (clientTargetSetterHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar still exposes Set vocabulary for client-target edits; Unity should request typed target changes: " +
+ string.Join(", ", clientTargetSetterHits));
+ }
+
+ if (aetheriaState.Contains("DaemonOperations", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar regressed to command-applier naming instead of native state handles.");
+ }
+
+ if (aetheriaState.Contains("IReadOnlyDictionary", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar exposes generic dictionary payload plumbing instead of typed client-target operations.");
+ }
+
+ if (aetheriaState.Contains("EveSurfaceCommandRequest", StringComparison.Ordinal) ||
+ aetheriaState.Contains("ReadPayloadValue(", StringComparison.Ordinal) ||
+ aetheriaState.Contains("request.Payload", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar still exposes Eve request payload plumbing instead of typed client-target operations.");
+ }
+
var requiredReplicaBridgeSymbols = new[]
{
"public static class AetheriaRuntimeVerseReplicaBridge",
@@ -4101,7 +5068,7 @@ static void RequireClientTargetBootAuthority(string root)
var requiredMainMenuSymbols = new[]
{
"CurrentStateBoot()",
- "LatestContinueRun(AetheriaRuntimeStateBootReport stateBoot)",
+ "LatestDaemonFrame(AetheriaRuntimeStateBootReport stateBoot)",
"LatestVerseHostSettings(AetheriaRuntimeStateBootReport stateBoot)",
"stateBoot.FailureMessage",
"stateBoot.DiscoveryEndpoints",
@@ -4111,6 +5078,19 @@ static void RequireClientTargetBootAuthority(string root)
"stateBoot.ReplicaStateFilePath",
"stateBoot.LastReplicaSyncAtUtc",
"stateBoot.LastReplicaSyncError",
+ "AetheriaState.At(ActionGameManager.GameDataDirectory)",
+ ".ClientTarget",
+ "TryRequestClientTargetCommand(request)",
+ "AetheriaRuntimeClientTargetSurfaceCommands.TryRead(request, out var operation)",
+ ".ClientTarget.Request(operation)",
+ "ProjectMainMenuSurfaceState(",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot(",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildSettings(",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings("
+ };
+ var requiredMainMenuBuilderSymbols = new[]
+ {
+ "AetheriaRuntimeMainMenuSurfaceState",
"\"Client Target\"",
"\"Transport\"",
"\"Target Source\""
@@ -4124,6 +5104,15 @@ static void RequireClientTargetBootAuthority(string root)
"MainMenu no longer lowers the shared client-target boot state through Eve: " +
string.Join(", ", missingMainMenuSymbols));
}
+ var missingMainMenuBuilderSymbols = requiredMainMenuBuilderSymbols
+ .Where(symbol => !mainMenuSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingMainMenuBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared main-menu surface builder no longer lowers the client-target boot state through Eve: " +
+ string.Join(", ", missingMainMenuBuilderSymbols));
+ }
var forbiddenDirectPathSymbols = new Dictionary
{
@@ -4138,6 +5127,15 @@ static void RequireClientTargetBootAuthority(string root)
[bootstrapPath] = new[]
{
"StatePathOverride()"
+ },
+ [mainMenuPath] = new[]
+ {
+ "AetheriaRuntimeStateBoundary.",
+ "AetheriaRuntimeClientTargetStore.",
+ "AetheriaRuntimeVerseDiscovery.RefreshClientTarget(",
+ "AetheriaRuntimeVerseReplicaBridge.Sync(",
+ "AetheriaRuntimeClientTarget.",
+ "DaemonOperations",
}
};
@@ -4254,9 +5252,10 @@ static void RequireVerseReplicaTool(string root)
static void RequireVerseSettingsShellAndBridge(string root)
{
- var unityFacadeProjectPath = Path.Combine(root, "Aetheria.State.Unity", "Aetheria.State.Unity.csproj");
+ var unityPackageProjectPath = Path.Combine(root, "GameCult.Aetheria.State.Unity.csproj");
var stateProjectPath = Path.Combine(root, "Aetheria.State", "Aetheria.State.csproj");
var clientTargetCommandsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeClientTargetCommands.cs");
+ var aetheriaStatePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaState.cs");
var clientTargetSurfaceBuilderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeClientTargetSurfaceBuilder.cs");
var verseHostCommandsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeVerseHostCommands.cs");
var clientTargetStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeClientTargetStore.cs");
@@ -4264,16 +5263,16 @@ static void RequireVerseSettingsShellAndBridge(string root)
var replicaBridgePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeVerseReplicaBridge.cs");
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
var commandBridgePath = Path.Combine(root, "Aetheria.State", "AetheriaEveCommandBridge.cs");
- var drainStatusPath = Path.Combine(root, "Aetheria.State", "Documents", "AetheriaEveCommandDrainStatus.cs");
+ var acceptanceStatusPath = Path.Combine(root, "Aetheria.State", "Documents", "AetheriaEveCommandAcceptanceStatus.cs");
var operationsProjectorPath = Path.Combine(root, "Aetheria.State", "AetheriaOperationsSurfaceProjector.cs");
- var applyPendingPath = Path.Combine(root, "Aetheria.State.ApplyPending", "Program.cs");
- var economyServerPath = Path.Combine(root, "Economy.Server", "Program.cs");
+ var daemonHostPath = Path.Combine(root, "Aetheria.State.Daemon", "Program.cs");
var requiredFiles = new[]
{
- unityFacadeProjectPath,
+ unityPackageProjectPath,
stateProjectPath,
clientTargetCommandsPath,
+ aetheriaStatePath,
clientTargetSurfaceBuilderPath,
verseHostCommandsPath,
clientTargetStorePath,
@@ -4281,10 +5280,9 @@ static void RequireVerseSettingsShellAndBridge(string root)
replicaBridgePath,
mainMenuPath,
commandBridgePath,
- drainStatusPath,
+ acceptanceStatusPath,
operationsProjectorPath,
- applyPendingPath,
- economyServerPath
+ daemonHostPath
};
var missingFiles = requiredFiles
@@ -4298,9 +5296,10 @@ static void RequireVerseSettingsShellAndBridge(string root)
string.Join(", ", missingFiles));
}
- var unityFacadeProject = File.ReadAllText(unityFacadeProjectPath);
+ var unityPackageProject = File.ReadAllText(unityPackageProjectPath);
var stateProject = File.ReadAllText(stateProjectPath);
var clientTargetCommands = File.ReadAllText(clientTargetCommandsPath);
+ var aetheriaState = File.ReadAllText(aetheriaStatePath);
var clientTargetSurfaceBuilder = File.ReadAllText(clientTargetSurfaceBuilderPath);
var verseHostCommands = File.ReadAllText(verseHostCommandsPath);
var clientTargetStore = File.ReadAllText(clientTargetStorePath);
@@ -4308,26 +5307,26 @@ static void RequireVerseSettingsShellAndBridge(string root)
var replicaBridge = File.ReadAllText(replicaBridgePath);
var mainMenu = File.ReadAllText(mainMenuPath);
var commandBridge = File.ReadAllText(commandBridgePath);
- var drainStatus = File.ReadAllText(drainStatusPath);
+ var acceptanceStatus = File.ReadAllText(acceptanceStatusPath);
var operationsProjector = File.ReadAllText(operationsProjectorPath);
- var applyPending = File.ReadAllText(applyPendingPath);
- var economyServer = File.ReadAllText(economyServerPath);
+ var daemonHost = File.ReadAllText(daemonHostPath);
- var requiredUnityFacadeSymbols = new[]
+ var requiredUnityPackageProjectSymbols = new[]
{
"AetheriaRuntimeClientTargetCommands.cs",
+ "AetheriaState.cs",
"AetheriaRuntimeClientTargetSurfaceBuilder.cs",
"AetheriaRuntimeVerseDiscovery.cs",
"AetheriaRuntimeVerseReplicaBridge.cs"
};
- var missingUnityFacadeSymbols = requiredUnityFacadeSymbols
- .Where(symbol => !unityFacadeProject.Contains(symbol, StringComparison.Ordinal))
+ var missingUnityPackageProjectSymbols = requiredUnityPackageProjectSymbols
+ .Where(symbol => !unityPackageProject.Contains(symbol, StringComparison.Ordinal))
.ToArray();
- if (missingUnityFacadeSymbols.Length > 0)
+ if (missingUnityPackageProjectSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Aetheria.State.Unity.csproj does not compile the Verse settings shell files: " +
- string.Join(", ", missingUnityFacadeSymbols));
+ "GameCult.Aetheria.State.Unity.csproj does not compile the Verse settings shell files: " +
+ string.Join(", ", missingUnityPackageProjectSymbols));
}
if (!stateProject.Contains("AetheriaRuntimeVerseHostCommands.cs", StringComparison.Ordinal))
@@ -4410,6 +5409,84 @@ static void RequireVerseSettingsShellAndBridge(string root)
"Client-target store no longer exposes typed update ownership for local target edits.");
}
+ var requiredAetheriaStateSymbols = new[]
+ {
+ "public readonly struct AetheriaState",
+ "public AetheriaClientTarget ClientTarget",
+ "public readonly struct AetheriaClientTarget",
+ "public AetheriaRuntimeClientTargetDocument Refresh()",
+ "public AetheriaRuntimeClientTargetDocument DiscoverVerses()",
+ "public AetheriaRuntimeClientTargetDocument SyncReplica()",
+ "public AetheriaRuntimeClientTargetDocument CycleTransport()",
+ "public AetheriaRuntimeClientTargetDocument RequestTitle(string title)",
+ "public AetheriaRuntimeClientTargetDocument RequestVerseId(string verseId)",
+ "public AetheriaRuntimeClientTargetDocument RequestCultMeshAddress(string cultMeshAddress)",
+ "public AetheriaRuntimeClientTargetDocument RequestStateFilePath(string stateFilePath)",
+ "public AetheriaRuntimeClientTargetDocument RequestDiscoveryEndpoints(IEnumerable? discoveryEndpoints)",
+ "public AetheriaRuntimeClientTargetDocument SelectDiscoveredVerse(",
+ "public bool TryRequest(AetheriaClientTargetOperation operation, out AetheriaRuntimeClientTargetDocument? document)",
+ "public AetheriaRuntimeClientTargetDocument Request(AetheriaClientTargetOperation operation)",
+ "AetheriaClientTargetOperationKind.SelectDiscoveredVerse",
+ "AetheriaRuntimeClientTargetStore.Update(",
+ "AetheriaRuntimeVerseDiscovery.RefreshClientTarget(",
+ "AetheriaRuntimeVerseReplicaBridge.Sync(",
+ "NormalizeDiscoveryEndpoints("
+ };
+ var missingAetheriaStateSymbols = requiredAetheriaStateSymbols
+ .Where(symbol => !aetheriaState.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingAetheriaStateSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar no longer owns the Verse settings mutation bridge: " +
+ string.Join(", ", missingAetheriaStateSymbols));
+ }
+
+ if (aetheriaState.Contains("public bool TryApply(AetheriaClientTargetOperation", StringComparison.Ordinal) ||
+ aetheriaState.Contains("public AetheriaRuntimeClientTargetDocument Apply(AetheriaClientTargetOperation", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar still exposes Apply vocabulary for Verse settings edits; Unity should request typed target changes.");
+ }
+
+ var forbiddenClientTargetSetters = new[]
+ {
+ "public AetheriaRuntimeClientTargetDocument SetTitle(",
+ "public AetheriaRuntimeClientTargetDocument SetVerseId(",
+ "public AetheriaRuntimeClientTargetDocument SetCultMeshAddress(",
+ "public AetheriaRuntimeClientTargetDocument SetStateFilePath(",
+ "public AetheriaRuntimeClientTargetDocument SetDiscoveryEndpoints("
+ };
+ var clientTargetSetterHits = forbiddenClientTargetSetters
+ .Where(symbol => aetheriaState.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (clientTargetSetterHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar still exposes Set vocabulary for Verse settings edits; Unity should request typed target changes: " +
+ string.Join(", ", clientTargetSetterHits));
+ }
+
+ if (aetheriaState.Contains("DaemonOperations", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar regressed to command-applier naming instead of native state handles.");
+ }
+
+ if (aetheriaState.Contains("IReadOnlyDictionary", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar exposes generic dictionary payload plumbing instead of typed client-target operations.");
+ }
+
+ if (aetheriaState.Contains("EveSurfaceCommandRequest", StringComparison.Ordinal) ||
+ aetheriaState.Contains("ReadPayloadValue(", StringComparison.Ordinal) ||
+ aetheriaState.Contains("request.Payload", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Aetheria state sugar still exposes Eve request payload plumbing instead of typed client-target operations.");
+ }
+
var requiredVerseDiscoverySymbols = new[]
{
"CultMesh.CreateVerseCatalog()",
@@ -4445,20 +5522,23 @@ static void RequireVerseSettingsShellAndBridge(string root)
var requiredMainMenuSymbols = new[]
{
- "VerseSettingsShellSurfaceId",
- "ShowVerseSettingsCommand",
+ "AetheriaRuntimeMainMenuCommands.VerseSettingsShellSurfaceId",
+ "AetheriaRuntimeMainMenuCommandKind.ShowVerseSettings",
"ShowVerseSettingsSurface()",
"HandleVerseSettingsSurfaceCommand(EveSurfaceCommandRequest request)",
"BuildVerseSettingsSurfaceDefinition()",
"AetheriaRuntimeClientTargetSurfaceBuilder.Build(",
- "TryCommitClientTargetCommand(",
- "TryQueueVerseHostCommand(",
- "AetheriaRuntimeClientTargetStore.Update(",
- "AetheriaRuntimeVerseDiscovery.RefreshClientTarget(",
- "AetheriaRuntimeVerseReplicaBridge.Sync(",
- "ParseDiscoveryEndpoints(",
- "new EveSurfaceCommandRequest(",
- "AetheriaRuntimeVerseHostCommands.SurfaceId"
+ "AetheriaRuntimeMainMenuSurfaceCommands.TryRead(request, out var command)",
+ "AetheriaRuntimeMainMenuCommandKind.ClientTargetCommand",
+ "AetheriaRuntimeMainMenuCommandKind.VerseHostCommand",
+ "TryRequestClientTargetCommand(request)",
+ "TrySendVerseHostCommand(command.Command)",
+ "AetheriaRuntimeEveCommands.TrySendVerseHostCommand(",
+ "AetheriaState.At(ActionGameManager.GameDataDirectory)",
+ ".ClientTarget",
+ "AetheriaRuntimeClientTargetSurfaceCommands.TryRead(request, out var operation)",
+ ".ClientTarget.Request(operation)",
+ "AetheriaRuntimeEveCommands.TrySendVerseHostCommand("
};
var missingMainMenuSymbols = requiredMainMenuSymbols
.Where(symbol => !mainMenu.Contains(symbol, StringComparison.Ordinal))
@@ -4470,12 +5550,49 @@ static void RequireVerseSettingsShellAndBridge(string root)
string.Join(", ", missingMainMenuSymbols));
}
+ var forbiddenMainMenuMutationSymbols = new[]
+ {
+ "AetheriaRuntimeClientTargetStore.",
+ "AetheriaRuntimeVerseDiscovery.RefreshClientTarget(",
+ "AetheriaRuntimeVerseReplicaBridge.Sync(",
+ "AetheriaRuntimeStateBoundary.",
+ "AetheriaRuntimeClientTarget.",
+ "DaemonOperations",
+ "ReadPayloadValue(",
+ "ParseDiscoveryEndpoints(",
+ "request.Payload",
+ "IReadOnlyDictionary",
+ "clientTarget.SetTitle(",
+ "clientTarget.SetVerseId(",
+ "clientTarget.SetCultMeshAddress(",
+ "clientTarget.SetStateFilePath(",
+ "clientTarget.SetDiscoveryEndpoints(",
+ "clientTarget.DiscoverVerses()",
+ "clientTarget.SelectDiscoveredVerse(",
+ "clientTarget.SyncReplica()",
+ "TryQueueVerseHostCommand(",
+ "TrySendVerseHostCommand(request.Command)",
+ "AetheriaRuntimeClientTargetCommands.IsKnown(request.Command",
+ "AetheriaRuntimeVerseHostCommands.IsKnown(request.Command",
+ "new EveSurfaceCommandRequest(",
+ "AetheriaRuntimeEveCommandLog.Queue",
+ };
+ var mainMenuMutationHits = forbiddenMainMenuMutationSymbols
+ .Where(symbol => mainMenu.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (mainMenuMutationHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "MainMenu still mutates the client target directly instead of dispatching through the runtime daemon operations: " +
+ string.Join(", ", mainMenuMutationHits));
+ }
+
var requiredBridgeSymbols = new[]
{
- "AppliedVerseHostCommands",
+ "AcceptedVerseHostCommands",
"AetheriaRuntimeVerseHostCommands.Refresh",
"AetheriaRuntimeVerseHostCommands.CycleVisibility",
- "ApplyVerseHostCommandAsync",
+ "ExecuteVerseHostCommandAsync",
"PutVerseHostSettingsAsync",
"PutProviderAdvertisementAsync",
"AetheriaOperationsSurfaceProjector.Build(",
@@ -4491,17 +5608,56 @@ static void RequireVerseSettingsShellAndBridge(string root)
string.Join(", ", missingBridgeSymbols));
}
- var requiredDrainSymbols = new[]
+ var requiredAcceptanceSymbols = new[]
{
+ "AetheriaEveCommandAcceptanceStatus",
+ "aetheria.eve_command_acceptance_status.v1",
+ "ObservedBeforeAccept",
"AppliedVerseHostCommands"
};
- var missingDrainSymbols = requiredDrainSymbols
- .Where(symbol => !drainStatus.Contains(symbol, StringComparison.Ordinal))
+ var missingAcceptanceSymbols = requiredAcceptanceSymbols
+ .Where(symbol => !acceptanceStatus.Contains(symbol, StringComparison.Ordinal))
.ToArray();
- if (missingDrainSymbols.Length > 0)
+ if (missingAcceptanceSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Aetheria Eve command drain status no longer records Verse-host command counts.");
+ "Aetheria Eve command acceptance status no longer records Verse-host command counts: " +
+ string.Join(", ", missingAcceptanceSymbols));
+ }
+
+ if (File.Exists(Path.Combine(root, "Aetheria.State", "Documents", "AetheriaEveCommandDrainStatus.cs")) ||
+ acceptanceStatus.Contains("AetheriaEveCommandDrainStatus", StringComparison.Ordinal) ||
+ acceptanceStatus.Contains("aetheria.eve_command_drain_status", StringComparison.Ordinal) ||
+ daemonHost.Contains("DrainEveCommandsAsync", StringComparison.Ordinal) ||
+ daemonHost.Contains("PutEveCommandDrainStatusAsync", StringComparison.Ordinal) ||
+ daemonHost.Contains("GetEveCommandDrainStatusAsync", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Eve command acceptance regressed to drain/queue vocabulary; the daemon should accept observed typed command records.");
+ }
+
+ if (acceptanceStatus.Contains("public int PendingBeforeApply", StringComparison.Ordinal) &&
+ !acceptanceStatus.Contains("[IgnoreMember]", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Eve command acceptance exposes the legacy PendingBeforeApply schema shim as serialized command state.");
+ }
+
+ var pendingBeforeApplyUseSources = new Dictionary
+ {
+ ["Aetheria daemon host"] = daemonHost,
+ ["Aetheria Eve command bridge"] = commandBridge,
+ ["operations projector"] = operationsProjector
+ };
+ var pendingBeforeApplyUses = pendingBeforeApplyUseSources
+ .Where(source => source.Value.Contains("PendingBeforeApply", StringComparison.Ordinal))
+ .Select(source => source.Key)
+ .ToArray();
+ if (pendingBeforeApplyUses.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Live Eve command acceptance code still uses the legacy PendingBeforeApply shim instead of ObservedBeforeAccept: " +
+ string.Join(", ", pendingBeforeApplyUses));
}
if (!operationsProjector.Contains("Verse Host Commands", StringComparison.Ordinal) ||
@@ -4511,18 +5667,1113 @@ static void RequireVerseSettingsShellAndBridge(string root)
"Operations surface no longer projects Verse-host Eve command counts.");
}
- if (!applyPending.Contains("AppliedVerseHostCommands = eveReport.AppliedVerseHostCommands", StringComparison.Ordinal) ||
- !applyPending.Contains("Eve verse host commands: {eveReport.AppliedVerseHostCommands}", StringComparison.Ordinal))
+ if (!commandBridge.Contains("report.AcceptedVerseHostCommands++", StringComparison.Ordinal) ||
+ !daemonHost.Contains("AppliedVerseHostCommands = report.AcceptedVerseHostCommands", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Aetheria.State.ApplyPending no longer publishes Verse-host Eve command totals.");
+ "Daemon command acceptance no longer publishes Verse-host Eve command totals.");
+ }
+}
+
+static void RequireTypedStatRecipeOperations(string root)
+{
+ var statRecipesPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStatRecipes.cs");
+ var legacyApplierPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStatRecipeCommandApplier.cs");
+ var catalogStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs");
+ var testsPath = Path.Combine(root, "Assets", "Scripts", "Tests", "StatRecipeSurfaceCommandTests.cs");
+
+ if (!File.Exists(statRecipesPath))
+ throw new InvalidOperationException("Typed stat recipe operations are missing.");
+ if (File.Exists(legacyApplierPath))
+ throw new InvalidOperationException("Legacy stat recipe command applier still exists.");
+ if (!File.Exists(catalogStorePath) || !File.Exists(testsPath))
+ throw new InvalidOperationException("Cannot verify typed stat recipe operations; required files are missing.");
+
+ var statRecipes = File.ReadAllText(statRecipesPath);
+ var catalogStore = File.ReadAllText(catalogStorePath);
+ var tests = File.ReadAllText(testsPath);
+
+ var requiredTypedSymbols = new[]
+ {
+ "public static class AetheriaRuntimeStatRecipes",
+ "public static AetheriaRuntimeStatRecipeSurfaceState Refresh(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState SelectStat(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState AddStat(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState RemoveStat(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState SetStatName(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState SetBaseValue(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState SetConditionEnabled(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState ToggleCondition(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState CycleInfluenceOperation(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState SetInfluenceAmount(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState SetInfluenceCurve(",
+ "public static AetheriaRuntimeStatRecipeSurfaceState SetPreviewCondition("
+ };
+ var missingTypedSymbols = requiredTypedSymbols
+ .Where(symbol => !statRecipes.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingTypedSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Typed stat recipe operations are incomplete: " +
+ string.Join(", ", missingTypedSymbols));
}
- if (!economyServer.Contains("AppliedVerseHostCommands = report.AppliedVerseHostCommands", StringComparison.Ordinal) ||
- !economyServer.Contains("verseHost={report.AppliedVerseHostCommands}", StringComparison.Ordinal))
+ var forbiddenPublicStringlySymbols = new[]
+ {
+ "public static AetheriaRuntimeStatRecipeSurfaceState Apply",
+ "public static AetheriaRuntimeStatRecipeSurfaceState ApplyCommand",
+ "public static class AetheriaRuntimeStatRecipeDaemonOperations",
+ "public static AetheriaRuntimeStatRecipeSurfaceState",
+ "IReadOnlyDictionary? payload"
+ };
+ var publicStringlyHits = forbiddenPublicStringlySymbols
+ .Where(symbol =>
+ symbol == "public static AetheriaRuntimeStatRecipeSurfaceState"
+ ? statRecipes.Contains("public static AetheriaRuntimeStatRecipeSurfaceState Apply(", StringComparison.Ordinal)
+ : statRecipes.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (publicStringlyHits.Length > 0)
{
throw new InvalidOperationException(
- "Economy.Server no longer publishes Verse-host Eve command totals.");
+ "Stat recipe client API still exposes stringly command/payload operations: " +
+ string.Join(", ", publicStringlyHits));
+ }
+
+ var forbiddenCatalogDecoderSymbols = new[]
+ {
+ "DrainCommandsStatRecipeCommand(",
+ "AetheriaRuntimeStatRecipes.ApplyCommand(",
+ "ReadPayloadDouble(",
+ "ReadPayloadBool("
+ };
+ var catalogDecoderHits = forbiddenCatalogDecoderSymbols
+ .Where(symbol => catalogStore.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (catalogDecoderHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Catalog store still replays stringly stat recipe command payloads: " +
+ string.Join(", ", catalogDecoderHits));
+ }
+
+ if (tests.Contains("AetheriaRuntimeStatRecipeDaemonOperations", StringComparison.Ordinal) ||
+ tests.Contains("AetheriaRuntimeStatRecipeCommands.", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Stat recipe tests still exercise string command constants instead of typed operations.");
+ }
+}
+
+static void RequireTypedDaemonCommandPayloads(string root)
+{
+ var daemonDocumentsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonDocuments.cs");
+ var daemonClientPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonOperationClient.cs");
+ var daemonRuntimeOperationsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonOperations.cs");
+ var legacyDaemonApplierPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonCommandApplier.cs");
+ var stateNodePath = Path.Combine(root, "Aetheria.State", "AetheriaStateNode.cs");
+ var observerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaDaemonObserver.cs");
+ var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
+ var testsPath = Path.Combine(root, "Assets", "Scripts", "Tests", "DaemonRuntimeDocumentTests.cs");
+ var daemonSurfaceCommandsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonSurfaceCommands.cs");
+
+ if (File.Exists(legacyDaemonApplierPath))
+ throw new InvalidOperationException("Legacy daemon command applier still exists; daemon operations must own execution.");
+
+ var requiredFiles = new[] { daemonDocumentsPath, daemonClientPath, daemonRuntimeOperationsPath, stateNodePath, observerPath, actionGameManagerPath, testsPath, daemonSurfaceCommandsPath };
+ var missingFiles = requiredFiles
+ .Where(path => !File.Exists(path))
+ .Select(path => Path.GetRelativePath(root, path))
+ .ToArray();
+ if (missingFiles.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Typed daemon command payloads cannot be verified because required files are missing: " +
+ string.Join(", ", missingFiles));
+ }
+
+ var daemonDocuments = File.ReadAllText(daemonDocumentsPath);
+ var daemonClient = File.ReadAllText(daemonClientPath);
+ var daemonOperationsSource = File.ReadAllText(daemonRuntimeOperationsPath);
+ var stateNode = File.ReadAllText(stateNodePath);
+ var observer = File.ReadAllText(observerPath);
+ var actionGameManager = File.ReadAllText(actionGameManagerPath);
+ var tests = File.ReadAllText(testsPath);
+ var daemonSurfaceCommands = File.ReadAllText(daemonSurfaceCommandsPath);
+
+ var requiredPayloadTypes = new[]
+ {
+ "public enum AetheriaRuntimeDaemonCommandKinds",
+ "public sealed class AetheriaRuntimeActionBarBindingCommand",
+ "public sealed class AetheriaRuntimeCargoTransferCommand",
+ "public sealed class AetheriaRuntimeTradePurchaseCommand",
+ "public sealed class AetheriaRuntimeLootPickupCommand",
+ "public sealed class AetheriaRuntimeLoadoutRestoreCommand",
+ "public sealed class AetheriaRuntimeEquipmentTransferCommand",
+ "public sealed class AetheriaRuntimeStoreItemCommand"
+ };
+ var missingPayloadTypes = requiredPayloadTypes
+ .Where(symbol => !daemonDocuments.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingPayloadTypes.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon command document is missing typed command payloads: " +
+ string.Join(", ", missingPayloadTypes));
+ }
+
+ var liveSources = new Dictionary
+ {
+ ["daemon documents"] = daemonDocuments,
+ ["daemon operation client"] = daemonClient,
+ ["daemon operations"] = daemonOperationsSource,
+ ["state node"] = stateNode,
+ ["Unity daemon observer"] = observer,
+ ["ActionGameManager"] = actionGameManager,
+ ["daemon command tests"] = tests,
+ ["daemon surface commands"] = daemonSurfaceCommands
+ };
+ foreach (var source in liveSources)
+ {
+ var forbidden = new[]
+ {
+ "Dictionary Payload",
+ ".Payload[",
+ "ReadPayloadInt(",
+ "ReadPayloadDouble(",
+ "ReadPayloadBool(",
+ "Payload(command,"
+ }
+ .Where(symbol => source.Value.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (forbidden.Length > 0)
+ {
+ throw new InvalidOperationException(
+ $"{source.Key} still uses stringly daemon command payloads: " +
+ string.Join(", ", forbidden));
+ }
+ }
+
+ var forbiddenDaemonKindSymbols = new[]
+ {
+ "public static class AetheriaRuntimeDaemonCommandKinds",
+ "public const string SetTarget",
+ "Queue(\r\n string kind",
+ "Create(\r\n string kind"
+ };
+ var daemonKindSources = new Dictionary
+ {
+ ["daemon documents"] = daemonDocuments,
+ ["daemon operation client"] = daemonClient,
+ ["Unity daemon observer"] = observer
+ };
+ foreach (var source in daemonKindSources)
+ {
+ var forbidden = forbiddenDaemonKindSymbols
+ .Where(symbol => source.Value.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (forbidden.Length > 0)
+ {
+ throw new InvalidOperationException(
+ $"{source.Key} still exposes daemon command kind as strings: " +
+ string.Join(", ", forbidden));
+ }
+ }
+
+ if (!daemonDocuments.Contains("public AetheriaRuntimeDaemonCommandKinds Kind { get; set; }", StringComparison.Ordinal) ||
+ !daemonDocuments.Contains("public AetheriaRuntimeDaemonCommandKinds Kind { get; }", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Daemon command document/envelope must expose typed enum command kinds.");
+ }
+
+ var requiredClientSymbols = new[]
+ {
+ "public AetheriaRuntimeDaemonCommandEnvelope Send(",
+ "public bool TrySend(",
+ "ReadObservedDaemonCommands()",
+ "DeleteDaemonCommandAsync(",
+ "_operationClient.Create(",
+ "_operationClient.TrySend(command, out var envelope, out var error)",
+ "command.ActionBarBinding.Kind",
+ "command.CargoTransfer.OriginEntityKey",
+ "command.TradePurchase.TotalPrice",
+ "command.LootPickup.ItemKey",
+ "command.LoadoutRestore.TemplateName",
+ "command.EquipmentTransfer.SourceKind",
+ "command.StoreItem.SourceEquipmentIndex"
+ };
+ var clientAndObserver = daemonClient + "\n" + observer + "\n" + stateNode;
+ var missingClientSymbols = requiredClientSymbols
+ .Where(symbol => !clientAndObserver.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingClientSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon command producers are not filling typed payloads: " +
+ string.Join(", ", missingClientSymbols));
+ }
+
+ var forbiddenQueueSymbols = new[]
+ {
+ "public static class AetheriaRuntimeDaemonCommandLog",
+ "internal static class AetheriaRuntimeDaemonCommandLog",
+ "public AetheriaRuntimeDaemonCommandEnvelope Queue(",
+ "public static AetheriaRuntimeDaemonCommandEnvelope QueueCommand(",
+ "AetheriaRuntimeDaemonCommandLog.QueueCommand(",
+ "AetheriaRuntimeDaemonCommandLog.",
+ "AetheriaRuntimeDaemonCommandInbox",
+ "ReadPending(",
+ ".daemon.pending",
+ "stateFilePath + \".daemon.commands\"",
+ "_operationClient.Queue("
+ };
+ var daemonQueueSources = new Dictionary
+ {
+ ["daemon operation client"] = daemonClient,
+ ["state node"] = stateNode,
+ ["Unity daemon observer"] = observer,
+ ["ActionGameManager"] = actionGameManager,
+ ["daemon command tests"] = tests
+ };
+ var survivingQueueSymbols = daemonQueueSources
+ .SelectMany(source => forbiddenQueueSymbols
+ .Where(symbol => source.Value.Contains(symbol, StringComparison.Ordinal))
+ .Select(symbol => $"{source.Key}: {symbol}"))
+ .ToArray();
+
+ if (survivingQueueSymbols.Length > 0 ||
+ observer.Contains("_operationClient.Queue(", StringComparison.Ordinal) ||
+ daemonClient.Contains("AetheriaRuntimeDaemonCommandLog.", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Unity-facing daemon operation clients still expose queue semantics instead of sending typed daemon operations: " +
+ string.Join(", ", survivingQueueSymbols));
+ }
+
+ if (tests.Contains("AetheriaRuntimeDaemonCommandLog.", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Daemon command tests still reach through the old command log instead of the typed command client/inbox.");
+ }
+
+ if (actionGameManager.Contains("local mutation suppressed", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "ActionGameManager still treats failed daemon submission as a local-mutation fallback.");
+ }
+
+ var failedSubmitSuccessHits = System.Text.RegularExpressions.Regex
+ .Matches(
+ actionGameManager,
+ "Failed to send Aetheria daemon[\\s\\S]*?return true;",
+ System.Text.RegularExpressions.RegexOptions.Multiline)
+ .Cast()
+ .Where(match => !match.Value.Contains("return false;", StringComparison.Ordinal))
+ .Select(match => match.Value.Split('\n').FirstOrDefault()?.Trim() ?? "daemon submit catch")
+ .Take(5)
+ .ToArray();
+ if (failedSubmitSuccessHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "ActionGameManager reports failed daemon submissions as successful commands: " +
+ string.Join("; ", failedSubmitSuccessHits));
+ }
+}
+
+static void RequireUnityPublicRequestVocabulary(string root)
+{
+ var checkedRoots = new[]
+ {
+ Path.Combine(root, "Assets", "Scripts", "Gameplay"),
+ Path.Combine(root, "Assets", "Scripts", "UI"),
+ Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime")
+ };
+
+ var commitPattern = new System.Text.RegularExpressions.Regex(
+ "\\bCommit[A-Z][A-Za-z0-9_]*\\b",
+ System.Text.RegularExpressions.RegexOptions.Compiled);
+ var hits = checkedRoots
+ .Where(Directory.Exists)
+ .SelectMany(path => Directory.EnumerateFiles(path, "*.cs", SearchOption.AllDirectories))
+ .Where(path => !path.Contains(Path.Combine("ServerShared", "NIH"), StringComparison.Ordinal))
+ .SelectMany(path => File.ReadLines(path)
+ .Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
+ .SelectMany(line => commitPattern.Matches(line.Line)
+ .Cast()
+ .Select(match => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {match.Value}"))
+ .Take(20)
+ .ToArray();
+
+ if (hits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity-facing Aetheria APIs must say Request/Submit, not Commit; Unity is an input provider, not state authority: " +
+ string.Join("; ", hits));
+ }
+}
+
+static void RequireDaemonVersePublication(string root)
+{
+ var daemonDocumentsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonDocuments.cs");
+ var daemonTickRunnerPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonTickRunner.cs");
+ var daemonPublicationStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonPublicationStore.cs");
+ var daemonSoaDocumentsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonSoaDocuments.cs");
+ var daemonGameSurfaceBuilderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonGameSurfaceBuilder.cs");
+ var daemonEditorSurfaceBuilderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonEditorSurfaceBuilder.cs");
+ var daemonHostProjectPath = Path.Combine(root, "Aetheria.State.Daemon", "Aetheria.State.Daemon.csproj");
+ var daemonHostProgramPath = Path.Combine(root, "Aetheria.State.Daemon", "Program.cs");
+ var documentRegistryPath = Path.Combine(root, "Aetheria.State", "AetheriaDocumentRegistry.cs");
+ var stateNodePath = Path.Combine(root, "Aetheria.State", "AetheriaStateNode.cs");
+ var daemonSurfaceProjectorPath = Path.Combine(root, "Aetheria.State", "AetheriaRuntimeEveSurfaceStateProjector.cs");
+ var providerAdvertisementPath = Path.Combine(root, "Aetheria.State", "AetheriaProviderAdvertisementProjector.cs");
+ var documentStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCultCacheDocumentStore.cs");
+ var boundaryPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateBoundary.cs");
+ var testsPath = Path.Combine(root, "Assets", "Scripts", "Tests", "DaemonRuntimeDocumentTests.cs");
+ var smokePath = Path.Combine(root, "Aetheria.State.Smoke", "Program.cs");
+ var notePath = Path.Combine(root, "Aetheria.State", "docs", "verse-daemon-shape.md");
+
+ var requiredFiles = new[]
+ {
+ daemonDocumentsPath,
+ daemonTickRunnerPath,
+ daemonPublicationStorePath,
+ daemonSoaDocumentsPath,
+ daemonGameSurfaceBuilderPath,
+ daemonEditorSurfaceBuilderPath,
+ daemonHostProjectPath,
+ daemonHostProgramPath,
+ documentRegistryPath,
+ stateNodePath,
+ daemonSurfaceProjectorPath,
+ providerAdvertisementPath,
+ documentStorePath,
+ boundaryPath,
+ testsPath,
+ smokePath,
+ notePath
+ };
+ var missingFiles = requiredFiles
+ .Where(path => !File.Exists(path))
+ .Select(path => Path.GetRelativePath(root, path))
+ .ToArray();
+ if (missingFiles.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria daemon Verse publication cannot be verified because required files are missing: " +
+ string.Join(", ", missingFiles));
+ }
+
+ var daemonDocuments = File.ReadAllText(daemonDocumentsPath);
+ var daemonTickRunner = File.ReadAllText(daemonTickRunnerPath);
+ var daemonPublicationStore = File.ReadAllText(daemonPublicationStorePath);
+ var daemonSoaDocuments = File.ReadAllText(daemonSoaDocumentsPath);
+ var daemonGameSurfaceBuilder = File.ReadAllText(daemonGameSurfaceBuilderPath);
+ var daemonEditorSurfaceBuilder = File.ReadAllText(daemonEditorSurfaceBuilderPath);
+ var daemonHostProject = File.ReadAllText(daemonHostProjectPath);
+ var daemonHostProgram = File.ReadAllText(daemonHostProgramPath);
+ var documentRegistry = File.ReadAllText(documentRegistryPath);
+ var stateNode = File.ReadAllText(stateNodePath);
+ var daemonSurfaceProjector = File.ReadAllText(daemonSurfaceProjectorPath);
+ var providerAdvertisement = File.ReadAllText(providerAdvertisementPath);
+ var documentStore = File.ReadAllText(documentStorePath);
+ var boundary = File.ReadAllText(boundaryPath);
+ var tests = File.ReadAllText(testsPath);
+ var smoke = File.ReadAllText(smokePath);
+ var note = File.ReadAllText(notePath);
+
+ var requiredDocumentSymbols = new[]
+ {
+ "public const string ProviderAdvertisement = \"gamecult.aetheria.daemon_provider_advertisement.v1\"",
+ "public const string Health = \"gamecult.aetheria.daemon_health.v1\"",
+ "public const string CommandBoundary = \"gamecult.aetheria.daemon_command_boundary.v1\"",
+ "public const string GameSurface = \"gamecult.aetheria.daemon_game_surface.v1\"",
+ "public const string EditorSurface = \"gamecult.aetheria.daemon_editor_surface.v1\"",
+ "public sealed class AetheriaRuntimeDaemonProviderAdvertisementDocument",
+ "public sealed class AetheriaRuntimeDaemonHealthDocument",
+ "public sealed class AetheriaRuntimeDaemonCommandBoundaryDocument",
+ "public sealed class AetheriaRuntimeDaemonCommandBoundaryEntry",
+ "AetheriaRuntimeDaemonCommandKinds Kind",
+ "AetheriaRuntimeCargoTransferCommand",
+ "[CultDocument(\"gamecult.aetheria.daemon_provider_advertisement\", \"gamecult.aetheria.daemon_provider_advertisement.v1\")]",
+ "[CultDocument(\"gamecult.aetheria.daemon_health\", \"gamecult.aetheria.daemon_health.v1\")]",
+ "[CultDocument(\"gamecult.aetheria.daemon_command_boundary\", \"gamecult.aetheria.daemon_command_boundary.v1\")]",
+ "[CultDocument(\"gamecult.aetheria.daemon_frame\", \"gamecult.aetheria.daemon_frame.v1\")]",
+ "[CultDocument(\"gamecult.aetheria.daemon_command\", \"gamecult.aetheria.daemon_command.v1\")]",
+ "EveGuiSurfaceWitnessPath",
+ "EveTuiSurfaceWitnessPath",
+ "EditorGuiSurfaceWitnessPath",
+ "EditorTuiSurfaceWitnessPath"
+ };
+ var missingDocumentSymbols = requiredDocumentSymbols
+ .Where(symbol => !daemonDocuments.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDocumentSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon Verse publication documents are incomplete: " +
+ string.Join(", ", missingDocumentSymbols));
+ }
+
+ if (!daemonSoaDocuments.Contains("[CultDocument(\"gamecult.aetheria.daemon_soa_view\", \"gamecult.aetheria.daemon_soa_view.v1\")]", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException("Daemon SoA view is no longer a registered CultCache/CultNet document.");
+ }
+
+ var requiredBoundarySymbols = new[]
+ {
+ "RuntimeDaemonProviderFileSuffix",
+ "RuntimeDaemonHealthFileSuffix",
+ "RuntimeDaemonCommandBoundaryFileSuffix",
+ "RuntimeDaemonGameSurfaceFileSuffix",
+ "RuntimeDaemonGameTuiSurfaceFileSuffix",
+ "RuntimeDaemonEditorSurfaceFileSuffix",
+ "RuntimeDaemonEditorTuiSurfaceFileSuffix",
+ "GetDaemonProviderPath(",
+ "GetDaemonHealthPath(",
+ "GetDaemonCommandBoundaryPath(",
+ "GetDaemonGameSurfacePath(",
+ "GetDaemonGameTuiSurfacePath(",
+ "GetDaemonEditorSurfacePath(",
+ "GetDaemonEditorTuiSurfacePath("
+ };
+ var missingBoundarySymbols = requiredBoundarySymbols
+ .Where(symbol => !boundary.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBoundarySymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon Verse publication paths are incomplete: " +
+ string.Join(", ", missingBoundarySymbols));
+ }
+
+ var requiredStoreSymbols = new[]
+ {
+ "WriteDaemonProviderAdvertisement(",
+ "ReadDaemonProviderAdvertisement(",
+ "WriteDaemonHealth(",
+ "ReadDaemonHealth(",
+ "WriteDaemonCommandBoundary(",
+ "ReadDaemonCommandBoundary(",
+ "WriteDaemonGameSurface(",
+ "ReadDaemonGameSurface(",
+ "WriteDaemonEditorSurface(",
+ "ReadDaemonEditorSurface(",
+ "PublishProviderAdvertisement(",
+ "PublishHealth(",
+ "PublishCommandBoundary(",
+ "PublishGameSurface(",
+ "PublishGameTuiSurface(",
+ "PublishEditorSurface(",
+ "PublishEditorTuiSurface(",
+ "TryReadProviderAdvertisement(",
+ "TryReadHealth(",
+ "TryReadCommandBoundary(",
+ "TryReadGameSurface(",
+ "TryReadGameTuiSurface(",
+ "TryReadEditorSurface(",
+ "TryReadEditorTuiSurface("
+ };
+ var storeSource = documentStore + "\n" + daemonPublicationStore;
+ var missingStoreSymbols = requiredStoreSymbols
+ .Where(symbol => !storeSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingStoreSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon Verse publication store is incomplete: " +
+ string.Join(", ", missingStoreSymbols));
+ }
+
+ var requiredDaemonRegistrySymbols = new[]
+ {
+ "CultNetDocumentBinding.ForDocument(registry)",
+ "CultNetDocumentBinding.ForDocument(registry)",
+ "CultNetDocumentBinding.ForDocument(registry)",
+ "CultNetDocumentBinding.ForDocument(registry)",
+ "CultNetDocumentBinding.ForDocument(registry)",
+ "CultNetDocumentBinding.ForDocument(registry)",
+ "typeof(AetheriaRuntimeDaemonProviderAdvertisementDocument)",
+ "typeof(AetheriaRuntimeDaemonHealthDocument)",
+ "typeof(AetheriaRuntimeDaemonCommandBoundaryDocument)",
+ "typeof(AetheriaRuntimeDaemonFrameDocument)",
+ "typeof(AetheriaRuntimeDaemonSoaViewDocument)",
+ "typeof(AetheriaRuntimeDaemonCommandDocument)"
+ };
+ var missingDaemonRegistrySymbols = requiredDaemonRegistrySymbols
+ .Where(symbol => !documentRegistry.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDaemonRegistrySymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon API documents are not registered as CultCache/CultNet records: " +
+ string.Join(", ", missingDaemonRegistrySymbols));
+ }
+
+ var requiredDaemonNodeSymbols = new[]
+ {
+ "PutDaemonProviderAdvertisementAsync(",
+ "GetDaemonProviderAdvertisementAsync(",
+ "PutDaemonHealthAsync(",
+ "GetDaemonHealthAsync(",
+ "PutDaemonCommandBoundaryAsync(",
+ "GetDaemonCommandBoundaryAsync(",
+ "PutDaemonFrameAsync(",
+ "GetDaemonFrameAsync(",
+ "PutDaemonSoaViewAsync(",
+ "GetDaemonSoaViewAsync(",
+ "PutDaemonGameSurfaceAsync(",
+ "GetDaemonGameSurfaceAsync(",
+ "PutDaemonGameTuiSurfaceAsync(",
+ "GetDaemonGameTuiSurfaceAsync(",
+ "PutDaemonEditorSurfaceAsync(",
+ "GetDaemonEditorSurfaceAsync(",
+ "PutDaemonEditorTuiSurfaceAsync(",
+ "GetDaemonEditorTuiSurfaceAsync("
+ };
+ var missingDaemonNodeSymbols = requiredDaemonNodeSymbols
+ .Where(symbol => !stateNode.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDaemonNodeSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "AetheriaStateNode no longer exposes daemon Verse API records ergonomically: " +
+ string.Join(", ", missingDaemonNodeSymbols));
+ }
+
+ if (!daemonSurfaceProjector.Contains("public static EveSurfaceState ToState(AetheriaRuntimeSurfaceDocument document)", StringComparison.Ordinal) ||
+ !daemonSurfaceProjector.Contains("EveCommandTemplate", StringComparison.Ordinal) ||
+ !daemonSurfaceProjector.Contains("EveSurfaceComponent", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException("Daemon Eve surface projector no longer lowers daemon surfaces into registered Eve surface state.");
+ }
+
+ if (!daemonPublicationStore.Contains("GetCommandBoundaryPath(", StringComparison.Ordinal) ||
+ !daemonDocuments.Contains("AetheriaRuntimeDaemonCommandKinds", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Daemon command boundary no longer exposes typed daemon command metadata.");
+ }
+
+ var forbiddenDaemonQueueSymbols = new[]
+ {
+ "public static AetheriaRuntimeDaemonCommandEnvelope QueueCommand(",
+ "AetheriaRuntimeDaemonCommandLog.",
+ "AetheriaRuntimeDaemonCommandLog.QueueCommand(",
+ "var envelope = AetheriaRuntimeDaemonCommandLog.QueueCommand",
+ ".daemon.pending",
+ "ReadPending("
+ };
+ var daemonQueueSource = daemonDocuments + "\n" + daemonTickRunner + "\n" + daemonPublicationStore + "\n" + tests;
+ var survivingDaemonQueueSymbols = forbiddenDaemonQueueSymbols
+ .Where(symbol => daemonQueueSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (survivingDaemonQueueSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon command boundary still exposes mailbox queue semantics: " +
+ string.Join(", ", survivingDaemonQueueSymbols));
+ }
+
+ if (daemonDocuments.Contains("public int PendingBeforeApply", StringComparison.Ordinal) &&
+ (!daemonDocuments.Contains("[IgnoreMember]", StringComparison.Ordinal) ||
+ !daemonDocuments.Contains("public int ObservedCommandCount", StringComparison.Ordinal)))
+ {
+ throw new InvalidOperationException(
+ "Daemon health exposes PendingBeforeApply without the ObservedCommandCount compatibility wrapper.");
+ }
+
+ var requiredProviderAdvertisementSymbols = new[]
+ {
+ "private const string DaemonCommandBoundaryId = \"aetheria.daemon.commands\"",
+ "private const string DaemonWitnessTransport = \"cultcache-witness\"",
+ "AetheriaRuntimeDaemonSchemas.ProviderAdvertisement",
+ "AetheriaRuntimeDaemonSchemas.Frame",
+ "AetheriaRuntimeDaemonSchemas.SoaView",
+ "AetheriaRuntimeDaemonSchemas.Health",
+ "AetheriaRuntimeDaemonSchemas.CommandBoundary",
+ "AetheriaRuntimeDaemonSchemas.GameSurface",
+ "AetheriaRuntimeDaemonSchemas.EditorSurface",
+ "AetheriaRuntimeDaemonSchemas.Command",
+ "AetheriaRuntimeStateBoundary.GetDaemonProviderPath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonFramePath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonSoaViewPath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonHealthPath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonCommandBoundaryPath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonGameSurfacePath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonGameTuiSurfacePath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonEditorSurfacePath(statePath)",
+ "AetheriaRuntimeStateBoundary.GetDaemonEditorTuiSurfacePath(statePath)",
+ "public const string DaemonGameSurfaceKey = \"eve:surface:aetheria.daemon.game\"",
+ "public const string DaemonGameTuiSurfaceKey = \"eve:surface:aetheria.daemon.game.tui\"",
+ "public const string DaemonEditorSurfaceKey = \"eve:surface:aetheria.daemon.editor\"",
+ "public const string DaemonEditorTuiSurfaceKey = \"eve:surface:aetheria.daemon.editor.tui\"",
+ "AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId",
+ "AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId",
+ "AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId",
+ "AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId"
+ };
+ var missingProviderAdvertisementSymbols = requiredProviderAdvertisementSymbols
+ .Where(symbol => !providerAdvertisement.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingProviderAdvertisementSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Odin-visible provider advertisement no longer points at daemon-owned Verse witnesses: " +
+ string.Join(", ", missingProviderAdvertisementSymbols));
+ }
+
+ var requiredTickSymbols = new[]
+ {
+ "VerseId",
+ "CultMeshAddress",
+ "AetheriaRuntimeDaemonCommandBoundaryDocument.Create",
+ "AetheriaRuntimeDaemonProviderAdvertisementDocument.Create",
+ "AetheriaRuntimeDaemonPublicationStore.PublishCommandBoundary",
+ "AetheriaRuntimeDaemonPublicationStore.PublishProviderAdvertisement",
+ "AetheriaRuntimeDaemonPublicationStore.PublishHealth",
+ "AetheriaRuntimeDaemonGameSurfaceBuilder.Build",
+ "AetheriaRuntimeDaemonPublicationStore.PublishGameSurface",
+ "AetheriaRuntimeDaemonPublicationStore.PublishGameTuiSurface",
+ "AetheriaRuntimeDaemonEditorSurfaceBuilder.Build",
+ "AetheriaRuntimeDaemonPublicationStore.PublishEditorSurface",
+ "AetheriaRuntimeDaemonPublicationStore.PublishEditorTuiSurface",
+ "ObservedCommands",
+ "ObservedCommandCount = commands.Length",
+ "PublicationSource = \"daemon-published\""
+ };
+ var missingTickSymbols = requiredTickSymbols
+ .Where(symbol => !daemonTickRunner.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingTickSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon tick does not publish Verse-facing provider/health/command-boundary records: " +
+ string.Join(", ", missingTickSymbols));
+ }
+
+ var requiredDaemonHostSymbols = new[]
+ {
+ "Exe",
+ "ProjectReference Include=\"..\\Aetheria.State\\Aetheria.State.csproj\"",
+ "AetheriaStateNode.OpenAsync(",
+ "startServer: true",
+ "new AetheriaVerseDiscoveryHost(node)",
+ "discoveryHost.Update(",
+ "PublishDaemonApiDocumentsAsync(node, result)",
+ "PutDaemonFrameAsync(result.Frame)",
+ "PutDaemonGameSurfaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(gameSurface))",
+ "PutDaemonEditorTuiSurfaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(editorTuiSurface))",
+ "AetheriaEveCommandBridge.AcceptObservedAsync(",
+ "!options.KeepAccountedCommandRecords",
+ "ReadObservedDaemonCommands()",
+ "DeleteAccountedDaemonCommandsAsync(node, result)",
+ "DeleteDaemonCommandAsync(commandId)",
+ "AetheriaRuntimeDaemonTickRunner.Tick(",
+ "AetheriaProviderAdvertisementProjector.Build(verseHost, node.StatePath, updatedAtUtc)",
+ "AetheriaOperationsSurfaceProjector.Build(eveStatus, verseHost, runtimeSession)",
+ "AetheriaPlayerSettingsSurfaceProjector.Build(playerSettings, playerSettingsUpdatedAt)",
+ "Role = \"verse-daemon\"",
+ "Console.CancelKeyPress",
+ "Aetheria Verse daemon is running"
+ };
+ var daemonHostSource = daemonHostProject + "\n" + daemonHostProgram;
+ var missingDaemonHostSymbols = requiredDaemonHostSymbols
+ .Where(symbol => !daemonHostSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDaemonHostSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria.State.Daemon no longer has Odin/VoidBot-shaped Verse daemon host authority: " +
+ string.Join(", ", missingDaemonHostSymbols));
+ }
+
+ var forbiddenDaemonHostSymbols = new[]
+ {
+ "AetheriaRuntimeDaemonCommandLog.",
+ "DeleteProcessedCommands",
+ "new HttpListener",
+ "UseUrls(",
+ "MapGet(",
+ "JsonSerializer.Serialize"
+ };
+ var survivingDaemonHostSymbols = forbiddenDaemonHostSymbols
+ .Where(symbol => daemonHostSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (survivingDaemonHostSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Aetheria.State.Daemon has drifted into private command-log/dashboard ownership instead of CultMesh Verse publication: " +
+ string.Join(", ", survivingDaemonHostSymbols));
+ }
+
+ var requiredGameSurfaceSymbols = new[]
+ {
+ "public const string SurfaceId = \"aetheria.game\"",
+ "public const string TuiSurfaceId = \"aetheria.game.tui\"",
+ "AetheriaRuntimeDaemonFrameDocument frame",
+ "AetheriaRuntimeDaemonHealthDocument health",
+ "AetheriaRuntimeDaemonCommandBoundaryDocument commandBoundary",
+ "\"game.daemon\"",
+ "\"Typed Command Boundary\"",
+ "\"commandBody\"",
+ "nameof(AetheriaRuntimeDaemonCommandDocument)",
+ "AetheriaRuntimeDaemonCommandKinds.SetMoveVector"
+ };
+ var missingGameSurfaceSymbols = requiredGameSurfaceSymbols
+ .Where(symbol => !daemonGameSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingGameSurfaceSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon game Eve surface builder is incomplete: " +
+ string.Join(", ", missingGameSurfaceSymbols));
+ }
+
+ var requiredEditorSurfaceSymbols = new[]
+ {
+ "public const string SurfaceId = \"aetheria.daemon.editor\"",
+ "public const string TuiSurfaceId = \"aetheria.daemon.editor.tui\"",
+ "AetheriaRuntimeDaemonProviderAdvertisementDocument provider",
+ "AetheriaRuntimeDaemonHealthDocument health",
+ "AetheriaRuntimeDaemonCommandBoundaryDocument commandBoundary",
+ "\"editor.daemon\"",
+ "\"Verse Provider\"",
+ "\"Witnesses\"",
+ "\"Typed Commands\"",
+ "AetheriaRuntimeDaemonCommandBoundaryEntry"
+ };
+ var missingEditorSurfaceSymbols = requiredEditorSurfaceSymbols
+ .Where(symbol => !daemonEditorSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingEditorSurfaceSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon editor Eve surface builder is incomplete: " +
+ string.Join(", ", missingEditorSurfaceSymbols));
+ }
+
+ var requiredTestSymbols = new[]
+ {
+ "TryReadProviderAdvertisement(",
+ "TryReadHealth(",
+ "TryReadCommandBoundary(",
+ "TryReadGameSurface(",
+ "TryReadEditorSurface(",
+ "TryReadGameTuiSurface(",
+ "TryReadEditorTuiSurface(",
+ "AetheriaRuntimeDaemonSchemas.ProviderAdvertisement",
+ "AetheriaRuntimeDaemonSchemas.CommandBoundary",
+ "AetheriaRuntimeDaemonSchemas.Health",
+ "AetheriaRuntimeDaemonSchemas.GameSurface",
+ "AetheriaRuntimeDaemonSchemas.EditorSurface",
+ "AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId",
+ "AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId",
+ "AetheriaRuntimeDaemonCommandKinds.TransferCargoItem",
+ "nameof(AetheriaRuntimeCargoTransferCommand)"
+ };
+ var missingTestSymbols = requiredTestSymbols
+ .Where(symbol => !tests.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingTestSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon Verse publication tests are incomplete: " +
+ string.Join(", ", missingTestSymbols));
+ }
+
+ var requiredSmokeSymbols = new[]
+ {
+ "PutDaemonProviderAdvertisementAsync(daemonProvider)",
+ "PutDaemonHealthAsync(daemonHealth)",
+ "PutDaemonCommandBoundaryAsync(daemonCommandBoundary)",
+ "AetheriaCommandPort.OpenAsync(",
+ "daemonCommandPort.SubmitDaemonCommandAsync(",
+ "eveCommandPort.SubmitEveCommandAsync(",
+ "PutDaemonFrameAsync(daemonFrame)",
+ "PutDaemonGameSurfaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(daemonGameSurface))",
+ "GetDaemonProviderAdvertisementAsync()",
+ "GetDaemonHealthAsync()",
+ "GetDaemonCommandBoundaryAsync()",
+ "GetDaemonFrameAsync()",
+ "GetDaemonGameSurfaceAsync()",
+ "DaemonGameSurfaceKey",
+ "DaemonGameTuiSurfaceKey",
+ "DaemonEditorSurfaceKey",
+ "DaemonEditorTuiSurfaceKey"
+ };
+ var missingSmokeSymbols = requiredSmokeSymbols
+ .Where(symbol => !smoke.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingSmokeSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "State smoke no longer proves daemon Verse API records round-trip through CultCache: " +
+ string.Join(", ", missingSmokeSymbols));
+ }
+
+ var requiredNoteSymbols = new[]
+ {
+ "Odin is the all-seer, not the owner.",
+ "Idunn keeps the daemon alive from daemon-published health and command-boundary records.",
+ "Bifrost hosts the MCP crossing for Codex and other xeno agents.",
+ "The Aetheria daemon remains the side-effect owner.",
+ "gamecult.aetheria.daemon_provider_advertisement.v1",
+ "gamecult.aetheria.daemon_health.v1",
+ "gamecult.aetheria.daemon_command_boundary.v1",
+ "gamecult.aetheria.daemon_frame.v1",
+ "gamecult.aetheria.daemon_soa_view.v1",
+ "gamecult.aetheria.daemon_game_surface.v1",
+ "gamecult.aetheria.daemon_editor_surface.v1",
+ "gamecult.eve.provider_advertisement.v1` is the Odin-visible Eve provider card",
+ "gamecult.aetheria.daemon_provider_advertisement.v1` is the daemon-owned Aetheria runtime contract",
+ "The bridge layer must point at daemon-owned witnesses instead of becoming a second source of truth.",
+ "Long term, Odin should discover the daemon-owned provider advertisement and interface bindings directly",
+ "Queues are an implementation detail.",
+ "Eve commands and daemon commands are typed `gamecult.eve.command.v1` and `gamecult.aetheria.daemon_command.v1` records in the Aetheria state graph",
+ "`AetheriaCommandPort` is the neutral command submission implementation for typed command records.",
+ "Unity-side command lowerers may use `AetheriaRuntimeCommandPort` as a facade over that same port.",
+ "`CommandLog`, `Inbox`, `mailbox`, `.eve.commands`, `.daemon.commands`, `.cc.pending`, or `" + "Pending" + "CultCacheStore` in Unity-facing daemon/Eve command code",
+ "Do not add a private HTTP dashboard, Unity-only inspector, JSON status blob, or agent-specific daemon wrapper as canonical truth."
+ };
+ var missingNoteSymbols = requiredNoteSymbols
+ .Where(symbol => !note.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingNoteSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon Verse shape note no longer records the Odin/VoidBot daemon authority contract: " +
+ string.Join(", ", missingNoteSymbols));
+ }
+}
+
+static void RequireTypedEveCommandBodies(string root)
+{
+ var eveCommandDocumentPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeEveCommandDocument.cs");
+ var eveCommandClientPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeEveCommandClient.cs");
+ var runtimeCommandPortPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCommandPort.cs");
+ var eveCommandBridgePath = Path.Combine(root, "Aetheria.State", "AetheriaEveCommandBridge.cs");
+ var stateNodePath = Path.Combine(root, "Aetheria.State", "AetheriaStateNode.cs");
+ var documentRegistryPath = Path.Combine(root, "Aetheria.State", "AetheriaDocumentRegistry.cs");
+ var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
+ var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
+ var evePresenterPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.eve-runtime", "Runtime", "AetheriaEveSurfacePresenter.cs");
+
+ var requiredFiles = new[] { eveCommandDocumentPath, eveCommandClientPath, runtimeCommandPortPath, eveCommandBridgePath, stateNodePath, documentRegistryPath, actionGameManagerPath, mainMenuPath, evePresenterPath };
+ var missingFiles = requiredFiles
+ .Where(path => !File.Exists(path))
+ .Select(path => Path.GetRelativePath(root, path))
+ .ToArray();
+ if (missingFiles.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Typed Eve command bodies cannot be verified because required files are missing: " +
+ string.Join(", ", missingFiles));
+ }
+
+ var eveCommandDocument = File.ReadAllText(eveCommandDocumentPath);
+ var eveCommandClient = File.ReadAllText(eveCommandClientPath);
+ var runtimeCommandPort = File.ReadAllText(runtimeCommandPortPath);
+ var eveCommandBridge = File.ReadAllText(eveCommandBridgePath);
+ var stateNode = File.ReadAllText(stateNodePath);
+ var documentRegistry = File.ReadAllText(documentRegistryPath);
+ var actionGameManager = File.ReadAllText(actionGameManagerPath);
+ var evePresenter = File.ReadAllText(evePresenterPath);
+
+ var requiredDocumentSymbols = new[]
+ {
+ "public sealed class AetheriaRuntimePlayerSettingsCommandBody",
+ "public sealed class AetheriaRuntimeInputSettingsCommandBody",
+ "public AetheriaRuntimePlayerSettingsCommandBody PlayerSettings",
+ "public AetheriaRuntimeInputSettingsCommandBody InputSettings",
+ "public AetheriaRuntimeLoadoutTemplateCommit? LoadoutTemplate",
+ "[CultDocument(\"gamecult.eve.command\", \"gamecult.eve.command.v1\")]"
+ };
+ var missingDocumentSymbols = requiredDocumentSymbols
+ .Where(symbol => !eveCommandDocument.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDocumentSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Eve submitted command document is missing typed command bodies: " +
+ string.Join(", ", missingDocumentSymbols));
+ }
+
+ var forbiddenDocumentSymbols = new[]
+ {
+ "IReadOnlyDictionary Payload",
+ "Dictionary Payload",
+ "SubmitSurfaceRequest(",
+ "CreateSurfaceRequestCommand("
+ };
+ var forbiddenDocumentHits = forbiddenDocumentSymbols
+ .Where(symbol => eveCommandDocument.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (forbiddenDocumentHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Eve submitted command document still persists string payload maps: " +
+ string.Join(", ", forbiddenDocumentHits));
+ }
+
+ var requiredTypedCommandSymbols = new[]
+ {
+ "public static class AetheriaRuntimeEveCommands",
+ "public static class AetheriaRuntimeEveCommandClient",
+ "public sealed class AetheriaRuntimeCommandPort",
+ "public sealed class AetheriaCommandPort",
+ "namespace Aetheria.State",
+ "namespace GameCult.Aetheria.State.Unity",
+ "global::Aetheria.State.AetheriaCommandPort",
+ "public static class AetheriaRuntimeCommandSubmitter",
+ "TrySubmitEveCommand(",
+ "TrySubmitDaemonCommand(",
+ "CreatePlayerSettingsCommand(",
+ "CreateInputSettingsCommand(",
+ "CreateCatalogCommand(",
+ "CreateOperationsCommand(",
+ "CreateVerseHostCommand(",
+ "CreateLoadoutTemplateCommand(",
+ "TrySendPlayerSettingsCommand(",
+ "TrySendInputSettingsCommand(",
+ "TrySendVerseHostCommand(",
+ "TrySendLoadoutTemplateCommand(",
+ "TrySendKnownSurfaceCommand(",
+ "TryCreateKnownSurfaceCommand(",
+ "ToDocument(",
+ "AcceptObservedAsync(",
+ "node.ReadObservedEveCommands()",
+ "node.DeleteEveCommandAsync(",
+ "SubmitEveCommandAsync(",
+ "ReadObservedEveCommands(",
+ "DeleteEveCommandAsync(",
+ "EveCommandKey(",
+ "CultNetDocumentBinding.ForDocument",
+ "typeof(AetheriaRuntimeEveCommandDocument)",
+ "SubmitPlayerSettingsCommand(",
+ "command.PlayerSettings.PlayerName",
+ "command.InputSettings.ActionName",
+ "command.InputSettings.InputSystemPath",
+ "AetheriaRuntimeEveCommands.TrySendInputSettingsCommand(",
+ "AetheriaRuntimeEveCommands.TrySendVerseHostCommand(",
+ "AetheriaRuntimeEveCommands.TrySendLoadoutTemplateCommand(",
+ "AetheriaRuntimeEveCommands.TrySendKnownSurfaceCommand("
+ };
+ var mainMenu = File.ReadAllText(mainMenuPath);
+ var typedCommandSources = eveCommandClient + "\n" + runtimeCommandPort + "\n" + eveCommandBridge + "\n" + stateNode + "\n" + documentRegistry + "\n" + actionGameManager + "\n" + mainMenu + "\n" + evePresenter;
+ var missingTypedCommandSymbols = requiredTypedCommandSymbols
+ .Where(symbol => !typedCommandSources.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingTypedCommandSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Eve command append/apply path is missing typed command body usage: " +
+ string.Join(", ", missingTypedCommandSymbols));
+ }
+
+ var forbiddenUnitySubmitterSymbols = new[]
+ {
+ "AetheriaRuntimeCommandSubmitter.TrySubmitEveCommand(",
+ "AetheriaRuntimeCommandSubmitter.TrySubmitDaemonCommand(",
+ "AetheriaRuntimeEveCommandClient.ToDocument("
+ };
+ var unitySubmitterSources = new Dictionary
+ {
+ [Path.GetRelativePath(root, actionGameManagerPath)] = actionGameManager,
+ [Path.GetRelativePath(root, mainMenuPath)] = mainMenu,
+ [Path.GetRelativePath(root, evePresenterPath)] = evePresenter
+ };
+ var unitySubmitterHits = unitySubmitterSources
+ .SelectMany(pair => forbiddenUnitySubmitterSymbols
+ .Where(symbol => pair.Value.Contains(symbol, StringComparison.Ordinal))
+ .Select(symbol => $"{pair.Key}: {symbol}"))
+ .ToArray();
+ if (unitySubmitterHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity-facing Eve command code still assembles transport documents instead of using typed send helpers: " +
+ string.Join(", ", unitySubmitterHits));
+ }
+
+ var forbiddenGenericSurfaceCommandSymbols = new[]
+ {
+ "SubmitSurfaceRequest(",
+ "CreateSurfaceRequestCommand("
+ };
+ var genericSurfaceCommandHits = forbiddenGenericSurfaceCommandSymbols
+ .Where(symbol => typedCommandSources.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (genericSurfaceCommandHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Eve command edge still exposes a generic surface-command submission back door: " +
+ string.Join(", ", genericSurfaceCommandHits));
+ }
+
+ var forbiddenQueueSymbols = new[]
+ {
+ "public static class AetheriaRuntimeEveCommandLog",
+ "internal static class AetheriaRuntimeEveCommandLog",
+ "public static AetheriaRuntimeEveCommandEnvelope QueueCommand(",
+ "public static AetheriaRuntimeEveCommandEnvelope QueuePlayerSettingsCommand(",
+ "public static AetheriaRuntimeEveCommandEnvelope QueueInputSettingsCommand(",
+ "public static AetheriaRuntimeEveCommandEnvelope QueueCatalogCommand(",
+ "public static AetheriaRuntimeEveCommandEnvelope QueueOperationsCommand(",
+ "public static AetheriaRuntimeEveCommandEnvelope QueueVerseHostCommand(",
+ "public static AetheriaRuntimeEveCommandEnvelope QueueLoadoutTemplateCommand(",
+ "private static AetheriaRuntimeEveCommandEnvelope QueueTypedCommand(",
+ "AetheriaRuntimeEveCommandLog.",
+ "AetheriaRuntimeEveCommandLog.Queue",
+ "AetheriaRuntimeEveCommandInbox",
+ "GetInboxDirectory(",
+ "Read" + "Submitted(",
+ ".eve.commands",
+ "ReadPending(",
+ ".eve.pending"
+ };
+ var forbiddenQueueSources = new Dictionary
+ {
+ ["Eve command client"] = eveCommandClient,
+ ["Eve command bridge"] = eveCommandBridge,
+ ["Aetheria state node"] = stateNode,
+ ["ActionGameManager"] = actionGameManager,
+ ["MainMenu"] = mainMenu,
+ ["Eve presenter"] = evePresenter
+ };
+ var survivingQueueSymbols = forbiddenQueueSources
+ .SelectMany(source => forbiddenQueueSymbols
+ .Where(symbol => source.Value.Contains(symbol, StringComparison.Ordinal))
+ .Select(symbol => $"{source.Key}: {symbol}"))
+ .ToArray();
+ if (survivingQueueSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Eve command edge still exposes queue-shaped public API: " +
+ string.Join(", ", survivingQueueSymbols));
+ }
+
+ var rendererLogSources = new Dictionary
+ {
+ ["ActionGameManager"] = actionGameManager,
+ ["MainMenu"] = mainMenu,
+ ["Eve presenter"] = evePresenter
+ };
+ var rendererLogHits = rendererLogSources
+ .Where(source => source.Value.Contains("AetheriaRuntimeEveCommandLog.", StringComparison.Ordinal))
+ .Select(source => $"{source.Key}: AetheriaRuntimeEveCommandLog.")
+ .ToArray();
+ if (rendererLogHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Renderer code still speaks to the Eve mailbox log instead of the typed command port: " +
+ string.Join(", ", rendererLogHits));
+ }
+
+ if (actionGameManager.Contains("TryQueueRuntimeEveCommand(", StringComparison.Ordinal) ||
+ actionGameManager.Contains("new EveSurfaceCommandRequest(", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "ActionGameManager still manufactures generic Eve surface command payloads instead of typed Eve command bodies.");
}
}
@@ -4532,13 +6783,15 @@ static void RequireMainMenuVerseHostProjection(string root)
var packageStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs");
var runtimeStateReaderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateReader.cs");
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
+ var mainMenuSurfaceBuilderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeMainMenuSurfaceBuilder.cs");
var requiredFiles = new[]
{
packageSnapshotPath,
packageStorePath,
runtimeStateReaderPath,
- mainMenuPath
+ mainMenuPath,
+ mainMenuSurfaceBuilderPath
};
var missingFiles = requiredFiles
@@ -4556,6 +6809,7 @@ static void RequireMainMenuVerseHostProjection(string root)
var packageStore = File.ReadAllText(packageStorePath);
var runtimeStateReader = File.ReadAllText(runtimeStateReaderPath);
var mainMenu = File.ReadAllText(mainMenuPath);
+ var mainMenuSurfaceBuilder = File.ReadAllText(mainMenuSurfaceBuilderPath);
var requiredSnapshotSymbols = new[]
{
@@ -4602,6 +6856,11 @@ static void RequireMainMenuVerseHostProjection(string root)
{
"LatestVerseHostSettings(AetheriaRuntimeStateBootReport stateBoot)",
"AetheriaRuntimeStateReader.ReadVerseHostSettings(stateBoot.StateFilePath)",
+ "ProjectMainMenuSurfaceState(",
+ "AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot("
+ };
+ var requiredBuilderSymbols = new[]
+ {
"\"Client Target\"",
"\"Transport\"",
"\"Target Source\"",
@@ -4619,6 +6878,15 @@ static void RequireMainMenuVerseHostProjection(string root)
"MainMenu no longer lowers daemon-owned Verse identity through its Eve shell: " +
string.Join(", ", missingMainMenuSymbols));
}
+ var missingBuilderSymbols = requiredBuilderSymbols
+ .Where(symbol => !mainMenuSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBuilderSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared main-menu surface builder no longer lowers daemon-owned Verse identity through its Eve shell: " +
+ string.Join(", ", missingBuilderSymbols));
+ }
}
static void RequireMainMenuContinueRunState(string root)
@@ -4662,11 +6930,12 @@ static void RequireMainMenuContinueRunState(string root)
var requiredMenuSymbols = new[]
{
- "LatestContinueRun",
+ "LatestDaemonFrame",
"AetheriaRuntimeStateReader",
- "ReadRunStates(stateBoot.StateFilePath)",
- "ContinueGame(continueRun)",
- "ActionGameManager.ContinueRunState = run",
+ "TryReadDaemonFrame(stateBoot.StateFilePath, out var frame)",
+ "frame.IsAuthoritative",
+ "ContinueGame()",
+ "ActionGameManager.ObservedGalaxy = Galaxy.ProjectObservedDaemonRun(",
"SceneManager.LoadScene(\"ARPG\")"
};
@@ -4677,16 +6946,10 @@ static void RequireMainMenuContinueRunState(string root)
if (missingMenuSymbols.Length > 0)
{
throw new InvalidOperationException(
- "MainMenu Continue no longer selects typed run state: " +
+ "MainMenu Continue no longer selects an authoritative daemon frame: " +
string.Join(", ", missingMenuSymbols));
}
- if (!runtimeStateReader.Contains("ReadRunStates", StringComparison.Ordinal))
- {
- throw new InvalidOperationException(
- "Shared runtime state reader no longer exposes typed run-state lookup for Continue.");
- }
-
if (mainMenu.Contains("AddButton(\"Continue\", null)", StringComparison.Ordinal))
{
throw new InvalidOperationException("MainMenu Continue regressed to a null button.");
@@ -4694,22 +6957,21 @@ static void RequireMainMenuContinueRunState(string root)
var requiredGameplaySymbols = new[]
{
- "AetheriaRuntimeRunStateSnapshot ContinueRunState",
- "ResolveStartZone(continuingRun)",
- "if (continuingRun != null)",
- "RestoreEntityGraphFromTypedRun(continuingRun)",
- "ReadEntitySnapshots(RuntimeStateFilePath)",
+ "ApplyLatestAuthoritativeDaemonFrame()",
+ "TryRestoreEntityGraphFromDaemonRun(observed.Run)",
+ "if (string.IsNullOrWhiteSpace(run.RunId))",
+ "Authoritative daemon frame does not identify a run id.",
+ "Authoritative daemon frame has no zone snapshot",
"entity.RecordKey",
"run.CurrentEntityKey",
- "ResolveCurrentEntityRecordKey(run)",
+ "CreateDaemonEntitySnapshots(runId, daemonZone)",
+ "CanApplyDaemonEntitySnapshotsInPlace",
+ "ApplyDaemonEntitySnapshotsInPlace",
"ReplaceZoneEntitiesFromTypedSnapshots",
- "Zone.Agents.Clear()",
- "FlattenEntityGraph(Zone)",
"RestoreChildAndDockingRelationships",
"RestoreCurrentEntityBinding",
"RestoreEntityContactsFromTypedSnapshot",
"entity.Target.Value = target",
- "string.Equals(entitySnapshot.RecordKey, currentEntityKey",
"RestoreCurrentEntityBinding(currentEntity, actionBarBindings)",
"RestoreActiveConsumablesFromTypedEntitySnapshot(entity, entitySnapshot)",
"RestoreRuntimeBehaviorStateFromTypedSnapshot(entity, entitySnapshot, restoredEntities)",
@@ -4720,8 +6982,7 @@ static void RequireMainMenuContinueRunState(string root)
"entity.RestoreStatGrids(entitySnapshot.StatGrids)",
"RestoreThermalExposure((float)entitySnapshot.Heatstroke, (float)entitySnapshot.Hypothermia)",
"entity.HeatsinksEnabled = entitySnapshot.HeatsinksEnabled",
- "ContinueRunState = null",
- "RestoreDroppedPickupsFromTypedZoneState"
+ "RestoreDroppedPickupsFromDaemonZoneState"
};
var missingGameplaySymbols = requiredGameplaySymbols
@@ -4731,7 +6992,7 @@ static void RequireMainMenuContinueRunState(string root)
if (missingGameplaySymbols.Length > 0)
{
throw new InvalidOperationException(
- "ActionGameManager no longer has the typed Continue boot path: " +
+ "ActionGameManager no longer has the daemon-frame Continue boot path: " +
string.Join(", ", missingGameplaySymbols));
}
@@ -4769,14 +7030,49 @@ static void RequireMainMenuContinueRunState(string root)
"Unity package runtime run snapshot still exposes integer current-entity slot authority.");
}
- var pendingCommitPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateCommitDocument.cs");
- var pendingCommit = File.Exists(pendingCommitPath)
- ? File.ReadAllText(pendingCommitPath)
- : throw new InvalidOperationException("Cannot verify pending commit authority; AetheriaRuntimeStateCommitDocument.cs is missing.");
- if (pendingCommit.Contains("CurrentZoneEntityIndex", StringComparison.Ordinal))
+ var snapshotDocumentPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeSnapshotDocuments.cs");
+ var snapshotDocument = File.Exists(snapshotDocumentPath)
+ ? File.ReadAllText(snapshotDocumentPath)
+ : throw new InvalidOperationException("Cannot verify daemon snapshot authority; AetheriaRuntimeSnapshotDocuments.cs is missing.");
+ if (snapshotDocument.Contains("CurrentZoneEntityIndex", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Pending runtime commit transport still exposes integer current-entity slot authority.");
+ "Daemon runtime snapshot transport still exposes integer current-entity slot authority.");
+ }
+
+ var forbiddenLegacyCommitSymbols = new[]
+ {
+ "public enum AetheriaRuntimeCommitKind",
+ "public sealed class AetheriaRuntimeCommitEnvelope",
+ "public sealed class AetheriaRuntimeStateCommitDocument",
+ "internal enum AetheriaRuntimeCommitKind",
+ "internal sealed class AetheriaRuntimeCommitEnvelope",
+ "internal sealed class AetheriaRuntimeStateCommitDocument"
+ };
+ var legacyCommitHits = forbiddenLegacyCommitSymbols
+ .Where(symbol => snapshotDocument.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (legacyCommitHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Legacy runtime commit envelope leaked back into the daemon snapshot contract: " +
+ string.Join(", ", legacyCommitHits));
+ }
+
+ var forbiddenLegacyFiles = new[]
+ {
+ Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateCommitDocument.cs"),
+ Path.Combine(root, "Aetheria.State", "AetheriaLegacyRuntimeSnapshotImporter.cs")
+ };
+ var existingLegacyFiles = forbiddenLegacyFiles
+ .Where(File.Exists)
+ .Select(path => Path.GetRelativePath(root, path))
+ .ToArray();
+ if (existingLegacyFiles.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Legacy runtime commit compatibility files must stay deleted: " +
+ string.Join(", ", existingLegacyFiles));
}
var requiredPackageSymbols = new[]
@@ -4822,6 +7118,688 @@ static void RequireMainMenuContinueRunState(string root)
}
}
+static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
+{
+ var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
+ var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
+ var galaxyPath = Path.Combine(root, "Assets", "Scripts", "ServerShared", "Galaxy.cs");
+ var daemonDocumentsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonDocuments.cs");
+ var daemonRuntimeOperationsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonOperations.cs");
+ var daemonIntentPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonIntentState.cs");
+ var daemonObserverPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaDaemonObserver.cs");
+ var daemonGameplayOperationsPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaDaemonOperations.cs");
+ var actionGameManager = File.Exists(actionGameManagerPath)
+ ? File.ReadAllText(actionGameManagerPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; ActionGameManager.cs is missing.");
+ var mainMenu = File.Exists(mainMenuPath)
+ ? File.ReadAllText(mainMenuPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; MainMenu.cs is missing.");
+ var galaxy = File.Exists(galaxyPath)
+ ? File.ReadAllText(galaxyPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; Galaxy.cs is missing.");
+ var daemonDocuments = File.Exists(daemonDocumentsPath)
+ ? File.ReadAllText(daemonDocumentsPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; daemon command documents are missing.");
+ var daemonOperationsSource = File.Exists(daemonRuntimeOperationsPath)
+ ? File.ReadAllText(daemonRuntimeOperationsPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; daemon operations is missing.");
+ var daemonIntent = File.Exists(daemonIntentPath)
+ ? File.ReadAllText(daemonIntentPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; daemon intent state is missing.");
+ var daemonObserver = File.Exists(daemonObserverPath)
+ ? File.ReadAllText(daemonObserverPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; AetheriaDaemonObserver.cs is missing.");
+ var daemonOperations = File.Exists(daemonGameplayOperationsPath)
+ ? File.ReadAllText(daemonGameplayOperationsPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; AetheriaDaemonOperations.cs is missing.");
+
+ var forbiddenGameplaySymbols = new[]
+ {
+ "CurrentGalaxy",
+ "Zone.Update(Time.deltaTime)",
+ "Zone.Update(",
+ "CurrentEntity.Update(",
+ ".Update(Time.deltaTime)",
+ "Death.Subscribe(Die)",
+ "private void Die(CauseOfDeath",
+ "ZoneGenerator.GenerateZone",
+ "TryDock(",
+ "TryUndock(",
+ "IntroCutscene(",
+ "IntroDuration",
+ "ship.CultPositionXZ =",
+ "ship.CultDirection =",
+ "ship.CultVelocity =",
+ "CurrentEntity.Zone.Entities.Remove(CurrentEntity)",
+ "CurrentEntity.Zone = Zone",
+ "Zone.Entities.Add(CurrentEntity)",
+ "CurrentEntity.CultPositionXZ = TowingStation.CultPositionXZ",
+ "PopulateLevel(TowingStation.Zone.GalaxyZone)",
+ "AetheriaRuntimeStateCommitLog.QueueRunCheckpoint",
+ "AetheriaRuntimeStateCommitLog.QueuePlayerSettings",
+ "AetheriaRuntimeStateCommitLog.QueueLoadoutTemplate"
+ };
+
+ var forbiddenGameplayHits = forbiddenGameplaySymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (forbiddenGameplayHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity gameplay still owns local simulation or legacy write fallback instead of daemon observation: " +
+ string.Join(", ", forbiddenGameplayHits));
+ }
+
+ if (daemonObserver.Contains("AetheriaRuntimeCommandSubmitter.TrySubmitDaemonCommand(", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Unity daemon observer still calls the generic command submitter instead of the typed daemon operation client.");
+ }
+
+ var requiredGameplaySymbols = new[]
+ {
+ "ApplyLatestAuthoritativeDaemonFrame()",
+ "ResolveDaemonObserver()",
+ "observed.IsAuthoritative",
+ "TryRestoreEntityGraphFromDaemonRun(observed.Run)",
+ "CreateDaemonZoneConstructionBlueprint(daemonZone)",
+ "CreateDaemonEntitySnapshots(runId, daemonZone)",
+ "ReplaceZoneEntitiesFromTypedSnapshots",
+ "EntityConstructionBlueprintProjector.ProjectObservedFromBlueprint",
+ "public static Galaxy ObservedGalaxy",
+ "TryRequestDaemonMoveVector",
+ "TryRequestDaemonLookDirection",
+ "TryRequestDaemonTractorPower",
+ "observer.Operations.SetMoveVector",
+ "observer.Operations.SetLookDirection",
+ "observer.Operations.SetTractorPower"
+ };
+
+ var missingGameplaySymbols = requiredGameplaySymbols
+ .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingGameplaySymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity gameplay no longer behaves as a daemon-frame observer and command lowerer: " +
+ string.Join(", ", missingGameplaySymbols));
+ }
+
+ var requiredDaemonControlValidationSymbols = new[]
+ {
+ "case AetheriaRuntimeDaemonCommandKinds.SetTractorPower:",
+ "!IsNormalizedScalar(command.ScalarValue)",
+ "private static bool IsNormalizedScalar(double value)",
+ "!IsFinite(command.DirectionX)",
+ "!IsFinite(command.DirectionY)"
+ };
+ var missingDaemonControlValidationSymbols = requiredDaemonControlValidationSymbols
+ .Where(symbol => !daemonOperationsSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDaemonControlValidationSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon continuous controls no longer validate normalized movement and tractor inputs: " +
+ string.Join(", ", missingDaemonControlValidationSymbols));
+ }
+
+ if (actionGameManager.Contains("EntityConstructionBlueprintProjector.InstantiateAuthoritativeFromBlueprint", StringComparison.Ordinal) ||
+ actionGameManager.Contains("EntityConstructionBlueprintProjector.InstantiateFromBlueprint", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Unity frame application must project observed daemon state, not instantiate authoritative gameplay entities.");
+ }
+
+ var permittedEntityProjectionMethods = new[]
+ {
+ "ReplaceZoneEntitiesFromTypedSnapshots",
+ "RestoreChildAndDockingRelationships"
+ };
+ var unauthorizedEntityProjectionHits = FindMethodScopedLineHits(
+ actionGameManager,
+ new[] { "Zone.Entities.Add(", "Zone.Entities.Remove(" })
+ .Where(hit => !permittedEntityProjectionMethods.Contains(hit.MethodName, StringComparer.Ordinal))
+ .Select(hit => $"{hit.MethodName}:{hit.LineNumber}: {hit.Line.Trim()}")
+ .ToArray();
+ if (unauthorizedEntityProjectionHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity gameplay may only add/remove zone entities while lowering observed daemon snapshots: " +
+ string.Join("; ", unauthorizedEntityProjectionHits));
+ }
+
+ var zonePath = Path.Combine(root, "Assets", "Scripts", "ServerShared", "Zone.cs");
+ var zoneSource = File.Exists(zonePath)
+ ? File.ReadAllText(zonePath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; Zone.cs is missing.");
+ var projectorPath = Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintProjector.cs");
+ var projectorSource = File.Exists(projectorPath)
+ ? File.ReadAllText(projectorPath)
+ : throw new InvalidOperationException("Cannot verify Unity observer authority; EntityConstructionBlueprintProjector.cs is missing.");
+
+ var requiredProjectionBoundarySymbols = new[]
+ {
+ "public static Galaxy ProjectObservedDaemonRun",
+ "private Galaxy(",
+ "AetheriaRuntimeRunCheckpointCommit run,",
+ "public static Entity InstantiateAuthoritativeFromBlueprint",
+ "public static Entity ProjectObservedFromBlueprint",
+ "private static Entity BuildFromBlueprint",
+ "EntityConstructionBlueprintProjector.InstantiateAuthoritativeFromBlueprint(_itemManager, this, entityBlueprint)"
+ };
+ var projectionBoundaryCorpus = projectorSource + "\n" + zoneSource + "\n" + galaxy;
+ var missingProjectionBoundarySymbols = requiredProjectionBoundarySymbols
+ .Where(symbol => !projectionBoundaryCorpus.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingProjectionBoundarySymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Entity projection no longer separates authoritative construction from observed daemon lowering: " +
+ string.Join(", ", missingProjectionBoundarySymbols));
+ }
+
+ if (galaxy.Contains("public Galaxy(\r\n AetheriaRuntimeRunCheckpointCommit run,", StringComparison.Ordinal) ||
+ galaxy.Contains("public Galaxy(\n AetheriaRuntimeRunCheckpointCommit run,", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Daemon-observed galaxy projection must be reached through ProjectObservedDaemonRun, not a public constructor.");
+ }
+
+ var forbiddenDaemonQueueLanguage = new[]
+ {
+ "observer.Queue",
+ "_lastQueuedDaemon",
+ "_hasQueuedDaemon",
+ "Failed to queue Aetheria daemon",
+ "Queued Aetheria daemon"
+ };
+ var forbiddenDaemonQueueHits = forbiddenDaemonQueueLanguage
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (forbiddenDaemonQueueHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity gameplay still uses queue-shaped daemon language instead of typed sent operations: " +
+ string.Join(", ", forbiddenDaemonQueueHits));
+ }
+
+ if (daemonObserver.Contains("public AetheriaRuntimeDaemonCommandEnvelope Queue", StringComparison.Ordinal) ||
+ daemonObserver.Contains("Queued Aetheria daemon command", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "AetheriaDaemonObserver still exposes queue-shaped public daemon APIs instead of typed Operations.");
+ }
+
+ var requiredDaemonNavigationAuthoritySymbols = new[]
+ {
+ "ApplyEnterWormholeIntent(run, command, context.Intents)",
+ "ApplyTowToStationIntent(run, command, context.Intents)",
+ "MoveEntityToZone(run, actor, command.TargetZoneIndex",
+ "run.CurrentZoneIndex = targetZoneIndex",
+ "run.CurrentEntityKey = movedEntityKey",
+ "run.DiscoveredZoneIndices = discovered.ToArray()"
+ };
+ var missingDaemonNavigationAuthoritySymbols = requiredDaemonNavigationAuthoritySymbols
+ .Where(symbol => !daemonOperationsSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDaemonNavigationAuthoritySymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon navigation commands no longer mutate canonical run state inside the daemon operation layer: " +
+ string.Join(", ", missingDaemonNavigationAuthoritySymbols));
+ }
+
+ var requiredSentOperationSymbols = new[]
+ {
+ "_lastSentDaemonMoveVector",
+ "_lastSentDaemonLookDirection",
+ "_lastSentDaemonTractorPower",
+ "_hasSentDaemonMoveVector",
+ "_hasSentDaemonLookDirection",
+ "_hasSentDaemonTractorPower",
+ "Failed to send Aetheria daemon movement operation",
+ "Failed to send Aetheria daemon look operation",
+ "Failed to send Aetheria daemon tractor-power operation"
+ };
+ var missingSentOperationSymbols = requiredSentOperationSymbols
+ .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingSentOperationSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity gameplay no longer describes daemon input as sent typed operations: " +
+ string.Join(", ", missingSentOperationSymbols));
+ }
+
+ var requiredDockingLoweringSymbols = new[]
+ {
+ "public void RequestDock()",
+ "public void RequestUndock()",
+ "public void RequestTowToStation()",
+ "TryRequestDaemonDock()",
+ "TryRequestDaemonUndock()",
+ "TryRequestDaemonTowToStation()",
+ "observer.Operations.Dock(targetKey)",
+ "observer.Operations.Undock()",
+ "observer.Operations.TowToStation(",
+ "TowingStation.CultPositionXZ.x",
+ "TowingStation.CultPositionXZ.y"
+ };
+
+ var missingDockingLoweringSymbols = requiredDockingLoweringSymbols
+ .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingDockingLoweringSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity docking/towing UI no longer lowers intent through daemon commands: " +
+ string.Join(", ", missingDockingLoweringSymbols));
+ }
+
+ var forbiddenUnityDockingAuthoritySymbols = new[]
+ {
+ "public void Dock()",
+ "public void Undock()",
+ "public void TowShip()",
+ "Missing cockpit component",
+ "Missing thruster component",
+ "Missing reactor component",
+ "Must empty docking bay"
+ };
+ var unityDockingAuthorityHits = forbiddenUnityDockingAuthoritySymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (unityDockingAuthorityHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity docking/towing still exposes imperative local authority instead of daemon-bound requests: " +
+ string.Join(", ", unityDockingAuthorityHits));
+ }
+
+ var undockLocalAuthorityHits = FindMethodScopedLineHits(
+ actionGameManager,
+ new[] { "CurrentEntity?.Parent == null" })
+ .Where(hit => hit.MethodName == "TryRequestDaemonUndock")
+ .Select(hit => $"ActionGameManager.cs:{hit.LineNumber}: {hit.Line.Trim()}")
+ .ToArray();
+ if (undockLocalAuthorityHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity undock request still rejects through renderer-local parent state instead of daemon acceptance: " +
+ string.Join("; ", undockLocalAuthorityHits));
+ }
+
+ var dockLocalAuthorityHits = FindMethodScopedLineHits(
+ actionGameManager,
+ new[] { "CurrentEntity?.Parent != null" })
+ .Where(hit => hit.MethodName == "TryRequestDaemonDock")
+ .Select(hit => $"ActionGameManager.cs:{hit.LineNumber}: {hit.Line.Trim()}")
+ .ToArray();
+ if (dockLocalAuthorityHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity dock request still rejects through renderer-local parent state instead of daemon acceptance: " +
+ string.Join("; ", dockLocalAuthorityHits));
+ }
+
+ var movementLocalAuthorityHits = FindMethodScopedLineHits(
+ actionGameManager,
+ new[] { "CurrentEntity?.Parent != null" })
+ .Where(hit => hit.MethodName == "TryRequestDaemonEnterWormhole" || hit.MethodName == "TryRequestDaemonTowToStation")
+ .Select(hit => $"ActionGameManager.cs:{hit.LineNumber}: {hit.Line.Trim()}")
+ .ToArray();
+ if (movementLocalAuthorityHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity movement requests still reject through renderer-local parent state instead of daemon acceptance: " +
+ string.Join("; ", movementLocalAuthorityHits));
+ }
+
+ var requiredShieldToggleSymbols = new[]
+ {
+ "TryRequestDaemonShieldToggle",
+ "observer.Operations.ToggleShieldEnabled()",
+ "AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled",
+ "ApplyToggleEquipmentBehaviorItem(run, command, \"Shield\""
+ };
+ var missingShieldToggleSymbols = requiredShieldToggleSymbols
+ .Where(symbol =>
+ !actionGameManager.Contains(symbol, StringComparison.Ordinal) &&
+ !daemonOperationsSource.Contains(symbol, StringComparison.Ordinal) &&
+ !daemonDocuments.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingShieldToggleSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shield input no longer lowers through a semantic daemon shield command: " +
+ string.Join(", ", missingShieldToggleSymbols));
+ }
+
+ var forbiddenUnityShieldAuthoritySymbols = new[]
+ {
+ "RequestShieldEnabled(",
+ "TryRequestDaemonShieldEnabled(",
+ "CurrentEntity.Shield.Item.Enabled",
+ "var shieldItem = CurrentEntity?.Shield?.Item",
+ "CurrentEntity.Equipment.IndexOf(shieldItem)"
+ };
+ var shieldAuthorityHits = forbiddenUnityShieldAuthoritySymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (shieldAuthorityHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity shield input still derives equipment authority from renderer-local shield components: " +
+ string.Join(", ", shieldAuthorityHits));
+ }
+
+ var requiredTargetAuthoritySymbols = new[]
+ {
+ "ApplySetTarget(run, command)",
+ "actor.Contacts ?? Array.Empty()",
+ "contact.TargetEntityIndex == targetIndex && contact.Visible"
+ };
+ var missingTargetAuthoritySymbols = requiredTargetAuthoritySymbols
+ .Where(symbol => !daemonOperationsSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingTargetAuthoritySymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon target selection no longer validates visibility through authoritative contact state: " +
+ string.Join(", ", missingTargetAuthoritySymbols));
+ }
+
+ var requiredIntentAuthoritySymbols = new[]
+ {
+ "!HasWeaponGroup(entity, command.WeaponGroup)",
+ "!HasEquipmentBehavior(entity, command.EquipmentIndex, command.BehaviorIndex)",
+ "private static bool HasWeaponGroup(AetheriaRuntimeEntitySnapshotCommit entity, int weaponGroup)",
+ "private static bool HasEquipmentBehavior("
+ };
+ var missingIntentAuthoritySymbols = requiredIntentAuthoritySymbols
+ .Where(symbol => !daemonOperationsSource.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingIntentAuthoritySymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon simulation intents no longer validate weapon-group and behavior indices against authoritative entity state: " +
+ string.Join(", ", missingIntentAuthoritySymbols));
+ }
+
+ var forbiddenUnityInputApplySymbols = new[]
+ {
+ "ApplyEnterWormhole(",
+ "ApplyLookDirection(",
+ "ApplyTractorPower(",
+ "ApplyTargetSelection(",
+ "ApplyOverrideShutdown(",
+ "ApplySensorPing(",
+ "ApplyHeatsinksEnabled(",
+ "ApplyShieldEnabled(",
+ "ApplyDock(",
+ "ApplyUndock("
+ };
+ var unityInputApplyHits = forbiddenUnityInputApplySymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (unityInputApplyHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity input still exposes Apply vocabulary for daemon-bound requests: " +
+ string.Join(", ", unityInputApplyHits));
+ }
+
+ var requiredTowDaemonSymbols = new[]
+ {
+ "TowToStation",
+ "AetheriaRuntimeDaemonCommandKinds.TowToStation",
+ "ApplyTowToStationIntent",
+ "MoveEntityToZone(run, actor, command.TargetZoneIndex, command.PositionX, command.PositionY, out var movedEntityKey)",
+ "intents.Towing.Add",
+ "AetheriaRuntimeDaemonTowIntent",
+ "public AetheriaRuntimeDaemonCommandEnvelope TowToStation("
+ };
+
+ var missingTowDaemonSymbols = requiredTowDaemonSymbols
+ .Where(symbol =>
+ !daemonDocuments.Contains(symbol, StringComparison.Ordinal) &&
+ !daemonOperationsSource.Contains(symbol, StringComparison.Ordinal) &&
+ !daemonIntent.Contains(symbol, StringComparison.Ordinal) &&
+ !daemonObserver.Contains(symbol, StringComparison.Ordinal) &&
+ !daemonOperations.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingTowDaemonSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Towing is not fully owned by daemon command state: " +
+ string.Join(", ", missingTowDaemonSymbols));
+ }
+
+ var forbiddenMenuSymbols = new[]
+ {
+ "new Galaxy(Settings",
+ "new Galaxy(settings",
+ "new Galaxy(",
+ "SectorGenerationSettings",
+ "RunGenerator",
+ "ZoneGenerator.GenerateZone"
+ };
+
+ var forbiddenMenuHits = forbiddenMenuSymbols
+ .Where(symbol => mainMenu.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (forbiddenMenuHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "MainMenu still has local run generation fallback on the gameplay boot path: " +
+ string.Join(", ", forbiddenMenuHits));
+ }
+
+ var requiredMenuSymbols = new[]
+ {
+ "TryStartDaemonObservedGame",
+ "TryReadDaemonFrame(stateBoot.StateFilePath, out var frame)",
+ "frame.IsAuthoritative",
+ "ActionGameManager.ObservedGalaxy = Galaxy.ProjectObservedDaemonRun(",
+ "frame.Run",
+ "SceneManager.LoadScene(\"ARPG\")"
+ };
+
+ var missingMenuSymbols = requiredMenuSymbols
+ .Where(symbol => !mainMenu.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingMenuSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "MainMenu no longer boots gameplay strictly from an authoritative daemon frame: " +
+ string.Join(", ", missingMenuSymbols));
+ }
+}
+
+static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
+{
+ var checkedRoots = new[]
+ {
+ Path.Combine(root, "Assets", "Scripts", "Gameplay"),
+ Path.Combine(root, "Assets", "Scripts", "UI")
+ };
+
+ var forbiddenCallerSymbols = new[]
+ {
+ "Zone.Update(",
+ ".Zone.Update(",
+ "CurrentEntity.Update(",
+ ".CurrentEntity.Update(",
+ "entity.Update(delta",
+ "entity.Update(Time.deltaTime",
+ "ship.Update(delta",
+ "ship.Update(Time.deltaTime",
+ "agent.Update(delta",
+ "agent.Update(Time.deltaTime",
+ "equippedItem.Update(delta",
+ "equippedItem.Update(Time.deltaTime",
+ "alwaysUpdatedBehavior.Update(delta",
+ "alwaysUpdatedBehavior.Update(Time.deltaTime"
+ };
+
+ var hits = checkedRoots
+ .Where(Directory.Exists)
+ .SelectMany(path => Directory.EnumerateFiles(path, "*.cs", SearchOption.AllDirectories))
+ .SelectMany(path => File.ReadLines(path)
+ .Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
+ .Where(line => forbiddenCallerSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
+ .Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}")
+ .ToArray();
+
+ if (hits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity gameplay/UI still calls shared simulation tick methods instead of observing daemon frames: " +
+ string.Join("; ", hits));
+ }
+
+ var daemonTickRunnerPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeDaemonTickRunner.cs");
+ var daemonTickRunner = File.Exists(daemonTickRunnerPath)
+ ? File.ReadAllText(daemonTickRunnerPath)
+ : throw new InvalidOperationException("Cannot verify shared simulation authority; daemon tick runner is missing.");
+
+ var requiredDaemonTickSymbols = new[]
+ {
+ "AetheriaRuntimeDaemonTickRunner",
+ "Tick(",
+ "AetheriaRuntimeDaemonFrameDocument.Create",
+ "AetheriaRuntimeDaemonFrameStore.PublishFrame",
+ "AetheriaRuntimeDaemonOperations.Execute("
+ };
+
+ var missingDaemonTickSymbols = requiredDaemonTickSymbols
+ .Where(symbol => !daemonTickRunner.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+
+ if (missingDaemonTickSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared simulation ticks no longer have a daemon-owned frame publication path: " +
+ string.Join(", ", missingDaemonTickSymbols));
+ }
+}
+
+static void RequireUnityPhysicsIsNotGameplayAuthority(string root)
+{
+ var checkedRoots = new[]
+ {
+ Path.Combine(root, "Assets", "Scripts", "Gameplay"),
+ Path.Combine(root, "Assets", "Scripts", "ServerShared")
+ };
+
+ var forbiddenSymbols = new[]
+ {
+ "OnTriggerEnter",
+ "OnTriggerStay",
+ "OnTriggerExit",
+ "OnCollisionEnter",
+ "OnCollisionStay",
+ "OnCollisionExit",
+ "OnControllerColliderHit",
+ "Physics.Raycast",
+ "Physics.SphereCast",
+ "Physics.BoxCast",
+ "Physics.CapsuleCast",
+ "Physics.OverlapSphere",
+ "Physics.OverlapBox",
+ "Physics.OverlapCapsule",
+ "Physics.CheckSphere",
+ "Physics.CheckBox",
+ "Physics.CheckCapsule",
+ "Rigidbody",
+ "Rigidbody2D",
+ "Collider2D"
+ };
+
+ var hits = checkedRoots
+ .Where(Directory.Exists)
+ .SelectMany(path => Directory.EnumerateFiles(path, "*.cs", SearchOption.AllDirectories))
+ .SelectMany(path => File.ReadLines(path)
+ .Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
+ .Where(line => forbiddenSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
+ .Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}")
+ .ToArray();
+
+ if (hits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity physics/collision callbacks are forbidden as gameplay authority; route queries through Ymir: " +
+ string.Join("; ", hits));
+ }
+
+ var ymirBridgePath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "Physics", "AetheriaYmirPhysicsBridge.cs");
+ var projectilePath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "Weapons", "Projectile.cs");
+ var guidedProjectilePath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "Weapons", "GuidedProjectile.cs");
+ var hitscanPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "Weapons", "HitscanEffect.cs");
+ var clickRaycasterPath = Path.Combine(root, "Assets", "Scripts", "UI", "ClickRaycaster.cs");
+
+ var requiredSymbols = new Dictionary
+ {
+ [ymirBridgePath] = new[]
+ {
+ "public string ServiceUrl",
+ "public string OverlapSphereUrl",
+ "public string OverlapCircleUrl",
+ "public string CastCircleUrl",
+ "public string CastSphereUrl",
+ "TryStepProjectile(",
+ "TryCastZoneHulls(",
+ "TryBuildDaemonWorld("
+ },
+ [projectilePath] = new[]
+ {
+ "AetheriaYmirPhysicsBridge.Instance.TryStepProjectile",
+ "projectile killed instead of falling back to Unity physics."
+ },
+ [guidedProjectilePath] = new[]
+ {
+ "AetheriaYmirPhysicsBridge.Instance.TryCastZoneHulls"
+ },
+ [hitscanPath] = new[]
+ {
+ "AetheriaYmirPhysicsBridge.Instance.TryCastZoneHulls"
+ },
+ [clickRaycasterPath] = new[]
+ {
+ "AetheriaYmirPhysicsBridge.Instance.TryCastClickables"
+ }
+ };
+
+ var missingSymbols = requiredSymbols
+ .Where(pair => !File.Exists(pair.Key) || pair.Value.Any(symbol => !File.ReadAllText(pair.Key).Contains(symbol, StringComparison.Ordinal)))
+ .SelectMany(pair =>
+ {
+ var text = File.Exists(pair.Key) ? File.ReadAllText(pair.Key) : "";
+ return pair.Value
+ .Where(symbol => !text.Contains(symbol, StringComparison.Ordinal))
+ .Select(symbol => $"{Path.GetRelativePath(root, pair.Key)}: missing {symbol}");
+ })
+ .ToArray();
+
+ if (missingSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Ymir gameplay query bridge is incomplete: " +
+ string.Join("; ", missingSymbols));
+ }
+}
+
static void RequireDeadPropertiesPanelShellDeleted(string root)
{
var deletedShellPaths = new[]
@@ -5012,7 +7990,8 @@ static void RequireNameToolsUsesUiToolkit(string root)
static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
{
var runtimeStateReaderPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateReader.cs");
- var unityFacadeProjectPath = Path.Combine(root, "Aetheria.State.Unity", "Aetheria.State.Unity.csproj");
+ var runtimeEveSurfaceAdapterPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeEveSurfaceAdapter.cs");
+ var unityPackageProjectPath = Path.Combine(root, "GameCult.Aetheria.State.Unity.csproj");
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs");
var eveSurfacePresenterPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.eve-runtime", "Runtime", "AetheriaEveSurfacePresenter.cs");
@@ -5020,7 +7999,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
var requiredPaths = new[]
{
runtimeStateReaderPath,
- unityFacadeProjectPath,
+ runtimeEveSurfaceAdapterPath,
+ unityPackageProjectPath,
actionGameManagerPath,
mainMenuPath,
eveSurfacePresenterPath
@@ -5039,7 +8019,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
}
var runtimeStateReader = File.ReadAllText(runtimeStateReaderPath);
- var unityFacadeProject = File.ReadAllText(unityFacadeProjectPath);
+ var runtimeEveSurfaceAdapter = File.ReadAllText(runtimeEveSurfaceAdapterPath);
+ var unityPackageProject = File.ReadAllText(unityPackageProjectPath);
var actionGameManager = File.ReadAllText(actionGameManagerPath);
var mainMenu = File.ReadAllText(mainMenuPath);
var eveSurfacePresenter = File.ReadAllText(eveSurfacePresenterPath);
@@ -5054,7 +8035,21 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
"ReadRunStates",
"ReadZoneStates",
"ReadEntitySnapshots",
- "ReadEveSurface"
+ "ReadEveSurface",
+ "TryReadDaemonGameSurface",
+ "TryReadDaemonGameTuiSurface",
+ "TryReadDaemonEditorSurface",
+ "TryReadDaemonEditorTuiSurface",
+ "AetheriaRuntimeDaemonPublicationStore.TryReadGameSurface",
+ "AetheriaRuntimeDaemonPublicationStore.TryReadGameTuiSurface",
+ "AetheriaRuntimeDaemonPublicationStore.TryReadEditorSurface",
+ "AetheriaRuntimeDaemonPublicationStore.TryReadEditorTuiSurface",
+ "AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId",
+ "AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId",
+ "AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId",
+ "AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId",
+ "AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument(surface)",
+ "AetheriaRuntimeEveSurfaceAdapter.EmptySurface(surfaceId)"
};
var missingReaderSymbols = requiredReaderSymbols
@@ -5068,19 +8063,48 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
string.Join(", ", missingReaderSymbols));
}
- if (!unityFacadeProject.Contains("AetheriaRuntimeStateReader.cs", StringComparison.Ordinal))
+ if (!unityPackageProject.Contains("AetheriaRuntimeStateReader.cs", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Aetheria.State.Unity.csproj does not include the shared runtime state reader.");
+ "GameCult.Aetheria.State.Unity.csproj does not include the shared runtime state reader.");
}
+ var requiredAdapterSymbols = new[]
+ {
+ "public static class AetheriaRuntimeEveSurfaceAdapter",
+ "public static EveSurfaceDocument ToEveSurfaceDocument(AetheriaRuntimeSurfaceDocument document)",
+ "public static EveSurfaceDocument EmptySurface(string surfaceId)",
+ "new EveSurfaceDocument(",
+ "new EveSurfaceComponent("
+ };
+ var missingAdapterSymbols = requiredAdapterSymbols
+ .Where(symbol => !runtimeEveSurfaceAdapter.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingAdapterSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Shared runtime Eve surface adapter is incomplete: " +
+ string.Join(", ", missingAdapterSymbols));
+ }
+
+ if (!unityPackageProject.Contains("AetheriaRuntimeEveSurfaceAdapter.cs", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "GameCult.Aetheria.State.Unity.csproj does not include the shared runtime Eve surface adapter.");
+ }
+
+ var daemonObserverPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaDaemonObserver.cs");
+ var daemonObserver = File.Exists(daemonObserverPath)
+ ? File.ReadAllText(daemonObserverPath)
+ : throw new InvalidOperationException("Cannot verify daemon state acquisition; AetheriaDaemonObserver.cs is missing.");
+
var requiredActionGameManagerSymbols = new[]
{
"AetheriaRuntimeStateReader.ReadPlayerSettings",
"AetheriaRuntimeStateReader.ReadLoadoutTemplates",
"AetheriaRuntimeStateReader.OpenRuntimeCatalog",
- "AetheriaRuntimeStateReader.ReadZoneStates",
- "AetheriaRuntimeStateReader.ReadEntitySnapshots"
+ "ResolveDaemonObserver()",
+ "LastObservedState"
};
var missingActionGameManagerSymbols = requiredActionGameManagerSymbols
@@ -5094,11 +8118,17 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
string.Join(", ", missingActionGameManagerSymbols));
}
- if (!mainMenu.Contains("AetheriaRuntimeStateReader", StringComparison.Ordinal) ||
- !mainMenu.Contains("ReadRunStates(stateBoot.StateFilePath)", StringComparison.Ordinal))
+ if (!daemonObserver.Contains("AetheriaRuntimeStateReader.TryReadObservedDaemonState", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "MainMenu no longer routes Continue-run lookup through the shared runtime state reader.");
+ "AetheriaDaemonObserver no longer routes observed daemon state through the shared runtime state reader.");
+ }
+
+ if (!mainMenu.Contains("AetheriaRuntimeStateReader", StringComparison.Ordinal) ||
+ !mainMenu.Contains("TryReadDaemonFrame(stateBoot.StateFilePath, out var frame)", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "MainMenu no longer routes daemon-frame lookup through the shared runtime state reader.");
}
if (!eveSurfacePresenter.Contains("AetheriaRuntimeStateReader.ReadEveSurface", StringComparison.Ordinal))
@@ -5144,31 +8174,57 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
"Unity gameplay/UI still reads typed state directly from the raw store instead of the shared runtime state reader: " +
string.Join("; ", directStoreHits));
}
+
+ var unitySurfaceLowererFiles = Directory
+ .EnumerateFiles(Path.Combine(root, "Assets", "Scripts", "UI"), "*.cs", SearchOption.AllDirectories)
+ .ToArray();
+ var forbiddenLocalSurfaceAdapterSymbols = new[]
+ {
+ "private static EveSurfaceDocument ToEveSurfaceDocument(AetheriaRuntimeSurfaceDocument document)",
+ "private static EveSurfaceComponent ToEveSurfaceComponent(AetheriaRuntimeSurfaceComponent component)",
+ "new EveSurfaceDocument(\r\n \"surface-state\"",
+ "new EveCommandTemplate(command.Command, command.Label, command.Transport)"
+ };
+ var localSurfaceAdapterHits = unitySurfaceLowererFiles
+ .SelectMany(path =>
+ {
+ var source = File.ReadAllText(path);
+ return forbiddenLocalSurfaceAdapterSymbols
+ .Where(symbol => source.Contains(symbol, StringComparison.Ordinal))
+ .Select(symbol => $"{Path.GetRelativePath(root, path)} -> {symbol}");
+ })
+ .ToArray();
+ if (localSurfaceAdapterHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity UI lowerers still duplicate runtime-to-Eve surface conversion instead of using the shared adapter: " +
+ string.Join("; ", localSurfaceAdapterHits));
+ }
}
-static void RequireRuntimeSimulationTuningCommits(string root)
+static void RequireRuntimeSimulationTuningRequests(string root)
{
var requiredActionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(requiredActionGameManagerPath)
? File.ReadAllText(requiredActionGameManagerPath)
: throw new InvalidOperationException("Cannot verify runtime simulation tuning authority; ActionGameManager.cs is missing.");
- var requiredCommitMethods = new[]
+ var requiredRequestMethods = new[]
{
- "CommitEntityOverrideShutdown",
- "CommitEquippedItemOverrideShutdown",
- "CommitThermotoggleTargetTemperature",
- "CommitEntityShutdownPerformance"
+ "RequestEntityOverrideShutdown",
+ "RequestEquippedItemOverrideShutdown",
+ "RequestThermotoggleTargetTemperature",
+ "RequestEntityShutdownPerformance"
};
- var missingMethods = requiredCommitMethods
+ var missingMethods = requiredRequestMethods
.Where(method => !actionGameManager.Contains(method, StringComparison.Ordinal))
.ToArray();
if (missingMethods.Length > 0)
{
throw new InvalidOperationException(
- "Runtime simulation tuning commit methods are missing from ActionGameManager: " +
+ "Runtime simulation tuning request methods are missing from ActionGameManager: " +
string.Join(", ", missingMethods));
}
@@ -5195,20 +8251,40 @@ static void RequireRuntimeSimulationTuningCommits(string root)
"Runtime simulation tuning still has renderer-local UI write authority: " +
string.Join("; ", hits));
}
+
+ var daemonOperationsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonOperations.cs");
+ var daemonOperations = File.Exists(daemonOperationsPath)
+ ? File.ReadAllText(daemonOperationsPath)
+ : throw new InvalidOperationException("Cannot verify runtime simulation tuning authority; AetheriaRuntimeDaemonOperations.cs is missing.");
+ var requiredDaemonValidationSymbols = new[]
+ {
+ "case AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance:",
+ "command.ScalarValue < 0.0 || command.ScalarValue > 1.0"
+ };
+ var missingDaemonValidationSymbols = requiredDaemonValidationSymbols
+ .Where(symbol => !daemonOperations.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingDaemonValidationSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Daemon runtime tuning no longer validates shutdown-performance range: " +
+ string.Join(", ", missingDaemonValidationSymbols));
+ }
}
-static void RequireHullConductivityCommitAuthority(string root)
+static void RequireHullConductivityRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify hull conductivity authority; ActionGameManager.cs is missing.");
- if (!actionGameManager.Contains("CommitHullConductivityToggle", StringComparison.Ordinal) ||
- !actionGameManager.Contains("QueueRunCheckpoint(\"hull-conductivity-toggle\")", StringComparison.Ordinal))
+ if (!actionGameManager.Contains("RequestHullConductivityToggle", StringComparison.Ordinal) ||
+ !actionGameManager.Contains("TryRequestDaemonHullConductivityToggle", StringComparison.Ordinal) ||
+ !actionGameManager.Contains("Operations.ToggleHullConductivity", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Hull conductivity no longer has a gameplay-owned checkpoint commit primitive.");
+ "Hull conductivity no longer has a typed daemon request primitive.");
}
var uiRoot = Path.Combine(root, "Assets", "Scripts", "UI");
@@ -5231,18 +8307,19 @@ static void RequireHullConductivityCommitAuthority(string root)
}
}
-static void RequireInventoryEntityRenameCommitAuthority(string root)
+static void RequireInventoryEntityRenameRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify inventory entity rename authority; ActionGameManager.cs is missing.");
- if (!actionGameManager.Contains("CommitEntityName", StringComparison.Ordinal) ||
- !actionGameManager.Contains("QueueRunCheckpoint(\"entity-name\")", StringComparison.Ordinal))
+ if (!actionGameManager.Contains("RequestEntityName", StringComparison.Ordinal) ||
+ !actionGameManager.Contains("TryRequestDaemonEntityName", StringComparison.Ordinal) ||
+ !actionGameManager.Contains("Operations.SetEntityName", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Entity rename no longer has a gameplay-owned checkpoint commit primitive.");
+ "Entity rename no longer has a typed daemon request primitive.");
}
var inventoryPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryPanel.cs");
@@ -5253,27 +8330,28 @@ static void RequireInventoryEntityRenameCommitAuthority(string root)
if (inventoryPanel.Contains("_displayedEntity.Name =", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "InventoryPanel still renames entities directly instead of using the gameplay checkpoint commit primitive.");
+ "InventoryPanel still renames entities directly instead of using the typed daemon request primitive.");
}
- if (!inventoryPanel.Contains("GameManager.CommitEntityName", StringComparison.Ordinal))
+ if (!inventoryPanel.Contains("GameManager.RequestEntityName", StringComparison.Ordinal))
{
throw new InvalidOperationException("InventoryPanel no longer routes entity rename through ActionGameManager.");
}
}
-static void RequireWeaponGroupCommitAuthority(string root)
+static void RequireWeaponGroupRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify weapon group authority; ActionGameManager.cs is missing.");
- if (!actionGameManager.Contains("CommitWeaponGroupMembership", StringComparison.Ordinal) ||
- !actionGameManager.Contains("QueueRunCheckpoint(\"weapon-group-membership\")", StringComparison.Ordinal))
+ if (!actionGameManager.Contains("RequestWeaponGroupMembership", StringComparison.Ordinal) ||
+ !actionGameManager.Contains("TryRequestDaemonWeaponGroupMembership", StringComparison.Ordinal) ||
+ !actionGameManager.Contains("Operations.SetWeaponGroupMembership", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Weapon group membership no longer has a gameplay-owned checkpoint commit primitive.");
+ "Weapon group membership no longer has a typed daemon request primitive.");
}
if (actionGameManager.Contains("WeaponGroupDragObject", StringComparison.Ordinal))
@@ -5282,6 +8360,22 @@ static void RequireWeaponGroupCommitAuthority(string root)
"Weapon-group action-bar binding still keeps the dead drag-object path alive instead of routing through live gameplay APIs.");
}
+ var forbiddenLocalAcceptanceSymbols = new[]
+ {
+ "item?.Entity?.WeaponGroups == null",
+ "groupIndex >= item.Entity.WeaponGroups.Length",
+ "item.GetBehavior()"
+ };
+ var localAcceptanceHits = forbiddenLocalAcceptanceSymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (localAcceptanceHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity weapon-group membership still rejects through renderer-local weapon/group checks instead of daemon acceptance: " +
+ string.Join(", ", localAcceptanceHits));
+ }
+
var assignmentPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "WeaponGroupAssignment.cs");
var elementPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "WeaponGroupElement.cs");
var weaponGroupsPrefabPath = Path.Combine(root, "Assets", "Prefabs", "UI", "Properties Panel", "Fancy", "Weapon Groups.prefab");
@@ -5305,7 +8399,7 @@ static void RequireWeaponGroupCommitAuthority(string root)
}
}
-static void RequireActionBarBindingCommitAuthority(string root)
+static void RequireActionBarBindingRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
@@ -5314,11 +8408,12 @@ static void RequireActionBarBindingCommitAuthority(string root)
var requiredSymbols = new[]
{
- "CommitActionBarBinding(",
- "QueueRunCheckpoint(\"action-bar-binding\")",
+ "RequestActionBarBinding(",
+ "TryRequestDaemonActionBarBinding(",
+ "TryRequestDaemonActionBarBindingClear(",
"RestoreActionBarBindingsFromTypedRun(",
"ApplyActionBarBindings(",
- "CommitActionBarBinding(slot, dragAction)"
+ "RequestActionBarBinding(slot, dragAction)"
};
var missingSymbols = requiredSymbols
@@ -5328,14 +8423,15 @@ static void RequireActionBarBindingCommitAuthority(string root)
if (missingSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Action-bar binding no longer has a gameplay-owned checkpoint/restore path: " +
+ "Action-bar binding no longer has a typed daemon request and observed restore path: " +
string.Join(", ", missingSymbols));
}
var forbiddenSymbols = new[]
{
"var newbinds = Enumerable.Range(0, 64)",
- ".Zip(\r\n bindings,"
+ ".Zip(\r\n bindings,",
+ "groupIndex >= CurrentEntity.WeaponGroups.Length"
};
var legacyHits = forbiddenSymbols
@@ -5350,34 +8446,53 @@ static void RequireActionBarBindingCommitAuthority(string root)
}
}
-static void RequireInventoryDoubleClickTransferCommitAuthority(string root)
+static void RequireInventoryDoubleClickTransferRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify inventory transfer authority; ActionGameManager.cs is missing.");
- var requiredCommits = new[]
+ var requiredRequests = new[]
{
- "CommitCargoItemTransfer",
- "CommitCargoItemEquip",
- "CommitEquippedItemStore",
- "CommitEquippedItemEquip",
- "QueueRunCheckpoint(\"cargo-item-transfer\")",
- "QueueRunCheckpoint(\"cargo-item-equip\")",
- "QueueRunCheckpoint(\"equipped-item-store\")",
- "QueueRunCheckpoint(\"equipped-item-equip\")"
+ "RequestCargoItemTransfer",
+ "RequestCargoItemEquip",
+ "RequestEquippedItemStore",
+ "RequestEquippedItemEquip",
+ "TryRequestDaemonCargoItemTransfer",
+ "TryRequestDaemonCargoItemEquip",
+ "TryRequestDaemonEquippedItemStore",
+ "TryRequestDaemonEquippedItemEquip"
};
- var missingCommits = requiredCommits
+ var missingRequests = requiredRequests
.Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
.ToArray();
- if (missingCommits.Length > 0)
+ if (missingRequests.Length > 0)
{
throw new InvalidOperationException(
- "Inventory transfer no longer has complete gameplay-owned checkpoint commit primitives: " +
- string.Join(", ", missingCommits));
+ "Inventory transfer no longer has complete typed daemon request primitives: " +
+ string.Join(", ", missingRequests));
+ }
+
+ var forbiddenUnityInventoryAcceptanceSymbols = new[]
+ {
+ "TryFindSpace(",
+ "ItemFits(",
+ "Cargo.ContainsKey(",
+ "Equipment.Contains(",
+ "origin == destination",
+ "ReferenceEquals(equippedItem.Entity, origin)"
+ };
+ var unityInventoryAcceptanceHits = forbiddenUnityInventoryAcceptanceSymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (unityInventoryAcceptanceHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity inventory request code still rejects requests through renderer-local capacity or membership checks: " +
+ string.Join(", ", unityInventoryAcceptanceHits));
}
var inventoryPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryPanel.cs");
@@ -5414,12 +8529,29 @@ static void RequireInventoryDoubleClickTransferCommitAuthority(string root)
string.Join("; ", hits));
}
+ var forbiddenInventoryUiAcceptanceSymbols = new[]
+ {
+ ".ItemFits(",
+ ".TryFindSpace("
+ };
+ var inventoryUiAcceptanceHits = File.ReadLines(inventoryPanelPath)
+ .Select((line, index) => new { LineNumber = index + 1, Line = line })
+ .Where(line => forbiddenInventoryUiAcceptanceSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
+ .Select(line => $"{Path.GetRelativePath(root, inventoryPanelPath)}:{line.LineNumber}: {line.Line.Trim()}")
+ .ToArray();
+ if (inventoryUiAcceptanceHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "InventoryPanel still rejects transfer placement through renderer-local fit checks instead of daemon authority: " +
+ string.Join("; ", inventoryUiAcceptanceHits));
+ }
+
var requiredUiCalls = new[]
{
- "GameManager.CommitCargoItemTransfer",
- "GameManager.CommitCargoItemEquip",
- "GameManager.CommitEquippedItemStore",
- "GameManager.CommitEquippedItemEquip"
+ "GameManager.RequestCargoItemTransfer",
+ "GameManager.RequestCargoItemEquip",
+ "GameManager.RequestEquippedItemStore",
+ "GameManager.RequestEquippedItemEquip"
};
var missingUiCalls = requiredUiCalls
@@ -5436,30 +8568,45 @@ static void RequireInventoryDoubleClickTransferCommitAuthority(string root)
}
}
-static void RequireTradePurchaseCommitAuthority(string root)
+static void RequireTradePurchaseRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify trade purchase authority; ActionGameManager.cs is missing.");
- var requiredCommits = new[]
+ var requiredRequests = new[]
{
- "CommitTradePurchase",
- "QueueRunCheckpoint(\"trade-purchase\")",
- "Credits -=",
- "new Ship("
+ "RequestTradePurchase",
+ "TryRequestDaemonTradePurchase",
+ "Operations.TradePurchase"
};
- var missingCommits = requiredCommits
+ var missingRequests = requiredRequests
.Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
.ToArray();
- if (missingCommits.Length > 0)
+ if (missingRequests.Length > 0)
{
throw new InvalidOperationException(
- "Trade purchase no longer has a gameplay-owned checkpoint commit primitive: " +
- string.Join(", ", missingCommits));
+ "Trade purchase no longer has a typed daemon request primitive: " +
+ string.Join(", ", missingRequests));
+ }
+
+ var forbiddenUnityTradeAcceptanceSymbols = new[]
+ {
+ "price > Credits",
+ "totalPrice > Credits",
+ "targetCargo.TryFindSpace("
+ };
+ var unityTradeAcceptanceHits = forbiddenUnityTradeAcceptanceSymbols
+ .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (unityTradeAcceptanceHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Unity trade/loadout request code still rejects requests through renderer-local credits or cargo-capacity checks: " +
+ string.Join(", ", unityTradeAcceptanceHits));
}
var tradeMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "TradeMenu.cs");
@@ -5488,35 +8635,46 @@ static void RequireTradePurchaseCommitAuthority(string root)
string.Join("; ", hits));
}
- if (!tradeMenu.Contains("GameManager.CommitTradePurchase", StringComparison.Ordinal))
+ var forbiddenLocalAcceptanceSymbols = new[]
+ {
+ "price > GameManager.Credits",
+ "totalPrice > GameManager.Credits",
+ "GameManager.Credits / price",
+ "\"Insufficient Credits!\"",
+ "\"Insufficient Cargo Space!\"",
+ "\"Unable to create ship!\""
+ };
+
+ var localAcceptanceHits = File.ReadLines(tradeMenuPath)
+ .Select((line, index) => new { LineNumber = index + 1, Line = line })
+ .Where(line => forbiddenLocalAcceptanceSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
+ .Select(line => $"{Path.GetRelativePath(root, tradeMenuPath)}:{line.LineNumber}: {line.Line.Trim()}")
+ .ToArray();
+
+ if (localAcceptanceHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "TradeMenu still rejects purchases through renderer-local acceptance checks instead of daemon authority: " +
+ string.Join("; ", localAcceptanceHits));
+ }
+
+ if (!tradeMenu.Contains("GameManager.RequestTradePurchase", StringComparison.Ordinal))
{
throw new InvalidOperationException("TradeMenu no longer routes purchases through ActionGameManager.");
}
}
-static void RequireLootPickupCommitAuthority(string root)
+static void RequireLootPickupRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify loot pickup authority; ActionGameManager.cs is missing.");
- var requiredSymbols = new[]
- {
- "CommitLootPickup",
- "QueueRunCheckpoint(\"loot-pickup\")",
- ".TryStore(item)"
- };
-
- var missingSymbols = requiredSymbols
- .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
- .ToArray();
-
- if (missingSymbols.Length > 0)
+ if (actionGameManager.Contains("CommitLootPickup", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Loot pickup no longer has a gameplay-owned checkpoint commit primitive: " +
- string.Join(", ", missingSymbols));
+ "Loot pickup should not have a Unity-owned gameplay mutation primitive; daemon snapshots own pickup state.");
}
var shieldManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ShieldManager.cs");
@@ -5543,36 +8701,21 @@ static void RequireLootPickupCommitAuthority(string root)
string.Join("; ", hits));
}
- if (!shieldManager.Contains("ActionGameManager.Instance.CommitLootPickup", StringComparison.Ordinal))
- {
- throw new InvalidOperationException("ShieldManager no longer routes loot pickup through ActionGameManager.");
- }
+ if (shieldManager.Contains("ActionGameManager.Instance.CommitLootPickup", StringComparison.Ordinal))
+ throw new InvalidOperationException("ShieldManager still routes loot pickup through Unity gameplay authority.");
}
-static void RequireEntityDestroyedCommitAuthority(string root)
+static void RequireEntityDestroyedRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
? File.ReadAllText(actionGameManagerPath)
: throw new InvalidOperationException("Cannot verify entity destruction authority; ActionGameManager.cs is missing.");
- var requiredSymbols = new[]
- {
- "CommitEntityDestroyed",
- "QueueRunCheckpoint(\"entity-destroyed\")",
- "entity.Zone.Entities.Remove(entity)",
- "zoneRenderer.DropItem("
- };
-
- var missingSymbols = requiredSymbols
- .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
- .ToArray();
-
- if (missingSymbols.Length > 0)
+ if (actionGameManager.Contains("CommitEntityDestroyed", StringComparison.Ordinal))
{
throw new InvalidOperationException(
- "Entity destruction no longer has a gameplay-owned checkpoint commit primitive: " +
- string.Join(", ", missingSymbols));
+ "Entity destruction should not have a Unity-owned gameplay mutation primitive; daemon frames own destruction and drops.");
}
var entityInstancePath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "EntityInstance.cs");
@@ -5601,17 +8744,15 @@ static void RequireEntityDestroyedCommitAuthority(string root)
string.Join("; ", hits));
}
- if (!entityInstance.Contains("ActionGameManager.Instance?.CommitEntityDestroyed", StringComparison.Ordinal))
- {
- throw new InvalidOperationException("EntityInstance no longer routes destruction through ActionGameManager.");
- }
+ if (entityInstance.Contains("ActionGameManager.Instance?.CommitEntityDestroyed", StringComparison.Ordinal))
+ throw new InvalidOperationException("EntityInstance still routes destruction through Unity gameplay authority.");
}
static void RequireDroppedPickupCheckpointState(string root)
{
var requiredFiles = new Dictionary
{
- [Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateCommitDocument.cs")] = new[]
+ [Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeSnapshotDocuments.cs")] = new[]
{
"AetheriaRuntimeDroppedPickupCommit",
"DroppedPickups"
@@ -5621,11 +8762,6 @@ static void RequireDroppedPickupCheckpointState(string root)
"AetheriaDroppedPickupSnapshot",
"DroppedPickups"
},
- [Path.Combine(root, "Aetheria.State", "AetheriaRuntimeCommitLogApplier.cs")] = new[]
- {
- "ToDroppedPickups",
- "DroppedPickups = ToDroppedPickups(zone.DroppedPickups)"
- },
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs")] = new[]
{
"ReadZoneStatePayload(record.Key, record.Payload)",
@@ -5640,21 +8776,12 @@ static void RequireDroppedPickupCheckpointState(string root)
},
[Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs")] = new[]
{
- "ProjectDroppedPickups",
- "DroppedPickups = ProjectDroppedPickups(zone)",
- "RestoreDroppedPickupsFromTypedZoneState",
- "AetheriaRuntimeStateReader.ReadZoneStates(RuntimeStateFilePath)",
+ "RestoreDroppedPickupsFromDaemonZoneState",
"ZoneRenderer.DropItem("
},
[Path.Combine(root, "Assets", "Scripts", "Zone Display", "ZoneRenderer.cs")] = new[]
{
"ActiveLoot"
- },
- [Path.Combine(root, "Aetheria.State.Unity.Smoke", "Program.cs")] = new[]
- {
- "new AetheriaRuntimeDroppedPickupCommit",
- "packageZones[0].RecordKey",
- "packageZones[0].DroppedPickups"
}
};
@@ -5679,7 +8806,94 @@ static void RequireDroppedPickupCheckpointState(string root)
}
}
-static void RequireInventoryLoadoutRestoreCommitAuthority(string root)
+static void RequireInventoryLoadoutSaveRequestAuthority(string root)
+{
+ var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
+ var actionGameManager = File.Exists(actionGameManagerPath)
+ ? File.ReadAllText(actionGameManagerPath)
+ : throw new InvalidOperationException("Cannot verify loadout save authority; ActionGameManager.cs is missing.");
+ var eveCommandDocumentPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeEveCommandDocument.cs");
+ var loadoutCommandsPath = Path.Combine(
+ root,
+ "Packages",
+ "org.gamecult.aetheria.state",
+ "Runtime",
+ "AetheriaRuntimeLoadoutTemplateCommands.cs");
+ var eveBridgePath = Path.Combine(root, "Aetheria.State", "AetheriaEveCommandBridge.cs");
+ var runtimeStateMapperPath = Path.Combine(root, "Aetheria.State", "AetheriaRuntimeStateMapper.cs");
+
+ var requiredFiles = new[] { eveCommandDocumentPath, loadoutCommandsPath, eveBridgePath, runtimeStateMapperPath };
+ var missingFiles = requiredFiles.Where(path => !File.Exists(path)).ToArray();
+ if (missingFiles.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Cannot verify loadout save authority; missing files: " +
+ string.Join(", ", missingFiles.Select(path => Path.GetRelativePath(root, path))));
+ }
+
+ var eveCommandDocument = File.ReadAllText(eveCommandDocumentPath);
+ var loadoutCommands = File.ReadAllText(loadoutCommandsPath);
+ var eveBridge = File.ReadAllText(eveBridgePath);
+ var runtimeStateMapper = File.ReadAllText(runtimeStateMapperPath);
+
+ var requiredActionSymbols = new[]
+ {
+ "RequestLoadoutTemplateSave",
+ "TrySendRuntimeLoadoutTemplateCommand(loadout",
+ "private static bool TrySendRuntimeLoadoutTemplateCommand(",
+ "AetheriaRuntimeEveCommands.TrySendLoadoutTemplateCommand",
+ };
+ var missingActionSymbols = requiredActionSymbols
+ .Where(symbol => !actionGameManager.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingActionSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Loadout save no longer sends a typed Eve loadout-template command: " +
+ string.Join(", ", missingActionSymbols));
+ }
+
+ if (actionGameManager.Contains("AetheriaRuntimeStateCommitLog.QueueLoadoutTemplate", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "ActionGameManager still saves loadout templates through the runtime commit log.");
+ }
+
+ var requiredBridgeSymbols = new[]
+ {
+ "AetheriaRuntimeLoadoutTemplateCommands.Save",
+ "ExecuteLoadoutTemplateCommandAsync",
+ "command.LoadoutTemplate",
+ "AetheriaRuntimeStateMapper.ToLoadoutTemplate",
+ "AetheriaRuntimeStateMapper.LoadoutKey"
+ };
+ var missingBridgeSymbols = requiredBridgeSymbols
+ .Where(symbol => !eveBridge.Contains(symbol, StringComparison.Ordinal))
+ .ToArray();
+ if (missingBridgeSymbols.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "Eve command bridge no longer owns typed loadout-template persistence: " +
+ string.Join(", ", missingBridgeSymbols));
+ }
+
+ if (!eveCommandDocument.Contains("AetheriaRuntimeLoadoutTemplateCommit? LoadoutTemplate", StringComparison.Ordinal) ||
+ !loadoutCommands.Contains("SurfaceId = \"aetheria.loadout_templates\"", StringComparison.Ordinal) ||
+ !loadoutCommands.Contains("Save = \"aetheria.loadout_templates.save\"", StringComparison.Ordinal) ||
+ !runtimeStateMapper.Contains("public static AetheriaLoadoutTemplate ToLoadoutTemplate", StringComparison.Ordinal) ||
+ !runtimeStateMapper.Contains("public static CultRecordKey LoadoutKey", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Shared loadout-template Eve command contract is incomplete.");
+ }
+}
+
+static void RequireInventoryLoadoutRestoreRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
@@ -5688,10 +8902,9 @@ static void RequireInventoryLoadoutRestoreCommitAuthority(string root)
var requiredSymbols = new[]
{
- "CommitRuntimeLoadoutRestore",
- "EntityConstructionBlueprintProjector.InstantiateFromBlueprint",
- "QueueRunCheckpoint(\"loadout-restore\")",
- "Credits -="
+ "RequestRuntimeLoadoutRestore",
+ "TryRequestDaemonLoadoutRestore",
+ "Operations.RestoreLoadout"
};
var missingSymbols = requiredSymbols
@@ -5701,10 +8914,16 @@ static void RequireInventoryLoadoutRestoreCommitAuthority(string root)
if (missingSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Loadout restore no longer has a gameplay-owned checkpoint commit primitive: " +
+ "Loadout restore no longer has a typed daemon request primitive: " +
string.Join(", ", missingSymbols));
}
+ if (actionGameManager.Contains("price > Credits", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Unity loadout restore still rejects requests through renderer-local credits instead of daemon acceptance.");
+ }
+
var inventoryPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryPanel.cs");
var inventoryPanel = File.Exists(inventoryPanelPath)
? File.ReadAllText(inventoryPanelPath)
@@ -5713,6 +8932,8 @@ static void RequireInventoryLoadoutRestoreCommitAuthority(string root)
var forbiddenSymbols = new[]
{
"EntityConstructionBlueprintProjector.InstantiateFromBlueprint",
+ "EntityConstructionBlueprintProjector.ProjectObservedFromBlueprint",
+ "EntityConstructionBlueprintProjector.InstantiateAuthoritativeFromBlueprint",
"GameManager.Credits -=",
".SetParent(GameManager.DockedEntity)"
};
@@ -5730,13 +8951,33 @@ static void RequireInventoryLoadoutRestoreCommitAuthority(string root)
string.Join("; ", hits));
}
- if (!inventoryPanel.Contains("GameManager.CommitRuntimeLoadoutRestore", StringComparison.Ordinal))
+ var forbiddenLocalAcceptanceSymbols = new[]
+ {
+ "price < GameManager.Credits",
+ "price <= GameManager.Credits",
+ "price > GameManager.Credits",
+ "price >= GameManager.Credits"
+ };
+ var localAcceptanceHits = File.ReadLines(inventoryPanelPath)
+ .Select((line, index) => new { LineNumber = index + 1, Line = line })
+ .Where(line => forbiddenLocalAcceptanceSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
+ .Select(line => $"{Path.GetRelativePath(root, inventoryPanelPath)}:{line.LineNumber}: {line.Line.Trim()}")
+ .ToArray();
+
+ if (localAcceptanceHits.Length > 0)
+ {
+ throw new InvalidOperationException(
+ "InventoryPanel still filters loadout restore through renderer-local credit checks instead of daemon acceptance: " +
+ string.Join("; ", localAcceptanceHits));
+ }
+
+ if (!inventoryPanel.Contains("GameManager.RequestRuntimeLoadoutRestore", StringComparison.Ordinal))
{
throw new InvalidOperationException("InventoryPanel no longer routes loadout restore through ActionGameManager.");
}
}
-static void RequireDockedCurrentShipCommitAuthority(string root)
+static void RequireDockedCurrentShipRequestAuthority(string root)
{
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
var actionGameManager = File.Exists(actionGameManagerPath)
@@ -5745,9 +8986,9 @@ static void RequireDockedCurrentShipCommitAuthority(string root)
var requiredSymbols = new[]
{
- "CommitDockedCurrentShip",
- "QueueRunCheckpoint(\"docked-current-ship\")",
- "DockingBay.DockedShip = ship"
+ "RequestDockedCurrentShip",
+ "TryRequestDaemonDockedCurrentShip",
+ "Operations.SetDockedCurrentShip"
};
var missingSymbols = requiredSymbols
@@ -5757,10 +8998,16 @@ static void RequireDockedCurrentShipCommitAuthority(string root)
if (missingSymbols.Length > 0)
{
throw new InvalidOperationException(
- "Docked current-ship selection no longer has a gameplay-owned checkpoint commit primitive: " +
+ "Docked current-ship selection no longer has a typed daemon request primitive: " +
string.Join(", ", missingSymbols));
}
+ if (actionGameManager.Contains("DockedEntity.Children.Contains(ship)", StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException(
+ "Unity docked current-ship selection still rejects through renderer-local child membership instead of daemon acceptance.");
+ }
+
var inventoryPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Menu", "InventoryPanel.cs");
var forbiddenSymbols = new[]
{
@@ -5782,12 +9029,85 @@ static void RequireDockedCurrentShipCommitAuthority(string root)
}
var inventoryPanel = File.ReadAllText(inventoryPanelPath);
- if (!inventoryPanel.Contains("GameManager.CommitDockedCurrentShip", StringComparison.Ordinal))
+ if (!inventoryPanel.Contains("GameManager.RequestDockedCurrentShip", StringComparison.Ordinal))
{
throw new InvalidOperationException("InventoryPanel no longer routes current-ship selection through ActionGameManager.");
}
}
+static IEnumerable<(string MethodName, int LineNumber, string Line)> FindMethodScopedLineHits(
+ string source,
+ IReadOnlyList symbols)
+{
+ var currentMethod = "";
+ var methodDepth = 0;
+ var pendingMethod = "";
+ var lines = source.Replace("\r\n", "\n", StringComparison.Ordinal).Split('\n');
+ for (var index = 0; index < lines.Length; index++)
+ {
+ var line = lines[index];
+ var trimmed = line.Trim();
+ var declaredMethod = TryReadMethodName(trimmed);
+ if (!string.IsNullOrWhiteSpace(declaredMethod))
+ pendingMethod = declaredMethod;
+
+ foreach (var symbol in symbols)
+ {
+ if (line.Contains(symbol, StringComparison.Ordinal))
+ yield return (currentMethod, index + 1, line);
+ }
+
+ var opens = line.Count(character => character == '{');
+ var closes = line.Count(character => character == '}');
+ if (!string.IsNullOrWhiteSpace(pendingMethod) && opens > 0)
+ {
+ currentMethod = pendingMethod;
+ pendingMethod = "";
+ methodDepth = opens - closes;
+ if (methodDepth <= 0)
+ {
+ currentMethod = "";
+ methodDepth = 0;
+ }
+ continue;
+ }
+
+ if (methodDepth <= 0)
+ continue;
+
+ methodDepth += opens - closes;
+ if (methodDepth <= 0)
+ {
+ currentMethod = "";
+ methodDepth = 0;
+ }
+ }
+}
+
+static string TryReadMethodName(string trimmedLine)
+{
+ if (!StartsWithMethodAccessModifier(trimmedLine) ||
+ !trimmedLine.Contains('(') ||
+ trimmedLine.Contains("=>", StringComparison.Ordinal) ||
+ trimmedLine.Contains("=", StringComparison.Ordinal))
+ {
+ return "";
+ }
+
+ var beforeParameters = trimmedLine.Substring(0, trimmedLine.IndexOf('(')).Trim();
+ var tokens = beforeParameters.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
+ return tokens.Length == 0 ? "" : tokens[^1];
+}
+
+static bool StartsWithMethodAccessModifier(string trimmedLine)
+{
+ return trimmedLine.StartsWith("private ", StringComparison.Ordinal) ||
+ trimmedLine.StartsWith("public ", StringComparison.Ordinal) ||
+ trimmedLine.StartsWith("protected ", StringComparison.Ordinal) ||
+ trimmedLine.StartsWith("internal ", StringComparison.Ordinal) ||
+ trimmedLine.StartsWith("static ", StringComparison.Ordinal);
+}
+
static bool ContainsBehaviorValueKind(AetheriaBehaviorValue value, string kind)
{
return string.Equals(value.Kind, kind, StringComparison.OrdinalIgnoreCase) ||
diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs
index c53db197f..b7f6b807a 100644
--- a/Assets/Scripts/Gameplay/ActionGameManager.cs
+++ b/Assets/Scripts/Gameplay/ActionGameManager.cs
@@ -18,12 +18,13 @@ using UnityEngine.InputSystem;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.Serialization;
using UnityEngine.UI;
-using Unity.Mathematics;
using UnityEngine.EventSystems;
using static Unity.Mathematics.math;
+using bool2 = CultMath.bool2;
using float2 = Unity.Mathematics.float2;
using float3 = Unity.Mathematics.float3;
-using quaternion = Unity.Mathematics.quaternion;
+using float4 = Unity.Mathematics.float4;
+using int2 = Unity.Mathematics.int2;
using Regex = System.Text.RegularExpressions.Regex;
using Random = UnityEngine.Random;
@@ -38,8 +39,34 @@ public class ActionGameManager : MonoBehaviour
"AutoWeapon"
};
+ private static float Saturate(float value) => Mathf.Clamp01(value);
+
+ private static float Unlerp(float from, float to, float value) => (value - from) / (to - from);
+
+ private const float DaemonMoveCommandIntervalSeconds = 0.05f;
+ private const float DaemonMoveCommandChangeThreshold = 0.001f;
+ private const float DaemonLookCommandIntervalSeconds = 0.02f;
+ private const float DaemonLookCommandChangeThreshold = 0.0001f;
+ private const float DaemonTractorCommandIntervalSeconds = 0.05f;
+ private const float DaemonTractorCommandChangeThreshold = 0.001f;
+
// Always check for null if accessing from anywhere that might not be in-game (e.g. menu UI)
public static ActionGameManager Instance { get; private set; }
+ private AetheriaDaemonObserver _daemonObserver;
+ private Vector2 _lastSentDaemonMoveVector;
+ private Vector3 _lastSentDaemonLookDirection;
+ private float _lastSentDaemonTractorPower;
+ private float _nextDaemonMoveCommandTime;
+ private float _nextDaemonLookCommandTime;
+ private float _nextDaemonTractorCommandTime;
+ private bool _hasSentDaemonMoveVector;
+ private bool _hasSentDaemonLookDirection;
+ private bool _hasSentDaemonTractorPower;
+ private long _lastAppliedAuthoritativeDaemonFrameId = -1;
+ private string _lastAppliedAuthoritativeDaemonFramePath = "";
+ private string _lastAppliedAuthoritativeDaemonRunId = "";
+ private int _lastAppliedAuthoritativeDaemonZoneIndex = -1;
+ private readonly Dictionary _authoritativeDaemonEntities = new Dictionary(StringComparer.Ordinal);
private static DirectoryInfo _gameDataDirectory;
public static DirectoryInfo GameDataDirectory
{
@@ -59,109 +86,60 @@ public class ActionGameManager : MonoBehaviour
}
}
- public static void QueueRuntimePlayerSettingsCommit()
+ public static void RequestRuntimeInputBindingOverride(string actionName, int bindingIndex, string inputSystemPath)
+ {
+ TrySendRuntimeInputSettingsCommand(
+ AetheriaRuntimeInputSettingsCommands.SetBindingOverride,
+ new AetheriaRuntimeInputSettingsCommandBody
+ {
+ ActionName = actionName ?? "",
+ BindingIndex = bindingIndex,
+ InputSystemPath = inputSystemPath ?? ""
+ },
+ "unity-input-screen",
+ "input binding override");
+ }
+
+ public static void RequestRuntimeActionBarInput(string inputSystemPath, bool enabled)
+ {
+ TrySendRuntimeInputSettingsCommand(
+ AetheriaRuntimeInputSettingsCommands.SetActionBarEnabled,
+ new AetheriaRuntimeInputSettingsCommandBody
+ {
+ InputSystemPath = inputSystemPath ?? "",
+ Enabled = enabled
+ },
+ "unity-input-screen",
+ "action-bar input");
+ }
+
+ private static bool TrySendRuntimeInputSettingsCommand(
+ string command,
+ AetheriaRuntimeInputSettingsCommandBody body,
+ string clientId,
+ string label)
{
try
{
- var commit = AetheriaRuntimeStateCommitLog.QueuePlayerSettings(
- RuntimeStateFilePath,
- ProjectRuntimePlayerSettings(RuntimePlayerSettings));
- Debug.Log($"Queued Aetheria Verse player settings commit: {commit.Path}");
+ if (!AetheriaRuntimeEveCommands.TrySendInputSettingsCommand(
+ RuntimeStateFilePath,
+ command,
+ body,
+ clientId,
+ out var submitted,
+ out var error))
+ {
+ Debug.LogError($"Failed to submit Aetheria {label} Eve command: {error}");
+ return false;
+ }
+
+ Debug.Log($"Submitted Aetheria {label} Eve command: {submitted!.CommandId}");
+ return true;
}
catch (Exception ex)
{
- Debug.LogError($"Failed to queue Aetheria Verse player settings commit: {ex}");
- }
- }
-
- public static void CommitRuntimeInputBindingOverride(string actionName, int bindingIndex, string inputSystemPath)
- {
- RuntimePlayerSettings.InputSettings.SetBindingOverride(actionName, bindingIndex, inputSystemPath);
- QueueRuntimePlayerSettingsCommit();
- }
-
- public static void CommitRuntimeActionBarInput(string inputSystemPath, bool enabled)
- {
- RuntimePlayerSettings.InputSettings.SetActionBarInputEnabled(inputSystemPath, enabled);
- QueueRuntimePlayerSettingsCommit();
- }
-
- public static void CommitRuntimePlayerName(string name)
- {
- RuntimePlayerSettings.Name = name ?? "";
- QueueRuntimePlayerSettingsCommit();
- }
-
- public static void CommitRuntimeTemperatureUnit(TemperatureUnit unit)
- {
- RuntimePlayerSettings.GameplaySettings.TemperatureUnit = unit;
- QueueRuntimePlayerSettingsCommit();
- }
-
- public static void CommitRuntimeSignificantDigits(int significantDigits)
- {
- RuntimePlayerSettings.GameplaySettings.SignificantDigits = significantDigits;
- QueueRuntimePlayerSettingsCommit();
- }
-
- public static void CommitRuntimeNebulaQuality(Quality quality)
- {
- RuntimePlayerSettings.GraphicsSettings.NebulaQuality = quality;
- QueueRuntimePlayerSettingsCommit();
- }
-
- public static void CommitRuntimeShowAsteroidsInMinimap(bool show)
- {
- RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap = show;
- QueueRuntimePlayerSettingsCommit();
- }
-
- public static bool CommitRuntimePlayerSettingsCommand(
- string command,
- IReadOnlyDictionary payload = null)
- {
- switch (command)
- {
- case AetheriaRuntimePlayerSettingsCommands.SetPlayerName:
- if (payload != null && payload.TryGetValue("value", out var playerName))
- {
- CommitRuntimePlayerName(playerName);
- }
- else
- {
- CommitRuntimePlayerName("");
- }
- return true;
- case AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit:
- CommitRuntimeTemperatureUnit(
- RuntimePlayerSettings.GameplaySettings.TemperatureUnit switch
- {
- TemperatureUnit.Kelvin => TemperatureUnit.Celsius,
- TemperatureUnit.Celsius => TemperatureUnit.Fahrenheit,
- _ => TemperatureUnit.Kelvin
- });
- return true;
- case AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits:
- CommitRuntimeSignificantDigits(max(0, RuntimePlayerSettings.GameplaySettings.SignificantDigits - 1));
- return true;
- case AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits:
- CommitRuntimeSignificantDigits(RuntimePlayerSettings.GameplaySettings.SignificantDigits + 1);
- return true;
- case AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality:
- CommitRuntimeNebulaQuality(
- RuntimePlayerSettings.GraphicsSettings.NebulaQuality switch
- {
- Quality.Low => Quality.Normal,
- Quality.Normal => Quality.High,
- Quality.High => Quality.Ultra,
- _ => Quality.Low
- });
- return true;
- case AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap:
- CommitRuntimeShowAsteroidsInMinimap(!RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap);
- return true;
- default:
- return false;
+ Debug.LogError($"Failed to send Aetheria {label} Eve command: {ex}");
+ return false;
}
}
@@ -398,9 +376,8 @@ public class ActionGameManager : MonoBehaviour
return instance;
}
- public static Galaxy CurrentGalaxy;
+ public static Galaxy ObservedGalaxy;
public static bool IsTutorial;
- public static AetheriaRuntimeRunStateSnapshot ContinueRunState { get; set; }
public static AetheriaRuntimeCatalogSnapshot RuntimeCatalog { get; private set; }
public GameSettings Settings;
@@ -409,7 +386,7 @@ public class ActionGameManager : MonoBehaviour
public int Credits = 15000000;
public float TargetSpottedBlinkFrequency = 20;
public float TargetSpottedBlinkOffset = -.25f;
-
+
[Header("Postprocessing")]
public float DeathPostTransitionTime;
public PostProcessVolume DeathPost;
@@ -424,14 +401,13 @@ public class ActionGameManager : MonoBehaviour
public InputDisplayLayout InputDisplayLayout;
public Transform ActionBar;
public ActionBarSlot ActionBarSlot;
- public Transform EffectManagerParent;
public ZoneRenderer ZoneRenderer;
public CinemachineVirtualCamera DockCamera;
public CinemachineVirtualCamera FollowCamera;
public CinemachineVirtualCamera WormholeCamera;
//public SectorRenderer SectorRenderer;
public SectorMap SectorMap;
-
+
[Header("Menu UI")]
public MainMenu MainMenu;
public MenuPanel Menu;
@@ -441,7 +417,7 @@ public class ActionGameManager : MonoBehaviour
public InventoryPanel ShipPanel;
public InventoryPanel TargetShipPanel;
public ConfirmationDialog Dialog;
-
+
[Header("Gameplay UI")]
public CanvasGroup GameplayUI;
public EventLog EventLog;
@@ -454,7 +430,7 @@ public class ActionGameManager : MonoBehaviour
public float HitMarkerDuration;
public SchematicDisplay SchematicDisplay;
public SchematicDisplay TargetSchematicDisplay;
-
+
[Header("Target Indicator")]
public PlaceUIElementWorldspace TargetIndicator;
public Image TargetHitpointsFill;
@@ -468,13 +444,11 @@ public class ActionGameManager : MonoBehaviour
public Sprite ShieldIcon;
public Sprite NoShieldIcon;
- public float IntroDuration;
-
//public PlayerInput Input;
-
+
// private CinemachineFramingTransposer _transposer;
// private CinemachineComposer _composer;
-
+
private bool _paused;
private float _time;
private int _zoomLevelIndex;
@@ -495,7 +469,7 @@ public class ActionGameManager : MonoBehaviour
private List _actionBarSlots = new List();
private List _actionBarActions = new List();
private float _hitMarkerTime;
-
+
public AetheriaInput Input { get; private set; }
public EquippedDockingBay DockingBay { get; private set; }
public Entity DockedEntity { get; private set; }
@@ -515,16 +489,16 @@ public class ActionGameManager : MonoBehaviour
get => _currentEntity;
set => _currentEntity = value;
}
-
+
public ItemManager ItemManager { get; private set; }
public Zone Zone { get; private set; }
public List LoadoutTemplates { get; } = new List();
private readonly (float2 direction, string name)[] _directions = {
- (float2(0, 1), "Front"),
- (float2(1, 0), "Right"),
- (float2(-1, 0), "Left"),
- (float2(0, -1), "Rear")
+ (new float2(0, 1), "Front"),
+ (new float2(1, 0), "Right"),
+ (new float2(-1, 0), "Left"),
+ (new float2(0, -1), "Rear")
};
public DragObject DragObject { get; private set; }
@@ -537,40 +511,6 @@ public class ActionGameManager : MonoBehaviour
get => Settings.GameplaySettings.DefaultEntitySettings.Copy();
}
- private static AetheriaRuntimePlayerSettingsCommit ProjectRuntimePlayerSettings(RuntimePlayerSettings settings)
- {
- return new AetheriaRuntimePlayerSettingsCommit
- {
- PlayerName = settings.Name,
- TutorialPassed = settings.TutorialPassed,
- StoryFileHashes = settings.HashedStoryFiles
- .OrderBy(pair => pair.Key, StringComparer.Ordinal)
- .Select(pair => new AetheriaRuntimeStoryFileHashCommit
- {
- StoryPath = pair.Key,
- Hash = pair.Value
- })
- .ToArray(),
- TemperatureUnit = Enum.GetName(typeof(TemperatureUnit), settings.GameplaySettings.TemperatureUnit),
- SignificantDigits = settings.GameplaySettings.SignificantDigits,
- NebulaQuality = Enum.GetName(typeof(Quality), settings.GraphicsSettings.NebulaQuality),
- ShowAsteroidsInMinimap = settings.GraphicsSettings.ShowAsteroidsInMinimap,
- BindingOverrides = settings.InputSettings.InputActionMap
- .OrderBy(pair => pair.Key.action, StringComparer.Ordinal)
- .ThenBy(pair => pair.Key.binding)
- .Select(pair => new AetheriaRuntimeInputBindingCommit
- {
- ActionName = pair.Key.action,
- BindingIndex = pair.Key.binding,
- BindingPath = pair.Value
- })
- .ToArray(),
- ActionBarInputs = settings.InputSettings.ActionBarInputs
- .OrderBy(input => input, StringComparer.Ordinal)
- .ToArray()
- };
- }
-
private AetheriaRuntimeLoadoutTemplateCommit ProjectLoadoutTemplate(EntityConstructionBlueprint blueprint)
{
return new AetheriaRuntimeLoadoutTemplateCommit
@@ -645,31 +585,6 @@ public class ActionGameManager : MonoBehaviour
};
}
- private AetheriaRuntimeRunCheckpointCommit ProjectRunCheckpoint()
- {
- var entityGraph = FlattenEntityGraph(Zone);
- var runId = IsTutorial ? "tutorial" : "local";
- var currentZoneIndex = ZoneIndex(Zone?.GalaxyZone);
- return new AetheriaRuntimeRunCheckpointCommit
- {
- RunId = runId,
- IsTutorial = IsTutorial,
- EntranceZoneIndex = ZoneIndex(CurrentGalaxy?.Entrance),
- ExitZoneIndex = ZoneIndex(CurrentGalaxy?.Exit),
- CurrentZoneIndex = currentZoneIndex,
- CurrentEntityKey = CurrentEntityRecordKey(runId, currentZoneIndex, entityGraph, CurrentEntity),
- GenerationSeed = CurrentGalaxy?.GenerationSeed ?? 0,
- DiscoveredZoneIndices = CurrentGalaxy?.DiscoveredZones
- .Select(ZoneIndex)
- .Where(index => index >= 0)
- .OrderBy(index => index)
- .ToArray() ?? Array.Empty(),
- ActionBarBindings = ProjectActionBarBindings(),
- FactionRelationships = ProjectFactionRelationships(),
- Zones = Zone == null ? Array.Empty() : new[] { ProjectZoneSnapshot(Zone) }
- };
- }
-
private AetheriaRuntimeActionBarBindingCommit[] ProjectActionBarBindings()
{
return _actionBarSlots?
@@ -680,7 +595,14 @@ public class ActionGameManager : MonoBehaviour
private static AetheriaRuntimeActionBarBindingCommit ProjectActionBarBinding(ActionBarSlot slot)
{
- switch (slot?.Binding)
+ return ProjectActionBarBinding(slot, slot?.Binding);
+ }
+
+ private static AetheriaRuntimeActionBarBindingCommit ProjectActionBarBinding(
+ ActionBarSlot slot,
+ ActionBarBinding binding)
+ {
+ switch (binding)
{
case ActionBarConsumableBinding consumable:
return new AetheriaRuntimeActionBarBindingCommit
@@ -726,18 +648,32 @@ public class ActionGameManager : MonoBehaviour
};
}
- private bool CommitActionBarBinding(ActionBarSlot slot, DragObject dragAction)
+ private static AetheriaRuntimeActionBarBindingSnapshot ToActionBarBindingSnapshot(
+ AetheriaRuntimeActionBarBindingCommit binding)
+ {
+ return binding == null
+ ? null
+ : new AetheriaRuntimeActionBarBindingSnapshot(
+ binding.ControlPath ?? "",
+ binding.Kind ?? "",
+ binding.ItemKey ?? "",
+ binding.EquipmentIndex,
+ binding.BehaviorIndex,
+ binding.WeaponGroup);
+ }
+
+ private bool RequestActionBarBinding(ActionBarSlot slot, DragObject dragAction)
{
if (slot == null || dragAction == null || CurrentEntity == null)
return false;
- var binding = CreateActionBarBinding(slot, CurrentEntity, dragAction);
- if (binding == null)
+ var bindingCommit = CreateActionBarBindingCommit(slot, CurrentEntity, dragAction);
+ if (bindingCommit == null)
return false;
- slot.Binding = binding;
- QueueRunCheckpoint("action-bar-binding");
- return true;
+ if (TryRequestDaemonActionBarBinding(bindingCommit))
+ return true;
+ return false;
}
public int GetActionBarSlotCount()
@@ -763,31 +699,34 @@ public class ActionGameManager : MonoBehaviour
};
}
- public bool CommitWeaponGroupActionBarBinding(int slotIndex, int groupIndex)
+ public bool RequestWeaponGroupActionBarBinding(int slotIndex, int groupIndex)
{
var slot = ResolveActionBarSlot(slotIndex);
- if (slot == null ||
- CurrentEntity?.WeaponGroups == null ||
- groupIndex < 0 ||
- groupIndex >= CurrentEntity.WeaponGroups.Length)
+ if (slot == null || groupIndex < 0)
{
return false;
}
- slot.Binding = new ActionBarWeaponGroupBinding(CurrentEntity, slot, groupIndex);
- QueueRunCheckpoint("action-bar-binding");
- return true;
+ var binding = new AetheriaRuntimeActionBarBindingCommit
+ {
+ ControlPath = slot.ControlPath ?? "",
+ Kind = "weapon_group",
+ WeaponGroup = groupIndex
+ };
+ if (TryRequestDaemonActionBarBinding(binding))
+ return true;
+ return false;
}
- public bool CommitClearActionBarBinding(int slotIndex)
+ public bool RequestClearActionBarBinding(int slotIndex)
{
var slot = ResolveActionBarSlot(slotIndex);
if (slot == null)
return false;
- slot.Binding = null;
- QueueRunCheckpoint("action-bar-binding");
- return true;
+ if (TryRequestDaemonActionBarBindingClear(slot))
+ return true;
+ return false;
}
private void RestoreActionBarBindingsFromTypedRun(
@@ -851,18 +790,45 @@ public class ActionGameManager : MonoBehaviour
private ActionBarBinding CreateActionBarBinding(ActionBarSlot slot, Entity entity, DragObject dragAction)
{
+ var binding = CreateActionBarBindingCommit(slot, entity, dragAction);
+ return binding == null ? null : CreateActionBarBinding(slot, entity, binding);
+ }
+
+ private AetheriaRuntimeActionBarBindingCommit CreateActionBarBindingCommit(
+ ActionBarSlot slot,
+ Entity entity,
+ DragObject dragAction)
+ {
+ if (slot == null || entity == null || dragAction == null)
+ return null;
+
switch (dragAction)
{
case EquippedItemDragObject equippedItemDragAction:
- var trigger = equippedItemDragAction.EquippedItem.GetBehavior();
- return trigger == null
+ var equippedItem = equippedItemDragAction.EquippedItem;
+ var trigger = equippedItem?.GetBehavior();
+ var equipmentIndex = equippedItem == null ? -1 : entity.Equipment.IndexOf(equippedItem);
+ var behaviorIndex = equippedItem?.Behaviors == null ? -1 : Array.IndexOf(equippedItem.Behaviors, trigger);
+ return trigger == null || equipmentIndex < 0 || behaviorIndex < 0
? null
- : new ActionBarGearBinding(entity, slot, equippedItemDragAction.EquippedItem, trigger);
+ : new AetheriaRuntimeActionBarBindingCommit
+ {
+ ControlPath = slot.ControlPath ?? "",
+ Kind = "gear",
+ ItemKey = equippedItem.EquippableItem?.ItemKey ?? "",
+ EquipmentIndex = equipmentIndex,
+ BehaviorIndex = behaviorIndex
+ };
case ItemInstanceDragObject itemInstanceDragAction:
var consumable = FindTypedActionBarConsumable(itemInstanceDragAction.Item);
return consumable == null
? null
- : new ActionBarConsumableBinding(entity, slot, consumable);
+ : new AetheriaRuntimeActionBarBindingCommit
+ {
+ ControlPath = slot.ControlPath ?? "",
+ Kind = "consumable",
+ ItemKey = consumable.ItemKey ?? ""
+ };
default:
return null;
}
@@ -949,767 +915,51 @@ public class ActionGameManager : MonoBehaviour
return RuntimeCatalog?.FindItem(item?.ItemKey ?? "");
}
- private AetheriaRuntimeFactionRelationshipCommit[] ProjectFactionRelationships()
- {
- return CurrentGalaxy?.FactionRelationships?
- .Where(pair => pair.Key != null)
- .OrderBy(pair => pair.Key.FactionKey ?? "", StringComparer.OrdinalIgnoreCase)
- .Select(pair => new AetheriaRuntimeFactionRelationshipCommit
- {
- FactionKey = pair.Key.FactionKey ?? "",
- Relationship = pair.Value.ToString(),
- Standing = (int)pair.Value
- })
- .ToArray() ?? Array.Empty();
- }
-
- private AetheriaRuntimeZoneSnapshotCommit ProjectZoneSnapshot(Zone zone)
- {
- var galaxyZone = zone.GalaxyZone;
- var entityGraph = FlattenEntityGraph(zone);
- return new AetheriaRuntimeZoneSnapshotCommit
- {
- ZoneIndex = ZoneIndex(galaxyZone),
- Name = galaxyZone?.Name ?? "",
- PositionX = galaxyZone?.Position.x ?? 0,
- PositionY = galaxyZone?.Position.y ?? 0,
- AdjacentZoneIndices = galaxyZone?.AdjacentZones
- .Select(ZoneIndex)
- .Where(index => index >= 0)
- .OrderBy(index => index)
- .ToArray() ?? Array.Empty(),
- FactionIndices = galaxyZone?.Factions?
- .Select(FactionIndex)
- .Where(index => index >= 0)
- .OrderBy(index => index)
- .ToArray() ?? Array.Empty(),
- OwnerFactionIndex = FactionIndex(galaxyZone?.Owner),
- Orbits = ProjectZoneOrbits(zone),
- Bodies = ProjectZoneBodies(zone),
- Entities = entityGraph
- .Select((entity, index) => ProjectEntitySnapshot(entityGraph, entity, index))
- .ToArray(),
- DroppedPickups = ProjectDroppedPickups(zone)
- };
- }
-
- private AetheriaRuntimeDroppedPickupCommit[] ProjectDroppedPickups(Zone zone)
- {
- if (Zone != zone || ZoneRenderer?.ActiveLoot == null)
- return Array.Empty();
-
- return ZoneRenderer.ActiveLoot
- .Where(pickup => pickup != null && pickup.Item != null)
- .Select((pickup, index) =>
- {
- var gridObject = pickup.GetComponent();
- var position = pickup.transform.position;
- var velocity = gridObject == null ? Vector3.zero : gridObject.Velocity;
- return new AetheriaRuntimeDroppedPickupCommit
- {
- PickupIndex = index,
- PositionX = position.x,
- PositionY = position.y,
- PositionZ = position.z,
- VelocityX = velocity.x,
- VelocityY = velocity.y,
- VelocityZ = velocity.z,
- Item = ProjectLoadoutItem(pickup.Item)
- };
- })
- .ToArray();
- }
-
- private static AetheriaRuntimeOrbitSnapshotCommit[] ProjectZoneOrbits(Zone zone)
- {
- return zone?.Orbits?.Values
- .OrderBy(orbit => orbit.OrbitKey, StringComparer.Ordinal)
- .Select(orbit => new AetheriaRuntimeOrbitSnapshotCommit
- {
- OrbitKey = orbit.OrbitKey,
- ParentOrbitKey = orbit.ParentOrbitKey,
- Distance = orbit.Distance,
- Phase = orbit.Phase,
- FixedPositionX = orbit.FixedPosition.x,
- FixedPositionY = orbit.FixedPosition.y
- })
- .ToArray() ?? Array.Empty();
- }
-
- private static AetheriaRuntimeBodySnapshotCommit[] ProjectZoneBodies(Zone zone)
- {
- if (zone == null)
- return Array.Empty();
-
- return zone.PlanetInstances.Values
- .Select(planet => ProjectZoneBody(planet))
- .Concat(zone.AsteroidBelts.Values.Select(belt => ProjectZoneBody(zone, belt)))
- .OrderBy(body => body.BodyKey)
- .ToArray();
- }
-
- private static AetheriaRuntimeBodySnapshotCommit ProjectZoneBody(Planet planet)
- {
- return new AetheriaRuntimeBodySnapshotCommit
- {
- BodyKey = planet.BodyKey,
- Kind = BodyKind(planet),
- Name = planet.Name,
- OrbitKey = planet.OrbitKey,
- Mass = planet.Mass,
- Resources = planet.Resources?
- .OrderBy(pair => pair.Key)
- .Select(pair => new AetheriaRuntimeBodyResourceCommit
- {
- ItemKey = pair.Key ?? "",
- Amount = pair.Value
- })
- .ToArray() ?? Array.Empty(),
- BodyRadiusMultiplier = planet.BodyRadiusMultiplier,
- GravityRadiusMultiplier = planet.GravityRadiusMultiplier,
- GravityDepthMultiplier = planet.GravityDepthMultiplier,
- GravityDepthExponent = planet.GravityDepthExponent,
- Asteroids = Array.Empty(),
- GasGiantVisual = planet is GasGiant gas
- ? ProjectGasGiantVisual(gas)
- : new AetheriaRuntimeGasGiantVisualCommit(),
- SunVisual = planet is Sun sun
- ? ProjectSunVisual(sun)
- : new AetheriaRuntimeSunVisualCommit()
- };
- }
-
- private static AetheriaRuntimeBodySnapshotCommit ProjectZoneBody(Zone zone, AsteroidBelt belt)
- {
- return new AetheriaRuntimeBodySnapshotCommit
- {
- BodyKey = belt.BodyKey,
- Kind = "asteroid_belt",
- Name = belt.Name,
- OrbitKey = belt.OrbitKey,
- Mass = belt.Mass,
- Resources = belt.Resources?
- .OrderBy(pair => pair.Key)
- .Select(pair => new AetheriaRuntimeBodyResourceCommit
- {
- ItemKey = pair.Key ?? "",
- Amount = pair.Value
- })
- .ToArray() ?? Array.Empty(),
- BodyRadiusMultiplier = belt.BodyRadiusMultiplier,
- GravityRadiusMultiplier = belt.GravityRadiusMultiplier,
- GravityDepthMultiplier = belt.GravityDepthMultiplier,
- GravityDepthExponent = belt.GravityDepthExponent,
- Asteroids = ProjectAsteroids(zone, belt),
- GasGiantVisual = new AetheriaRuntimeGasGiantVisualCommit(),
- SunVisual = new AetheriaRuntimeSunVisualCommit()
- };
- }
-
- private static AetheriaRuntimeAsteroidCommit[] ProjectAsteroids(Zone zone, AsteroidBelt asteroidBelt)
- {
- return Enumerable.Range(0, asteroidBelt.AsteroidCount)
- .Select(asteroidIndex =>
- {
- var asteroid = asteroidBelt.GetAsteroid(asteroidIndex);
- return new AetheriaRuntimeAsteroidCommit
- {
- Distance = asteroid.Distance,
- Phase = asteroid.Phase,
- Size = asteroid.Size,
- RotationSpeed = asteroid.RotationSpeed,
- Damage = asteroidBelt.Damage.TryGetValue(asteroidIndex, out var damage) ? damage : 0,
- RespawnTimer = asteroidBelt.RespawnTimers.TryGetValue(asteroidIndex, out var respawnTimer) ? respawnTimer : 0,
- MiningAccumulators = asteroidBelt.MiningAccumulator
- .Where(pair => pair.Key.Item2 == asteroidIndex)
- .Select(pair => new AetheriaRuntimeAsteroidMiningAccumulatorCommit
- {
- MinerEntityIndex = zone.Entities.IndexOf(pair.Key.Item1),
- Amount = pair.Value
- })
- .Where(accumulator => accumulator.MinerEntityIndex >= 0)
- .ToArray()
- };
- })
- .ToArray();
- }
-
- private static AetheriaRuntimeGasGiantVisualCommit ProjectGasGiantVisual(GasGiant gas)
- {
- return new AetheriaRuntimeGasGiantVisualCommit
- {
- FirstOffsetDomainRotationSpeed = gas.FirstOffsetDomainRotationSpeed,
- FirstOffsetRotationSpeed = gas.FirstOffsetRotationSpeed,
- SecondOffsetDomainRotationSpeed = gas.SecondOffsetDomainRotationSpeed,
- SecondOffsetRotationSpeed = gas.SecondOffsetRotationSpeed,
- AlbedoRotationSpeed = gas.AlbedoRotationSpeed,
- WaveRadiusMultiplier = gas.WaveRadiusMultiplier,
- WaveDepthMultiplier = gas.WaveDepthMultiplier,
- WaveDepthExponent = gas.WaveDepthExponent,
- WaveSpeedMultiplier = gas.WaveSpeedMultiplier,
- MaterialOverrides = gas.MaterialOverrides?.ToArray() ?? Array.Empty(),
- Colors = gas.Colors?
- .Select(color => new AetheriaRuntimeColorCommit
- {
- X = color.x,
- Y = color.y,
- Z = color.z,
- W = color.w
- })
- .ToArray() ?? Array.Empty()
- };
- }
-
- private static AetheriaRuntimeSunVisualCommit ProjectSunVisual(Sun sun)
- {
- return new AetheriaRuntimeSunVisualCommit
- {
- LightColorX = sun.LightColor.x,
- LightColorY = sun.LightColor.y,
- LightColorZ = sun.LightColor.z,
- FogTintColorX = sun.FogTintColor.x,
- FogTintColorY = sun.FogTintColor.y,
- FogTintColorZ = sun.FogTintColor.z,
- LightRadiusMultiplier = sun.LightRadiusMultiplier
- };
- }
-
- private static string BodyKind(Planet body)
- {
- return body switch
- {
- Sun => "sun",
- GasGiant => "gas_giant",
- _ => "planet"
- };
- }
-
- private static List FlattenEntityGraph(Zone zone)
- {
- var entities = new List();
- if (zone == null)
- return entities;
-
- var visited = new HashSet();
- foreach (var entity in zone.Entities)
- AddEntityAndChildren(entity);
- return entities;
-
- void AddEntityAndChildren(Entity entity)
- {
- if (entity == null || !visited.Add(entity))
- return;
-
- entities.Add(entity);
- foreach (var child in entity.Children)
- AddEntityAndChildren(child);
- }
- }
-
- private AetheriaRuntimeEntitySnapshotCommit ProjectEntitySnapshot(IReadOnlyList entityGraph, Entity entity, int entityIndex)
- {
- return new AetheriaRuntimeEntitySnapshotCommit
- {
- EntityIndex = entityIndex,
- Name = entity.Name ?? "",
- Kind = entity is Ship ? "ship" : entity is OrbitalEntity ? "orbital" : "entity",
- PositionX = entity.Position.x,
- PositionY = entity.Position.y,
- PositionZ = entity.Position.z,
- DirectionX = entity.Direction.x,
- DirectionY = entity.Direction.y,
- VelocityX = entity.Velocity.x,
- VelocityY = entity.Velocity.y,
- TargetEntityIndex = entity.Target?.Value == null ? -1 : IndexOfEntity(entityGraph, entity.Target.Value),
- IsActive = entity.Active,
- HeatsinksEnabled = entity.HeatsinksEnabled,
- OverrideShutdown = entity.OverrideShutdown,
- TractorPower = entity.TractorPower,
- Heatstroke = entity.Heatstroke,
- Hypothermia = entity.Hypothermia,
- FactionKey = entity.Faction?.FactionKey ?? "",
- HullItemKey = entity.Hull?.ItemKey ?? "",
- Equipment = ProjectEquippedSlots(entity.Equipment),
- CargoBays = ProjectEquippedSlots(entity.CargoBays),
- DockingBays = ProjectEquippedSlots(entity.DockingBays),
- CargoContents = ProjectRuntimeCargoBays(entity.CargoBays),
- DockingBayContents = ProjectRuntimeCargoBays(entity.DockingBays),
- DockingBayAssignments = entity.DockingBays?
- .Select(bay => entity.Children.IndexOf(bay.DockedShip))
- .ToArray() ?? Array.Empty(),
- Visibility = entity.Visibility,
- VisibilitySourceCount = entity.VisibilitySources.Count,
- Contacts = ProjectEntityContacts(entityGraph, entity),
- ChildEntityIndices = entity.Children?
- .Select(child => IndexOfEntity(entityGraph, child))
- .Where(index => index >= 0)
- .ToArray() ?? Array.Empty(),
- WeaponGroups = entity.WeaponGroups?
- .Select(group => (IReadOnlyList)group.items.Select(item => entity.Equipment.IndexOf(item)).Where(index => index >= 0).ToArray())
- .ToArray() ?? Array.Empty>(),
- StatGrids = ProjectEntityStatGrids(entity),
- ActiveConsumables = ProjectActiveConsumables(entity),
- BehaviorProgress = ProjectBehaviorProgress(entity),
- WeaponStates = ProjectWeaponStates(entityGraph, entity),
- BehaviorStates = ProjectBehaviorStates(entity)
- };
- }
-
- private static AetheriaRuntimeEntityContactCommit[] ProjectEntityContacts(IReadOnlyList entityGraph, Entity entity)
- {
- return entity.EntityInfoGathered
- .Select(contact =>
- {
- var targetIndex = IndexOfEntity(entityGraph, contact.Key);
- entity.EntityHostility.TryGetValue(contact.Key, out var hostile);
- return new AetheriaRuntimeEntityContactCommit
- {
- TargetEntityIndex = targetIndex,
- InfoGathered = contact.Value,
- Hostile = hostile,
- Visible = entity.VisibleEntities.Contains(contact.Key)
- };
- })
- .Where(contact => contact.TargetEntityIndex >= 0)
- .ToArray();
- }
-
- private static int IndexOfEntity(IReadOnlyList entityGraph, Entity entity)
- {
- if (entityGraph == null || entity == null)
- return -1;
-
- for (var index = 0; index < entityGraph.Count; index++)
- {
- if (ReferenceEquals(entityGraph[index], entity))
- return index;
- }
-
- return -1;
- }
-
- private static AetheriaRuntimeCargoBayLoadoutCommit[] ProjectRuntimeCargoBays(IEnumerable bays)
- where TBay : EquippedCargoBay
- {
- return bays?
- .Select(bay => new AetheriaRuntimeCargoBayLoadoutCommit
- {
- Items = bay.Cargo?
- .Select(slot => new AetheriaRuntimeLoadoutItemSlotCommit
- {
- X = slot.Value.x,
- Y = slot.Value.y,
- Item = ProjectLoadoutItem(slot.Key)
- })
- .ToArray() ?? Array.Empty()
- })
- .ToArray() ?? Array.Empty();
- }
-
- private static AetheriaRuntimeBehaviorStateCommit[] ProjectBehaviorStates(Entity entity)
- {
- var states = new List();
- var zone = entity.Zone;
-
- for (var ownerIndex = 0; ownerIndex < entity.Equipment.Count; ownerIndex++)
- states.AddRange(ProjectBehaviorStates(zone, "equipment", ownerIndex, entity.Equipment[ownerIndex].Behaviors));
-
- var activeConsumables = entity.ActiveConsumables;
- for (var ownerIndex = 0; ownerIndex < activeConsumables.Count; ownerIndex++)
- states.AddRange(ProjectBehaviorStates(zone, "active_consumable", ownerIndex, activeConsumables[ownerIndex].Behaviors));
-
- return states.ToArray();
- }
-
- private static IEnumerable ProjectBehaviorStates(
- Zone zone,
- string ownerKind,
- int ownerIndex,
- IReadOnlyList behaviors)
- {
- if (behaviors == null)
- yield break;
-
- for (var behaviorIndex = 0; behaviorIndex < behaviors.Count; behaviorIndex++)
- {
- var behavior = behaviors[behaviorIndex];
- AetheriaRuntimeBehaviorStateCommit state = null;
-
- if (behavior is Sensor sensor)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- Pinging = sensor.Pinging,
- PingCooldown = sensor.Cooldown,
- PingLerp = sensor.PingLerp,
- PingRadius = sensor.PingRadius,
- PingedEntityCount = sensor.PingedEntityCount
- };
- }
- else if (behavior is Radiator radiator)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- RadiatorTemperature = radiator.RadiatorTemperature,
- Emissivity = radiator.Emissivity,
- PumpedHeat = radiator.PumpedHeat,
- WasteHeat = radiator.WasteHeat,
- EnergyUsage = radiator.EnergyUsage
- };
- }
- else if (behavior is Reactor reactor)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- ReactorDraw = reactor.Draw,
- ReactorLoadRatio = reactor.CurrentLoadRatio
- };
- }
- else if (behavior is Capacitor capacitor)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- CapacitorCharge = capacitor.Charge,
- CapacitorCapacity = capacitor.Capacity,
- CapacitorEfficiency = capacitor.Efficiency
- };
- }
- else if (behavior is AetherDrive drive)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- AetherDriveAxisX = drive.Axis.x,
- AetherDriveAxisY = drive.Axis.y,
- AetherDriveAxisZ = drive.Axis.z,
- AetherDriveThrustX = drive.Thrust.x,
- AetherDriveThrustY = drive.Thrust.y,
- AetherDriveThrustZ = drive.Thrust.z,
- AetherDriveRpmX = drive.Rpm.x,
- AetherDriveRpmY = drive.Rpm.y,
- AetherDriveRpmZ = drive.Rpm.z,
- AetherDriveMaximumRpm = drive.MaximumRpm,
- AetherDriveThrustDirectionX = drive.ThrustDirection.x,
- AetherDriveThrustDirectionY = drive.ThrustDirection.y
- };
- }
- else if (behavior is ResourceScanner resourceScanner)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- ResourceScannerTargetBodyKey = resourceScanner.ScanTargetBodyKey ?? "",
- ResourceScannerAsteroidIndex = resourceScanner.Asteroid,
- ResourceScannerScanTime = resourceScanner.ScanTime,
- ResourceScannerRange = resourceScanner.Range,
- ResourceScannerMinimumDensity = resourceScanner.MinimumDensity,
- ResourceScannerScanDuration = resourceScanner.ScanDuration
- };
- }
- else if (behavior is MiningTool miningTool)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- MiningToolAsteroidBeltKey = miningTool.AsteroidBeltBodyKey ?? "",
- MiningToolAsteroidIndex = miningTool.Asteroid,
- MiningToolRange = miningTool.Range
- };
- }
- else if (behavior is Thruster thruster)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- ThrusterAxis = thruster.Axis,
- ThrusterThrust = thruster.Thrust,
- ThrusterTorque = thruster.Torque
- };
- }
- else if (behavior is Shield shield)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- ShieldEfficiency = shield.Efficiency,
- ShieldEnergyUsage = shield.EnergyUsage
- };
- }
- else if (behavior is VelocityLimit velocityLimit)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- VelocityLimit = velocityLimit.Limit
- };
- }
- else if (behavior is Thermotoggle thermotoggle)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- ThermotoggleTargetTemperature = thermotoggle.TargetTemperature
- };
- }
- else if (behavior is Switch switchBehavior)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- SwitchActivated = switchBehavior.Activated
- };
- }
- else if (behavior is Trigger trigger)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- TriggerPulled = trigger.Pulled
- };
- }
- else if (behavior is StatModifier statModifier)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- StatModifierApplied = statModifier.Applied,
- StatModifierExecuted = statModifier.Executed,
- StatModifierTargetStatCount = statModifier.TargetStatCount
- };
- }
- else if (behavior is TurretController turretController)
- {
- state = new AetheriaRuntimeBehaviorStateCommit
- {
- TurretControllerWeaponCount = turretController.WeaponCount,
- TurretControllerShotSpeed = turretController.ShotSpeed,
- TurretControllerPredictShots = turretController.PredictShots
- };
- }
-
- if (state == null)
- continue;
-
- state.OwnerKind = ownerKind;
- state.OwnerIndex = ownerIndex;
- state.BehaviorIndex = behaviorIndex;
- state.BehaviorKind = behavior.Kind;
- yield return state;
- }
- }
-
- private static AetheriaRuntimeWeaponStateCommit[] ProjectWeaponStates(IReadOnlyList entityGraph, Entity entity)
- {
- var states = new List();
-
- for (var ownerIndex = 0; ownerIndex < entity.Equipment.Count; ownerIndex++)
- states.AddRange(ProjectWeaponStates(entityGraph, "equipment", ownerIndex, entity.Equipment[ownerIndex].Behaviors));
-
- var activeConsumables = entity.ActiveConsumables;
- for (var ownerIndex = 0; ownerIndex < activeConsumables.Count; ownerIndex++)
- states.AddRange(ProjectWeaponStates(entityGraph, "active_consumable", ownerIndex, activeConsumables[ownerIndex].Behaviors));
-
- return states.ToArray();
- }
-
- private static IEnumerable ProjectWeaponStates(
- IReadOnlyList entityGraph,
- string ownerKind,
- int ownerIndex,
- IReadOnlyList behaviors)
- {
- if (behaviors == null)
- yield break;
-
- for (var behaviorIndex = 0; behaviorIndex < behaviors.Count; behaviorIndex++)
- {
- if (!(behaviors[behaviorIndex] is Weapon weapon))
- continue;
-
- var state = new AetheriaRuntimeWeaponStateCommit
- {
- OwnerKind = ownerKind,
- OwnerIndex = ownerIndex,
- BehaviorIndex = behaviorIndex,
- BehaviorKind = weapon.Kind,
- Firing = weapon.Firing,
- Ammo = weapon.Ammo
- };
-
- if (weapon is InstantWeapon instant)
- {
- state.BurstRemaining = instant.BurstRemaining;
- state.BurstTimer = instant.BurstTimer;
- state.BurstInterval = instant.BurstInterval;
- state.CooldownProgress = instant.CooldownProgress;
- state.CoolingDown = instant.CoolingDown;
- }
-
- if (weapon is ChargedWeapon charged)
- {
- state.Charging = charged.Charging;
- state.Charged = charged.Charged;
- state.Charge = charged.Charge;
- }
-
- if (weapon is ConstantWeapon constant)
- {
- state.Reloading = constant.Reloading;
- state.ReloadProgress = constant.ReloadProgress;
- state.AmmoIntervalProgress = constant.AmmoIntervalProgress;
- }
-
- if (weapon is LockWeapon lockWeapon)
- {
- state.LockProgress = lockWeapon.LockProgress;
- state.LockTargetEntityIndex = lockWeapon.LockTarget == null ? -1 : IndexOfEntity(entityGraph, lockWeapon.LockTarget);
- }
-
- yield return state;
- }
- }
-
- private static AetheriaRuntimeBehaviorProgressCommit[] ProjectBehaviorProgress(Entity entity)
- {
- var progress = new List();
-
- for (var ownerIndex = 0; ownerIndex < entity.Equipment.Count; ownerIndex++)
- progress.AddRange(ProjectBehaviorProgress("equipment", ownerIndex, entity.Equipment[ownerIndex].Behaviors));
-
- var activeConsumables = entity.ActiveConsumables;
- for (var ownerIndex = 0; ownerIndex < activeConsumables.Count; ownerIndex++)
- progress.AddRange(ProjectBehaviorProgress("active_consumable", ownerIndex, activeConsumables[ownerIndex].Behaviors));
-
- return progress.ToArray();
- }
-
- private static IEnumerable ProjectBehaviorProgress(
- string ownerKind,
- int ownerIndex,
- IReadOnlyList behaviors)
- {
- if (behaviors == null)
- yield break;
-
- for (var behaviorIndex = 0; behaviorIndex < behaviors.Count; behaviorIndex++)
- {
- if (!(behaviors[behaviorIndex] is IProgressBehavior progressBehavior))
- continue;
-
- yield return new AetheriaRuntimeBehaviorProgressCommit
- {
- OwnerKind = ownerKind,
- OwnerIndex = ownerIndex,
- BehaviorIndex = behaviorIndex,
- BehaviorKind = behaviors[behaviorIndex].Kind,
- Progress = progressBehavior.Progress
- };
- }
- }
-
- private static AetheriaRuntimeActiveConsumableCommit[] ProjectActiveConsumables(Entity entity)
- {
- return entity.ActiveConsumables?
- .Select(effect => new AetheriaRuntimeActiveConsumableCommit
- {
- ItemKey = effect.Item?.ItemKey ?? "",
- Quality = effect.Item?.Quality ?? 1.0,
- RemainingDuration = effect.RemainingDuration,
- Duration = effect.Duration
- })
- .ToArray() ?? Array.Empty();
- }
-
- private static AetheriaRuntimeEntityStatGridCommit[] ProjectEntityStatGrids(Entity entity)
- {
- return new[]
- {
- ProjectFloatGrid("temperature", entity.Temperature),
- ProjectFloatGrid("thermal_mass", entity.ThermalMass),
- ProjectFloatGrid("armor", entity.Armor),
- ProjectFloatGrid("max_armor", entity.MaxArmor),
- ProjectBool2Grid("hull_conductivity_x", entity.HullConductivity, axis: 0),
- ProjectBool2Grid("hull_conductivity_y", entity.HullConductivity, axis: 1)
- }
- .Where(grid => grid != null)
- .ToArray();
- }
-
- private static AetheriaRuntimeEntityStatGridCommit ProjectFloatGrid(string name, float[,] values)
- {
- if (values == null)
- return null;
-
- var width = values.GetLength(0);
- var height = values.GetLength(1);
- var flattened = new double[width * height];
- var index = 0;
- for (var y = 0; y < height; y++)
- for (var x = 0; x < width; x++)
- flattened[index++] = values[x, y];
-
- return new AetheriaRuntimeEntityStatGridCommit
- {
- Name = name,
- Width = width,
- Height = height,
- Values = flattened
- };
- }
-
- private static AetheriaRuntimeEntityStatGridCommit ProjectBool2Grid(string name, bool2[,] values, int axis)
- {
- if (values == null)
- return null;
-
- var width = values.GetLength(0);
- var height = values.GetLength(1);
- var flattened = new double[width * height];
- var index = 0;
- for (var y = 0; y < height; y++)
- for (var x = 0; x < width; x++)
- flattened[index++] = (axis == 0 ? values[x, y].x : values[x, y].y) ? 1.0 : 0.0;
-
- return new AetheriaRuntimeEntityStatGridCommit
- {
- Name = name,
- Width = width,
- Height = height,
- Values = flattened
- };
- }
-
- private static AetheriaRuntimeLoadoutItemSlotCommit[] ProjectEquippedSlots(IEnumerable slots)
- {
- return slots?
- .Select(slot => new AetheriaRuntimeLoadoutItemSlotCommit
- {
- X = slot.Position.x,
- Y = slot.Position.y,
- Item = ProjectLoadoutItem(slot.EquippableItem)
- })
- .ToArray() ?? Array.Empty();
- }
-
private static int ZoneIndex(GalaxyZone zone)
{
- return CurrentGalaxy?.Zones == null || zone == null ? -1 : Array.IndexOf(CurrentGalaxy.Zones, zone);
+ return ObservedGalaxy?.Zones == null || zone == null ? -1 : Array.IndexOf(ObservedGalaxy.Zones, zone);
}
private static int FactionIndex(Faction faction)
{
- return CurrentGalaxy?.Factions == null || faction == null ? -1 : Array.IndexOf(CurrentGalaxy.Factions, faction);
+ return ObservedGalaxy?.Factions == null || faction == null ? -1 : Array.IndexOf(ObservedGalaxy.Factions, faction);
}
- public void QueueRuntimeLoadoutTemplateCommit(EntityConstructionBlueprint blueprint)
+ public void RequestLoadoutTemplateSave(EntityConstructionBlueprint blueprint)
{
var loadout = ProjectLoadoutTemplate(blueprint);
- LoadoutTemplates.RemoveAll(template => template.Name == loadout.Name);
- LoadoutTemplates.Add(CreateRuntimeLoadoutTemplateSnapshot(loadout));
+ TrySendRuntimeLoadoutTemplateCommand(loadout, "unity-inventory", "loadout template save");
+ }
+
+ private static bool TrySendRuntimeLoadoutTemplateCommand(
+ AetheriaRuntimeLoadoutTemplateCommit loadout,
+ string clientId,
+ string label)
+ {
try
{
- var commit = AetheriaRuntimeStateCommitLog.QueueLoadoutTemplate(
- RuntimeStateFilePath,
- loadout);
- Debug.Log($"Queued Aetheria Verse loadout commit: {commit.Path}");
+ if (!AetheriaRuntimeEveCommands.TrySendLoadoutTemplateCommand(
+ RuntimeStateFilePath,
+ loadout,
+ clientId,
+ out var submitted,
+ out var error))
+ {
+ Debug.LogError($"Failed to submit Aetheria {label} Eve command: {error}");
+ return false;
+ }
+
+ Debug.Log($"Submitted Aetheria {label} Eve command: {submitted!.CommandId}");
+ return true;
}
catch (Exception ex)
{
- Debug.LogError($"Failed to queue Aetheria Verse loadout commit: {ex}");
+ Debug.LogError($"Failed to send Aetheria {label} Eve command: {ex}");
+ return false;
}
}
- public bool CommitRuntimeLoadoutRestore(AetheriaRuntimeLoadoutTemplateSnapshot template, out Entity entity)
+ public bool RequestRuntimeLoadoutRestore(AetheriaRuntimeLoadoutTemplateSnapshot template, out Entity entity)
{
entity = null;
var blueprint = CreateEntityConstructionBlueprint(template);
@@ -1721,51 +971,61 @@ public class ActionGameManager : MonoBehaviour
}
var price = blueprint.Price(ItemManager);
- if (price > Credits)
- return false;
-
- entity = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, blueprint, true);
- entity.SetParent(DockedEntity);
- Credits -= price;
- CurrentEntity = entity;
- if (entity is Ship ship)
+ var observer = ResolveDaemonObserver();
+ if (observer != null && observer.HasAuthoritativeState)
{
- ship.IsPlayerShip = true;
- if (DockingBay != null)
- DockingBay.DockedShip = ship;
+ return TryRequestDaemonLoadoutRestore(observer, template, price);
}
-
- QueueRunCheckpoint("loadout-restore");
- return true;
+ return false;
}
- public bool CommitDockedCurrentShip(Ship ship)
+ private bool TryRequestDaemonLoadoutRestore(
+ AetheriaDaemonObserver observer,
+ AetheriaRuntimeLoadoutTemplateSnapshot template,
+ int price)
+ {
+ if (observer == null ||
+ !observer.HasAuthoritativeState ||
+ template == null ||
+ string.IsNullOrWhiteSpace(template.Name) ||
+ price < 0)
+ {
+ return false;
+ }
+
+ var dockedEntityKey = ResolveEntityRecordKey(DockedEntity);
+ if (string.IsNullOrWhiteSpace(dockedEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.RestoreLoadout(dockedEntityKey, template.Name, price);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon loadout restore operation: {ex.Message}");
+ return false;
+ }
+ }
+
+ public bool RequestDockedCurrentShip(Ship ship)
{
if (ship == null ||
!ship.IsPlayerShip ||
DockedEntity == null ||
- DockingBay == null ||
- !DockedEntity.Children.Contains(ship))
+ DockingBay == null)
{
return false;
}
- CurrentEntity = ship;
- DockingBay.DockedShip = ship;
- QueueRunCheckpoint("docked-current-ship");
- return true;
- }
-
- private static AetheriaRuntimeLoadoutTemplateSnapshot CreateRuntimeLoadoutTemplateSnapshot(
- AetheriaRuntimeLoadoutTemplateCommit template)
- {
- var timestamp = DateTime.UtcNow.ToString("O");
- return new AetheriaRuntimeLoadoutTemplateSnapshot(
- template.Name ?? "",
- template.OwnerPlayerKey ?? "",
- CreateRuntimeEntityLoadoutSnapshot(template.RootEntity),
- timestamp,
- timestamp);
+ if (TryRequestDaemonDockedCurrentShip(ship))
+ {
+ return true;
+ }
+ return false;
}
private static AetheriaRuntimeEntityLoadoutSnapshot CreateRuntimeEntityLoadoutSnapshot(
@@ -1824,168 +1084,54 @@ public class ActionGameManager : MonoBehaviour
.ToArray();
}
- private void OnApplicationQuit() => QueueRunCheckpoint("application-quit");
-
- private void QueueRunCheckpoint(string reason)
- {
- if (CurrentGalaxy == null)
- return;
-
- try
- {
- var commit = AetheriaRuntimeStateCommitLog.QueueRunCheckpoint(
- RuntimeStateFilePath,
- ProjectRunCheckpoint());
- Debug.Log($"Queued Aetheria Verse run checkpoint ({reason}): {commit.Path}");
- }
- catch (Exception ex)
- {
- Debug.LogError($"Failed to queue Aetheria Verse run checkpoint ({reason}): {ex}");
- }
- }
-
- public void CommitEntityOverrideShutdown(Entity entity, bool enabled)
+ public void RequestEntityOverrideShutdown(Entity entity, bool enabled)
{
if (entity == null)
return;
- entity.OverrideShutdown = enabled;
- QueueRunCheckpoint("entity-override-shutdown");
+ if (TryRequestDaemonEntityOverrideShutdown(entity, enabled))
+ return;
}
- public void CommitEntityName(Entity entity, string name)
+ public void RequestEntityName(Entity entity, string name)
{
if (entity == null)
return;
- entity.Name = name ?? "";
- QueueRunCheckpoint("entity-name");
+ if (TryRequestDaemonEntityName(entity, name))
+ return;
}
- public bool CommitWeaponGroupMembership(EquippedItem item, int groupIndex, bool assigned)
+ public bool RequestWeaponGroupMembership(EquippedItem item, int groupIndex, bool assigned)
{
- if (item?.Entity?.WeaponGroups == null ||
- groupIndex < 0 ||
- groupIndex >= item.Entity.WeaponGroups.Length)
+ if (item == null ||
+ groupIndex < 0)
{
return false;
}
- var weapon = item.GetBehavior();
- if (weapon == null)
- return false;
-
- var group = item.Entity.WeaponGroups[groupIndex];
- if (assigned)
- {
- if (!group.items.Contains(item))
- group.items.Add(item);
- if (!group.weapons.Contains(weapon))
- group.weapons.Add(weapon);
- }
- else
- {
- group.items.Remove(item);
- group.weapons.Remove(weapon);
- }
-
- QueueRunCheckpoint("weapon-group-membership");
- return true;
- }
-
- public bool CommitCargoItemTransfer(EquippedCargoBay origin, EquippedCargoBay destination, ItemInstance item)
- {
- if (origin == null ||
- destination == null ||
- item == null ||
- origin == destination ||
- !origin.Cargo.ContainsKey(item) ||
- !destination.TryFindSpace(item))
- {
- return false;
- }
-
- if (item is SimpleCommodity commodity)
- {
- var quantity = commodity.Quantity;
- var transferItem = new SimpleCommodity
- {
- Reference = commodity.Reference,
- Quantity = quantity,
- Rotation = commodity.Rotation
- };
-
- if (!destination.TryStore(transferItem))
- return false;
-
- origin.Remove(commodity, quantity);
- QueueRunCheckpoint("cargo-item-transfer");
+ if (TryRequestDaemonWeaponGroupMembership(item, groupIndex, assigned))
return true;
- }
-
- if (!destination.TryStore(item))
- return false;
-
- origin.Remove(item);
- QueueRunCheckpoint("cargo-item-transfer");
- return true;
- }
-
- public bool CommitLootPickup(Entity entity, ItemInstance item)
- {
- if (entity == null || item == null)
- return false;
-
- foreach (var cargoBay in entity.CargoBays)
- {
- if (!cargoBay.TryStore(item))
- continue;
-
- QueueRunCheckpoint("loot-pickup");
- return true;
- }
-
return false;
}
- public bool CommitEntityDestroyed(Entity entity, ZoneRenderer zoneRenderer)
+ public bool RequestCargoItemTransfer(EquippedCargoBay origin, EquippedCargoBay destination, ItemInstance item)
{
- if (entity?.Zone == null)
- return false;
-
- if (zoneRenderer != null)
+ if (origin == null ||
+ destination == null ||
+ item == null)
{
- foreach (var gear in entity.Equipment)
- {
- if (gear == entity.EquippedHull || Random.value >= zoneRenderer.Settings.LootDropProbability)
- continue;
-
- zoneRenderer.DropItem(
- entity.Position,
- Random.onUnitSphere * zoneRenderer.Settings.LootDropVelocity,
- gear.EquippableItem);
- }
-
- foreach (var cargo in entity.CargoBays)
- {
- foreach (var item in cargo.Cargo.Keys.ToArray())
- {
- zoneRenderer.DropItem(
- entity.Position,
- Random.onUnitSphere * zoneRenderer.Settings.LootDropVelocity,
- item);
- }
- }
+ return false;
}
- if (!entity.Zone.Entities.Remove(entity))
- return false;
-
- QueueRunCheckpoint("entity-destroyed");
- return true;
+ if (TryRequestDaemonCargoItemTransfer(origin, destination, item, default, false))
+ {
+ return true;
+ }
+ return false;
}
- public bool CommitCargoItemTransfer(
+ public bool RequestCargoItemTransfer(
EquippedCargoBay origin,
EquippedCargoBay destination,
ItemInstance item,
@@ -1993,73 +1139,86 @@ public class ActionGameManager : MonoBehaviour
{
if (origin == null ||
destination == null ||
- item == null ||
- !origin.Cargo.ContainsKey(item) ||
- !destination.ItemFits(item, destinationPosition))
+ item == null)
{
return false;
}
- if (origin == destination)
+ if (TryRequestDaemonCargoItemTransfer(origin, destination, item, destinationPosition, true))
{
- var originalPosition = origin.Cargo[item];
- origin.Remove(item);
- if (!destination.TryStore(item, destinationPosition))
- {
- origin.TryStore(item, originalPosition);
- return false;
- }
-
- QueueRunCheckpoint("cargo-item-transfer");
return true;
}
-
- if (item is SimpleCommodity commodity)
- {
- var quantity = commodity.Quantity;
- var transferItem = new SimpleCommodity
- {
- Reference = commodity.Reference,
- Quantity = quantity,
- Rotation = commodity.Rotation
- };
-
- if (!destination.TryStore(transferItem, destinationPosition))
- return false;
-
- origin.Remove(commodity, quantity);
- QueueRunCheckpoint("cargo-item-transfer");
- return true;
- }
-
- if (!destination.TryStore(item, destinationPosition))
- return false;
-
- origin.Remove(item);
- QueueRunCheckpoint("cargo-item-transfer");
- return true;
+ return false;
}
- public bool CommitCargoItemEquip(EquippedCargoBay origin, Entity destination, EquippableItem item)
+ private bool TryRequestDaemonCargoItemTransfer(
+ EquippedCargoBay origin,
+ EquippedCargoBay destination,
+ ItemInstance item,
+ int2 destinationPosition,
+ bool hasDestinationPosition)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ if (!TryResolveCargoBayCommandTarget(origin, out var originEntityKey, out var originCargoIndex) ||
+ !TryResolveCargoBayCommandTarget(destination, out var destinationEntityKey, out var destinationCargoIndex) ||
+ item == null ||
+ string.IsNullOrWhiteSpace(item.ItemKey) ||
+ !origin.Cargo.TryGetValue(item, out var sourcePosition))
+ {
+ return false;
+ }
+
+ var quantity = item is SimpleCommodity commodity ? commodity.Quantity : 1;
+ if (quantity <= 0)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.TransferCargoItem(
+ originEntityKey,
+ originCargoIndex,
+ destinationEntityKey,
+ destinationCargoIndex,
+ item.ItemKey,
+ quantity,
+ sourcePosition.x,
+ sourcePosition.y,
+ destinationPosition.x,
+ destinationPosition.y,
+ hasDestinationPosition);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon cargo transfer operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ public bool RequestCargoItemEquip(EquippedCargoBay origin, Entity destination, EquippableItem item)
{
if (origin == null ||
destination == null ||
- item == null ||
- !origin.Cargo.ContainsKey(item) ||
- !destination.TryFindSpace(item, out _))
+ item == null)
{
return false;
}
- if (!destination.TryEquip(item))
- return false;
-
- origin.Remove(item);
- QueueRunCheckpoint("cargo-item-equip");
- return true;
+ if (TryRequestDaemonCargoItemEquip(origin, destination, item, default, false))
+ {
+ return true;
+ }
+ return false;
}
- public bool CommitCargoItemEquip(
+ public bool RequestCargoItemEquip(
EquippedCargoBay origin,
Entity destination,
EquippableItem item,
@@ -2067,47 +1226,35 @@ public class ActionGameManager : MonoBehaviour
{
if (origin == null ||
destination == null ||
- item == null ||
- !origin.Cargo.ContainsKey(item) ||
- !destination.ItemFits(item, destinationPosition))
+ item == null)
{
return false;
}
- if (!destination.TryEquip(item, destinationPosition))
- return false;
-
- origin.Remove(item);
- QueueRunCheckpoint("cargo-item-equip");
- return true;
+ if (TryRequestDaemonCargoItemEquip(origin, destination, item, destinationPosition, true))
+ {
+ return true;
+ }
+ return false;
}
- public bool CommitEquippedItemStore(Entity origin, EquippedItem equippedItem, EquippedCargoBay destination)
+ public bool RequestEquippedItemStore(Entity origin, EquippedItem equippedItem, EquippedCargoBay destination)
{
if (origin == null ||
equippedItem?.EquippableItem == null ||
- destination == null ||
- !origin.Equipment.Contains(equippedItem) ||
- !destination.TryFindSpace(equippedItem.EquippableItem))
+ destination == null)
{
return false;
}
- var item = origin.TryUnequip(equippedItem);
- if (item == null)
- return false;
-
- if (!destination.TryStore(item))
+ if (TryRequestDaemonEquippedItemStore(origin, equippedItem, destination, default, false))
{
- origin.TryEquip(item, equippedItem.Position);
- return false;
+ return true;
}
-
- QueueRunCheckpoint("equipped-item-store");
- return true;
+ return false;
}
- public bool CommitEquippedItemStore(
+ public bool RequestEquippedItemStore(
Entity origin,
EquippedItem equippedItem,
EquippedCargoBay destination,
@@ -2115,29 +1262,19 @@ public class ActionGameManager : MonoBehaviour
{
if (origin == null ||
equippedItem?.EquippableItem == null ||
- destination == null ||
- !origin.Equipment.Contains(equippedItem) ||
- !destination.ItemFits(equippedItem.EquippableItem, destinationPosition))
+ destination == null)
{
return false;
}
- var originalPosition = equippedItem.Position;
- var item = origin.TryUnequip(equippedItem);
- if (item == null)
- return false;
-
- if (!destination.TryStore(item, destinationPosition))
+ if (TryRequestDaemonEquippedItemStore(origin, equippedItem, destination, destinationPosition, true))
{
- origin.TryEquip(item, originalPosition);
- return false;
+ return true;
}
-
- QueueRunCheckpoint("equipped-item-store");
- return true;
+ return false;
}
- public bool CommitEquippedItemEquip(
+ public bool RequestEquippedItemEquip(
Entity origin,
EquippedItem equippedItem,
Entity destination,
@@ -2145,29 +1282,158 @@ public class ActionGameManager : MonoBehaviour
{
if (origin == null ||
equippedItem?.EquippableItem == null ||
- destination == null ||
- !origin.Equipment.Contains(equippedItem) ||
- !destination.ItemFits(equippedItem.EquippableItem, destinationPosition))
+ destination == null)
{
return false;
}
- var originalPosition = equippedItem.Position;
- var item = origin.TryUnequip(equippedItem);
- if (item == null)
- return false;
-
- if (!destination.TryEquip(item, destinationPosition))
+ if (TryRequestDaemonEquippedItemEquip(origin, equippedItem, destination, destinationPosition))
{
- origin.TryEquip(item, originalPosition);
- return false;
+ return true;
}
-
- QueueRunCheckpoint("equipped-item-equip");
- return true;
+ return false;
}
- public bool CommitTradePurchase(
+ private bool TryRequestDaemonCargoItemEquip(
+ EquippedCargoBay origin,
+ Entity destination,
+ EquippableItem item,
+ int2 destinationPosition,
+ bool hasDestinationPosition)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ if (!TryResolveCargoBayCommandTarget(origin, out var originEntityKey, out var originCargoIndex) ||
+ destination == null ||
+ item == null ||
+ string.IsNullOrWhiteSpace(item.ItemKey) ||
+ !origin.Cargo.TryGetValue(item, out var sourcePosition))
+ {
+ return false;
+ }
+
+ var destinationEntityKey = ResolveEntityRecordKey(destination);
+ if (string.IsNullOrWhiteSpace(destinationEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.EquipItem(
+ "cargo",
+ originEntityKey,
+ originCargoIndex,
+ destinationEntityKey,
+ item.ItemKey,
+ sourcePosition.x,
+ sourcePosition.y,
+ destinationPosition.x,
+ destinationPosition.y,
+ hasDestinationPosition);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon item equip operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonEquippedItemStore(
+ Entity origin,
+ EquippedItem equippedItem,
+ EquippedCargoBay destination,
+ int2 destinationPosition,
+ bool hasDestinationPosition)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ if (!TryResolveEquippedItemCommandTarget(equippedItem, out var originEntityKey, out var sourceEquipmentIndex) ||
+ !TryResolveCargoBayCommandTarget(destination, out var destinationEntityKey, out var destinationCargoIndex) ||
+ origin == null ||
+ equippedItem?.EquippableItem == null)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.StoreItem(
+ originEntityKey,
+ sourceEquipmentIndex,
+ destinationEntityKey,
+ destinationCargoIndex,
+ equippedItem.EquippableItem.ItemKey,
+ destinationPosition.x,
+ destinationPosition.y,
+ hasDestinationPosition);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon item store operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonEquippedItemEquip(
+ Entity origin,
+ EquippedItem equippedItem,
+ Entity destination,
+ int2 destinationPosition)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ if (!TryResolveEquippedItemCommandTarget(equippedItem, out var originEntityKey, out var sourceEquipmentIndex) ||
+ origin == null ||
+ destination == null ||
+ equippedItem?.EquippableItem == null)
+ {
+ return false;
+ }
+
+ var destinationEntityKey = ResolveEntityRecordKey(destination);
+ if (string.IsNullOrWhiteSpace(destinationEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.EquipItem(
+ "equipment",
+ originEntityKey,
+ sourceEquipmentIndex,
+ destinationEntityKey,
+ equippedItem.EquippableItem.ItemKey,
+ equippedItem.Position.x,
+ equippedItem.Position.y,
+ destinationPosition.x,
+ destinationPosition.y,
+ true);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon equipped-item equip operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ public bool RequestTradePurchase(
EquippedCargoBay stationInventory,
EquippedCargoBay targetCargo,
CraftedItemInstance item,
@@ -2175,41 +1441,41 @@ public class ActionGameManager : MonoBehaviour
bool createsDockedShip)
{
if (item == null ||
- price < 0 ||
- price > Credits)
+ price < 0)
{
return false;
}
if (createsDockedShip)
{
- if (!(item is EquippableItem hull) ||
+ if (!(item is EquippableItem) ||
Zone == null ||
DockedEntity == null)
{
return false;
}
- var ship = new Ship(ItemManager, Zone, hull, NewEntitySettings) { IsPlayerShip = true };
- ship.SetParent(DockedEntity);
- Credits -= price;
- QueueRunCheckpoint("trade-purchase");
- return true;
+ if (TryRequestDaemonTradePurchase(stationInventory, targetCargo, item, 1, price, price, true))
+ {
+ return true;
+ }
+ return false;
}
if (stationInventory == null ||
- targetCargo == null ||
- !stationInventory.TryTransferItem(targetCargo, item))
+ targetCargo == null)
{
return false;
}
- Credits -= price;
- QueueRunCheckpoint("trade-purchase");
- return true;
+ if (TryRequestDaemonTradePurchase(stationInventory, targetCargo, item, 1, price, price, false))
+ {
+ return true;
+ }
+ return false;
}
- public bool CommitTradePurchase(
+ public bool RequestTradePurchase(
EquippedCargoBay stationInventory,
EquippedCargoBay targetCargo,
SimpleCommodity item,
@@ -2226,45 +1492,132 @@ public class ActionGameManager : MonoBehaviour
}
var totalPrice = (long)quantity * unitPrice;
- if (totalPrice > Credits || totalPrice > int.MaxValue)
+ if (totalPrice > int.MaxValue)
return false;
- if (!stationInventory.TryTransferItem(targetCargo, item, quantity))
- return false;
-
- Credits -= (int)totalPrice;
- QueueRunCheckpoint("trade-purchase");
- return true;
+ if (TryRequestDaemonTradePurchase(stationInventory, targetCargo, item, quantity, unitPrice, (int)totalPrice, false))
+ {
+ return true;
+ }
+ return false;
}
- public void CommitEquippedItemOverrideShutdown(EquippedItem item, bool enabled)
+ private bool TryRequestDaemonTradePurchase(
+ EquippedCargoBay stationInventory,
+ EquippedCargoBay targetCargo,
+ ItemInstance item,
+ int quantity,
+ int unitPrice,
+ int totalPrice,
+ bool createsDockedShip)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ if (item == null ||
+ string.IsNullOrWhiteSpace(item.ItemKey) ||
+ quantity <= 0 ||
+ unitPrice < 0 ||
+ totalPrice < 0)
+ {
+ return false;
+ }
+
+ var stationEntityKey = "";
+ var stationCargoIndex = -1;
+ var sourcePosition = new int2(-1, -1);
+ if (stationInventory != null)
+ {
+ TryResolveCargoBayCommandTarget(stationInventory, out stationEntityKey, out stationCargoIndex);
+ stationInventory.Cargo.TryGetValue(item, out sourcePosition);
+ }
+
+ var targetEntityKey = "";
+ var targetCargoIndex = -1;
+ if (targetCargo != null)
+ {
+ TryResolveCargoBayCommandTarget(targetCargo, out targetEntityKey, out targetCargoIndex);
+ }
+
+ if (createsDockedShip)
+ {
+ targetEntityKey = ResolveEntityRecordKey(DockedEntity);
+ targetCargoIndex = -1;
+ }
+ else if (string.IsNullOrWhiteSpace(stationEntityKey) ||
+ stationCargoIndex < 0 ||
+ string.IsNullOrWhiteSpace(targetEntityKey) ||
+ targetCargoIndex < 0)
+ {
+ return false;
+ }
+
+ if (string.IsNullOrWhiteSpace(targetEntityKey))
+ {
+ return false;
+ }
+
+ var purchaseKind = createsDockedShip
+ ? "docked_ship"
+ : item is SimpleCommodity
+ ? "commodity"
+ : "crafted";
+
+ try
+ {
+ observer.Operations.TradePurchase(
+ purchaseKind,
+ item.ItemKey,
+ quantity,
+ unitPrice,
+ totalPrice,
+ stationEntityKey,
+ stationCargoIndex,
+ targetEntityKey,
+ targetCargoIndex,
+ sourcePosition.x,
+ sourcePosition.y,
+ createsDockedShip);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon trade purchase operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ public void RequestEquippedItemOverrideShutdown(EquippedItem item, bool enabled)
{
if (item?.EquippableItem == null)
return;
- item.EquippableItem.OverrideShutdown = enabled;
- QueueRunCheckpoint("item-override-shutdown");
+ if (TryRequestDaemonEquippedItemOverrideShutdown(item, enabled))
+ return;
}
- public void CommitThermotoggleTargetTemperature(Thermotoggle thermotoggle, float targetTemperature)
+ public void RequestThermotoggleTargetTemperature(Thermotoggle thermotoggle, float targetTemperature)
{
if (thermotoggle == null)
return;
- thermotoggle.TargetTemperature = targetTemperature;
- QueueRunCheckpoint("thermotoggle-target-temperature");
+ if (TryRequestDaemonThermotoggleTargetTemperature(thermotoggle, targetTemperature))
+ return;
}
- public void CommitEntityShutdownPerformance(Entity entity, float shutdownPerformance)
+ public void RequestEntityShutdownPerformance(Entity entity, float shutdownPerformance)
{
if (entity?.Settings == null)
return;
- entity.Settings.ShutdownPerformance = shutdownPerformance;
- QueueRunCheckpoint("entity-shutdown-performance");
+ if (TryRequestDaemonEntityShutdownPerformance(entity, shutdownPerformance))
+ return;
}
- public bool CommitHullConductivityToggle(Entity entity, int2 position, int axis)
+ public bool RequestHullConductivityToggle(Entity entity, int2 position, int axis)
{
if (entity?.HullConductivity == null ||
position.x < 0 ||
@@ -2277,49 +1630,321 @@ public class ActionGameManager : MonoBehaviour
return false;
}
- var conductivity = entity.HullConductivity[position.x, position.y];
- if (axis == 0)
- conductivity.x = !conductivity.x;
- else
- conductivity.y = !conductivity.y;
+ if (TryRequestDaemonHullConductivityToggle(entity, position, axis))
+ {
+ return true;
+ }
+ return false;
+ }
- entity.HullConductivity[position.x, position.y] = conductivity;
- QueueRunCheckpoint("hull-conductivity-toggle");
- return true;
+ private bool TryRequestDaemonHullConductivityToggle(Entity entity, int2 position, int axis)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var targetEntityKey = ResolveEntityRecordKey(entity);
+ if (string.IsNullOrWhiteSpace(targetEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.ToggleHullConductivity(targetEntityKey, position.x, position.y, axis);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon hull-conductivity operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonEntityName(Entity entity, string name)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var targetEntityKey = ResolveEntityRecordKey(entity);
+ if (string.IsNullOrWhiteSpace(targetEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetEntityName(targetEntityKey, name ?? "");
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon entity-name operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonEquippedItemOverrideShutdown(EquippedItem item, bool enabled)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ if (!TryResolveEquippedItemCommandTarget(item, out var targetEntityKey, out var equipmentIndex))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetItemOverrideShutdown(targetEntityKey, equipmentIndex, enabled);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon item override-shutdown operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonWeaponGroupMembership(EquippedItem item, int groupIndex, bool assigned)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ if (!TryResolveEquippedItemCommandTarget(item, out var targetEntityKey, out var equipmentIndex))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetWeaponGroupMembership(targetEntityKey, equipmentIndex, groupIndex, assigned);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon weapon-group membership operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonThermotoggleTargetTemperature(Thermotoggle thermotoggle, float targetTemperature)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var item = thermotoggle.Item;
+ if (!TryResolveEquippedItemCommandTarget(item, out var targetEntityKey, out var equipmentIndex))
+ {
+ return false;
+ }
+
+ var behaviorIndex = Array.IndexOf(item.Behaviors, thermotoggle);
+ if (behaviorIndex < 0)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetThermotoggleTargetTemperature(
+ targetEntityKey,
+ equipmentIndex,
+ behaviorIndex,
+ targetTemperature);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon thermotoggle operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonEntityShutdownPerformance(Entity entity, float shutdownPerformance)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var targetEntityKey = ResolveEntityRecordKey(entity);
+ if (string.IsNullOrWhiteSpace(targetEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetShutdownPerformance(targetEntityKey, shutdownPerformance);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon shutdown-performance operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonEntityOverrideShutdown(Entity entity, bool enabled)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var targetEntityKey = ResolveEntityRecordKey(entity);
+ if (string.IsNullOrWhiteSpace(targetEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetEntityOverrideShutdown(targetEntityKey, enabled);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon entity override-shutdown operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonActionBarBinding(AetheriaRuntimeActionBarBindingCommit binding)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || binding == null)
+ {
+ return false;
+ }
+
+ if (string.IsNullOrWhiteSpace(binding.ControlPath) ||
+ string.IsNullOrWhiteSpace(binding.Kind))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetActionBarBinding(
+ binding.ControlPath,
+ binding.Kind,
+ binding.ItemKey ?? "",
+ binding.EquipmentIndex,
+ binding.BehaviorIndex,
+ binding.WeaponGroup);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon action-bar binding operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonActionBarBindingClear(ActionBarSlot slot)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || slot == null)
+ {
+ return false;
+ }
+
+ var controlPath = slot.ControlPath ?? "";
+ if (string.IsNullOrWhiteSpace(controlPath))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.ClearActionBarBinding(controlPath);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon action-bar clear operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryResolveEquippedItemCommandTarget(
+ EquippedItem item,
+ out string targetEntityKey,
+ out int equipmentIndex)
+ {
+ targetEntityKey = "";
+ equipmentIndex = -1;
+
+ var entity = item?.Entity;
+ if (entity?.Equipment == null)
+ {
+ return false;
+ }
+
+ equipmentIndex = entity.Equipment.IndexOf(item);
+ if (equipmentIndex < 0)
+ {
+ return false;
+ }
+
+ targetEntityKey = ResolveEntityRecordKey(entity);
+ return !string.IsNullOrWhiteSpace(targetEntityKey);
+ }
+
+ private bool TryResolveCargoBayCommandTarget(
+ EquippedCargoBay cargoBay,
+ out string targetEntityKey,
+ out int equipmentIndex)
+ {
+ return TryResolveEquippedItemCommandTarget(cargoBay, out targetEntityKey, out equipmentIndex);
}
private void OnDisable()
{
Input.Dispose();
- EntityInstance.ClearWeaponManagers();
}
void Start()
{
Instance = this;
- EntityInstance.EffectManagerParent = EffectManagerParent;
-
var stateBoot = AetheriaRuntimeStateBoot.Inspect(GameDataDirectory);
_runtimeStateFilePath = stateBoot.StateFilePath;
Debug.Log(
$"Aetheria runtime target: {stateBoot.TargetLabel} via {stateBoot.TargetKind} ({stateBoot.TargetSource})");
- Debug.Log($"Aetheria typed state file: {stateBoot.StateFilePath}");
+ Debug.Log($"Aetheria runtime state file: {stateBoot.StateFilePath}");
if (!stateBoot.SupportsLocalStateFileRead)
{
throw new InvalidOperationException(
- $"Aetheria runtime target cannot boot gameplay from local typed state: {stateBoot.FailureMessage}");
+ $"Aetheria runtime target cannot read the daemon mirror state required for gameplay boot: {stateBoot.FailureMessage}");
}
if (!stateBoot.StateFileExists)
{
- Debug.LogWarning("Aetheria typed state file is missing. Run the Aetheria.State importer before treating legacy catalog data as runtime state.");
- }
- else
- {
- RuntimeCatalog = AetheriaRuntimeStateReader.OpenRuntimeCatalog(stateBoot.StateFilePath);
- Debug.Log($"Aetheria typed runtime catalog: {RuntimeCatalog.Items.Count} items, {RuntimeCatalog.Corporations.Count} corporations, {RuntimeCatalog.NameFiles.Count} name files");
+ throw new InvalidOperationException(
+ $"Aetheria runtime state file is missing at {stateBoot.StateFilePath}; gameplay requires an authoritative daemon mirror.");
}
+ RuntimeCatalog = AetheriaRuntimeStateReader.OpenRuntimeCatalog(stateBoot.StateFilePath);
+ Debug.Log($"Aetheria runtime catalog: {RuntimeCatalog.Items.Count} items, {RuntimeCatalog.Corporations.Count} corporations, {RuntimeCatalog.NameFiles.Count} name files");
+
if (RuntimeCatalog == null)
{
throw new InvalidOperationException("Aetheria typed runtime catalog is required before gameplay boot.");
@@ -2331,11 +1956,11 @@ public class ActionGameManager : MonoBehaviour
Debug.Log);
LoadRuntimeLoadoutTemplates(stateBoot.StateFilePath);
ZoneRenderer.ItemManager = ItemManager;
-
+
// If hiding minimap asteroids, turn them off to start with
if (!RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap)
ZoneRenderer.ShowAsteroidUI = false;
-
+
// TODO: Process Stories
#region Input Handling
@@ -2356,7 +1981,7 @@ public class ActionGameManager : MonoBehaviour
Input.Global.ZoneMap.performed += context =>
{
ToggleMenuTab(MenuTab.Map);
- MenuMap.Position = CurrentEntity.Position.xz;
+ MenuMap.Position = AetheriaMath.ToUnity(CurrentEntity.CultPositionXZ);
};
Input.Global.Inventory.performed += context => ToggleMenuTab(MenuTab.Inventory);
@@ -2379,12 +2004,13 @@ public class ActionGameManager : MonoBehaviour
{
foreach (var wormhole in ZoneRenderer.WormholeInstances.Keys)
{
- if (!(length(wormhole.Position - CurrentEntity.Position.xz) < Settings.GameplaySettings.WormholeExitRadius)) continue;
- EnterWormhole(wormhole);
+ if (!(CultMath.math.length(wormhole.Position - CurrentEntity.CultPositionXZ) < Settings.GameplaySettings.WormholeExitRadius)) continue;
+ RequestEnterWormhole(wormhole);
+ return;
}
- Dock();
+ RequestDock();
}
- else Undock();
+ else RequestUndock();
};
Input.Global.MainMenu.performed += context =>
@@ -2394,7 +2020,7 @@ public class ActionGameManager : MonoBehaviour
else
ToggleFullscreenMenu(MainMenu.gameObject);
};
-
+
Input.Global.InputScreen.performed += context => ToggleFullscreenMenu(HelpScreen);
Input.Player.HideUI.performed += context =>
@@ -2407,27 +2033,24 @@ public class ActionGameManager : MonoBehaviour
Input.Player.OverrideShutdown.performed += context =>
{
if (CurrentEntity != null)
- CommitEntityOverrideShutdown(CurrentEntity, !CurrentEntity.OverrideShutdown);
+ RequestOverrideShutdown(!CurrentEntity.OverrideShutdown);
};
Input.Player.Ping.performed += context =>
{
- CurrentEntity.Sensor?.Ping();
+ RequestSensorPing();
};
Input.Player.ToggleHeatsinks.performed += context =>
{
- CurrentEntity.HeatsinksEnabled = !CurrentEntity.HeatsinksEnabled;
+ RequestHeatsinksEnabled(!CurrentEntity.HeatsinksEnabled);
// TODO: SFX: Success/Fail
};
Input.Player.ToggleShield.performed += context =>
{
- if (CurrentEntity.Shield != null)
- {
- CurrentEntity.Shield.Item.Enabled.Value = !CurrentEntity.Shield.Item.Enabled.Value;
- // TODO: SFX: Success/Fail
- }
+ RequestShieldToggle();
+ // TODO: SFX: Success/Fail
};
#region Targeting
@@ -2436,35 +2059,41 @@ public class ActionGameManager : MonoBehaviour
{
if (!CurrentEntity.VisibleEnemies.Any()) return;
var underReticle = CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity)
- .MaxBy(x => dot(normalize(x.Position - CurrentEntity.Position), CurrentEntity.LookDirection));
- CurrentEntity.Target.Value = CurrentEntity.Target.Value == underReticle ? null : underReticle;
+ .MaxBy(x => CultMath.math.dot(
+ CultMath.math.normalize(x.CultPosition - CurrentEntity.CultPosition),
+ CurrentEntity.CultLookDirection));
+ RequestTargetSelection(CurrentEntity.Target.Value == underReticle ? null : underReticle);
};
Input.Player.TargetNearest.performed += context =>
{
if(CurrentEntity.VisibleEnemies.Any())
{
- CurrentEntity.Target.Value = CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity)
- .MaxBy(x => length(x.Position - CurrentEntity.Position));
+ RequestTargetSelection(CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity)
+ .MaxBy(x => CultMath.math.length(x.CultPosition - CurrentEntity.CultPosition)));
}
};
Input.Player.TargetNext.performed += context =>
{
if (!CurrentEntity.VisibleEnemies.Any()) return;
- var targets = CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity).OrderBy(x => length(x.Position - CurrentEntity.Position)).ToArray();
+ var targets = CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity)
+ .OrderBy(x => CultMath.math.length(x.CultPosition - CurrentEntity.CultPosition))
+ .ToArray();
var currentTargetIndex = Array.IndexOf(targets, CurrentEntity.Target.Value);
- CurrentEntity.Target.Value = targets[(currentTargetIndex + 1) % targets.Length];
+ RequestTargetSelection(targets[(currentTargetIndex + 1) % targets.Length]);
};
Input.Player.TargetPrevious.performed += context =>
{
if (!CurrentEntity.VisibleEnemies.Any()) return;
- var targets = CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity).OrderBy(x => length(x.Position - CurrentEntity.Position)).ToArray();
+ var targets = CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity)
+ .OrderBy(x => CultMath.math.length(x.CultPosition - CurrentEntity.CultPosition))
+ .ToArray();
var currentTargetIndex = Array.IndexOf(targets, CurrentEntity.Target.Value);
- CurrentEntity.Target.Value = targets[(currentTargetIndex + targets.Length - 1) % targets.Length];
+ RequestTargetSelection(targets[(currentTargetIndex + targets.Length - 1) % targets.Length]);
};
-
+
#endregion
@@ -2497,7 +2126,7 @@ public class ActionGameManager : MonoBehaviour
slot.PointerEnterTrigger.OnPointerEnterAsObservable().Subscribe(_ =>
{
//Debug.Log($"Pointer entered action bar slot {controlPath}");
- RegisterDragTarget(dragAction => CommitActionBarBinding(slot, dragAction));
+ RegisterDragTarget(dragAction => RequestActionBarBinding(slot, dragAction));
});
slot.PointerExitTrigger.OnPointerExitAsObservable().Subscribe(_ =>
{
@@ -2555,63 +2184,62 @@ public class ActionGameManager : MonoBehaviour
foreach (var a in _actionBarActions) a.Disable();
}
- private void EnterWormhole(Wormhole wormhole)
+ private void RequestEnterWormhole(Wormhole wormhole)
{
- if (!(CurrentEntity is Ship ship) || ship.WormholeAnimationInProgress) return;
- // var wormholeCameraFollow = new GameObject("Wormhole Camera Follow").transform;
- // wormholeCameraFollow.position = new Vector3(wormhole.Position.x, -50, wormhole.Position.y);
- // wormholeCameraFollow.rotation = Quaternion.LookRotation(Vector3.down, ship.LookDirection);
- // WormholeCamera.enabled = true;
- // WormholeCamera.Follow = wormholeCameraFollow;
- // FollowCamera.enabled = false;
- ship.EnterWormhole(wormhole.Position);
- ship.OnEnteredWormhole += () =>
- {
- var oldZone = Zone;
- PopulateLevel(wormhole.Target);
- foreach (var zone in wormhole.Target.AdjacentZones)
- CurrentGalaxy.DiscoveredZones.Add(zone);
- SectorMap.QueueZoneReveal(wormhole.Target.AdjacentZones);
- ship.ExitWormhole(ZoneRenderer.WormholeInstances.Keys.First(w => w.Target == oldZone.GalaxyZone).Position,
- Settings.GameplaySettings.WormholeExitVelocity * ItemManager.Random.NextFloat2Direction());
- CurrentEntity.Zone = Zone;
- QueueRunCheckpoint("wormhole-transition");
- };
+ TryRequestDaemonEnterWormhole(wormhole);
}
- public void PopulateLevel(GalaxyZone galaxyZone)
+ private bool TryRequestDaemonEnterWormhole(Wormhole wormhole)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null ||
+ !observer.HasAuthoritativeState ||
+ wormhole == null)
+ {
+ return false;
+ }
+
+ var targetZoneIndex = ZoneIndex(wormhole.Target);
+ if (targetZoneIndex < 0)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.EnterWormhole(targetZoneIndex, wormhole.Position.x, wormhole.Position.y);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon wormhole operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ public void PopulateLevel(GalaxyZone galaxyZone, AetheriaRuntimeZoneSnapshotCommit daemonZone = null)
{
if (galaxyZone == null) throw new ArgumentNullException(nameof(galaxyZone));
-
+
+ if (daemonZone == null)
+ {
+ Debug.LogWarning($"Daemon-authoritative zone population suppressed for {galaxyZone.Name}; no daemon zone snapshot was provided.");
+ return;
+ }
+
if (galaxyZone.Contents == null)
{
- var constructionBlueprint = ZoneGenerator.GenerateZone(
- ItemManager,
- RuntimeCatalog,
- Settings.ZoneSettings,
- CurrentGalaxy,
- galaxyZone,
- IsTutorial
- );
- galaxyZone.Contents = new Zone(ItemManager, Settings.PlanetSettings, constructionBlueprint, galaxyZone, CurrentGalaxy);
+ var constructionBlueprint = CreateDaemonZoneConstructionBlueprint(daemonZone);
+ galaxyZone.Contents = new Zone(ItemManager, Settings.PlanetSettings, constructionBlueprint, galaxyZone, ObservedGalaxy);
+ RestoreDaemonAsteroidRuntimeState(galaxyZone.Contents, daemonZone);
}
Zone = galaxyZone.Contents;
PlayMusic(MusicType.Overworld);
-
+
Zone.Log = s => Debug.Log($"Zone: {s}");
- if (CurrentEntity != null)
- {
- CurrentEntity.Deactivate();
- CurrentEntity.Zone.Entities.Remove(CurrentEntity);
- CurrentEntity.Zone = Zone;
- Zone.Entities.Add(CurrentEntity);
- CurrentEntity.Activate();
- }
-
ZoneRenderer.LoadZone(Zone);
- RestoreDroppedPickupsFromTypedZoneState(galaxyZone);
-
+
if (CurrentEntity != null)
{
UnbindEntity();
@@ -2619,49 +2247,6 @@ public class ActionGameManager : MonoBehaviour
}
}
- private void RestoreDroppedPickupsFromTypedZoneState(GalaxyZone galaxyZone)
- {
- if (RuntimeCatalog == null ||
- ZoneRenderer == null ||
- galaxyZone == null)
- {
- return;
- }
-
- var zoneIndex = ZoneIndex(galaxyZone);
- if (zoneIndex < 0)
- return;
-
- var runId = IsTutorial ? "tutorial" : "local";
- var zoneKey = $"global:aetheria.run_state.{runId}.zone.{zoneIndex}.v1";
- AetheriaRuntimeZoneStateSnapshot zoneState;
- try
- {
- zoneState = AetheriaRuntimeStateReader.ReadZoneStates(RuntimeStateFilePath)
- .FirstOrDefault(zone => string.Equals(zone.RecordKey, zoneKey, StringComparison.Ordinal));
- }
- catch (Exception ex)
- {
- Debug.LogError($"Failed to read typed dropped pickup state for zone {zoneKey}: {ex}");
- return;
- }
-
- if (zoneState?.DroppedPickups == null || zoneState.DroppedPickups.Count == 0)
- return;
-
- foreach (var pickup in zoneState.DroppedPickups.OrderBy(pickup => pickup.PickupIndex))
- {
- var item = CreateLoadoutItem(pickup.Item);
- if (item == null)
- continue;
-
- ZoneRenderer.DropItem(
- new Vector3((float)pickup.PositionX, (float)pickup.PositionY, (float)pickup.PositionZ),
- new Vector3((float)pickup.VelocityX, (float)pickup.VelocityY, (float)pickup.VelocityZ),
- item);
- }
- }
-
public bool CanShowInputScreenFromMenu()
{
return CurrentEntity != null && HelpScreen != null;
@@ -2742,95 +2327,581 @@ public class ActionGameManager : MonoBehaviour
private void StartGame()
{
- if (CurrentGalaxy != null)
+ if (ObservedGalaxy == null)
{
- var continuingRun = ContinueRunState;
- var startZone = ResolveStartZone(continuingRun);
- SectorMap.QueueZoneReveal(startZone.AdjacentZones.Prepend(startZone));
- PopulateLevel(startZone);
-
- if (continuingRun != null)
- {
- RestoreEntityGraphFromTypedRun(continuingRun);
- ContinueRunState = null;
- return;
- }
-
- var loadoutGenerator = new LoadoutGenerator(ref ItemManager.Random, ItemManager, RuntimeCatalog, CurrentGalaxy, Zone.GalaxyZone, IsTutorial ? CurrentGalaxy.ResolveFaction(Settings.TutorialGenerationSettings.ProtagonistFaction) : null, 2);
- var ship = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(
- ItemManager,
- Zone,
- loadoutGenerator.GenerateShipLoadout(data => string.IsNullOrEmpty(Settings.StartingHullName) || data.Name==Settings.StartingHullName ),
- true);
- ((Ship) ship).IsPlayerShip = true;
- ship.Position = float3.zero;
- ship.Zone = Zone;
- Zone.Entities.Add(ship);
- ship.Activate();
- BindToEntity(ship);
+ return;
}
+
+ ApplyLatestAuthoritativeDaemonFrame();
}
- private void RestoreEntityGraphFromTypedRun(AetheriaRuntimeRunStateSnapshot run)
+ private bool TryRestoreEntityGraphFromDaemonRun(AetheriaRuntimeRunCheckpointCommit run)
{
- if (run == null || run.CurrentZoneIndex < 0)
+ if (run == null || run.CurrentZoneIndex < 0 || ObservedGalaxy?.Zones == null)
{
- return;
+ return false;
}
- var zoneEntityKeyPrefix = $"global:aetheria.run_state.{run.RunId}.zone.{run.CurrentZoneIndex}.entity.";
- var currentEntityKey = ResolveCurrentEntityRecordKey(run);
+ if (string.IsNullOrWhiteSpace(run.RunId))
+ {
+ Debug.LogWarning("Authoritative daemon frame does not identify a run id.");
+ return false;
+ }
+
+ var runId = run.RunId;
+ var zoneEntityKeyPrefix = $"global:aetheria.run_state.{runId}.zone.{run.CurrentZoneIndex}.entity.";
+ var currentEntityKey = string.IsNullOrWhiteSpace(run.CurrentEntityKey) ? "" : run.CurrentEntityKey;
if (string.IsNullOrWhiteSpace(currentEntityKey))
{
- Debug.LogWarning($"Typed run {run.RunId} does not identify a current entity for restored zone {zoneEntityKeyPrefix}.");
- return;
+ Debug.LogWarning($"Authoritative daemon frame for run {runId} does not identify a current entity.");
+ return false;
+ }
+ Credits = run.Credits;
+
+ var daemonZone = (run.Zones ?? Array.Empty())
+ .FirstOrDefault(zone => zone != null && zone.ZoneIndex == run.CurrentZoneIndex);
+ if (daemonZone == null)
+ {
+ Debug.LogWarning($"Authoritative daemon frame has no zone snapshot for zone {run.CurrentZoneIndex}.");
+ return false;
}
- AetheriaRuntimeEntitySnapshot[] entitySnapshots;
- try
- {
- entitySnapshots = AetheriaRuntimeStateReader.ReadEntitySnapshots(RuntimeStateFilePath)
- .Where(entity => entity.RecordKey.StartsWith(zoneEntityKeyPrefix, StringComparison.Ordinal))
- .OrderBy(entity => EntityIndexFromRecordKey(entity.RecordKey))
- .ToArray();
- }
- catch (Exception ex)
- {
- Debug.LogError($"Failed to read typed entity snapshots for zone {zoneEntityKeyPrefix}: {ex}");
- return;
- }
+ var entitySnapshots = CreateDaemonEntitySnapshots(runId, daemonZone)
+ .OrderBy(entity => EntityIndexFromRecordKey(entity.RecordKey))
+ .ToArray();
if (entitySnapshots.Length == 0)
{
- Debug.LogWarning($"No typed entity snapshots found for restored zone {zoneEntityKeyPrefix}.");
- return;
+ Debug.LogWarning($"Authoritative daemon frame has no entity snapshots for zone {zoneEntityKeyPrefix}.");
+ return false;
}
- ReplaceZoneEntitiesFromTypedSnapshots(entitySnapshots, currentEntityKey, run.ActionBarBindings);
- }
-
- private static string CurrentEntityRecordKey(
- string runId,
- int currentZoneIndex,
- IReadOnlyList entityGraph,
- Entity currentEntity)
- {
- if (string.IsNullOrWhiteSpace(runId) || currentZoneIndex < 0 || currentEntity == null)
+ var targetZone = run.CurrentZoneIndex < ObservedGalaxy.Zones.Length
+ ? ObservedGalaxy.Zones[run.CurrentZoneIndex]
+ : null;
+ if (targetZone == null)
{
- return "";
+ Debug.LogWarning($"Authoritative daemon frame references missing zone index {run.CurrentZoneIndex}.");
+ return false;
}
- var currentZoneEntityIndex = IndexOfEntity(entityGraph, currentEntity);
- return currentZoneEntityIndex < 0
- ? ""
- : $"global:aetheria.run_state.{runId}.zone.{currentZoneIndex}.entity.{currentZoneEntityIndex}.v1";
+ if (CanApplyDaemonEntitySnapshotsInPlace(runId, run.CurrentZoneIndex, entitySnapshots, currentEntityKey))
+ {
+ RestoreDroppedPickupsFromDaemonZoneState(daemonZone);
+ return true;
+ }
+
+ if (Zone?.GalaxyZone != targetZone)
+ {
+ PopulateLevel(targetZone, daemonZone);
+ }
+
+ var actionBarBindings = run.ActionBarBindings?
+ .Select(ToActionBarBindingSnapshot)
+ .Where(binding => binding != null)
+ .ToArray() ?? Array.Empty();
+ ReplaceZoneEntitiesFromTypedSnapshots(entitySnapshots, currentEntityKey, actionBarBindings);
+ RestoreDroppedPickupsFromDaemonZoneState(daemonZone);
+ _lastAppliedAuthoritativeDaemonRunId = runId;
+ _lastAppliedAuthoritativeDaemonZoneIndex = run.CurrentZoneIndex;
+ return true;
}
- private static string ResolveCurrentEntityRecordKey(AetheriaRuntimeRunStateSnapshot run)
+ private void RestoreDroppedPickupsFromDaemonZoneState(AetheriaRuntimeZoneSnapshotCommit zone)
{
- return string.IsNullOrWhiteSpace(run.CurrentEntityKey)
+ if (ZoneRenderer == null || zone == null)
+ return;
+
+ ClearRenderedLoot();
+
+ foreach (var pickup in (zone.DroppedPickups ?? Array.Empty())
+ .Where(pickup => pickup != null)
+ .OrderBy(pickup => pickup.PickupIndex))
+ {
+ var item = CreateLoadoutItem(CreateRuntimeLoadoutItemSnapshot(pickup.Item));
+ if (item == null)
+ continue;
+
+ ZoneRenderer.DropItem(
+ new Vector3((float)pickup.PositionX, (float)pickup.PositionY, (float)pickup.PositionZ),
+ new Vector3((float)pickup.VelocityX, (float)pickup.VelocityY, (float)pickup.VelocityZ),
+ item);
+ }
+ }
+
+ private static ZoneConstructionBlueprint CreateDaemonZoneConstructionBlueprint(AetheriaRuntimeZoneSnapshotCommit zone)
+ {
+ var blueprint = new ZoneConstructionBlueprint
+ {
+ Radius = 2000,
+ Mass = 10000
+ };
+
+ foreach (var orbit in zone.Orbits ?? Array.Empty())
+ {
+ if (orbit == null)
+ continue;
+
+ blueprint.Orbits.Add(new OrbitConstructionData
+ {
+ OrbitKey = orbit.OrbitKey ?? "",
+ ParentOrbitKey = orbit.ParentOrbitKey ?? "",
+ Distance = (float)orbit.Distance,
+ Phase = (float)orbit.Phase,
+ FixedPosition = new float2((float)orbit.FixedPositionX, (float)orbit.FixedPositionY)
+ });
+ }
+
+ foreach (var body in zone.Bodies ?? Array.Empty())
+ {
+ if (body == null)
+ continue;
+
+ blueprint.Bodies.Add(CreateDaemonBodyConstructionData(body));
+ }
+
+ return blueprint;
+ }
+
+ private static BodyConstructionData CreateDaemonBodyConstructionData(AetheriaRuntimeBodySnapshotCommit body)
+ {
+ BodyConstructionData data = (body.Kind ?? "").ToLowerInvariant() switch
+ {
+ "asteroid_belt" => new AsteroidBeltConstructionData
+ {
+ Asteroids = (body.Asteroids ?? Array.Empty())
+ .Where(asteroid => asteroid != null)
+ .Select(asteroid => new Asteroid
+ {
+ Distance = (float)asteroid.Distance,
+ Phase = (float)asteroid.Phase,
+ Size = (float)asteroid.Size,
+ RotationSpeed = (float)asteroid.RotationSpeed
+ })
+ .ToArray()
+ },
+ "sun" => CreateDaemonSunConstructionData(body),
+ "gas_giant" => CreateDaemonGasGiantConstructionData(body),
+ _ => new PlanetConstructionData()
+ };
+
+ PopulateDaemonBodyConstructionData(data, body);
+ return data;
+ }
+
+ private static GasGiantConstructionData CreateDaemonGasGiantConstructionData(AetheriaRuntimeBodySnapshotCommit body)
+ {
+ var visual = body.GasGiantVisual ?? new AetheriaRuntimeGasGiantVisualCommit();
+ return new GasGiantConstructionData
+ {
+ FirstOffsetDomainRotationSpeed = (float)visual.FirstOffsetDomainRotationSpeed,
+ FirstOffsetRotationSpeed = (float)visual.FirstOffsetRotationSpeed,
+ SecondOffsetDomainRotationSpeed = (float)visual.SecondOffsetDomainRotationSpeed,
+ SecondOffsetRotationSpeed = (float)visual.SecondOffsetRotationSpeed,
+ AlbedoRotationSpeed = (float)visual.AlbedoRotationSpeed,
+ WaveRadiusMultiplier = (float)visual.WaveRadiusMultiplier,
+ WaveDepthMultiplier = (float)visual.WaveDepthMultiplier,
+ WaveDepthExponent = (float)visual.WaveDepthExponent,
+ WaveSpeedMultiplier = (float)visual.WaveSpeedMultiplier,
+ MaterialOverrides = (visual.MaterialOverrides ?? Array.Empty()).ToList(),
+ Colors = (visual.Colors ?? Array.Empty())
+ .Where(color => color != null)
+ .Select(color => new float4((float)color.X, (float)color.Y, (float)color.Z, (float)color.W))
+ .ToArray()
+ };
+ }
+
+ private static SunConstructionData CreateDaemonSunConstructionData(AetheriaRuntimeBodySnapshotCommit body)
+ {
+ var gas = CreateDaemonGasGiantConstructionData(body);
+ var visual = body.SunVisual ?? new AetheriaRuntimeSunVisualCommit();
+ return new SunConstructionData
+ {
+ FirstOffsetDomainRotationSpeed = gas.FirstOffsetDomainRotationSpeed,
+ FirstOffsetRotationSpeed = gas.FirstOffsetRotationSpeed,
+ SecondOffsetDomainRotationSpeed = gas.SecondOffsetDomainRotationSpeed,
+ SecondOffsetRotationSpeed = gas.SecondOffsetRotationSpeed,
+ AlbedoRotationSpeed = gas.AlbedoRotationSpeed,
+ WaveRadiusMultiplier = gas.WaveRadiusMultiplier,
+ WaveDepthMultiplier = gas.WaveDepthMultiplier,
+ WaveDepthExponent = gas.WaveDepthExponent,
+ WaveSpeedMultiplier = gas.WaveSpeedMultiplier,
+ MaterialOverrides = gas.MaterialOverrides,
+ Colors = gas.Colors,
+ LightColor = new CultMath.float3((float)visual.LightColorX, (float)visual.LightColorY, (float)visual.LightColorZ),
+ FogTintColor = new CultMath.float3((float)visual.FogTintColorX, (float)visual.FogTintColorY, (float)visual.FogTintColorZ),
+ LightRadiusMultiplier = (float)visual.LightRadiusMultiplier
+ };
+ }
+
+ private static void PopulateDaemonBodyConstructionData(
+ BodyConstructionData data,
+ AetheriaRuntimeBodySnapshotCommit body)
+ {
+ data.BodyKey = body.BodyKey ?? "";
+ data.Name = body.Name ?? "";
+ data.OrbitKey = body.OrbitKey ?? "";
+ data.Mass = (float)body.Mass;
+ data.BodyRadiusMultiplier = (float)body.BodyRadiusMultiplier;
+ data.GravityRadiusMultiplier = (float)body.GravityRadiusMultiplier;
+ data.GravityDepthMultiplier = (float)body.GravityDepthMultiplier;
+ data.GravityDepthExponent = (float)body.GravityDepthExponent;
+ data.Resources = (body.Resources ?? Array.Empty())
+ .Where(resource => resource != null && !string.IsNullOrWhiteSpace(resource.ItemKey))
+ .ToDictionary(resource => resource.ItemKey, resource => (float)resource.Amount, StringComparer.Ordinal);
+ }
+
+ private static void RestoreDaemonAsteroidRuntimeState(Zone zone, AetheriaRuntimeZoneSnapshotCommit daemonZone)
+ {
+ if (zone == null || daemonZone == null)
+ return;
+
+ foreach (var body in daemonZone.Bodies ?? Array.Empty())
+ {
+ if (body == null ||
+ !string.Equals(body.Kind ?? "", "asteroid_belt", StringComparison.OrdinalIgnoreCase) ||
+ !zone.AsteroidBelts.TryGetValue(body.BodyKey ?? "", out var belt))
+ {
+ continue;
+ }
+
+ belt.Damage.Clear();
+ belt.RespawnTimers.Clear();
+ var asteroids = body.Asteroids ?? Array.Empty();
+ for (var index = 0; index < asteroids.Count; index++)
+ {
+ var asteroid = asteroids[index];
+ if (asteroid == null)
+ continue;
+
+ if (asteroid.Damage > 0)
+ belt.Damage[index] = (float)asteroid.Damage;
+ if (asteroid.RespawnTimer > 0)
+ belt.RespawnTimers[index] = (float)asteroid.RespawnTimer;
+ }
+ }
+ }
+
+ private void ClearRenderedLoot()
+ {
+ if (ZoneRenderer?.ActiveLoot == null)
+ return;
+
+ foreach (var loot in ZoneRenderer.ActiveLoot.ToArray())
+ {
+ if (loot == null)
+ continue;
+
+ ZoneRenderer.DestroyLoot(loot);
+ Destroy(loot.gameObject);
+ }
+ }
+
+ private static AetheriaRuntimeEntitySnapshot[] CreateDaemonEntitySnapshots(
+ string runId,
+ AetheriaRuntimeZoneSnapshotCommit zone)
+ {
+ if (zone == null)
+ return Array.Empty();
+
+ return (zone.Entities ?? Array.Empty())
+ .Where(entity => entity != null)
+ .Select(entity => CreateDaemonEntitySnapshot(runId, zone.ZoneIndex, entity))
+ .ToArray();
+ }
+
+ private static AetheriaRuntimeEntitySnapshot CreateDaemonEntitySnapshot(
+ string runId,
+ int zoneIndex,
+ AetheriaRuntimeEntitySnapshotCommit entity)
+ {
+ return new AetheriaRuntimeEntitySnapshot(
+ DaemonEntityRecordKey(runId, zoneIndex, entity.EntityIndex),
+ entity.Name ?? "",
+ entity.Kind ?? "",
+ entity.PositionX,
+ entity.PositionY,
+ entity.PositionZ,
+ entity.DirectionX,
+ entity.DirectionY,
+ entity.FactionKey ?? "",
+ entity.HullItemKey ?? "",
+ CreateDaemonItemSlots(entity.Equipment),
+ CreateDaemonItemSlots(entity.CargoBays),
+ CreateDaemonItemSlots(entity.DockingBays),
+ (entity.ChildEntityIndices ?? Array.Empty())
+ .Where(index => index >= 0)
+ .Select(index => DaemonEntityRecordKey(runId, zoneIndex, index))
+ .ToArray(),
+ (entity.WeaponGroups ?? Array.Empty>())
+ .Select(group => (IReadOnlyList)(group ?? Array.Empty()).ToArray())
+ .ToArray(),
+ (entity.StatGrids ?? Array.Empty())
+ .Select(grid => new AetheriaRuntimeEntityStatGridSnapshot(
+ grid.Name ?? "",
+ grid.Width,
+ grid.Height,
+ (grid.Values ?? Array.Empty()).ToArray()))
+ .ToArray(),
+ entity.VelocityX,
+ entity.VelocityY,
+ entity.TargetEntityIndex < 0 ? "" : DaemonEntityRecordKey(runId, zoneIndex, entity.TargetEntityIndex),
+ entity.IsActive,
+ entity.HeatsinksEnabled,
+ entity.OverrideShutdown,
+ entity.TractorPower,
+ entity.Heatstroke,
+ entity.Hypothermia,
+ (entity.ActiveConsumables ?? Array.Empty())
+ .Select(consumable => new AetheriaRuntimeActiveConsumableSnapshot(
+ consumable.ItemKey ?? "",
+ consumable.Quality,
+ consumable.RemainingDuration,
+ consumable.Duration))
+ .ToArray(),
+ (entity.BehaviorProgress ?? Array.Empty())
+ .Select(progress => new AetheriaRuntimeBehaviorProgressSnapshot(
+ progress.OwnerKind ?? "",
+ progress.OwnerIndex,
+ progress.BehaviorIndex,
+ progress.BehaviorKind ?? "",
+ progress.Progress))
+ .ToArray(),
+ CreateDaemonWeaponStates(runId, zoneIndex, entity.WeaponStates),
+ CreateDaemonBehaviorStates(entity.BehaviorStates),
+ CreateDaemonCargoBays(entity.CargoContents),
+ CreateDaemonCargoBays(entity.DockingBayContents),
+ (entity.DockingBayAssignments ?? Array.Empty()).ToArray(),
+ entity.Visibility,
+ entity.VisibilitySourceCount,
+ (entity.Contacts ?? Array.Empty())
+ .Where(contact => contact != null && contact.TargetEntityIndex >= 0)
+ .Select(contact => new AetheriaRuntimeEntityContactSnapshot(
+ DaemonEntityRecordKey(runId, zoneIndex, contact.TargetEntityIndex),
+ contact.InfoGathered,
+ contact.Hostile,
+ contact.Visible))
+ .ToArray(),
+ entity.ShutdownPerformance);
+ }
+
+ private static AetheriaRuntimeEntityItemSlotSnapshot[] CreateDaemonItemSlots(
+ IReadOnlyList slots)
+ {
+ return (slots ?? Array.Empty())
+ .Where(slot => slot?.Item != null)
+ .Select(slot => new AetheriaRuntimeEntityItemSlotSnapshot(
+ slot.X,
+ slot.Y,
+ slot.Item.ItemKey ?? "",
+ slot.Item.Quality,
+ slot.Item.Durability,
+ slot.Item.Quantity,
+ slot.Item.Enabled,
+ slot.Item.OverrideShutdown))
+ .ToArray();
+ }
+
+ private static AetheriaRuntimeCargoBayLoadoutSnapshot[] CreateDaemonCargoBays(
+ IReadOnlyList cargoBays)
+ {
+ return (cargoBays ?? Array.Empty())
+ .Select(bay => new AetheriaRuntimeCargoBayLoadoutSnapshot(
+ CreateDaemonLoadoutSlots(bay?.Items)))
+ .ToArray();
+ }
+
+ private static AetheriaRuntimeLoadoutItemSlotSnapshot[] CreateDaemonLoadoutSlots(
+ IReadOnlyList slots)
+ {
+ return (slots ?? Array.Empty())
+ .Where(slot => slot?.Item != null)
+ .Select(slot => new AetheriaRuntimeLoadoutItemSlotSnapshot(
+ slot.X,
+ slot.Y,
+ new AetheriaRuntimeLoadoutItemSnapshot(
+ slot.Item.ItemKey ?? "",
+ slot.Item.Quality,
+ slot.Item.Durability,
+ slot.Item.Quantity,
+ slot.Item.Enabled,
+ slot.Item.OverrideShutdown)))
+ .ToArray();
+ }
+
+ private static AetheriaRuntimeWeaponStateSnapshot[] CreateDaemonWeaponStates(
+ string runId,
+ int zoneIndex,
+ IReadOnlyList weaponStates)
+ {
+ return (weaponStates ?? Array.Empty())
+ .Where(state => state != null)
+ .Select(state => new AetheriaRuntimeWeaponStateSnapshot(
+ state.OwnerKind ?? "",
+ state.OwnerIndex,
+ state.BehaviorIndex,
+ state.BehaviorKind ?? "",
+ state.Firing,
+ state.Ammo,
+ state.BurstRemaining,
+ state.BurstTimer,
+ state.BurstInterval,
+ state.CooldownProgress,
+ state.CoolingDown,
+ state.Charging,
+ state.Charged,
+ state.Charge,
+ state.Reloading,
+ state.ReloadProgress,
+ state.AmmoIntervalProgress,
+ state.LockProgress,
+ state.LockTargetEntityIndex < 0 ? "" : DaemonEntityRecordKey(runId, zoneIndex, state.LockTargetEntityIndex)))
+ .ToArray();
+ }
+
+ private static AetheriaRuntimeBehaviorStateSnapshot[] CreateDaemonBehaviorStates(
+ IReadOnlyList behaviorStates)
+ {
+ return (behaviorStates ?? Array.Empty())
+ .Where(state => state != null)
+ .Select(state => new AetheriaRuntimeBehaviorStateSnapshot(
+ state.OwnerKind ?? "",
+ state.OwnerIndex,
+ state.BehaviorIndex,
+ state.BehaviorKind ?? "",
+ state.Pinging,
+ state.PingCooldown,
+ state.PingLerp,
+ state.PingRadius,
+ state.PingedEntityCount,
+ state.RadiatorTemperature,
+ state.Emissivity,
+ state.PumpedHeat,
+ state.WasteHeat,
+ state.EnergyUsage,
+ state.ReactorDraw,
+ state.ReactorLoadRatio,
+ state.CapacitorCharge,
+ state.CapacitorCapacity,
+ state.CapacitorEfficiency,
+ state.AetherDriveAxisX,
+ state.AetherDriveAxisY,
+ state.AetherDriveAxisZ,
+ state.AetherDriveThrustX,
+ state.AetherDriveThrustY,
+ state.AetherDriveThrustZ,
+ state.AetherDriveRpmX,
+ state.AetherDriveRpmY,
+ state.AetherDriveRpmZ,
+ state.AetherDriveMaximumRpm,
+ state.AetherDriveThrustDirectionX,
+ state.AetherDriveThrustDirectionY,
+ state.ResourceScannerTargetBodyKey ?? "",
+ state.ResourceScannerAsteroidIndex,
+ state.ResourceScannerScanTime,
+ state.ResourceScannerRange,
+ state.ResourceScannerMinimumDensity,
+ state.ResourceScannerScanDuration,
+ state.MiningToolAsteroidBeltKey ?? "",
+ state.MiningToolAsteroidIndex,
+ state.MiningToolRange,
+ state.ThrusterAxis,
+ state.ThrusterThrust,
+ state.ThrusterTorque,
+ state.ShieldEfficiency,
+ state.ShieldEnergyUsage,
+ state.VelocityLimit,
+ state.ThermotoggleTargetTemperature,
+ state.SwitchActivated,
+ state.TriggerPulled,
+ state.StatModifierApplied,
+ state.StatModifierExecuted,
+ state.StatModifierTargetStatCount,
+ state.TurretControllerWeaponCount,
+ state.TurretControllerShotSpeed,
+ state.TurretControllerPredictShots))
+ .ToArray();
+ }
+
+ private static string DaemonEntityRecordKey(string runId, int zoneIndex, int entityIndex)
+ {
+ return string.IsNullOrWhiteSpace(runId)
? ""
- : run.CurrentEntityKey;
+ : $"global:aetheria.run_state.{runId}.zone.{zoneIndex}.entity.{entityIndex}.v1";
+ }
+
+ private bool CanApplyDaemonEntitySnapshotsInPlace(
+ string runId,
+ int zoneIndex,
+ IReadOnlyList entitySnapshots,
+ string currentEntityKey)
+ {
+ if (!string.Equals(_lastAppliedAuthoritativeDaemonRunId, runId, StringComparison.Ordinal) ||
+ _lastAppliedAuthoritativeDaemonZoneIndex != zoneIndex ||
+ _authoritativeDaemonEntities.Count != entitySnapshots.Count)
+ {
+ return false;
+ }
+
+ foreach (var snapshot in entitySnapshots)
+ {
+ if (!_authoritativeDaemonEntities.ContainsKey(snapshot.RecordKey))
+ {
+ return false;
+ }
+ }
+
+ ApplyDaemonEntitySnapshotsInPlace(entitySnapshots, currentEntityKey);
+ return true;
+ }
+
+ private void ApplyDaemonEntitySnapshotsInPlace(
+ IReadOnlyList entitySnapshots,
+ string currentEntityKey)
+ {
+ foreach (var entitySnapshot in entitySnapshots)
+ {
+ if (!_authoritativeDaemonEntities.TryGetValue(entitySnapshot.RecordKey, out var entity))
+ continue;
+
+ entity.Name = entitySnapshot.Name ?? "";
+ entity.CultPosition = new CultMath.float3((float)entitySnapshot.PositionX, (float)entitySnapshot.PositionY, (float)entitySnapshot.PositionZ);
+ entity.CultDirection = new CultMath.float2((float)entitySnapshot.DirectionX, (float)entitySnapshot.DirectionY);
+ entity.CultVelocity = new CultMath.float2((float)entitySnapshot.VelocityX, (float)entitySnapshot.VelocityY);
+ entity.OverrideShutdown = entitySnapshot.OverrideShutdown;
+ entity.TractorPower = (float)entitySnapshot.TractorPower;
+ entity.HeatsinksEnabled = entitySnapshot.HeatsinksEnabled;
+ if (entity.Settings != null)
+ entity.Settings.ShutdownPerformance = (float)entitySnapshot.ShutdownPerformance;
+ entity.RestoreThermalExposure((float)entitySnapshot.Heatstroke, (float)entitySnapshot.Hypothermia);
+ RestoreRuntimeBehaviorStateFromTypedSnapshot(entity, entitySnapshot, _authoritativeDaemonEntities);
+ }
+
+ foreach (var entity in _authoritativeDaemonEntities.Values)
+ {
+ entity.EntityInfoGathered.Clear();
+ entity.EntityHostility.Clear();
+ entity.VisibleEntities.Clear();
+ entity.VisibleEnemies.Clear();
+ entity.VisibleFriendlies.Clear();
+ entity.Target.Value = null;
+ }
+
+ foreach (var entitySnapshot in entitySnapshots)
+ {
+ if (!_authoritativeDaemonEntities.TryGetValue(entitySnapshot.RecordKey, out var entity))
+ continue;
+
+ RestoreEntityContactsFromTypedSnapshot(entity, entitySnapshot, _authoritativeDaemonEntities);
+ if (_authoritativeDaemonEntities.TryGetValue(entitySnapshot.TargetEntityKey, out var target))
+ entity.Target.Value = target;
+ }
+
+ if (_authoritativeDaemonEntities.TryGetValue(currentEntityKey, out var currentEntity) &&
+ CurrentEntity != currentEntity)
+ {
+ RestoreCurrentEntityBinding(currentEntity, Array.Empty());
+ }
}
private void ReplaceZoneEntitiesFromTypedSnapshots(
@@ -2840,7 +2911,6 @@ public class ActionGameManager : MonoBehaviour
{
foreach (var existingEntity in Zone.Entities.ToArray())
{
- existingEntity.Deactivate();
Zone.Entities.Remove(existingEntity);
}
Zone.Agents.Clear();
@@ -2857,23 +2927,21 @@ public class ActionGameManager : MonoBehaviour
continue;
}
- var entity = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, blueprint, true);
+ var entity = EntityConstructionBlueprintProjector.ProjectObservedFromBlueprint(ItemManager, Zone, blueprint);
if (entity == null)
continue;
- entity.Position = new float3((float)entitySnapshot.PositionX, (float)entitySnapshot.PositionY, (float)entitySnapshot.PositionZ);
- entity.Direction = new float2((float)entitySnapshot.DirectionX, (float)entitySnapshot.DirectionY);
- entity.Velocity = new float2((float)entitySnapshot.VelocityX, (float)entitySnapshot.VelocityY);
+ entity.CultPosition = new CultMath.float3((float)entitySnapshot.PositionX, (float)entitySnapshot.PositionY, (float)entitySnapshot.PositionZ);
+ entity.CultDirection = new CultMath.float2((float)entitySnapshot.DirectionX, (float)entitySnapshot.DirectionY);
+ entity.CultVelocity = new CultMath.float2((float)entitySnapshot.VelocityX, (float)entitySnapshot.VelocityY);
entity.OverrideShutdown = entitySnapshot.OverrideShutdown;
entity.TractorPower = (float)entitySnapshot.TractorPower;
+ entity.RestoreActiveState(entitySnapshot.IsActive);
entity.Zone = Zone;
Zone.Entities.Add(entity);
restoredEntities[entitySnapshot.RecordKey] = entity;
}
- foreach (var entity in restoredEntities.Values)
- entity.Activate();
-
RestoreChildAndDockingRelationships(entitySnapshots, restoredEntities);
foreach (var entitySnapshot in entitySnapshots)
@@ -2891,6 +2959,10 @@ public class ActionGameManager : MonoBehaviour
entity.Target.Value = target;
}
+ _authoritativeDaemonEntities.Clear();
+ foreach (var restoredEntity in restoredEntities)
+ _authoritativeDaemonEntities[restoredEntity.Key] = restoredEntity.Value;
+
if (restoredEntities.TryGetValue(currentEntityKey, out var currentEntity))
RestoreCurrentEntityBinding(currentEntity, actionBarBindings);
}
@@ -2938,7 +3010,7 @@ public class ActionGameManager : MonoBehaviour
}
if (Zone.Entities.Contains(ship))
Zone.Entities.Remove(ship);
- ship.Deactivate();
+ ship.RestoreActiveState(false);
}
}
}
@@ -3117,11 +3189,11 @@ public class ActionGameManager : MonoBehaviour
break;
case AetherDrive drive:
drive.RestoreRuntimeState(
- new float3((float)behaviorState.AetherDriveAxisX, (float)behaviorState.AetherDriveAxisY, (float)behaviorState.AetherDriveAxisZ),
- new float3((float)behaviorState.AetherDriveThrustX, (float)behaviorState.AetherDriveThrustY, (float)behaviorState.AetherDriveThrustZ),
- new float3((float)behaviorState.AetherDriveRpmX, (float)behaviorState.AetherDriveRpmY, (float)behaviorState.AetherDriveRpmZ),
+ new CultMath.float3((float)behaviorState.AetherDriveAxisX, (float)behaviorState.AetherDriveAxisY, (float)behaviorState.AetherDriveAxisZ),
+ new CultMath.float3((float)behaviorState.AetherDriveThrustX, (float)behaviorState.AetherDriveThrustY, (float)behaviorState.AetherDriveThrustZ),
+ new CultMath.float3((float)behaviorState.AetherDriveRpmX, (float)behaviorState.AetherDriveRpmY, (float)behaviorState.AetherDriveRpmZ),
(float)behaviorState.AetherDriveMaximumRpm,
- new float2((float)behaviorState.AetherDriveThrustDirectionX, (float)behaviorState.AetherDriveThrustDirectionY));
+ new CultMath.float2((float)behaviorState.AetherDriveThrustDirectionX, (float)behaviorState.AetherDriveThrustDirectionY));
break;
case ResourceScanner resourceScanner:
resourceScanner.RestoreRuntimeState(
@@ -3198,77 +3270,6 @@ public class ActionGameManager : MonoBehaviour
}
}
- private static GalaxyZone ResolveStartZone(AetheriaRuntimeRunStateSnapshot run)
- {
- if (CurrentGalaxy?.Zones == null || CurrentGalaxy.Zones.Length == 0)
- return CurrentGalaxy?.Entrance;
-
- if (run != null &&
- run.CurrentZoneIndex >= 0 &&
- run.CurrentZoneIndex < CurrentGalaxy.Zones.Length)
- {
- return CurrentGalaxy.Zones[run.CurrentZoneIndex];
- }
-
- return CurrentGalaxy.Entrance;
- }
-
- private IEnumerator IntroCutscene(Ship ship)
- {
- ZoneRenderer.PerspectiveEntity = ship;
- var entityPosition = ship.Position.xz;
- var followOrbit = Zone.Orbits.Values.MinBy(orbit => lengthsq(Zone.GetOrbitPosition(orbit.OrbitKey) - entityPosition));
- var followPlanetBodyKey = Zone.PlanetInstances.Values.First(planet => planet.OrbitKey == followOrbit.OrbitKey).BodyKey;
- var followPlanet = ZoneRenderer.Planets[followPlanetBodyKey];
- DockCamera.Follow = followPlanet.Body.transform;
- var rootOrbit = followOrbit;
- while (!string.IsNullOrWhiteSpace(rootOrbit.ParentOrbitKey) &&
- Zone.TryGetOrbit(rootOrbit.ParentOrbitKey, out var parentOrbit))
- rootOrbit = parentOrbit;
- var rootPlanetBodyKey = Zone.PlanetInstances.Values.First(planet => planet.OrbitKey == rootOrbit.OrbitKey).BodyKey;
- var rootPlanet = ZoneRenderer.Planets[rootPlanetBodyKey];
- DockCamera.LookAt = rootPlanet.Body.transform;
-
- var shipVelocity = ship.GetBehavior().Limit;
- var followOrbitPosition = Zone.GetOrbitPosition(followOrbit.OrbitKey);
- var shipDirection = normalize(Zone.GetOrbitPosition(rootOrbit.OrbitKey) - followOrbitPosition);
- ship.Position.xz = followOrbitPosition - shipDirection * shipVelocity * IntroDuration;
-
- var startTime = Time.time;
- while (Time.time - startTime < IntroDuration)
- {
- ship.Direction = shipDirection;
- ship.Velocity = shipDirection * shipVelocity;
- yield return null;
- }
-
- BindToEntity(ship);
- }
-
- public void Dock()
- {
- if (CurrentEntity.Parent != null) return;
- if (CurrentEntity is Ship ship)
- {
- foreach (var entity in Zone.Entities.ToArray())
- {
- if (entity != CurrentEntity && lengthsq(entity.Position.xz - CurrentEntity.Position.xz) <
- Settings.GameplaySettings.DockingDistance * Settings.GameplaySettings.DockingDistance)
- {
- var bay = entity.TryDock(ship);
- if (bay != null)
- {
- UnbindEntity();
- DoDock(entity, bay);
- // TODO: SFX: Docking
- //AkSoundEngine.PostEvent("Dock", gameObject);
- return;
- }
- }
- }
- }
- }
-
private void DoDock(Entity entity, EquippedDockingBay dockingBay)
{
TradeMenu.Inventory = entity.CargoBays.First();
@@ -3289,73 +3290,41 @@ public class ActionGameManager : MonoBehaviour
Menu.ShowTab(MenuTab.Inventory);
}
- public void Undock()
+ public void RequestTowToStation()
{
- if (CurrentEntity.Parent == null) return;
- if (CurrentEntity is Ship ship)
- {
- if (CurrentEntity.GetBehavior() == null)
- {
- Dialog.Clear();
- Dialog.Title.text = "Can't undock. Missing cockpit component!";
- Dialog.Show();
- Dialog.MoveToCursor();
- // TODO: SFX: Fail
- }
- else if (CurrentEntity.GetBehavior() == null && CurrentEntity.GetBehavior() == null)
- {
- Dialog.Clear();
- Dialog.Title.text = "Can't undock. Missing thruster component!";
- Dialog.Show();
- Dialog.MoveToCursor();
- // TODO: SFX: Fail
- }
- else if (CurrentEntity.GetBehavior() == null)
- {
- Dialog.Clear();
- Dialog.Title.text = "Can't undock. Missing reactor component!";
- Dialog.Show();
- Dialog.MoveToCursor();
- // TODO: SFX: Fail
- }
- else if (CurrentEntity.Parent.TryUndock(ship))
- {
- BindToEntity(ship);
- // TODO: SFX: Undock
- }
- else
- {
- Dialog.Title.text = "Can't undock. Must empty docking bay!";
- Dialog.Show();
- Dialog.MoveToCursor();
- // TODO: SFX: Fail
- }
- }
+ TryRequestDaemonTowToStation();
}
- public void TowShip()
+ private bool TryRequestDaemonTowToStation()
{
- if (CurrentEntity.Parent != null) return;
- if (CurrentEntity is Ship ship)
+ var observer = ResolveDaemonObserver();
+ if (observer == null ||
+ !observer.HasAuthoritativeState ||
+ TowingStation == null)
{
- if (Zone.Equals(TowingStation.Zone))
- {
- var distance = (int)length(TowingStation.Position.xz - CurrentEntity.Position.xz);
- CurrentEntity.Position.xz = TowingStation.Position.xz;
- Dock();
- //Debug.Log($"${distance}");
- //payment = distance * TowingZoneRate;
- }
- else
- {
- var distance = Zone.GalaxyZone.Distance[TowingStation.Zone.GalaxyZone];
- PopulateLevel(TowingStation.Zone.GalaxyZone);
- CurrentEntity.Zone = Zone;
- CurrentEntity.Position.xz = TowingStation.Position.xz;
- Dock();
- //Debug.Log($"${distance * 1000}");
- //payment = distance * TowingGalaxyRate;
- }
+ return false;
+ }
+
+ var stationEntityKey = ResolveEntityRecordKey(TowingStation);
+ var targetZoneIndex = ZoneIndex(TowingStation.Zone?.GalaxyZone);
+ if (string.IsNullOrWhiteSpace(stationEntityKey) || targetZoneIndex < 0)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.TowToStation(
+ stationEntityKey,
+ targetZoneIndex,
+ TowingStation.CultPositionXZ.x,
+ TowingStation.CultPositionXZ.y);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon towing operation; operation not submitted: {ex.Message}");
+ return false;
}
}
@@ -3363,16 +3332,16 @@ public class ActionGameManager : MonoBehaviour
{
foreach (var indicator in _visibleHostileIndicators) Destroy(indicator.Value.gameObject);
_visibleHostileIndicators.Clear();
-
+
foreach (var indicator in _visibleFriendlyIndicators) Destroy(indicator.Value.gameObject);
_visibleFriendlyIndicators.Clear();
-
+
if(_lockingIndicators!=null) foreach(var (_, indicator, _) in _lockingIndicators)
indicator.GetComponent().ReturnToPool();
DisablePlayerInput();
Cursor.lockState = CursorLockMode.None;
GameplayUI.gameObject.SetActive(false);
-
+
foreach(var subscription in _shipSubscriptions) subscription.Dispose();
_shipSubscriptions.Clear();
}
@@ -3391,22 +3360,22 @@ public class ActionGameManager : MonoBehaviour
CurrentEntity = entity;
DeathPost.weight = 0;
ZoneRenderer.PerspectiveEntity = CurrentEntity;
-
+
Menu.gameObject.SetActive(false);
DockedEntity = null;
DockingBay = null;
DockCamera.enabled = false;
FollowCamera.enabled = true;
- if (length(CurrentEntity.Direction) > .1f)
- _viewDirection = float3(CurrentEntity.Direction.x,0,CurrentEntity.Direction.y);
-
+ if (CultMath.math.length(CurrentEntity.CultDirection) > .1f)
+ _viewDirection = (float3)AetheriaMath.ToUnityXZ(CurrentEntity.CultDirection);
+
Cursor.lockState = CursorLockMode.Locked;
EnablePlayerInput();
GameplayUI.gameObject.SetActive(true);
ShipPanel.Display(CurrentEntity, true);
SchematicDisplay.ShowShip(CurrentEntity);
-
+
FollowCamera.LookAt = ZoneRenderer.EntityInstances[CurrentEntity].LookAtPoint;
FollowCamera.Follow = ZoneRenderer.EntityInstances[CurrentEntity].transform;
_articulationGroups = CurrentEntity.Equipment
@@ -3421,17 +3390,17 @@ public class ActionGameManager : MonoBehaviour
Crosshairs[index]
);
}).ToArray();
-
+
foreach (var crosshair in Crosshairs)
crosshair.gameObject.SetActive(false);
foreach (var group in _articulationGroups)
group.crosshair.gameObject.SetActive(true);
-
+
_shipSubscriptions.Add(CurrentEntity.TargetedByCount.Subscribe(count =>
{
PlayMusic(count > 0 ? MusicType.Combat : MusicType.Overworld);
}));
-
+
_shipSubscriptions.Add(CurrentEntity.Target.Subscribe(target =>
{
// Clear previous subscriptions related to currently targeted enemy
@@ -3454,7 +3423,7 @@ public class ActionGameManager : MonoBehaviour
TargetShieldsIcon.color = NoShieldColor;
TargetShieldsIcon.sprite = NoShieldIcon;
}
-
+
// Subscribe to incoming hits from the player ship to display the hit marker
_targetSubscriptions.Add(target.IncomingHit.Where(e => e == CurrentEntity).Subscribe(_ =>
{
@@ -3469,13 +3438,13 @@ public class ActionGameManager : MonoBehaviour
var indicator = HostileTargetIndicator.Instantiate();
_visibleHostileIndicators.Add(hostile, indicator);
}
-
+
_shipSubscriptions.Add(CurrentEntity.VisibleEnemies.ObserveAdd().Subscribe(addEvent =>
{
var indicator = HostileTargetIndicator.Instantiate();
_visibleHostileIndicators.Add(addEvent.Value, indicator);
}));
-
+
_shipSubscriptions.Add(CurrentEntity.VisibleEnemies.ObserveRemove().Subscribe(removeEvent =>
{
_visibleHostileIndicators[removeEvent.Value].GetComponent().ReturnToPool();
@@ -3487,21 +3456,19 @@ public class ActionGameManager : MonoBehaviour
var indicator = FriendlyTargetIndicator.Instantiate();
_visibleFriendlyIndicators.Add(friendly, indicator);
}
-
+
_shipSubscriptions.Add(CurrentEntity.VisibleFriendlies.ObserveAdd().Subscribe(addEvent =>
{
var indicator = FriendlyTargetIndicator.Instantiate();
_visibleFriendlyIndicators.Add(addEvent.Value, indicator);
}));
-
+
_shipSubscriptions.Add(CurrentEntity.VisibleFriendlies.ObserveRemove().Subscribe(removeEvent =>
{
_visibleFriendlyIndicators[removeEvent.Value].GetComponent().ReturnToPool();
_visibleFriendlyIndicators.Remove(removeEvent.Value);
}));
-
- _shipSubscriptions.Add(CurrentEntity.Death.Subscribe(Die));
-
+
_lockingIndicators = CurrentEntity.GetBehaviors()
.Select(x =>
{
@@ -3535,49 +3502,13 @@ public class ActionGameManager : MonoBehaviour
}
}
- private void Die(CauseOfDeath cause)
- {
- var deathTime = Time.time;
- UnbindEntity();
- CurrentEntity = null;
- MainMenu.gameObject.SetActive(true);
- Menu.gameObject.SetActive(false);
- CurrentGalaxy = null;
- QueueRuntimePlayerSettingsCommit();
- Observable.EveryUpdate()
- .Where(_ => Time.time - deathTime < DeathPostTransitionTime)
- .Subscribe(_ =>
- {
- var t = (Time.time - deathTime) / DeathPostTransitionTime;
- if(cause==CauseOfDeath.Heatstroke)
- {
- HeatstrokePost.weight = 1 - t;
- SevereHeatstrokePost.weight = 1 - t;
- }
- else if (cause == CauseOfDeath.Hypothermia)
- {
- HypothermiaPost.weight = 1 - t;
- SevereHypothermiaPost.weight = 1 - t;
- }
- DeathPost.weight = t;
- },
- () =>
- {
- HeatstrokePost.weight = 0;
- SevereHeatstrokePost.weight = 0;
- HypothermiaPost.weight = 0;
- SevereHypothermiaPost.weight = 0;
- DeathPost.weight = 1;
- });
- }
-
// public void ToggleEditMode()
// {
// _editMode = !_editMode;
// FollowCamera.gameObject.SetActive(!_editMode);
// TopDownCamera.gameObject.SetActive(_editMode);
// }
-
+
public IEnumerable AvailableCargoBays()
{
if (CurrentEntity.Parent != null)
@@ -3609,6 +3540,7 @@ public class ActionGameManager : MonoBehaviour
{
if(!_paused)
{
+ ApplyLatestAuthoritativeDaemonFrame();
_time += Time.deltaTime;
_hitMarkerTime -= Time.deltaTime;
if(HitMarker.activeSelf && _hitMarkerTime < 0) HitMarker.SetActive(false);
@@ -3624,10 +3556,10 @@ public class ActionGameManager : MonoBehaviour
else
{
indicator.Value.Fill.fillAmount =
- saturate(indicator.Key.EntityInfoGathered[CurrentEntity] / Settings.GameplaySettings.TargetDetectionInfoThreshold);
+ Saturate(indicator.Key.EntityInfoGathered[CurrentEntity] / Settings.GameplaySettings.TargetDetectionInfoThreshold);
indicator.Value.Fill.enabled =
!(indicator.Key.EntityInfoGathered[CurrentEntity] > Settings.GameplaySettings.TargetDetectionInfoThreshold) ||
- sin(TargetSpottedBlinkFrequency * Time.time) + TargetSpottedBlinkOffset > 0;
+ Mathf.Sin(TargetSpottedBlinkFrequency * Time.time) + TargetSpottedBlinkOffset > 0;
}
}
foreach (var indicator in _visibleFriendlyIndicators)
@@ -3640,46 +3572,509 @@ public class ActionGameManager : MonoBehaviour
{
indicator.Value.Fill.enabled = true;
indicator.Value.Fill.fillAmount =
- saturate(indicator.Key.EntityInfoGathered[CurrentEntity] / Settings.GameplaySettings.TargetDetectionInfoThreshold);
+ Saturate(indicator.Key.EntityInfoGathered[CurrentEntity] / Settings.GameplaySettings.TargetDetectionInfoThreshold);
}
}
var look = Input.Player.Look.ReadValue();
- _entityYawPitch = float2(_entityYawPitch.x + look.x * Sensitivity.x, clamp(_entityYawPitch.y + look.y * Sensitivity.y, -.45f * PI, .45f * PI));
- _viewDirection = mul(float3(0, 0, 1), Unity.Mathematics.float3x3.Euler(float3(_entityYawPitch.yx, 0), RotationOrder.YXZ));
- CurrentEntity.LookDirection = _viewDirection;
- HeatstrokePost.weight = saturate(unlerp(0, Settings.GameplaySettings.SevereHeatstrokeRiskThreshold, CurrentEntity.Heatstroke));
- var severeHeatstrokeLerp = saturate(unlerp(Settings.GameplaySettings.SevereHeatstrokeRiskThreshold, 1, CurrentEntity.Heatstroke));
+ _entityYawPitch = new float2(
+ _entityYawPitch.x + look.x * Sensitivity.x,
+ Mathf.Clamp(_entityYawPitch.y + look.y * Sensitivity.y, -.45f * Mathf.PI, .45f * Mathf.PI));
+ _viewDirection = Quaternion.Euler(_entityYawPitch.y * Mathf.Rad2Deg, _entityYawPitch.x * Mathf.Rad2Deg, 0) * Vector3.forward;
+ RequestLookDirection(_viewDirection);
+ HeatstrokePost.weight = Saturate(Unlerp(0, Settings.GameplaySettings.SevereHeatstrokeRiskThreshold, CurrentEntity.Heatstroke));
+ var severeHeatstrokeLerp = Saturate(Unlerp(Settings.GameplaySettings.SevereHeatstrokeRiskThreshold, 1, CurrentEntity.Heatstroke));
SevereHeatstrokePost.weight =
severeHeatstrokeLerp + severeHeatstrokeLerp * (1 - severeHeatstrokeLerp) *
- max(Settings.HeatstrokePhasingFloor, sin(Time.time * Settings.HeatstrokePhasingFrequency));
-
- if(CurrentEntity is Ship ship)
+ Mathf.Max(Settings.HeatstrokePhasingFloor, Mathf.Sin(Time.time * Settings.HeatstrokePhasingFrequency));
+
+ if(CurrentEntity is Ship)
{
- ship.MovementDirection = Input.Player.Move.ReadValue();
+ var movement = Input.Player.Move.ReadValue();
+ TryRequestDaemonMoveVector(movement);
}
var target = CurrentEntity.Target.Value;
if (target != null)
{
var threshold = Settings.GameplaySettings.TargetDetectionInfoThreshold;
- TargetVisibilityFill.fillAmount = lerp(.25f, .75f, (CurrentEntity.EntityInfoGathered[target] - threshold)/(1-threshold));
- VisibilityToTargetFill.fillAmount = lerp(.25f, .75f, target.EntityInfoGathered[CurrentEntity] / threshold);
+ TargetVisibilityFill.fillAmount = Mathf.Lerp(.25f, .75f, (CurrentEntity.EntityInfoGathered[target] - threshold) / (1 - threshold));
+ VisibilityToTargetFill.fillAmount = Mathf.Lerp(.25f, .75f, target.EntityInfoGathered[CurrentEntity] / threshold);
var targetHull = ItemManager.GetRuntimeItem(target.Hull);
var targetMaxDurability = targetHull?.Durability > 0
? (float)targetHull.Durability
: Math.Max(target.Hull.Durability, 1f);
- TargetHitpointsFill.fillAmount = lerp(.25f, .75f, target.Hull.Durability / targetMaxDurability);
- TargetShieldsFill.fillAmount = target.Shield == null ? 0 : lerp(.25f, .75f, target.Shield.Progress);
+ TargetHitpointsFill.fillAmount = Mathf.Lerp(.25f, .75f, target.Hull.Durability / targetMaxDurability);
+ TargetShieldsFill.fillAmount = target.Shield == null ? 0 : Mathf.Lerp(.25f, .75f, target.Shield.Progress);
}
var tractorPower = Input.Player.TractorBeam.ReadValue();
- CurrentEntity.TractorPower =
- saturate(CurrentEntity.TractorPower + sign(tractorPower - CurrentEntity.TractorPower) * Time.deltaTime * 2);
+ RequestTractorPower(Saturate(CurrentEntity.TractorPower + Mathf.Sign(tractorPower - CurrentEntity.TractorPower) * Time.deltaTime * 2));
}
- Zone.Update(Time.deltaTime);
}
}
+ private void ApplyLatestAuthoritativeDaemonFrame()
+ {
+ var observer = ResolveDaemonObserver();
+ var observed = observer?.LastObservedState;
+ if (observed == null || !observed.IsAuthoritative)
+ {
+ return;
+ }
+
+ if (observed.Frame.FrameId == _lastAppliedAuthoritativeDaemonFrameId &&
+ string.Equals(observed.FramePath, _lastAppliedAuthoritativeDaemonFramePath, StringComparison.Ordinal))
+ {
+ return;
+ }
+
+ if (TryRestoreEntityGraphFromDaemonRun(observed.Run))
+ {
+ _lastAppliedAuthoritativeDaemonFrameId = observed.Frame.FrameId;
+ _lastAppliedAuthoritativeDaemonFramePath = observed.FramePath ?? "";
+ }
+ }
+
+ private bool TryRequestDaemonMoveVector(Vector2 movement)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var changed = !_hasSentDaemonMoveVector ||
+ (movement - _lastSentDaemonMoveVector).sqrMagnitude >
+ DaemonMoveCommandChangeThreshold * DaemonMoveCommandChangeThreshold;
+ if (!changed && Time.unscaledTime < _nextDaemonMoveCommandTime)
+ {
+ return true;
+ }
+
+ try
+ {
+ observer.Operations.SetMoveVector(movement.x, movement.y, movement.magnitude);
+ _lastSentDaemonMoveVector = movement;
+ _hasSentDaemonMoveVector = true;
+ _nextDaemonMoveCommandTime = Time.unscaledTime + DaemonMoveCommandIntervalSeconds;
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon movement operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private void RequestLookDirection(Vector3 lookDirection)
+ {
+ TryRequestDaemonLookDirection(lookDirection);
+ }
+
+ private bool TryRequestDaemonLookDirection(Vector3 lookDirection)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var changed = !_hasSentDaemonLookDirection ||
+ (lookDirection - _lastSentDaemonLookDirection).sqrMagnitude >
+ DaemonLookCommandChangeThreshold * DaemonLookCommandChangeThreshold;
+ if (!changed && Time.unscaledTime < _nextDaemonLookCommandTime)
+ {
+ return true;
+ }
+
+ try
+ {
+ observer.Operations.SetLookDirection(lookDirection.x, lookDirection.y, lookDirection.z);
+ _lastSentDaemonLookDirection = lookDirection;
+ _hasSentDaemonLookDirection = true;
+ _nextDaemonLookCommandTime = Time.unscaledTime + DaemonLookCommandIntervalSeconds;
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon look operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private void RequestTractorPower(float power)
+ {
+ TryRequestDaemonTractorPower(power);
+ }
+
+ private bool TryRequestDaemonTractorPower(float power)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ var changed = !_hasSentDaemonTractorPower ||
+ Mathf.Abs(power - _lastSentDaemonTractorPower) >
+ DaemonTractorCommandChangeThreshold;
+ if (!changed && Time.unscaledTime < _nextDaemonTractorCommandTime)
+ {
+ return true;
+ }
+
+ try
+ {
+ observer.Operations.SetTractorPower(power);
+ _lastSentDaemonTractorPower = power;
+ _hasSentDaemonTractorPower = true;
+ _nextDaemonTractorCommandTime = Time.unscaledTime + DaemonTractorCommandIntervalSeconds;
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon tractor-power operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private void RequestTargetSelection(Entity target)
+ {
+ TryRequestDaemonTargetSelection(target);
+ }
+
+ private bool TryRequestDaemonTargetSelection(Entity target)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ try
+ {
+ if (target == null)
+ {
+ observer.Operations.ClearTarget();
+ return true;
+ }
+
+ var targetEntityKey = ResolveEntityRecordKey(target);
+ if (string.IsNullOrWhiteSpace(targetEntityKey))
+ {
+ return false;
+ }
+
+ observer.Operations.SetTarget(targetEntityKey);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon target operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private void RequestOverrideShutdown(bool enabled)
+ {
+ TryRequestDaemonOverrideShutdown(enabled);
+ }
+
+ private bool TryRequestDaemonOverrideShutdown(bool enabled)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetOverrideShutdown(enabled);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon override-shutdown operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private void RequestSensorPing()
+ {
+ TryRequestDaemonSensorPing();
+ }
+
+ private bool TryRequestDaemonSensorPing()
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SensorPing();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon sensor-ping operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private void RequestHeatsinksEnabled(bool enabled)
+ {
+ TryRequestDaemonHeatsinksEnabled(enabled);
+ }
+
+ private bool TryRequestDaemonHeatsinksEnabled(bool enabled)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetHeatsinksEnabled(enabled);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon heatsinks operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private void RequestShieldToggle()
+ {
+ TryRequestDaemonShieldToggle();
+ }
+
+ private bool TryRequestDaemonShieldToggle()
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.ToggleShieldEnabled();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon shield enablement operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ public void RequestDock()
+ {
+ TryRequestDaemonDock();
+ }
+
+ private bool TryRequestDaemonDock()
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || CurrentEntity == null)
+ {
+ return false;
+ }
+
+ var target = FindDaemonDockTarget();
+ var targetKey = ResolveEntityRecordKey(target);
+ if (string.IsNullOrWhiteSpace(targetKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.Dock(targetKey);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon dock operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private Entity FindDaemonDockTarget()
+ {
+ if (CurrentEntity == null || Zone == null)
+ {
+ return null;
+ }
+
+ var dockingDistanceSq = Settings.GameplaySettings.DockingDistance * Settings.GameplaySettings.DockingDistance;
+ Entity closest = null;
+ var closestDistanceSq = float.MaxValue;
+ foreach (var entity in Zone.Entities)
+ {
+ if (entity == null || entity == CurrentEntity)
+ {
+ continue;
+ }
+
+ var distanceSq = CultMath.math.lengthsq(entity.CultPositionXZ - CurrentEntity.CultPositionXZ);
+ if (distanceSq >= dockingDistanceSq || distanceSq >= closestDistanceSq)
+ {
+ continue;
+ }
+
+ closest = entity;
+ closestDistanceSq = distanceSq;
+ }
+
+ return closest;
+ }
+
+ public void RequestUndock()
+ {
+ TryRequestDaemonUndock();
+ }
+
+ private bool TryRequestDaemonUndock()
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || CurrentEntity == null)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.Undock();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon undock operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private bool TryRequestDaemonDockedCurrentShip(Ship ship)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || ship == null)
+ {
+ return false;
+ }
+
+ var targetEntityKey = ResolveEntityRecordKey(ship);
+ if (string.IsNullOrWhiteSpace(targetEntityKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetDockedCurrentShip(targetEntityKey);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon docked current ship operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private string ResolveEntityRecordKey(Entity entity)
+ {
+ if (entity == null || Zone == null)
+ {
+ return "";
+ }
+
+ foreach (var pair in _authoritativeDaemonEntities)
+ {
+ if (ReferenceEquals(pair.Value, entity))
+ return pair.Key;
+ }
+
+ return "";
+ }
+
+ public bool TryRequestDaemonActionBarConsumable(string itemKey)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || string.IsNullOrWhiteSpace(itemKey))
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.ActivateConsumable(itemKey);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon consumable operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ public bool TryRequestDaemonActionBarBehavior(int equipmentIndex, int behaviorIndex, bool active)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || equipmentIndex < 0 || behaviorIndex < 0)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetBehaviorActive(equipmentIndex, behaviorIndex, active);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon behavior activation operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ public bool TryRequestDaemonActionBarWeaponGroup(int weaponGroup, bool active)
+ {
+ var observer = ResolveDaemonObserver();
+ if (observer == null || !observer.HasAuthoritativeState || weaponGroup < 0)
+ {
+ return false;
+ }
+
+ try
+ {
+ observer.Operations.SetWeaponGroupActive(weaponGroup, active);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarning($"Failed to send Aetheria daemon weapon-group operation; operation not submitted: {ex.Message}");
+ return false;
+ }
+ }
+
+ private AetheriaDaemonObserver ResolveDaemonObserver()
+ {
+ if (_daemonObserver != null)
+ {
+ return _daemonObserver;
+ }
+
+ _daemonObserver = FindAnyObjectByType();
+ return _daemonObserver;
+ }
+
private void LateUpdate()
{
UpdateTargetIndicators();
@@ -3692,7 +4087,7 @@ public class ActionGameManager : MonoBehaviour
ViewDot.Target = ZoneRenderer.EntityInstances[CurrentEntity].LookAtPoint.position;
if (CurrentEntity.Target.Value != null)
TargetIndicator.Target = CurrentEntity.Target.Value.Position;
- var distance = length((float3)ViewDot.Target - CurrentEntity.Position);
+ var distance = CultMath.math.length(AetheriaMath.ToCult((float3)ViewDot.Target) - CurrentEntity.CultPosition);
foreach (var (_, barrels, crosshair) in _articulationGroups)
{
var averagePosition = Vector3.zero;
@@ -3701,7 +4096,7 @@ public class ActionGameManager : MonoBehaviour
averagePosition /= barrels.Length;
crosshair.Target = averagePosition;
}
-
+
foreach (var (targetLock, indicator, spin) in _lockingIndicators)
{
var showLockingIndicator = targetLock.Lock > .01f && CurrentEntity.Target.Value != null && CurrentEntity.Target.Value.IsHostileTo(CurrentEntity);
diff --git a/Assets/Scripts/Gameplay/AetheriaDaemonOperations.cs b/Assets/Scripts/Gameplay/AetheriaDaemonOperations.cs
new file mode 100644
index 000000000..b1a88868a
--- /dev/null
+++ b/Assets/Scripts/Gameplay/AetheriaDaemonOperations.cs
@@ -0,0 +1,438 @@
+using System;
+using GameCult.Aetheria.State.Unity;
+
+public sealed class AetheriaDaemonOperations
+{
+ private readonly AetheriaDaemonObserver _observer;
+
+ internal AetheriaDaemonOperations(AetheriaDaemonObserver observer)
+ {
+ _observer = observer ?? throw new ArgumentNullException(nameof(observer));
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetTarget(string targetEntityKey)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetTarget, command =>
+ command.TargetEntityKey = targetEntityKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ClearTarget()
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ClearTarget);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetMoveVector(
+ double directionX,
+ double directionY,
+ double scalarValue = 1.0)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetMoveVector, command =>
+ {
+ command.DirectionX = directionX;
+ command.DirectionY = directionY;
+ command.ScalarValue = scalarValue;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetLookDirection(double directionX, double directionY, double directionZ)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetLookDirection, command =>
+ {
+ command.DirectionX = directionX;
+ command.DirectionY = directionY;
+ command.PositionZ = directionZ;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetTractorPower(double power)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetTractorPower, command =>
+ command.ScalarValue = power);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope FireWeaponGroup(int weaponGroup)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, command =>
+ command.WeaponGroup = weaponGroup);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupActive(int weaponGroup, bool active)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupActive, command =>
+ {
+ command.WeaponGroup = weaponGroup;
+ command.ScalarValue = active ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupMembership(
+ string targetEntityKey,
+ int equipmentIndex,
+ int weaponGroup,
+ bool assigned)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.WeaponGroup = weaponGroup;
+ command.ScalarValue = assigned ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetBehaviorActive(int equipmentIndex, int behaviorIndex, bool active)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive, command =>
+ {
+ command.EquipmentIndex = equipmentIndex;
+ command.BehaviorIndex = behaviorIndex;
+ command.ScalarValue = active ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ActivateConsumable(string itemKey)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ActivateConsumable, command =>
+ command.TextValue = itemKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SensorPing()
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SensorPing);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetHeatsinksEnabled(bool enabled)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetHeatsinksEnabled, command =>
+ command.ScalarValue = enabled ? 1.0 : 0.0);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetOverrideShutdown(bool enabled)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, command =>
+ command.ScalarValue = enabled ? 1.0 : 0.0);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetEntityOverrideShutdown(string targetEntityKey, bool enabled)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.ScalarValue = enabled ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetItemEnabled(int equipmentIndex, bool enabled)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetItemEnabled, command =>
+ {
+ command.EquipmentIndex = equipmentIndex;
+ command.ScalarValue = enabled ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ToggleShieldEnabled()
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetItemOverrideShutdown(
+ string targetEntityKey,
+ int equipmentIndex,
+ bool enabled)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetItemOverrideShutdown, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.ScalarValue = enabled ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetThermotoggleTargetTemperature(
+ string targetEntityKey,
+ int equipmentIndex,
+ int behaviorIndex,
+ double targetTemperature)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetThermotoggleTargetTemperature, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.BehaviorIndex = behaviorIndex;
+ command.ScalarValue = targetTemperature;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetShutdownPerformance(
+ string targetEntityKey,
+ double shutdownPerformance)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.ScalarValue = shutdownPerformance;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetActionBarBinding(
+ string controlPath,
+ string kind,
+ string itemKey,
+ int equipmentIndex,
+ int behaviorIndex,
+ int weaponGroup)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding, command =>
+ {
+ command.TextValue = controlPath ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.BehaviorIndex = behaviorIndex;
+ command.WeaponGroup = weaponGroup;
+ command.ActionBarBinding.Kind = kind ?? "";
+ command.ActionBarBinding.ItemKey = itemKey ?? "";
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ClearActionBarBinding(string controlPath)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ClearActionBarBinding, command =>
+ command.TextValue = controlPath ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ToggleHullConductivity(
+ string targetEntityKey,
+ int x,
+ int y,
+ int axis)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ToggleHullConductivity, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.PositionX = x;
+ command.PositionY = y;
+ command.ScalarValue = axis;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetEntityName(string targetEntityKey, string name)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetEntityName, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.TextValue = name ?? "";
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope Dock(string targetEntityKey)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.Dock, command =>
+ command.TargetEntityKey = targetEntityKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope Undock()
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.Undock);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetDockedCurrentShip(string targetEntityKey)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetDockedCurrentShip, command =>
+ command.TargetEntityKey = targetEntityKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope EnterWormhole(
+ int targetZoneIndex,
+ double positionX,
+ double positionY)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.EnterWormhole, command =>
+ {
+ command.TargetZoneIndex = targetZoneIndex;
+ command.PositionX = positionX;
+ command.PositionY = positionY;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope TowToStation(
+ string stationEntityKey,
+ int targetZoneIndex,
+ double positionX,
+ double positionY)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.TowToStation, command =>
+ {
+ command.TargetEntityKey = stationEntityKey ?? "";
+ command.TargetZoneIndex = targetZoneIndex;
+ command.PositionX = positionX;
+ command.PositionY = positionY;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope TransferCargoItem(
+ string originEntityKey,
+ int originCargoIndex,
+ string destinationEntityKey,
+ int destinationCargoIndex,
+ string itemKey,
+ int quantity,
+ int sourceX,
+ int sourceY,
+ int destinationX,
+ int destinationY,
+ bool hasDestinationPosition)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.TransferCargoItem, command =>
+ {
+ command.TargetEntityKey = destinationEntityKey ?? "";
+ command.EquipmentIndex = destinationCargoIndex;
+ command.PositionX = destinationX;
+ command.PositionY = destinationY;
+ command.ScalarValue = quantity;
+ command.TextValue = itemKey ?? "";
+ command.CargoTransfer.OriginEntityKey = originEntityKey ?? "";
+ command.CargoTransfer.OriginCargoIndex = originCargoIndex;
+ command.CargoTransfer.DestinationEntityKey = destinationEntityKey ?? "";
+ command.CargoTransfer.DestinationCargoIndex = destinationCargoIndex;
+ command.CargoTransfer.SourceX = sourceX;
+ command.CargoTransfer.SourceY = sourceY;
+ command.CargoTransfer.DestinationX = destinationX;
+ command.CargoTransfer.DestinationY = destinationY;
+ command.CargoTransfer.HasDestinationPosition = hasDestinationPosition;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope TradePurchase(
+ string purchaseKind,
+ string itemKey,
+ int quantity,
+ int unitPrice,
+ int totalPrice,
+ string stationEntityKey,
+ int stationCargoIndex,
+ string targetEntityKey,
+ int targetCargoIndex,
+ int sourceX,
+ int sourceY,
+ bool createsDockedShip)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.TradePurchase, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = targetCargoIndex;
+ command.PositionX = sourceX;
+ command.PositionY = sourceY;
+ command.ScalarValue = totalPrice;
+ command.TextValue = itemKey ?? "";
+ command.TradePurchase.PurchaseKind = purchaseKind ?? "";
+ command.TradePurchase.ItemKey = itemKey ?? "";
+ command.TradePurchase.Quantity = quantity;
+ command.TradePurchase.UnitPrice = unitPrice;
+ command.TradePurchase.TotalPrice = totalPrice;
+ command.TradePurchase.StationEntityKey = stationEntityKey ?? "";
+ command.TradePurchase.StationCargoIndex = stationCargoIndex;
+ command.TradePurchase.TargetEntityKey = targetEntityKey ?? "";
+ command.TradePurchase.TargetCargoIndex = targetCargoIndex;
+ command.TradePurchase.SourceX = sourceX;
+ command.TradePurchase.SourceY = sourceY;
+ command.TradePurchase.CreatesDockedShip = createsDockedShip;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope PickUpLoot(
+ string targetEntityKey,
+ string itemKey,
+ int quantity,
+ double positionX,
+ double positionY,
+ double positionZ)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.PickUpLoot, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.TextValue = itemKey ?? "";
+ command.ScalarValue = quantity;
+ command.PositionX = positionX;
+ command.PositionY = positionY;
+ command.PositionZ = positionZ;
+ command.LootPickup.ItemKey = itemKey ?? "";
+ command.LootPickup.Quantity = quantity;
+ command.LootPickup.PositionX = positionX;
+ command.LootPickup.PositionY = positionY;
+ command.LootPickup.PositionZ = positionZ;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope RestoreLoadout(
+ string dockedEntityKey,
+ string templateName,
+ int price)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.RestoreLoadout, command =>
+ {
+ command.TargetEntityKey = dockedEntityKey ?? "";
+ command.TextValue = templateName ?? "";
+ command.ScalarValue = price;
+ command.LoadoutRestore.DockedEntityKey = dockedEntityKey ?? "";
+ command.LoadoutRestore.TemplateName = templateName ?? "";
+ command.LoadoutRestore.Price = price;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope EquipItem(
+ string sourceKind,
+ string originEntityKey,
+ int originIndex,
+ string destinationEntityKey,
+ string itemKey,
+ int sourceX,
+ int sourceY,
+ int destinationX,
+ int destinationY,
+ bool hasDestinationPosition)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.EquipItem, command =>
+ {
+ command.TargetEntityKey = destinationEntityKey ?? "";
+ command.PositionX = destinationX;
+ command.PositionY = destinationY;
+ command.TextValue = itemKey ?? "";
+ command.EquipmentTransfer.SourceKind = sourceKind ?? "";
+ command.EquipmentTransfer.OriginEntityKey = originEntityKey ?? "";
+ command.EquipmentTransfer.OriginIndex = originIndex;
+ command.EquipmentTransfer.DestinationEntityKey = destinationEntityKey ?? "";
+ command.EquipmentTransfer.SourceX = sourceX;
+ command.EquipmentTransfer.SourceY = sourceY;
+ command.EquipmentTransfer.DestinationX = destinationX;
+ command.EquipmentTransfer.DestinationY = destinationY;
+ command.EquipmentTransfer.HasDestinationPosition = hasDestinationPosition;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope StoreItem(
+ string originEntityKey,
+ int sourceEquipmentIndex,
+ string destinationEntityKey,
+ int destinationCargoIndex,
+ string itemKey,
+ int destinationX,
+ int destinationY,
+ bool hasDestinationPosition)
+ {
+ return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.StoreItem, command =>
+ {
+ command.TargetEntityKey = destinationEntityKey ?? "";
+ command.EquipmentIndex = sourceEquipmentIndex;
+ command.PositionX = destinationX;
+ command.PositionY = destinationY;
+ command.TextValue = itemKey ?? "";
+ command.StoreItem.OriginEntityKey = originEntityKey ?? "";
+ command.StoreItem.SourceEquipmentIndex = sourceEquipmentIndex;
+ command.StoreItem.DestinationEntityKey = destinationEntityKey ?? "";
+ command.StoreItem.DestinationCargoIndex = destinationCargoIndex;
+ command.StoreItem.DestinationX = destinationX;
+ command.StoreItem.DestinationY = destinationY;
+ command.StoreItem.HasDestinationPosition = hasDestinationPosition;
+ });
+ }
+}
diff --git a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs
new file mode 100644
index 000000000..057317735
--- /dev/null
+++ b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs
@@ -0,0 +1,2336 @@
+using GameCult.Aetheria.State.Unity;
+using GameCult.Eve.Surface;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+public class DaemonRuntimeDocumentTests
+{
+ [Test]
+ public void FrameFactoryMarksDaemonAsAuthoritativeStateSource()
+ {
+ var run = new AetheriaRuntimeRunCheckpointCommit
+ {
+ RunId = "run-1",
+ CurrentZoneIndex = 3,
+ CurrentEntityKey = "entity:player"
+ };
+
+ var frame = AetheriaRuntimeDaemonFrameDocument.Create(
+ run,
+ "ymir-daemon",
+ "session-1",
+ 42,
+ 12.5,
+ 0.02);
+
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.Frame, frame.Schema);
+ Assert.AreEqual("ymir-daemon", frame.DaemonId);
+ Assert.AreEqual("session-1", frame.SessionId);
+ Assert.AreEqual(42, frame.FrameId);
+ Assert.AreEqual(12.5, frame.SimulationTimeSeconds);
+ Assert.AreEqual(0.02, frame.FixedDeltaSeconds);
+ Assert.IsTrue(frame.IsAuthoritative);
+ Assert.AreEqual("daemon", frame.StateSource);
+ Assert.AreSame(run, frame.Run);
+ Assert.AreEqual("entity:player", frame.Run.CurrentEntityKey);
+ Assert.IsNotEmpty(frame.PublishedAtUtc);
+ }
+
+ [Test]
+ public void CommandFactoryPreservesClientObservedFrame()
+ {
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetTarget,
+ "codex",
+ "session-1",
+ 42,
+ "entity:player");
+
+ command.TargetEntityKey = "entity:pirate";
+
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.Command, command.Schema);
+ Assert.AreEqual(AetheriaRuntimeDaemonCommandKinds.SetTarget, command.Kind);
+ Assert.AreEqual("codex", command.ClientId);
+ Assert.AreEqual("session-1", command.SessionId);
+ Assert.AreEqual(42, command.ObservedFrameId);
+ Assert.AreEqual("entity:player", command.ActorEntityKey);
+ Assert.AreEqual("entity:pirate", command.TargetEntityKey);
+ Assert.IsNotEmpty(command.CommandId);
+ Assert.IsNotEmpty(command.IssuedAtUtc);
+ }
+
+ [Test]
+ public void CommandDocumentRoundTripsThroughStateNode()
+ {
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup,
+ "bifrost",
+ "session-2",
+ 99,
+ "entity:player");
+ command.WeaponGroup = 2;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(
+ new AetheriaRuntimeRunCheckpointCommit(),
+ new[] { command });
+
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.Command, command.Schema);
+ Assert.AreEqual(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, command.Kind);
+ Assert.AreEqual("bifrost", command.ClientId);
+ Assert.AreEqual("session-2", command.SessionId);
+ Assert.AreEqual(99, command.ObservedFrameId);
+ Assert.AreEqual("entity:player", command.ActorEntityKey);
+ Assert.AreEqual(2, command.WeaponGroup);
+ CollectionAssert.Contains(result.AppliedCommandIds, command.CommandId);
+ }
+
+ [Test]
+ public void FrameStorePublishesLatestDaemonFrame()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-frame-store-tests",
+ Path.GetRandomFileName(),
+ "state.cc");
+ var frame = AetheriaRuntimeDaemonFrameDocument.Create(
+ new AetheriaRuntimeRunCheckpointCommit
+ {
+ RunId = "run-2",
+ CurrentZoneIndex = 7,
+ CurrentEntityKey = "entity:ship"
+ },
+ "aetheria-daemon",
+ "session-3",
+ 123,
+ 45.5,
+ 0.016);
+
+ var framePath = AetheriaRuntimeDaemonFrameStore.PublishFrame(statePath, frame);
+ var read = AetheriaRuntimeDaemonFrameStore.TryReadFrame(statePath, out var stored);
+
+ Assert.IsTrue(read);
+ Assert.AreEqual(AetheriaRuntimeStateBoundary.GetDaemonFramePath(statePath), framePath);
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.Frame, stored.Schema);
+ Assert.AreEqual("aetheria-daemon", stored.DaemonId);
+ Assert.AreEqual("session-3", stored.SessionId);
+ Assert.AreEqual(123, stored.FrameId);
+ Assert.IsTrue(stored.IsAuthoritative);
+ Assert.AreEqual("daemon", stored.StateSource);
+ Assert.AreEqual("run-2", stored.Run.RunId);
+ Assert.AreEqual(7, stored.Run.CurrentZoneIndex);
+ Assert.AreEqual("entity:ship", stored.Run.CurrentEntityKey);
+ }
+
+ [Test]
+ public void FrameStoreReportsMissingFrame()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-frame-store-tests",
+ Path.GetRandomFileName(),
+ "missing-state.cc");
+
+ Assert.IsFalse(AetheriaRuntimeDaemonFrameStore.TryReadFrame(statePath, out _));
+ }
+
+ [Test]
+ public void TickRunnerAppliesObservedCommandsAndPublishesFrame()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-tick-runner-tests",
+ Path.GetRandomFileName(),
+ "state.cc");
+ var run = RunWithTwoEntities();
+ var targetCommand = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetTarget,
+ "codex",
+ "session-tick",
+ 40,
+ "zone.0.entity.0");
+ targetCommand.TargetEntityKey = "zone.0.entity.1";
+ var movementCommand = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetMoveVector,
+ "codex",
+ "session-tick",
+ 41,
+ "zone.0.entity.0");
+ movementCommand.DirectionX = 1.0;
+ movementCommand.DirectionY = 0.0;
+ movementCommand.ScalarValue = 1.0;
+
+ var result = AetheriaRuntimeDaemonTickRunner.Tick(
+ statePath,
+ run,
+ new AetheriaRuntimeDaemonTickOptions
+ {
+ DaemonId = "test-daemon",
+ SessionId = "session-tick",
+ VerseId = "aetheria.test",
+ CultMeshAddress = "cultmesh://aetheria.test/eve/providers/aetheria.daemon",
+ FrameId = 42,
+ SimulationTimeSeconds = 12.5,
+ FixedDeltaSeconds = 0.02,
+ ObservedCommands = new[] { targetCommand, movementCommand }
+ });
+
+ Assert.AreEqual(2, result.OperationResult.AppliedCommandIds.Count);
+ Assert.AreEqual(0, result.OperationResult.RejectedCommandIds.Count);
+ Assert.AreEqual(1, run.Zones[0].Entities[0].TargetEntityIndex);
+ Assert.AreEqual("zone.0.entity.0", result.Intents.Movement.ActorEntityKey);
+ Assert.AreEqual(1.0, result.Intents.Movement.DirectionX, 0.0001);
+ Assert.IsTrue(AetheriaRuntimeDaemonFrameStore.TryReadFrame(statePath, out var frame));
+ Assert.AreEqual(result.FramePath, AetheriaRuntimeDaemonFrameStore.GetFramePath(statePath));
+ Assert.AreEqual("test-daemon", frame.DaemonId);
+ Assert.AreEqual("session-tick", frame.SessionId);
+ Assert.AreEqual(42, frame.FrameId);
+ Assert.IsTrue(frame.IsAuthoritative);
+ Assert.AreEqual("daemon", frame.StateSource);
+ CollectionAssert.Contains(frame.Capabilities, "aetheria.daemon.intent_state.v1");
+ CollectionAssert.Contains(frame.Capabilities, AetheriaRuntimeDaemonSchemas.ProviderAdvertisement);
+ CollectionAssert.Contains(frame.Capabilities, AetheriaRuntimeDaemonSchemas.CommandBoundary);
+ CollectionAssert.Contains(frame.Capabilities, AetheriaRuntimeDaemonSchemas.Health);
+ CollectionAssert.Contains(frame.Capabilities, AetheriaRuntimeDaemonSchemas.GameSurface);
+ CollectionAssert.Contains(frame.Capabilities, AetheriaRuntimeDaemonSchemas.EditorSurface);
+ CollectionAssert.AreEquivalent(result.OperationResult.AppliedCommandIds, frame.AppliedCommandIds);
+ Assert.AreEqual(1, frame.Run.Zones[0].Entities[0].TargetEntityIndex);
+ Assert.AreEqual(
+ AetheriaRuntimeDaemonPublicationStore.GetProviderAdvertisementPath(statePath),
+ result.ProviderAdvertisementPath);
+ Assert.AreEqual(AetheriaRuntimeDaemonPublicationStore.GetHealthPath(statePath), result.HealthPath);
+ Assert.AreEqual(
+ AetheriaRuntimeDaemonPublicationStore.GetCommandBoundaryPath(statePath),
+ result.CommandBoundaryPath);
+ Assert.AreEqual(AetheriaRuntimeDaemonPublicationStore.GetGameSurfacePath(statePath), result.GameSurfacePath);
+ Assert.AreEqual(AetheriaRuntimeDaemonPublicationStore.GetGameTuiSurfacePath(statePath), result.GameTuiSurfacePath);
+ Assert.AreEqual(AetheriaRuntimeDaemonPublicationStore.GetEditorSurfacePath(statePath), result.EditorSurfacePath);
+ Assert.AreEqual(AetheriaRuntimeDaemonPublicationStore.GetEditorTuiSurfacePath(statePath), result.EditorTuiSurfacePath);
+ Assert.IsTrue(AetheriaRuntimeDaemonPublicationStore.TryReadProviderAdvertisement(
+ statePath,
+ out var providerAdvertisement));
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.ProviderAdvertisement, providerAdvertisement.Schema);
+ Assert.AreEqual("aetheria.test", providerAdvertisement.VerseId);
+ Assert.AreEqual("aetheria.daemon", providerAdvertisement.ProviderId);
+ Assert.AreEqual("test-daemon", providerAdvertisement.DaemonId);
+ Assert.AreEqual("cultmesh://aetheria.test/eve/providers/aetheria.daemon", providerAdvertisement.CultMeshAddress);
+ Assert.AreEqual(AetheriaRuntimeDaemonFrameStore.GetFramePath(statePath), providerAdvertisement.FrameWitnessPath);
+ Assert.AreEqual(AetheriaRuntimeDaemonPublicationStore.GetHealthPath(statePath), providerAdvertisement.HealthWitnessPath);
+ Assert.AreEqual(
+ AetheriaRuntimeDaemonPublicationStore.GetCommandBoundaryPath(statePath),
+ providerAdvertisement.CommandBoundaryWitnessPath);
+ Assert.AreEqual(
+ AetheriaRuntimeDaemonPublicationStore.GetGameSurfacePath(statePath),
+ providerAdvertisement.EveGuiSurfaceWitnessPath);
+ Assert.AreEqual(
+ AetheriaRuntimeDaemonPublicationStore.GetGameTuiSurfacePath(statePath),
+ providerAdvertisement.EveTuiSurfaceWitnessPath);
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, providerAdvertisement.EveGuiSurfaceId);
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, providerAdvertisement.EveTuiSurfaceId);
+ Assert.AreEqual(
+ AetheriaRuntimeDaemonPublicationStore.GetEditorSurfacePath(statePath),
+ providerAdvertisement.EditorGuiSurfaceWitnessPath);
+ Assert.AreEqual(
+ AetheriaRuntimeDaemonPublicationStore.GetEditorTuiSurfacePath(statePath),
+ providerAdvertisement.EditorTuiSurfaceWitnessPath);
+ Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, providerAdvertisement.EditorGuiSurfaceId);
+ Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, providerAdvertisement.EditorTuiSurfaceId);
+ CollectionAssert.Contains(providerAdvertisement.PublishedSchemas, AetheriaRuntimeDaemonSchemas.Command);
+ CollectionAssert.Contains(providerAdvertisement.PublishedSchemas, AetheriaRuntimeDaemonSchemas.CommandBoundary);
+ CollectionAssert.Contains(providerAdvertisement.PublishedSchemas, AetheriaRuntimeDaemonSchemas.GameSurface);
+ CollectionAssert.Contains(providerAdvertisement.PublishedSchemas, AetheriaRuntimeDaemonSchemas.EditorSurface);
+ Assert.IsTrue(AetheriaRuntimeDaemonPublicationStore.TryReadHealth(statePath, out var health));
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.Health, health.Schema);
+ Assert.AreEqual("test-daemon", health.DaemonId);
+ Assert.AreEqual("aetheria.test", health.VerseId);
+ Assert.AreEqual(42, health.FrameId);
+ Assert.AreEqual(2, health.ObservedCommandCount);
+ Assert.AreEqual(2, health.AppliedCommandCount);
+ Assert.AreEqual(0, health.RejectedCommandCount);
+ Assert.AreEqual("daemon-published", health.PublicationSource);
+ Assert.AreEqual("cultcache-witness", health.Transport);
+ Assert.IsTrue(AetheriaRuntimeDaemonPublicationStore.TryReadCommandBoundary(
+ statePath,
+ out var commandBoundary));
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.CommandBoundary, commandBoundary.Schema);
+ Assert.AreEqual("aetheria.daemon.commands", commandBoundary.BoundaryId);
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.Command, commandBoundary.CommandSchema);
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.Frame, commandBoundary.ReceiptSchema);
+ Assert.IsTrue(commandBoundary.Commands.Any(entry => entry.Kind == AetheriaRuntimeDaemonCommandKinds.SetMoveVector));
+ Assert.IsTrue(commandBoundary.Commands.Any(entry =>
+ entry.Kind == AetheriaRuntimeDaemonCommandKinds.TransferCargoItem &&
+ entry.CommandBody == nameof(AetheriaRuntimeCargoTransferCommand)));
+ Assert.IsTrue(AetheriaRuntimeDaemonPublicationStore.TryReadGameSurface(statePath, out var gameSurface));
+ Assert.AreEqual("aetheria.daemon", gameSurface.ProviderId);
+ Assert.AreEqual("game.daemon", gameSurface.ProviderKind);
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, gameSurface.Surface.Id);
+ Assert.AreEqual(42, gameSurface.Version);
+ Assert.IsTrue(gameSurface.Commands.Any(command =>
+ command.Command == "aetheria.daemon.commands.SetMoveVector" &&
+ command.Transport == "cultmesh"));
+ Assert.IsTrue(ContainsSurfaceMetric(gameSurface.Surface.Root, "Name", "Player"));
+ Assert.IsTrue(ContainsSurfaceMetric(gameSurface.Surface.Root, "Target", "Target"));
+ Assert.IsTrue(AetheriaRuntimeDaemonPublicationStore.TryReadGameTuiSurface(statePath, out var gameTuiSurface));
+ Assert.AreEqual("aetheria.daemon", gameTuiSurface.ProviderId);
+ Assert.AreEqual("game.daemon", gameTuiSurface.ProviderKind);
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, gameTuiSurface.Surface.Id);
+ Assert.AreEqual(42, gameTuiSurface.Version);
+ Assert.IsTrue(AetheriaRuntimeDaemonPublicationStore.TryReadEditorSurface(statePath, out var editorSurface));
+ Assert.AreEqual("aetheria.daemon", editorSurface.ProviderId);
+ Assert.AreEqual("editor.daemon", editorSurface.ProviderKind);
+ Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, editorSurface.Surface.Id);
+ Assert.AreEqual(42, editorSurface.Version);
+ Assert.IsTrue(ContainsSurfaceMetric(editorSurface.Surface.Root, "Verse", "aetheria.test"));
+ Assert.IsTrue(ContainsSurfaceMetric(editorSurface.Surface.Root, "Status", "healthy"));
+ Assert.IsTrue(editorSurface.Commands.Any(command =>
+ command.Command == "aetheria.daemon.commands.TransferCargoItem" &&
+ command.Transport == "cultmesh"));
+ Assert.IsTrue(AetheriaRuntimeDaemonPublicationStore.TryReadEditorTuiSurface(statePath, out var editorTuiSurface));
+ Assert.AreEqual("aetheria.daemon", editorTuiSurface.ProviderId);
+ Assert.AreEqual("editor.daemon", editorTuiSurface.ProviderKind);
+ Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, editorTuiSurface.Surface.Id);
+ Assert.AreEqual(42, editorTuiSurface.Version);
+ Assert.IsTrue(AetheriaRuntimeStateReader.TryReadDaemonGameSurface(
+ statePath,
+ out var unityGameSurface));
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, unityGameSurface.Surface.Id);
+ Assert.AreEqual("aetheria.daemon", unityGameSurface.ProviderId);
+ Assert.IsTrue(unityGameSurface.Commands.Any(command =>
+ command.Command == "aetheria.daemon.commands.SetMoveVector" &&
+ command.Transport == "cultmesh"));
+ Assert.IsTrue(AetheriaRuntimeStateReader.TryReadDaemonGameTuiSurface(
+ statePath,
+ out var unityGameTuiSurface));
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, unityGameTuiSurface.Surface.Id);
+ Assert.AreEqual("game.daemon", unityGameTuiSurface.ProviderKind);
+ Assert.IsTrue(AetheriaRuntimeStateReader.TryReadDaemonEditorSurface(
+ statePath,
+ out var unityEditorSurface));
+ Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, unityEditorSurface.Surface.Id);
+ Assert.AreEqual("editor.daemon", unityEditorSurface.ProviderKind);
+ Assert.IsTrue(unityEditorSurface.Commands.Any(command =>
+ command.Command == "aetheria.daemon.commands.TransferCargoItem" &&
+ command.Transport == "cultmesh"));
+ Assert.IsTrue(AetheriaRuntimeStateReader.TryReadDaemonEditorTuiSurface(
+ statePath,
+ out var unityEditorTuiSurface));
+ Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, unityEditorTuiSurface.Surface.Id);
+ Assert.AreEqual("editor.daemon", unityEditorTuiSurface.ProviderKind);
+ var genericGameSurface = AetheriaRuntimeStateReader.ReadEveSurface(
+ statePath,
+ AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId);
+ Assert.IsNotNull(genericGameSurface);
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, genericGameSurface.Surface.Id);
+ Assert.AreEqual(unityGameSurface.ProviderId, genericGameSurface.ProviderId);
+ var genericGameTuiSurface = AetheriaRuntimeStateReader.ReadEveSurface(
+ statePath,
+ AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId);
+ Assert.IsNotNull(genericGameTuiSurface);
+ Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, genericGameTuiSurface.Surface.Id);
+ var genericEditorTuiSurface = AetheriaRuntimeStateReader.ReadEveSurface(
+ statePath,
+ AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId);
+ Assert.IsNotNull(genericEditorTuiSurface);
+ Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, genericEditorTuiSurface.Surface.Id);
+ }
+
+ [Test]
+ public void SoaViewFactoryDescribesDaemonOwnedObserverReadOnlySlabs()
+ {
+ var buffer = new AetheriaRuntimeDaemonSoaBufferDocument
+ {
+ BufferId = "hot-transform-0",
+ DisplayName = "Hot Transform Page 0",
+ Backend = AetheriaRuntimeDaemonSoaBackends.MemoryMappedFile,
+ Location = "Local\\AetheriaHotTransform0",
+ ByteLength = 4096,
+ Generation = 77,
+ DaemonWritable = true,
+ ObserverWritable = false
+ };
+ var positionX = new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "position-x",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.PositionX,
+ BufferId = buffer.BufferId,
+ ScalarType = "float32",
+ ByteOffset = 0,
+ ElementStride = 4,
+ ElementCount = 128,
+ Unit = "world_units",
+ CoordinateSpace = "zone"
+ };
+ var dirtyRange = new AetheriaRuntimeDaemonSoaDirtyRangeDocument
+ {
+ ColumnId = positionX.ColumnId,
+ StartIndex = 16,
+ Count = 8,
+ Generation = 77
+ };
+
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "ymir-daemon",
+ "session-soa",
+ 42,
+ 77,
+ new[] { buffer },
+ new[] { positionX },
+ new[] { dirtyRange },
+ AetheriaRuntimeDaemonSoaBackends.MemoryMappedFile,
+ AetheriaRuntimeDaemonSoaSynchronizationModes.DoubleBuffered);
+
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.SoaView, view.Schema);
+ Assert.AreEqual("ymir-daemon", view.DaemonId);
+ Assert.AreEqual("session-soa", view.SessionId);
+ Assert.AreEqual(42, view.FrameId);
+ Assert.AreEqual(77, view.Generation);
+ Assert.IsTrue(view.IsAuthoritative);
+ Assert.AreEqual(AetheriaRuntimeDaemonSoaBackends.MemoryMappedFile, view.Backend);
+ Assert.AreEqual(AetheriaRuntimeDaemonSoaSynchronizationModes.DoubleBuffered, view.SynchronizationMode);
+ Assert.AreEqual(1, view.Buffers.Count);
+ Assert.IsTrue(view.Buffers[0].DaemonWritable);
+ Assert.IsFalse(view.Buffers[0].ObserverWritable);
+ Assert.AreEqual(AetheriaRuntimeDaemonSoaColumnKinds.PositionX, view.Columns[0].Kind);
+ Assert.AreEqual(16, view.DirtyRanges[0].StartIndex);
+ Assert.AreEqual(8, view.DirtyRanges[0].Count);
+ Assert.IsNotEmpty(view.PublishedAtUtc);
+ }
+
+ [Test]
+ public void SoaViewIndexBindsReadOnlyDirectMemoryColumns()
+ {
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "ymir-daemon",
+ "session-soa-index",
+ 90,
+ 91,
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaBufferDocument
+ {
+ BufferId = "transform-hot",
+ Backend = AetheriaRuntimeDaemonSoaBackends.MemoryMappedFile,
+ Location = "Local\\AetheriaTransformHot",
+ ByteOffset = 128,
+ ByteLength = 512,
+ Generation = 91,
+ DaemonWritable = true,
+ ObserverWritable = false
+ }
+ },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "position-x",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.PositionX,
+ BufferId = "transform-hot",
+ ScalarType = "float32",
+ ByteOffset = 16,
+ ElementStride = 4,
+ ElementCount = 64,
+ Unit = "world_units",
+ CoordinateSpace = "zone"
+ }
+ },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaDirtyRangeDocument
+ {
+ ColumnId = "position-x",
+ StartIndex = 8,
+ Count = 4,
+ Generation = 91
+ }
+ },
+ AetheriaRuntimeDaemonSoaBackends.MemoryMappedFile);
+
+ var index = AetheriaRuntimeDaemonSoaViewIndex.Build(view);
+
+ Assert.IsTrue(index.IsValid);
+ Assert.IsTrue(index.TryGetFirstColumnOfKind(AetheriaRuntimeDaemonSoaColumnKinds.PositionX, out var binding));
+ Assert.AreEqual("position-x", binding.Column.ColumnId);
+ Assert.AreEqual("transform-hot", binding.Buffer.BufferId);
+ Assert.AreEqual(144, binding.AbsoluteByteOffset);
+ Assert.AreEqual(256, binding.ByteLength);
+ Assert.IsTrue(binding.DirectMemoryCompatible);
+ Assert.AreEqual(1, index.GetDirtyRanges("position-x").Count);
+ Assert.AreEqual(8, index.GetDirtyRanges("position-x")[0].StartIndex);
+ }
+
+ [Test]
+ public void SoaViewIndexBindsDaemonAuthoredRenderGroups()
+ {
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "aetheria-daemon",
+ "session-render-groups",
+ 120,
+ 121,
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaBufferDocument
+ {
+ BufferId = "render-hot",
+ Backend = AetheriaRuntimeDaemonSoaBackends.SharedNativeMemory,
+ ByteLength = 256,
+ Generation = 121,
+ DaemonWritable = true,
+ ObserverWritable = false
+ }
+ },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "render-group-id",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.RenderGroupId,
+ BufferId = "render-hot",
+ ScalarType = "uint32",
+ ByteOffset = 0,
+ ElementStride = 4,
+ ElementCount = 64
+ }
+ },
+ backend: AetheriaRuntimeDaemonSoaBackends.SharedNativeMemory,
+ renderGroups: new[]
+ {
+ new AetheriaRuntimeDaemonRenderGroupDocument
+ {
+ GroupId = 7,
+ MeshKey = "ships/djinni",
+ MaterialKey = "materials/ships/hull",
+ SubMeshIndex = 0,
+ Layer = 12,
+ ShaderKey = "aetheria/daemon-indirect",
+ DisplayName = "Djinni hull",
+ InstanceCount = 24,
+ BoundsCenterX = 10,
+ BoundsCenterY = 20,
+ BoundsCenterZ = 30,
+ BoundsSizeX = 100,
+ BoundsSizeY = 80,
+ BoundsSizeZ = 60,
+ ShadowMode = AetheriaRuntimeDaemonRenderShadowModes.TwoSided,
+ ReceiveShadows = false,
+ DefaultScale = 2.5f,
+ Lod = 2
+ }
+ });
+
+ var index = AetheriaRuntimeDaemonSoaViewIndex.Build(view);
+
+ Assert.IsTrue(index.IsValid);
+ Assert.IsTrue(index.TryGetFirstColumnOfKind(AetheriaRuntimeDaemonSoaColumnKinds.RenderGroupId, out var groupColumn));
+ Assert.AreEqual("render-group-id", groupColumn.Column.ColumnId);
+ Assert.IsTrue(groupColumn.DirectMemoryCompatible);
+ Assert.AreEqual(1, index.RenderGroups.Count);
+ Assert.IsTrue(index.TryGetRenderGroup(7, out var renderGroup));
+ Assert.AreEqual("ships/djinni", renderGroup.MeshKey);
+ Assert.AreEqual("materials/ships/hull", renderGroup.MaterialKey);
+ Assert.AreEqual(12, renderGroup.Layer);
+ Assert.AreEqual(24, renderGroup.InstanceCount);
+ Assert.AreEqual(10, renderGroup.BoundsCenterX);
+ Assert.AreEqual(100, renderGroup.BoundsSizeX);
+ Assert.AreEqual(AetheriaRuntimeDaemonRenderShadowModes.TwoSided, renderGroup.ShadowMode);
+ Assert.IsFalse(renderGroup.ReceiveShadows);
+ Assert.AreEqual(2.5f, renderGroup.DefaultScale);
+ Assert.AreEqual(2, renderGroup.Lod);
+ }
+
+ [Test]
+ public void SoaViewIndexRejectsInvalidRenderGroups()
+ {
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "aetheria-daemon",
+ "session-render-groups-invalid",
+ 122,
+ 123,
+ new[] { new AetheriaRuntimeDaemonSoaBufferDocument { BufferId = "render-hot", ByteLength = 16 } },
+ new[] { new AetheriaRuntimeDaemonSoaColumnDocument { ColumnId = "render-group-id", Kind = AetheriaRuntimeDaemonSoaColumnKinds.RenderGroupId, BufferId = "render-hot", ScalarType = "uint32", ElementStride = 4, ElementCount = 4 } },
+ renderGroups: new[]
+ {
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 3, MeshKey = "ships/djinni" },
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 3, MeshKey = "ships/djinni", MaterialKey = "materials/ships/hull" },
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 4, MeshKey = "ships/pirate", MaterialKey = "materials/ships/hull", SubMeshIndex = -1 },
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 5, MeshKey = "ships/frigate", MaterialKey = "materials/ships/hull", InstanceCount = -2 },
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 6, MeshKey = "ships/cruiser", MaterialKey = "materials/ships/hull", BoundsSizeX = 10, BoundsSizeY = 0, BoundsSizeZ = 10 },
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 7, MeshKey = "ships/hauler", MaterialKey = "materials/ships/hull", ShadowMode = "unity-local-policy" },
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 8, MeshKey = "ships/shuttle", MaterialKey = "materials/ships/hull", DefaultScale = 0 },
+ new AetheriaRuntimeDaemonRenderGroupDocument { GroupId = 9, MeshKey = "ships/scout", MaterialKey = "materials/ships/hull", Lod = -2 }
+ });
+
+ var index = AetheriaRuntimeDaemonSoaViewIndex.Build(view);
+ var errors = string.Join("\n", index.ValidationErrors);
+
+ Assert.IsFalse(index.IsValid);
+ StringAssert.Contains("missing a material key", errors);
+ StringAssert.Contains("Duplicate render group id '3'", errors);
+ StringAssert.Contains("negative submesh index", errors);
+ StringAssert.Contains("invalid instance count", errors);
+ StringAssert.Contains("must publish positive render bounds", errors);
+ StringAssert.Contains("invalid shadow mode", errors);
+ StringAssert.Contains("non-positive default scale", errors);
+ StringAssert.Contains("invalid render lod", errors);
+ }
+
+ [Test]
+ public void SoaViewIndexRejectsInvalidRenderSemanticColumnTypes()
+ {
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "aetheria-daemon",
+ "session-render-column-types-invalid",
+ 126,
+ 127,
+ new[] { new AetheriaRuntimeDaemonSoaBufferDocument { BufferId = "render-hot", ByteLength = 64 } },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "render-scale",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.RenderScale,
+ BufferId = "render-hot",
+ ScalarType = "uint32",
+ ElementStride = 4,
+ ElementCount = 4
+ },
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "render-visibility",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.RenderVisibility,
+ BufferId = "render-hot",
+ ScalarType = "float32",
+ ByteOffset = 16,
+ ElementStride = 4,
+ ElementCount = 4
+ },
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "render-lod",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.RenderLod,
+ BufferId = "render-hot",
+ ScalarType = "float32",
+ ByteOffset = 32,
+ ElementStride = 4,
+ ElementCount = 4
+ },
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "physics-body-radius",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.PhysicsBodyRadius,
+ BufferId = "render-hot",
+ ScalarType = "uint32",
+ ByteOffset = 48,
+ ElementStride = 4,
+ ElementCount = 4
+ }
+ });
+
+ var index = AetheriaRuntimeDaemonSoaViewIndex.Build(view);
+ var errors = string.Join("\n", index.ValidationErrors);
+
+ Assert.IsFalse(index.IsValid);
+ StringAssert.Contains("render scale must use float32", errors);
+ StringAssert.Contains("render visibility must use bool, byte, or uint8", errors);
+ StringAssert.Contains("render lod must use int32", errors);
+ StringAssert.Contains("physics.body.radius must use float32", errors);
+ }
+
+ [Test]
+ public void SoaViewIndexRequiresRenderGroupIdColumnForMultipleRenderGroups()
+ {
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "aetheria-daemon",
+ "session-render-groups-without-group-column",
+ 124,
+ 125,
+ Array.Empty(),
+ Array.Empty(),
+ renderGroups: new[]
+ {
+ new AetheriaRuntimeDaemonRenderGroupDocument
+ {
+ GroupId = 1,
+ MeshKey = "ships/djinni",
+ MaterialKey = "materials/ships/hull",
+ BoundsSizeX = 10,
+ BoundsSizeY = 10,
+ BoundsSizeZ = 10
+ },
+ new AetheriaRuntimeDaemonRenderGroupDocument
+ {
+ GroupId = 2,
+ MeshKey = "ships/frigate",
+ MaterialKey = "materials/ships/hull",
+ BoundsSizeX = 10,
+ BoundsSizeY = 10,
+ BoundsSizeZ = 10
+ }
+ });
+
+ var index = AetheriaRuntimeDaemonSoaViewIndex.Build(view);
+ var errors = string.Join("\n", index.ValidationErrors);
+
+ Assert.IsFalse(index.IsValid);
+ StringAssert.Contains("Multiple render groups require a render group id column", errors);
+ }
+
+ [Test]
+ public void SoaViewIndexRejectsObserverWritableAndOutOfBoundsColumns()
+ {
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "ymir-daemon",
+ "session-soa-index-invalid",
+ 92,
+ 93,
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaBufferDocument
+ {
+ BufferId = "mutable-hot",
+ Backend = AetheriaRuntimeDaemonSoaBackends.SharedNativeMemory,
+ ByteLength = 16,
+ ObserverWritable = true
+ }
+ },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "heat",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.Heat,
+ BufferId = "mutable-hot",
+ ScalarType = "float32",
+ ByteOffset = 8,
+ ElementStride = 4,
+ ElementCount = 8
+ }
+ });
+
+ var index = AetheriaRuntimeDaemonSoaViewIndex.Build(view);
+
+ Assert.IsFalse(index.IsValid);
+ Assert.GreaterOrEqual(index.ValidationErrors.Count, 2);
+ Assert.IsTrue(index.TryGetFirstColumnOfKind(AetheriaRuntimeDaemonSoaColumnKinds.Heat, out var binding));
+ Assert.IsFalse(binding.DirectMemoryCompatible);
+ }
+
+ [Test]
+ public void SoaViewStorePublishesLatestDaemonView()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-soa-view-store-tests",
+ Path.GetRandomFileName(),
+ "state.cc");
+ var view = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "aetheria-daemon",
+ "session-soa-store",
+ 123,
+ 456,
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaBufferDocument
+ {
+ BufferId = "entity-hot-0",
+ Backend = AetheriaRuntimeDaemonSoaBackends.CultCache,
+ Location = "cultcache://aetheria/run/local/entity-hot-0",
+ ByteLength = 8192,
+ Generation = 456,
+ DaemonWritable = true,
+ ObserverWritable = false
+ }
+ },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "heat",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.Heat,
+ BufferId = "entity-hot-0",
+ ScalarType = "float32",
+ ByteOffset = 1024,
+ ElementStride = 4,
+ ElementCount = 256,
+ Unit = "thermal_units"
+ }
+ },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaDirtyRangeDocument
+ {
+ ColumnId = "heat",
+ StartIndex = 0,
+ Count = 256,
+ Generation = 456
+ }
+ });
+
+ var viewPath = AetheriaRuntimeDaemonSoaViewStore.PublishView(statePath, view);
+ var read = AetheriaRuntimeDaemonSoaViewStore.TryReadView(statePath, out var stored);
+
+ Assert.IsTrue(read);
+ Assert.AreEqual(AetheriaRuntimeStateBoundary.GetDaemonSoaViewPath(statePath), viewPath);
+ Assert.AreEqual(AetheriaRuntimeDaemonSchemas.SoaView, stored.Schema);
+ Assert.AreEqual("aetheria-daemon", stored.DaemonId);
+ Assert.AreEqual("session-soa-store", stored.SessionId);
+ Assert.AreEqual(123, stored.FrameId);
+ Assert.AreEqual(456, stored.Generation);
+ Assert.IsTrue(stored.IsAuthoritative);
+ Assert.AreEqual(1, stored.Buffers.Count);
+ Assert.AreEqual("entity-hot-0", stored.Buffers[0].BufferId);
+ Assert.IsFalse(stored.Buffers[0].ObserverWritable);
+ Assert.AreEqual(1, stored.Columns.Count);
+ Assert.AreEqual(AetheriaRuntimeDaemonSoaColumnKinds.Heat, stored.Columns[0].Kind);
+ Assert.AreEqual(1, stored.DirtyRanges.Count);
+ Assert.AreEqual(256, stored.DirtyRanges[0].Count);
+ }
+
+ [Test]
+ public void SoaViewStoreReportsMissingView()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-soa-view-store-tests",
+ Path.GetRandomFileName(),
+ "missing-state.cc");
+
+ Assert.IsFalse(AetheriaRuntimeDaemonSoaViewStore.TryReadView(statePath, out _));
+ }
+
+ [Test]
+ public void StateReaderReadsObservedDaemonStateWithSoaView()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-observed-daemon-state-tests",
+ Path.GetRandomFileName(),
+ "state.cc");
+ var frame = AetheriaRuntimeDaemonFrameDocument.Create(
+ new AetheriaRuntimeRunCheckpointCommit
+ {
+ RunId = "daemon-run",
+ CurrentZoneIndex = 2,
+ CurrentEntityKey = "entity:observer-target"
+ },
+ "aetheria-daemon",
+ "session-observed",
+ 300,
+ 12.0,
+ 0.02);
+ var soaView = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "aetheria-daemon",
+ "session-observed",
+ 300,
+ 301,
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaBufferDocument
+ {
+ BufferId = "entity-hot",
+ Backend = AetheriaRuntimeDaemonSoaBackends.CultCache,
+ Location = "cultcache://aetheria/run/daemon-run/entity-hot",
+ ByteLength = 1024,
+ Generation = 301,
+ DaemonWritable = true,
+ ObserverWritable = false
+ }
+ },
+ new[]
+ {
+ new AetheriaRuntimeDaemonSoaColumnDocument
+ {
+ ColumnId = "position-x",
+ Kind = AetheriaRuntimeDaemonSoaColumnKinds.PositionX,
+ BufferId = "entity-hot",
+ ScalarType = "float32",
+ ElementStride = 4,
+ ElementCount = 64
+ }
+ });
+
+ AetheriaRuntimeDaemonFrameStore.PublishFrame(statePath, frame);
+ AetheriaRuntimeDaemonSoaViewStore.PublishView(statePath, soaView);
+
+ var read = AetheriaRuntimeStateReader.TryReadObservedDaemonState(statePath, out var observed);
+
+ Assert.IsTrue(read);
+ Assert.IsTrue(observed.IsAuthoritative);
+ Assert.IsTrue(observed.HasSoaView);
+ Assert.AreEqual("daemon-run", observed.Run.RunId);
+ Assert.AreEqual("entity:observer-target", observed.Run.CurrentEntityKey);
+ Assert.AreEqual(300, observed.Frame.FrameId);
+ Assert.AreEqual(301, observed.SoaView.Generation);
+ Assert.AreEqual(AetheriaRuntimeStateBoundary.GetDaemonFramePath(statePath), observed.FramePath);
+ Assert.AreEqual(AetheriaRuntimeStateBoundary.GetDaemonSoaViewPath(statePath), observed.SoaViewPath);
+ Assert.IsFalse(observed.SoaView.Buffers[0].ObserverWritable);
+ }
+
+ [Test]
+ public void StateReaderReportsMissingObservedDaemonState()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-observed-daemon-state-tests",
+ Path.GetRandomFileName(),
+ "missing-state.cc");
+
+ var read = AetheriaRuntimeStateReader.TryReadObservedDaemonState(statePath, out var observed);
+
+ Assert.IsFalse(read);
+ Assert.IsFalse(observed.IsAuthoritative);
+ Assert.IsFalse(observed.HasSoaView);
+ Assert.AreEqual("missing", observed.Frame.StateSource);
+ Assert.AreEqual(AetheriaRuntimeStateBoundary.GetDaemonFramePath(statePath), observed.FramePath);
+ }
+
+ [Test]
+ public void ObservationCursorTracksFrameAndSoaGenerationChanges()
+ {
+ var cursor = new AetheriaRuntimeDaemonObservationCursor();
+ var observed = ObservedState(frameId: 10, soaGeneration: 20);
+
+ var first = cursor.Observe(observed);
+ var second = cursor.Observe(observed);
+ var third = cursor.Observe(ObservedState(frameId: 11, soaGeneration: 20));
+ var fourth = cursor.Observe(ObservedState(frameId: 11, soaGeneration: 21));
+
+ Assert.IsTrue(first.Observed);
+ Assert.IsTrue(first.FrameChanged);
+ Assert.IsTrue(first.SoaViewChanged);
+ Assert.AreEqual(10, first.FrameId);
+ Assert.AreEqual(20, first.SoaGeneration);
+ Assert.IsFalse(second.Changed);
+ Assert.IsTrue(third.FrameChanged);
+ Assert.IsFalse(third.SoaViewChanged);
+ Assert.IsFalse(fourth.FrameChanged);
+ Assert.IsTrue(fourth.SoaViewChanged);
+ Assert.AreEqual(11, cursor.LastFrameId);
+ Assert.AreEqual(21, cursor.LastSoaGeneration);
+ }
+
+ [Test]
+ public void ObservationCursorResetForgetsDaemonState()
+ {
+ var cursor = new AetheriaRuntimeDaemonObservationCursor();
+
+ cursor.Observe(ObservedState(frameId: 12, soaGeneration: 22));
+ cursor.Reset();
+ var missing = cursor.Observe(null);
+
+ Assert.AreEqual(-1, cursor.LastFrameId);
+ Assert.AreEqual(-1, cursor.LastSoaGeneration);
+ Assert.IsFalse(missing.Observed);
+ Assert.IsFalse(missing.Changed);
+ }
+
+ [Test]
+ public void CommandClientSendsCommandAgainstObservedDaemonFrame()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-command-client-tests",
+ Path.GetRandomFileName(),
+ "state.cc");
+ var observed = ObservedState(frameId: 33, soaGeneration: 44);
+ observed.Frame.SessionId = "session-command-client";
+ observed.Frame.Run.CurrentEntityKey = "entity:player";
+ var client = new AetheriaRuntimeDaemonOperationClient(statePath, "unity-test", "unobserved-session");
+
+ var envelope = client.FireWeaponGroup(observed, 2);
+
+ Assert.AreEqual(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, envelope.Kind);
+ Assert.AreEqual("unity-test", envelope.ClientId);
+ Assert.AreEqual("session-command-client", envelope.SessionId);
+ Assert.AreEqual(33, envelope.ObservedFrameId);
+ Assert.AreEqual("entity:player", envelope.ActorEntityKey);
+ Assert.IsEmpty(envelope.Path);
+ }
+
+ [Test]
+ public void DaemonEveSurfaceCommandSubmitsTypedDaemonOperation()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-surface-command-tests",
+ Path.GetRandomFileName(),
+ "state.cc");
+ var frame = AetheriaRuntimeDaemonFrameDocument.Create(
+ new AetheriaRuntimeRunCheckpointCommit
+ {
+ CurrentEntityKey = "entity:surface-player"
+ },
+ "aetheria-daemon",
+ "session-surface-command",
+ 77,
+ 1.5,
+ 0.02);
+ AetheriaRuntimeDaemonFrameStore.PublishFrame(statePath, frame);
+ var request = new EveSurfaceCommandRequest(
+ "aetheria.daemon",
+ AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId,
+ "aetheria.daemon.commands.FireWeaponGroup",
+ new Dictionary(StringComparer.Ordinal),
+ DateTimeOffset.UtcNow,
+ "unity-uitoolkit");
+
+ Assert.IsTrue(AetheriaRuntimeDaemonSurfaceCommands.TrySubmit(statePath, request, out var envelope));
+
+ Assert.AreEqual(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, envelope.Kind);
+ Assert.AreEqual("unity-uitoolkit", envelope.ClientId);
+ Assert.AreEqual("session-surface-command", envelope.SessionId);
+ Assert.AreEqual(77, envelope.ObservedFrameId);
+ Assert.AreEqual("entity:surface-player", envelope.ActorEntityKey);
+ Assert.IsEmpty(envelope.Path);
+ }
+
+ [Test]
+ public void DaemonOperationsMovesTargetSelectionIntoDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetTarget,
+ "codex",
+ "session-target",
+ 15,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.1";
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(0, result.RejectedCommandIds.Count);
+ Assert.AreEqual(1, run.Zones[0].Entities[0].TargetEntityIndex);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsTargetSelectionWithoutVisibleContact()
+ {
+ var run = RunWithTwoEntities();
+ run.Zones[0].Entities[0].Contacts = Array.Empty();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetTarget,
+ "codex",
+ "session-target",
+ 15,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.1";
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(-1, run.Zones[0].Entities[0].TargetEntityIndex);
+ }
+
+ [Test]
+ public void DaemonOperationsMutatesHotEntityControlsInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var look = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetLookDirection,
+ "codex",
+ "session-controls",
+ 16,
+ "zone.0.entity.0");
+ look.DirectionX = 0.25;
+ look.PositionZ = -0.75;
+ var tractor = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetTractorPower,
+ "codex",
+ "session-controls",
+ 16,
+ "zone.0.entity.0");
+ tractor.ScalarValue = 0.8;
+ var heatsinks = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetHeatsinksEnabled,
+ "codex",
+ "session-controls",
+ 16,
+ "zone.0.entity.0");
+ heatsinks.ScalarValue = 1.0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { look, tractor, heatsinks });
+
+ var player = run.Zones[0].Entities[0];
+ Assert.AreEqual(3, result.AppliedCommandIds.Count);
+ Assert.AreEqual(0, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0.25, player.DirectionX, 0.0001);
+ Assert.AreEqual(-0.75, player.DirectionY, 0.0001);
+ Assert.AreEqual(0.8, player.TractorPower, 0.0001);
+ Assert.IsTrue(player.HeatsinksEnabled);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsOutOfRangeTractorPower()
+ {
+ var run = RunWithTwoEntities();
+ var tractor = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetTractorPower,
+ "codex",
+ "session-controls",
+ 16,
+ "zone.0.entity.0");
+ tractor.ScalarValue = 1.25;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { tractor });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0.0, run.Zones[0].Entities[0].TractorPower, 0.0001);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsOutOfRangeMoveMagnitude()
+ {
+ var run = RunWithTwoEntities();
+ var move = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetMoveVector,
+ "codex",
+ "session-intents",
+ 32,
+ "zone.0.entity.0");
+ move.DirectionX = 0.25;
+ move.DirectionY = -0.5;
+ move.ScalarValue = 1.25;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { move });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.IsFalse(result.Intents.HasAny);
+ }
+
+ [Test]
+ public void DaemonOperationsOwnsActionBarBindingsInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ run.ActionBarBindings = new[]
+ {
+ new AetheriaRuntimeActionBarBindingCommit
+ {
+ ControlPath = "/1",
+ Kind = "equipment",
+ EquipmentIndex = 0
+ }
+ };
+ var set = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding,
+ "codex",
+ "session-bindings",
+ 17,
+ "zone.0.entity.0");
+ set.TextValue = "/1";
+ set.ActionBarBinding.Kind = "weapon_group";
+ set.ActionBarBinding.ItemKey = "laser";
+ set.WeaponGroup = 2;
+ var clear = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.ClearActionBarBinding,
+ "codex",
+ "session-bindings",
+ 18,
+ "zone.0.entity.0");
+ clear.TextValue = "/1";
+
+ var setResult = AetheriaRuntimeDaemonOperations.Execute(run, new[] { set });
+
+ Assert.AreEqual(1, setResult.AppliedCommandIds.Count);
+ Assert.AreEqual(1, run.ActionBarBindings.Count);
+ Assert.AreEqual("weapon_group", run.ActionBarBindings[0].Kind);
+ Assert.AreEqual("laser", run.ActionBarBindings[0].ItemKey);
+ Assert.AreEqual(2, run.ActionBarBindings[0].WeaponGroup);
+
+ var clearResult = AetheriaRuntimeDaemonOperations.Execute(run, new[] { clear });
+
+ Assert.AreEqual(1, clearResult.AppliedCommandIds.Count);
+ Assert.AreEqual(0, run.ActionBarBindings.Count);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsWeaponGroupActionBarBindingForMissingGroup()
+ {
+ var run = RunWithTwoEntities();
+ var set = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding,
+ "codex",
+ "session-bindings",
+ 17,
+ "zone.0.entity.0");
+ set.TextValue = "/1";
+ set.ActionBarBinding.Kind = "weapon_group";
+ set.WeaponGroup = 99;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { set });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0, run.ActionBarBindings.Count);
+ }
+
+ [Test]
+ public void DaemonOperationsOwnsEquipmentSwitchesInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var disable = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetItemEnabled,
+ "codex",
+ "session-equipment",
+ 19,
+ "zone.0.entity.0");
+ disable.EquipmentIndex = 0;
+ disable.ScalarValue = 0.0;
+ var overrideShutdown = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetItemOverrideShutdown,
+ "codex",
+ "session-equipment",
+ 20,
+ "zone.0.entity.0");
+ overrideShutdown.TargetEntityKey = "zone.0.entity.0";
+ overrideShutdown.EquipmentIndex = 0;
+ overrideShutdown.ScalarValue = 1.0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { disable, overrideShutdown });
+
+ var item = run.Zones[0].Entities[0].Equipment[0].Item;
+ Assert.AreEqual(2, result.AppliedCommandIds.Count);
+ Assert.IsFalse(item.Enabled);
+ Assert.IsTrue(item.OverrideShutdown);
+ }
+
+ [Test]
+ public void DaemonOperationsOwnsShieldToggleSelectionInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var toggle = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled,
+ "codex",
+ "session-equipment",
+ 21,
+ "zone.0.entity.0");
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { toggle });
+
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.IsFalse(run.Zones[0].Entities[0].Equipment[1].Item.Enabled);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsShieldToggleWhenNoShieldBehaviorExists()
+ {
+ var run = RunWithTwoEntities();
+ run.Zones[0].Entities[0].BehaviorStates = Array.Empty();
+ var toggle = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled,
+ "codex",
+ "session-equipment",
+ 21,
+ "zone.0.entity.0");
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { toggle });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.IsTrue(run.Zones[0].Entities[0].Equipment[1].Item.Enabled);
+ }
+
+ [Test]
+ public void DaemonOperationsOwnsWeaponGroupMembershipInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var add = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership,
+ "codex",
+ "session-weapon-groups",
+ 21,
+ "zone.0.entity.0");
+ add.TargetEntityKey = "zone.0.entity.0";
+ add.EquipmentIndex = 1;
+ add.WeaponGroup = 0;
+ add.ScalarValue = 1.0;
+ var remove = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership,
+ "codex",
+ "session-weapon-groups",
+ 22,
+ "zone.0.entity.0");
+ remove.TargetEntityKey = "zone.0.entity.0";
+ remove.EquipmentIndex = 0;
+ remove.WeaponGroup = 0;
+ remove.ScalarValue = 0.0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { add, remove });
+
+ Assert.AreEqual(2, result.AppliedCommandIds.Count);
+ CollectionAssert.AreEqual(new[] { 1 }, run.Zones[0].Entities[0].WeaponGroups[0]);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsWeaponGroupMembershipForMissingEquipment()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership,
+ "codex",
+ "session-weapon-groups",
+ 21,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.EquipmentIndex = 99;
+ command.WeaponGroup = 0;
+ command.ScalarValue = 1.0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ CollectionAssert.AreEqual(new[] { 0 }, run.Zones[0].Entities[0].WeaponGroups[0]);
+ }
+
+ [Test]
+ public void DaemonOperationsOwnsThermotoggleTargetInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetThermotoggleTargetTemperature,
+ "codex",
+ "session-thermotoggle",
+ 23,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.EquipmentIndex = 0;
+ command.BehaviorIndex = 0;
+ command.ScalarValue = 450.0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(450.0, run.Zones[0].Entities[0].BehaviorStates[0].ThermotoggleTargetTemperature, 0.0001);
+ }
+
+ [Test]
+ public void DaemonOperationsTransfersCargoItemsInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.TransferCargoItem,
+ "codex",
+ "session-inventory",
+ 24,
+ "zone.0.entity.0");
+ command.TextValue = "ore";
+ command.TargetEntityKey = "zone.0.entity.1";
+ command.PositionX = 5;
+ command.PositionY = 6;
+ command.ScalarValue = 12;
+ command.CargoTransfer.OriginEntityKey = "zone.0.entity.0";
+ command.CargoTransfer.OriginCargoIndex = 0;
+ command.CargoTransfer.DestinationEntityKey = "zone.0.entity.1";
+ command.CargoTransfer.DestinationCargoIndex = 0;
+ command.CargoTransfer.SourceX = 2;
+ command.CargoTransfer.SourceY = 3;
+ command.CargoTransfer.DestinationX = 5;
+ command.CargoTransfer.DestinationY = 6;
+ command.CargoTransfer.HasDestinationPosition = true;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var originCargo = run.Zones[0].Entities[0].CargoContents[0].Items;
+ var destinationCargo = run.Zones[0].Entities[1].CargoContents[0].Items;
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(0, originCargo.Count);
+ Assert.AreEqual(1, destinationCargo.Count);
+ Assert.AreEqual("ore", destinationCargo[0].Item.ItemKey);
+ Assert.AreEqual(5, destinationCargo[0].X);
+ Assert.AreEqual(6, destinationCargo[0].Y);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsSameCargoTransferWithoutReposition()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.TransferCargoItem,
+ "codex",
+ "session-inventory",
+ 24,
+ "zone.0.entity.0");
+ command.TextValue = "ore";
+ command.CargoTransfer.OriginEntityKey = "zone.0.entity.0";
+ command.CargoTransfer.OriginCargoIndex = 0;
+ command.CargoTransfer.DestinationEntityKey = "zone.0.entity.0";
+ command.CargoTransfer.DestinationCargoIndex = 0;
+ command.CargoTransfer.SourceX = 2;
+ command.CargoTransfer.SourceY = 3;
+ command.CargoTransfer.HasDestinationPosition = false;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var cargo = run.Zones[0].Entities[0].CargoContents[0].Items;
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(1, cargo.Count);
+ Assert.AreEqual(2, cargo[0].X);
+ Assert.AreEqual(3, cargo[0].Y);
+ }
+
+ [Test]
+ public void DaemonOperationsRepositionsCargoItemWithinSameCargoBay()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.TransferCargoItem,
+ "codex",
+ "session-inventory",
+ 24,
+ "zone.0.entity.0");
+ command.TextValue = "ore";
+ command.CargoTransfer.OriginEntityKey = "zone.0.entity.0";
+ command.CargoTransfer.OriginCargoIndex = 0;
+ command.CargoTransfer.DestinationEntityKey = "zone.0.entity.0";
+ command.CargoTransfer.DestinationCargoIndex = 0;
+ command.CargoTransfer.SourceX = 2;
+ command.CargoTransfer.SourceY = 3;
+ command.CargoTransfer.DestinationX = 6;
+ command.CargoTransfer.DestinationY = 7;
+ command.CargoTransfer.HasDestinationPosition = true;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var cargo = run.Zones[0].Entities[0].CargoContents[0].Items;
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, cargo.Count);
+ Assert.AreEqual(6, cargo[0].X);
+ Assert.AreEqual(7, cargo[0].Y);
+ }
+
+ [Test]
+ public void DaemonOperationsEquipsCargoItemInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.EquipItem,
+ "codex",
+ "session-inventory",
+ 25,
+ "zone.0.entity.0");
+ command.TextValue = "ore";
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.EquipmentTransfer.SourceKind = "cargo";
+ command.EquipmentTransfer.OriginEntityKey = "zone.0.entity.0";
+ command.EquipmentTransfer.OriginIndex = 0;
+ command.EquipmentTransfer.DestinationEntityKey = "zone.0.entity.0";
+ command.EquipmentTransfer.SourceX = 2;
+ command.EquipmentTransfer.SourceY = 3;
+ command.EquipmentTransfer.DestinationX = 8;
+ command.EquipmentTransfer.DestinationY = 9;
+ command.EquipmentTransfer.HasDestinationPosition = true;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var entity = run.Zones[0].Entities[0];
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(0, entity.CargoContents[0].Items.Count);
+ Assert.AreEqual(3, entity.Equipment.Count);
+ Assert.AreEqual("ore", entity.Equipment[2].Item.ItemKey);
+ Assert.AreEqual(8, entity.Equipment[2].X);
+ Assert.AreEqual(9, entity.Equipment[2].Y);
+ }
+
+ [Test]
+ public void DaemonOperationsStoresEquipmentItemInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.StoreItem,
+ "codex",
+ "session-inventory",
+ 26,
+ "zone.0.entity.0");
+ command.TextValue = "laser";
+ command.StoreItem.OriginEntityKey = "zone.0.entity.0";
+ command.StoreItem.SourceEquipmentIndex = 1;
+ command.StoreItem.DestinationEntityKey = "zone.0.entity.1";
+ command.StoreItem.DestinationCargoIndex = 0;
+ command.StoreItem.DestinationX = 4;
+ command.StoreItem.DestinationY = 7;
+ command.StoreItem.HasDestinationPosition = true;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var origin = run.Zones[0].Entities[0];
+ var destinationCargo = run.Zones[0].Entities[1].CargoContents[0].Items;
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, origin.Equipment.Count);
+ Assert.AreEqual(1, destinationCargo.Count);
+ Assert.AreEqual("laser", destinationCargo[0].Item.ItemKey);
+ Assert.AreEqual(4, destinationCargo[0].X);
+ Assert.AreEqual(7, destinationCargo[0].Y);
+ CollectionAssert.IsEmpty(origin.WeaponGroups[0]);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsStoreItemWhenEquipmentSourceDoesNotMatch()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.StoreItem,
+ "codex",
+ "session-inventory",
+ 26,
+ "zone.0.entity.0");
+ command.TextValue = "laser";
+ command.StoreItem.OriginEntityKey = "zone.0.entity.0";
+ command.StoreItem.SourceEquipmentIndex = 0;
+ command.StoreItem.DestinationEntityKey = "zone.0.entity.1";
+ command.StoreItem.DestinationCargoIndex = 0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(2, run.Zones[0].Entities[0].Equipment.Count);
+ Assert.AreEqual(0, run.Zones[0].Entities[1].CargoContents[0].Items.Count);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsEquipItemWhenEquipmentSourceDoesNotMatch()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.EquipItem,
+ "codex",
+ "session-inventory",
+ 26,
+ "zone.0.entity.0");
+ command.TextValue = "laser";
+ command.EquipmentTransfer.SourceKind = "equipment";
+ command.EquipmentTransfer.OriginEntityKey = "zone.0.entity.0";
+ command.EquipmentTransfer.OriginIndex = 0;
+ command.EquipmentTransfer.DestinationEntityKey = "zone.0.entity.1";
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(2, run.Zones[0].Entities[0].Equipment.Count);
+ Assert.AreEqual(0, run.Zones[0].Entities[1].Equipment.Count);
+ }
+
+ [Test]
+ public void DaemonOperationsPicksUpLootInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.PickUpLoot,
+ "codex",
+ "session-loot",
+ 27,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.TextValue = "loot-cell";
+ command.PositionX = 10;
+ command.PositionY = 11;
+ command.PositionZ = 12;
+ command.ScalarValue = 1;
+ command.LootPickup.ItemKey = "loot-cell";
+ command.LootPickup.Quantity = 1;
+ command.LootPickup.PositionX = 10;
+ command.LootPickup.PositionY = 11;
+ command.LootPickup.PositionZ = 12;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var zone = run.Zones[0];
+ var cargo = zone.Entities[0].CargoContents[0].Items;
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(0, zone.DroppedPickups.Count);
+ Assert.AreEqual(2, cargo.Count);
+ Assert.AreEqual("loot-cell", cargo[1].Item.ItemKey);
+ }
+
+ [Test]
+ public void DaemonOperationsTogglesHullConductivityInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.ToggleHullConductivity,
+ "codex",
+ "session-hull",
+ 28,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.PositionX = 1;
+ command.PositionY = 0;
+ command.ScalarValue = 0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var grid = run.Zones[0].Entities[0].StatGrids[0];
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ CollectionAssert.AreEqual(new[] { 1.0, 1.0, 0.0, 1.0 }, grid.Values);
+ }
+
+ [Test]
+ public void DaemonOperationsOwnsShutdownPerformanceInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance,
+ "codex",
+ "session-shutdown-performance",
+ 29,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.ScalarValue = 0.375;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(0.375, run.Zones[0].Entities[0].ShutdownPerformance, 0.0001);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsOutOfRangeShutdownPerformance()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance,
+ "codex",
+ "session-shutdown-performance",
+ 29,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.ScalarValue = 1.5;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0.25, run.Zones[0].Entities[0].ShutdownPerformance, 0.0001);
+ }
+
+ [Test]
+ public void DaemonOperationsOwnsTradePurchaseCreditsAndCargoInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.TradePurchase,
+ "codex",
+ "session-trade",
+ 30,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.1";
+ command.TextValue = "ore";
+ command.ScalarValue = 200;
+ command.TradePurchase.PurchaseKind = "commodity";
+ command.TradePurchase.ItemKey = "ore";
+ command.TradePurchase.Quantity = 5;
+ command.TradePurchase.UnitPrice = 40;
+ command.TradePurchase.TotalPrice = 200;
+ command.TradePurchase.StationEntityKey = "zone.0.entity.0";
+ command.TradePurchase.StationCargoIndex = 0;
+ command.TradePurchase.TargetEntityKey = "zone.0.entity.1";
+ command.TradePurchase.TargetCargoIndex = 0;
+ command.TradePurchase.SourceX = 2;
+ command.TradePurchase.SourceY = 3;
+ command.TradePurchase.CreatesDockedShip = false;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var stationCargo = run.Zones[0].Entities[0].CargoContents[0].Items;
+ var targetCargo = run.Zones[0].Entities[1].CargoContents[0].Items;
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(800, run.Credits);
+ Assert.AreEqual(1, stationCargo.Count);
+ Assert.AreEqual(7, stationCargo[0].Item.Quantity);
+ Assert.AreEqual(1, targetCargo.Count);
+ Assert.AreEqual("ore", targetCargo[0].Item.ItemKey);
+ Assert.AreEqual(5, targetCargo[0].Item.Quantity);
+ }
+
+ [Test]
+ public void DaemonOperationsRestoresLoadoutIntoDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.RestoreLoadout,
+ "codex",
+ "session-loadout",
+ 31,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.0.entity.0";
+ command.TextValue = "Starter";
+ command.ScalarValue = 250;
+ command.LoadoutRestore.DockedEntityKey = "zone.0.entity.0";
+ command.LoadoutRestore.TemplateName = "Starter";
+ command.LoadoutRestore.Price = 250;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(
+ run,
+ new[] { command },
+ new AetheriaRuntimeDaemonOperationContext
+ {
+ LoadoutTemplates = new[]
+ {
+ new AetheriaRuntimeLoadoutTemplateCommit
+ {
+ Name = "Starter",
+ RootEntity = new AetheriaRuntimeEntityLoadoutCommit
+ {
+ Name = "Starter Ship",
+ Kind = "ship",
+ Hull = new AetheriaRuntimeLoadoutItemCommit
+ {
+ ItemKey = "starter-hull"
+ },
+ Equipment = new[]
+ {
+ new AetheriaRuntimeLoadoutItemSlotCommit
+ {
+ X = 1,
+ Y = 2,
+ Item = new AetheriaRuntimeLoadoutItemCommit
+ {
+ ItemKey = "starter-reactor"
+ }
+ }
+ },
+ WeaponGroups = new[]
+ {
+ new[] { 0 }
+ }
+ }
+ }
+ }
+ });
+
+ var zone = run.Zones[0];
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(750, run.Credits);
+ Assert.AreEqual(3, zone.Entities.Count);
+ Assert.AreEqual("Starter Ship", zone.Entities[2].Name);
+ Assert.AreEqual("starter-hull", zone.Entities[2].HullItemKey);
+ Assert.AreEqual("starter-reactor", zone.Entities[2].Equipment[0].Item.ItemKey);
+ CollectionAssert.Contains(zone.Entities[0].ChildEntityIndices, 2);
+ Assert.AreEqual("global:aetheria.run_state.daemon-command-apply-run.zone.0.entity.2.v1", run.CurrentEntityKey);
+ }
+
+ [Test]
+ public void DaemonOperationsDestroysEntityInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ run.CurrentEntityKey = "zone.0.entity.1";
+ run.Zones[0].Entities[0].TargetEntityIndex = 1;
+ run.Zones[0].Entities[0].ChildEntityIndices = new[] { 1 };
+ run.Zones[0].Entities[0].DockingBayAssignments = new[] { 1, -1 };
+ run.Zones[0].Entities[0].Contacts = new[]
+ {
+ new AetheriaRuntimeEntityContactCommit
+ {
+ TargetEntityIndex = 1,
+ Visible = true
+ }
+ };
+ run.Zones[0].Entities = new[]
+ {
+ run.Zones[0].Entities[0],
+ run.Zones[0].Entities[1],
+ new AetheriaRuntimeEntitySnapshotCommit
+ {
+ EntityIndex = 2,
+ Name = "Reindexed"
+ }
+ };
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.DestroyEntity,
+ "codex",
+ "session-destroy",
+ 44,
+ "");
+ command.TargetEntityKey = "zone.0.entity.1";
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(2, run.Zones[0].Entities.Count);
+ Assert.AreEqual("Player", run.Zones[0].Entities[0].Name);
+ Assert.AreEqual(0, run.Zones[0].Entities[0].EntityIndex);
+ Assert.AreEqual("Reindexed", run.Zones[0].Entities[1].Name);
+ Assert.AreEqual(1, run.Zones[0].Entities[1].EntityIndex);
+ Assert.AreEqual(-1, run.Zones[0].Entities[0].TargetEntityIndex);
+ Assert.AreEqual(0, run.Zones[0].Entities[0].ChildEntityIndices.Count);
+ Assert.AreEqual(-1, run.Zones[0].Entities[0].DockingBayAssignments[0]);
+ Assert.AreEqual(-1, run.Zones[0].Entities[0].DockingBayAssignments[1]);
+ Assert.AreEqual(0, run.Zones[0].Entities[0].Contacts.Count);
+ Assert.AreEqual("", run.CurrentEntityKey);
+ }
+
+ [Test]
+ public void DaemonOperationsMovesEntityThroughWormholeInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.EnterWormhole,
+ "codex",
+ "session-wormhole",
+ 45,
+ "zone.0.entity.0");
+ command.TargetZoneIndex = 2;
+ command.PositionX = 100;
+ command.PositionY = 200;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var sourceZone = FindZone(run, 0);
+ var targetZone = FindZone(run, 2);
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(2, run.CurrentZoneIndex);
+ Assert.AreEqual("global:aetheria.run_state.daemon-command-apply-run.zone.2.entity.0.v1", run.CurrentEntityKey);
+ Assert.AreEqual(1, sourceZone.Entities.Count);
+ Assert.AreEqual("Target", sourceZone.Entities[0].Name);
+ Assert.AreEqual(0, sourceZone.Entities[0].EntityIndex);
+ Assert.AreEqual(1, targetZone.Entities.Count);
+ Assert.AreEqual("Player", targetZone.Entities[0].Name);
+ Assert.AreEqual(0, targetZone.Entities[0].EntityIndex);
+ Assert.AreEqual(100, targetZone.Entities[0].PositionX, 0.0001);
+ Assert.AreEqual(200, targetZone.Entities[0].PositionZ, 0.0001);
+ CollectionAssert.Contains(run.DiscoveredZoneIndices, 2);
+ Assert.AreEqual(1, result.Intents.Wormholes.Count);
+ Assert.AreEqual("global:aetheria.run_state.daemon-command-apply-run.zone.2.entity.0.v1", result.Intents.Wormholes[0].ActorEntityKey);
+ Assert.AreEqual(2, result.Intents.Wormholes[0].TargetZoneIndex);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsWormholeMoveWhenEntityIsDocked()
+ {
+ var run = RunWithTwoEntities();
+ run.Zones[0].Entities[1].ChildEntityIndices = new[] { 0 };
+ run.Zones[0].Entities[1].DockingBayAssignments = new[] { 0, -1 };
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.EnterWormhole,
+ "codex",
+ "session-wormhole",
+ 45,
+ "zone.0.entity.0");
+ command.TargetZoneIndex = 2;
+ command.PositionX = 100;
+ command.PositionY = 200;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0, result.Intents.Wormholes.Count);
+ Assert.AreEqual(1, run.Zones[0].Entities[1].ChildEntityIndices.Count);
+ CollectionAssert.Contains(run.Zones[0].Entities[1].DockingBayAssignments, 0);
+ }
+
+ [Test]
+ public void DaemonOperationsTowsEntityToStationInDaemonState()
+ {
+ var run = RunWithTwoEntities();
+ run.Zones = new[]
+ {
+ run.Zones[0],
+ new AetheriaRuntimeZoneSnapshotCommit
+ {
+ ZoneIndex = 3,
+ Entities = new[]
+ {
+ new AetheriaRuntimeEntitySnapshotCommit
+ {
+ EntityIndex = 0,
+ Name = "Tow Station"
+ }
+ }
+ }
+ };
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.TowToStation,
+ "codex",
+ "session-towing",
+ 46,
+ "zone.0.entity.0");
+ command.TargetEntityKey = "zone.3.entity.0";
+ command.TargetZoneIndex = 3;
+ command.PositionX = 300;
+ command.PositionY = 400;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ var sourceZone = FindZone(run, 0);
+ var targetZone = FindZone(run, 3);
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(3, run.CurrentZoneIndex);
+ Assert.AreEqual("global:aetheria.run_state.daemon-command-apply-run.zone.3.entity.1.v1", run.CurrentEntityKey);
+ Assert.AreEqual(1, sourceZone.Entities.Count);
+ Assert.AreEqual("Target", sourceZone.Entities[0].Name);
+ Assert.AreEqual(2, targetZone.Entities.Count);
+ Assert.AreEqual("Tow Station", targetZone.Entities[0].Name);
+ Assert.AreEqual("Player", targetZone.Entities[1].Name);
+ Assert.AreEqual(1, targetZone.Entities[1].EntityIndex);
+ Assert.AreEqual(300, targetZone.Entities[1].PositionX, 0.0001);
+ Assert.AreEqual(400, targetZone.Entities[1].PositionZ, 0.0001);
+ Assert.AreEqual(1, result.Intents.Towing.Count);
+ Assert.AreEqual("global:aetheria.run_state.daemon-command-apply-run.zone.3.entity.1.v1", result.Intents.Towing[0].ActorEntityKey);
+ Assert.AreEqual("zone.3.entity.0", result.Intents.Towing[0].StationEntityKey);
+ Assert.AreEqual(3, result.Intents.Towing[0].TargetZoneIndex);
+ }
+
+ [Test]
+ public void DaemonOperationsSetsDockedCurrentShipAsDaemonRunCursor()
+ {
+ var run = RunWithTwoEntities();
+ run.Zones = new[]
+ {
+ run.Zones[0],
+ new AetheriaRuntimeZoneSnapshotCommit
+ {
+ ZoneIndex = 2,
+ Entities = new[]
+ {
+ new AetheriaRuntimeEntitySnapshotCommit
+ {
+ EntityIndex = 0,
+ Name = "Docking Station",
+ DockingBayAssignments = new[] { 1 }
+ },
+ new AetheriaRuntimeEntitySnapshotCommit
+ {
+ EntityIndex = 1,
+ Name = "Docked Scout"
+ }
+ }
+ }
+ };
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetDockedCurrentShip,
+ "codex",
+ "session-current",
+ 46,
+ "");
+ command.TargetEntityKey = "zone.2.entity.1";
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(2, run.CurrentZoneIndex);
+ Assert.AreEqual("global:aetheria.run_state.daemon-command-apply-run.zone.2.entity.1.v1", run.CurrentEntityKey);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsUndockedCurrentShipSelection()
+ {
+ var run = RunWithTwoEntities();
+ var command = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetDockedCurrentShip,
+ "codex",
+ "session-current",
+ 46,
+ "");
+ command.TargetEntityKey = "zone.0.entity.1";
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { command });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0, run.CurrentZoneIndex);
+ Assert.AreEqual("zone.0.entity.0", run.CurrentEntityKey);
+ }
+
+ [Test]
+ public void DaemonOperationsRecordsSimulationIntentsForDaemonLoop()
+ {
+ var run = RunWithTwoEntities();
+ var move = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetMoveVector,
+ "codex",
+ "session-intents",
+ 32,
+ "");
+ move.DirectionX = 0.25;
+ move.DirectionY = -0.5;
+ move.ScalarValue = 0.75;
+ var fire = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup,
+ "codex",
+ "session-intents",
+ 33,
+ "zone.0.entity.0");
+ fire.WeaponGroup = 1;
+ var behavior = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive,
+ "codex",
+ "session-intents",
+ 34,
+ "zone.0.entity.0");
+ behavior.EquipmentIndex = 0;
+ behavior.BehaviorIndex = 0;
+ behavior.ScalarValue = 1.0;
+ var consumable = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.ActivateConsumable,
+ "codex",
+ "session-intents",
+ 35,
+ "zone.0.entity.0");
+ consumable.TextValue = "repair-gel";
+ var ping = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SensorPing,
+ "codex",
+ "session-intents",
+ 36,
+ "zone.0.entity.0");
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(
+ run,
+ new[] { move, fire, behavior, consumable, ping });
+
+ Assert.AreEqual(5, result.AppliedCommandIds.Count);
+ Assert.IsTrue(result.Intents.HasAny);
+ Assert.AreEqual("zone.0.entity.0", result.Intents.Movement.ActorEntityKey);
+ Assert.AreEqual(0.25, result.Intents.Movement.DirectionX, 0.0001);
+ Assert.AreEqual(-0.5, result.Intents.Movement.DirectionY, 0.0001);
+ Assert.AreEqual(0.75, result.Intents.Movement.Magnitude, 0.0001);
+ Assert.AreEqual(1, result.Intents.WeaponGroups.Count);
+ Assert.IsTrue(result.Intents.WeaponGroups[0].Fire);
+ Assert.AreEqual(1, result.Intents.WeaponGroups[0].WeaponGroup);
+ Assert.AreEqual(1, result.Intents.Behaviors.Count);
+ Assert.IsTrue(result.Intents.Behaviors[0].Active);
+ Assert.AreEqual(1, result.Intents.Consumables.Count);
+ Assert.AreEqual("repair-gel", result.Intents.Consumables[0].ItemKey);
+ Assert.IsTrue(result.Intents.SensorPingRequested);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsWeaponGroupIntentForMissingGroup()
+ {
+ var run = RunWithTwoEntities();
+ var fire = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup,
+ "codex",
+ "session-intents",
+ 33,
+ "zone.0.entity.0");
+ fire.WeaponGroup = 99;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { fire });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0, result.Intents.WeaponGroups.Count);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsBehaviorIntentForMissingBehavior()
+ {
+ var run = RunWithTwoEntities();
+ var behavior = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive,
+ "codex",
+ "session-intents",
+ 34,
+ "zone.0.entity.0");
+ behavior.EquipmentIndex = 0;
+ behavior.BehaviorIndex = 99;
+ behavior.ScalarValue = 1.0;
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { behavior });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0, result.Intents.Behaviors.Count);
+ }
+
+ [Test]
+ public void DaemonOperationsRecordsNavigationIntentsForDaemonLoop()
+ {
+ var run = RunWithTwoEntities();
+ var dock = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.Dock,
+ "codex",
+ "session-navigation",
+ 37,
+ "zone.0.entity.0");
+ dock.TargetEntityKey = "zone.0.entity.1";
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(
+ run,
+ new[] { dock });
+
+ Assert.AreEqual(1, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.Intents.Docking.Count);
+ Assert.IsTrue(result.Intents.Docking[0].Dock);
+ Assert.AreEqual("zone.0.entity.1", result.Intents.Docking[0].TargetEntityKey);
+ CollectionAssert.Contains(run.Zones[0].Entities[1].ChildEntityIndices, 0);
+ CollectionAssert.Contains(run.Zones[0].Entities[1].DockingBayAssignments, 0);
+
+ var undock = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.Undock,
+ "codex",
+ "session-navigation",
+ 40,
+ "zone.0.entity.0");
+ var undockResult = AetheriaRuntimeDaemonOperations.Execute(run, new[] { undock });
+
+ Assert.AreEqual(1, undockResult.AppliedCommandIds.Count);
+ Assert.AreEqual(1, undockResult.Intents.Docking.Count);
+ Assert.IsTrue(undockResult.Intents.Docking[0].Undock);
+ Assert.AreEqual(0, run.Zones[0].Entities[1].ChildEntityIndices.Count);
+ CollectionAssert.DoesNotContain(run.Zones[0].Entities[1].DockingBayAssignments, 0);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsUndockWhenEntityIsNotDocked()
+ {
+ var run = RunWithTwoEntities();
+ var undock = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.Undock,
+ "codex",
+ "session-navigation",
+ 40,
+ "zone.0.entity.0");
+
+ var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { undock });
+
+ Assert.AreEqual(0, result.AppliedCommandIds.Count);
+ Assert.AreEqual(1, result.RejectedCommandIds.Count);
+ Assert.AreEqual(0, result.Intents.Docking.Count);
+ }
+
+ [Test]
+ public void DaemonOperationsRejectsDockWhenEntityIsAlreadyDocked()
+ {
+ var run = RunWithTwoEntities();
+ var dock = AetheriaRuntimeDaemonCommandDocument.Create(
+ AetheriaRuntimeDaemonCommandKinds.Dock,
+ "codex",
+ "session-navigation",
+ 37,
+ "zone.0.entity.0");
+ dock.TargetEntityKey = "zone.0.entity.1";
+
+ var firstResult = AetheriaRuntimeDaemonOperations.Execute(run, new[] { dock });
+ var secondResult = AetheriaRuntimeDaemonOperations.Execute(run, new[] { dock });
+
+ Assert.AreEqual(1, firstResult.AppliedCommandIds.Count);
+ Assert.AreEqual(0, secondResult.AppliedCommandIds.Count);
+ Assert.AreEqual(1, secondResult.RejectedCommandIds.Count);
+ Assert.AreEqual(0, secondResult.Intents.Docking.Count);
+ CollectionAssert.Contains(run.Zones[0].Entities[1].ChildEntityIndices, 0);
+ }
+
+ [Test]
+ public void CommandClientCanSendWithoutObservedState()
+ {
+ var statePath = Path.Combine(
+ Path.GetTempPath(),
+ "aetheria-daemon-command-client-tests",
+ Path.GetRandomFileName(),
+ "state.cc");
+ var client = new AetheriaRuntimeDaemonOperationClient(statePath, "headless-client", "session-headless");
+
+ var envelope = client.SetMoveVector(null, 0.25, -0.75, 0.5);
+
+ Assert.AreEqual(AetheriaRuntimeDaemonCommandKinds.SetMoveVector, envelope.Kind);
+ Assert.AreEqual("headless-client", envelope.ClientId);
+ Assert.AreEqual("session-headless", envelope.SessionId);
+ Assert.AreEqual(-1, envelope.ObservedFrameId);
+ Assert.AreEqual("", envelope.ActorEntityKey);
+ Assert.IsEmpty(envelope.Path);
+ }
+
+ private static AetheriaRuntimeRunCheckpointCommit RunWithTwoEntities()
+ {
+ return new AetheriaRuntimeRunCheckpointCommit
+ {
+ RunId = "daemon-command-apply-run",
+ CurrentZoneIndex = 0,
+ CurrentEntityKey = "zone.0.entity.0",
+ Credits = 1000,
+ Zones = new[]
+ {
+ new AetheriaRuntimeZoneSnapshotCommit
+ {
+ ZoneIndex = 0,
+ Entities = new[]
+ {
+ new AetheriaRuntimeEntitySnapshotCommit
+ {
+ EntityIndex = 0,
+ Name = "Player",
+ TargetEntityIndex = -1,
+ ShutdownPerformance = 0.25,
+ Contacts = new[]
+ {
+ new AetheriaRuntimeEntityContactCommit
+ {
+ TargetEntityIndex = 1,
+ Visible = true,
+ Hostile = true
+ }
+ },
+ Equipment = new[]
+ {
+ new AetheriaRuntimeLoadoutItemSlotCommit
+ {
+ Item = new AetheriaRuntimeLoadoutItemCommit
+ {
+ ItemKey = "reactor",
+ Enabled = true
+ }
+ },
+ new AetheriaRuntimeLoadoutItemSlotCommit
+ {
+ Item = new AetheriaRuntimeLoadoutItemCommit
+ {
+ ItemKey = "laser",
+ Enabled = true
+ }
+ }
+ },
+ WeaponGroups = new[]
+ {
+ new[] { 0 },
+ new[] { 1 },
+ Array.Empty()
+ },
+ BehaviorStates = new[]
+ {
+ new AetheriaRuntimeBehaviorStateCommit
+ {
+ OwnerKind = "equipment",
+ OwnerIndex = 0,
+ BehaviorIndex = 0,
+ BehaviorKind = "Thermotoggle",
+ ThermotoggleTargetTemperature = 300.0
+ },
+ new AetheriaRuntimeBehaviorStateCommit
+ {
+ OwnerKind = "equipment",
+ OwnerIndex = 1,
+ BehaviorIndex = 0,
+ BehaviorKind = "Shield"
+ }
+ },
+ CargoContents = new[]
+ {
+ new AetheriaRuntimeCargoBayLoadoutCommit
+ {
+ Items = new[]
+ {
+ new AetheriaRuntimeLoadoutItemSlotCommit
+ {
+ X = 2,
+ Y = 3,
+ Item = new AetheriaRuntimeLoadoutItemCommit
+ {
+ ItemKey = "ore",
+ Quantity = 12
+ }
+ }
+ }
+ }
+ },
+ StatGrids = new[]
+ {
+ new AetheriaRuntimeEntityStatGridCommit
+ {
+ Name = "hull_conductivity_x",
+ Width = 2,
+ Height = 2,
+ Values = new[] { 1.0, 0.0, 0.0, 1.0 }
+ },
+ new AetheriaRuntimeEntityStatGridCommit
+ {
+ Name = "hull_conductivity_y",
+ Width = 2,
+ Height = 2,
+ Values = new[] { 0.0, 1.0, 1.0, 0.0 }
+ }
+ }
+ },
+ new AetheriaRuntimeEntitySnapshotCommit
+ {
+ EntityIndex = 1,
+ Name = "Target",
+ TargetEntityIndex = -1,
+ CargoContents = new[]
+ {
+ new AetheriaRuntimeCargoBayLoadoutCommit()
+ }
+ }
+ },
+ DroppedPickups = new[]
+ {
+ new AetheriaRuntimeDroppedPickupCommit
+ {
+ PickupIndex = 0,
+ PositionX = 10,
+ PositionY = 11,
+ PositionZ = 12,
+ Item = new AetheriaRuntimeLoadoutItemCommit
+ {
+ ItemKey = "loot-cell",
+ Quantity = 1
+ }
+ }
+ }
+ }
+ }
+ };
+ }
+
+ private static AetheriaRuntimeZoneSnapshotCommit FindZone(AetheriaRuntimeRunCheckpointCommit run, int zoneIndex)
+ {
+ foreach (var zone in run.Zones)
+ {
+ if (zone.ZoneIndex == zoneIndex)
+ return zone;
+ }
+
+ Assert.Fail("Expected zone " + zoneIndex);
+ return null;
+ }
+
+ private static AetheriaRuntimeObservedDaemonState ObservedState(long frameId, long soaGeneration)
+ {
+ var frame = AetheriaRuntimeDaemonFrameDocument.Create(
+ new AetheriaRuntimeRunCheckpointCommit { RunId = "cursor-run" },
+ "daemon",
+ "session",
+ frameId,
+ 0,
+ 0.02);
+ var soaView = AetheriaRuntimeDaemonSoaViewDocument.Create(
+ "daemon",
+ "session",
+ frameId,
+ soaGeneration,
+ new[] { new AetheriaRuntimeDaemonSoaBufferDocument { BufferId = "hot" } },
+ new[] { new AetheriaRuntimeDaemonSoaColumnDocument { ColumnId = "position-x", BufferId = "hot" } });
+
+ return new AetheriaRuntimeObservedDaemonState(
+ frame,
+ soaView,
+ "state.cc.daemon.frame.cc",
+ "state.cc.daemon.soa.cc");
+ }
+
+ private static bool ContainsSurfaceMetric(
+ AetheriaRuntimeSurfaceComponent component,
+ string label,
+ string value)
+ {
+ if (component.Kind == "metric" &&
+ component.Props.TryGetValue("label", out var actualLabel) &&
+ component.Props.TryGetValue("value", out var actualValue) &&
+ actualLabel == label &&
+ actualValue == value)
+ {
+ return true;
+ }
+
+ return component.Children.Any(child => ContainsSurfaceMetric(child, label, value));
+ }
+}
diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonDocuments.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonDocuments.cs
new file mode 100644
index 000000000..7fb568f1f
--- /dev/null
+++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonDocuments.cs
@@ -0,0 +1,689 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using GameCult.Caching;
+using MessagePack;
+
+#nullable enable
+
+namespace GameCult.Aetheria.State.Unity
+{
+ public sealed class AetheriaRuntimeDaemonCommandEnvelope
+ {
+ public AetheriaRuntimeDaemonCommandEnvelope(
+ string schema,
+ string commandId,
+ string clientId,
+ string issuedAtUtc,
+ string sessionId,
+ long observedFrameId,
+ AetheriaRuntimeDaemonCommandKinds kind,
+ string actorEntityKey,
+ string path)
+ {
+ Schema = schema;
+ CommandId = commandId;
+ ClientId = clientId;
+ IssuedAtUtc = issuedAtUtc;
+ SessionId = sessionId;
+ ObservedFrameId = observedFrameId;
+ Kind = kind;
+ ActorEntityKey = actorEntityKey;
+ Path = path;
+ }
+
+ public string Schema { get; }
+ public string CommandId { get; }
+ public string ClientId { get; }
+ public string IssuedAtUtc { get; }
+ public string SessionId { get; }
+ public long ObservedFrameId { get; }
+ public AetheriaRuntimeDaemonCommandKinds Kind { get; }
+ public string ActorEntityKey { get; }
+ public string Path { get; }
+ }
+
+ public static class AetheriaRuntimeDaemonSchemas
+ {
+ public const string Frame = "gamecult.aetheria.daemon_frame.v1";
+ public const string Command = "gamecult.aetheria.daemon_command.v1";
+ public const string SoaView = "gamecult.aetheria.daemon_soa_view.v1";
+ public const string ProviderAdvertisement = "gamecult.aetheria.daemon_provider_advertisement.v1";
+ public const string Health = "gamecult.aetheria.daemon_health.v1";
+ public const string CommandBoundary = "gamecult.aetheria.daemon_command_boundary.v1";
+ public const string GameSurface = "gamecult.aetheria.daemon_game_surface.v1";
+ public const string EditorSurface = "gamecult.aetheria.daemon_editor_surface.v1";
+ }
+
+ public enum AetheriaRuntimeDaemonCommandKinds
+ {
+ None = 0,
+ Ping,
+ SetTarget,
+ ClearTarget,
+ SetMoveVector,
+ SetLookDirection,
+ SetTractorPower,
+ FireWeaponGroup,
+ SetWeaponGroupActive,
+ SetWeaponGroupMembership,
+ SetBehaviorActive,
+ ActivateConsumable,
+ SensorPing,
+ SetItemEnabled,
+ SetItemOverrideShutdown,
+ SetThermotoggleTargetTemperature,
+ SetActionBarBinding,
+ ClearActionBarBinding,
+ PickUpLoot,
+ RestoreLoadout,
+ Dock,
+ Undock,
+ SetDockedCurrentShip,
+ TowToStation,
+ EnterWormhole,
+ TradePurchase,
+ TransferCargoItem,
+ EquipItem,
+ StoreItem,
+ ToggleHullConductivity,
+ SetEntityName,
+ DestroyEntity,
+ SetOverrideShutdown,
+ SetHeatsinksEnabled,
+ SetShutdownPerformance,
+ ToggleShieldEnabled
+ }
+
+ [CultDocument("gamecult.aetheria.daemon_provider_advertisement", "gamecult.aetheria.daemon_provider_advertisement.v1")]
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeDaemonProviderAdvertisementDocument
+ {
+ [Key(0)]
+ public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.ProviderAdvertisement;
+
+ [Key(1)]
+ public string VerseId { get; set; } = "aetheria.local";
+
+ [Key(2)]
+ public string ProviderId { get; set; } = "aetheria.daemon";
+
+ [Key(3)]
+ public string DaemonId { get; set; } = "aetheria-daemon";
+
+ [Key(4)]
+ public string PublishedAtUtc { get; set; } = "";
+
+ [Key(5)]
+ public string StateWitnessPath { get; set; } = "";
+
+ [Key(6)]
+ public string FrameWitnessPath { get; set; } = "";
+
+ [Key(7)]
+ public string SoaWitnessPath { get; set; } = "";
+
+ [Key(8)]
+ public string HealthWitnessPath { get; set; } = "";
+
+ [Key(9)]
+ public string CommandBoundaryWitnessPath { get; set; } = "";
+
+ [Key(10)]
+ public string EveGuiSurfaceWitnessPath { get; set; } = "";
+
+ [Key(11)]
+ public string EveTuiSurfaceWitnessPath { get; set; } = "";
+
+ [Key(12)]
+ public string EveGuiSurfaceId { get; set; } = "aetheria.game";
+
+ [Key(13)]
+ public string EveTuiSurfaceId { get; set; } = "aetheria.game.tui";
+
+ [Key(14)]
+ public string EditorGuiSurfaceWitnessPath { get; set; } = "";
+
+ [Key(15)]
+ public string EditorTuiSurfaceWitnessPath { get; set; } = "";
+
+ [Key(16)]
+ public string EditorGuiSurfaceId { get; set; } = "aetheria.daemon.editor";
+
+ [Key(17)]
+ public string EditorTuiSurfaceId { get; set; } = "aetheria.daemon.editor.tui";
+
+ [Key(18)]
+ public IReadOnlyList PublishedSchemas { get; set; } = Array.Empty();
+
+ [Key(19)]
+ public IReadOnlyList CommandBoundaryIds { get; set; } = Array.Empty();
+
+ [Key(20)]
+ public string CultMeshAddress { get; set; } = "cultmesh://aetheria.local/eve/providers/aetheria.daemon";
+
+ public static AetheriaRuntimeDaemonProviderAdvertisementDocument Create(
+ string stateFilePath,
+ string daemonId,
+ string verseId,
+ string cultMeshAddress)
+ {
+ return new AetheriaRuntimeDaemonProviderAdvertisementDocument
+ {
+ VerseId = string.IsNullOrWhiteSpace(verseId) ? "aetheria.local" : verseId,
+ DaemonId = string.IsNullOrWhiteSpace(daemonId) ? "aetheria-daemon" : daemonId,
+ PublishedAtUtc = DateTime.UtcNow.ToString("O"),
+ StateWitnessPath = stateFilePath ?? "",
+ FrameWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonFramePath(stateFilePath ?? ""),
+ SoaWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonSoaViewPath(stateFilePath ?? ""),
+ HealthWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonHealthPath(stateFilePath ?? ""),
+ CommandBoundaryWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonCommandBoundaryPath(stateFilePath ?? ""),
+ EveGuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonGameSurfacePath(stateFilePath ?? ""),
+ EveTuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonGameTuiSurfacePath(stateFilePath ?? ""),
+ EveGuiSurfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId,
+ EveTuiSurfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId,
+ EditorGuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonEditorSurfacePath(stateFilePath ?? ""),
+ EditorTuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonEditorTuiSurfacePath(stateFilePath ?? ""),
+ EditorGuiSurfaceId = AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId,
+ EditorTuiSurfaceId = AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId,
+ CultMeshAddress = string.IsNullOrWhiteSpace(cultMeshAddress)
+ ? "cultmesh://aetheria.local/eve/providers/aetheria.daemon"
+ : cultMeshAddress,
+ PublishedSchemas = new[]
+ {
+ AetheriaRuntimeDaemonSchemas.Frame,
+ AetheriaRuntimeDaemonSchemas.SoaView,
+ AetheriaRuntimeDaemonSchemas.Health,
+ AetheriaRuntimeDaemonSchemas.CommandBoundary,
+ AetheriaRuntimeDaemonSchemas.GameSurface,
+ AetheriaRuntimeDaemonSchemas.EditorSurface,
+ AetheriaRuntimeDaemonSchemas.Command
+ },
+ CommandBoundaryIds = new[] { "aetheria.daemon.commands" }
+ };
+ }
+ }
+
+ [CultDocument("gamecult.aetheria.daemon_health", "gamecult.aetheria.daemon_health.v1")]
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeDaemonHealthDocument
+ {
+ [Key(0)]
+ public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.Health;
+
+ [Key(1)]
+ public string DaemonId { get; set; } = "aetheria-daemon";
+
+ [Key(2)]
+ public string VerseId { get; set; } = "aetheria.local";
+
+ [Key(3)]
+ public string PublishedAtUtc { get; set; } = "";
+
+ [Key(4)]
+ public string StatePath { get; set; } = "";
+
+ [Key(5)]
+ public long FrameId { get; set; }
+
+ [Key(6)]
+ public int PendingBeforeApply { get; set; }
+
+ [IgnoreMember]
+ public int ObservedCommandCount
+ {
+ get => PendingBeforeApply;
+ set => PendingBeforeApply = value;
+ }
+
+ [Key(7)]
+ public int AppliedCommandCount { get; set; }
+
+ [Key(8)]
+ public int RejectedCommandCount { get; set; }
+
+ [Key(9)]
+ public string Status { get; set; } = "healthy";
+
+ [Key(10)]
+ public string PublicationSource { get; set; } = "daemon-published";
+
+ [Key(11)]
+ public string Transport { get; set; } = "cultcache-witness";
+
+ [Key(12)]
+ public string CommandBoundaryPath { get; set; } = "";
+ }
+
+ [CultDocument("gamecult.aetheria.daemon_command_boundary", "gamecult.aetheria.daemon_command_boundary.v1")]
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeDaemonCommandBoundaryDocument
+ {
+ [Key(0)]
+ public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.CommandBoundary;
+
+ [Key(1)]
+ public string BoundaryId { get; set; } = "aetheria.daemon.commands";
+
+ [Key(2)]
+ public string DaemonId { get; set; } = "aetheria-daemon";
+
+ [Key(3)]
+ public string PublishedAtUtc { get; set; } = "";
+
+ [Key(4)]
+ public string CommandSchema { get; set; } = AetheriaRuntimeDaemonSchemas.Command;
+
+ [Key(5)]
+ public string ReceiptSchema { get; set; } = AetheriaRuntimeDaemonSchemas.Frame;
+
+ [Key(6)]
+ public string Delivery { get; set; } = "cultnet-document-put";
+
+ [Key(7)]
+ public IReadOnlyList Commands { get; set; } =
+ Array.Empty();
+
+ public static AetheriaRuntimeDaemonCommandBoundaryDocument Create(string daemonId)
+ {
+ return new AetheriaRuntimeDaemonCommandBoundaryDocument
+ {
+ DaemonId = string.IsNullOrWhiteSpace(daemonId) ? "aetheria-daemon" : daemonId,
+ PublishedAtUtc = DateTime.UtcNow.ToString("O"),
+ Commands = Enum
+ .GetValues(typeof(AetheriaRuntimeDaemonCommandKinds))
+ .Cast()
+ .Where(kind => kind != AetheriaRuntimeDaemonCommandKinds.None)
+ .Select(kind => new AetheriaRuntimeDaemonCommandBoundaryEntry
+ {
+ Kind = kind,
+ CommandBody = CommandBodyFor(kind),
+ Authority = "local-player-input",
+ Receipt = "applied-or-rejected-command-id-in-frame"
+ })
+ .ToArray()
+ };
+ }
+
+ private static string CommandBodyFor(AetheriaRuntimeDaemonCommandKinds kind)
+ {
+ switch (kind)
+ {
+ case AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding:
+ return nameof(AetheriaRuntimeActionBarBindingCommand);
+ case AetheriaRuntimeDaemonCommandKinds.TransferCargoItem:
+ return nameof(AetheriaRuntimeCargoTransferCommand);
+ case AetheriaRuntimeDaemonCommandKinds.TradePurchase:
+ return nameof(AetheriaRuntimeTradePurchaseCommand);
+ case AetheriaRuntimeDaemonCommandKinds.PickUpLoot:
+ return nameof(AetheriaRuntimeLootPickupCommand);
+ case AetheriaRuntimeDaemonCommandKinds.RestoreLoadout:
+ return nameof(AetheriaRuntimeLoadoutRestoreCommand);
+ case AetheriaRuntimeDaemonCommandKinds.EquipItem:
+ return nameof(AetheriaRuntimeEquipmentTransferCommand);
+ case AetheriaRuntimeDaemonCommandKinds.StoreItem:
+ return nameof(AetheriaRuntimeStoreItemCommand);
+ default:
+ return nameof(AetheriaRuntimeDaemonCommandDocument);
+ }
+ }
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeDaemonCommandBoundaryEntry
+ {
+ [Key(0)]
+ public AetheriaRuntimeDaemonCommandKinds Kind { get; set; }
+
+ [Key(1)]
+ public string CommandBody { get; set; } = "";
+
+ [Key(2)]
+ public string Authority { get; set; } = "";
+
+ [Key(3)]
+ public string Receipt { get; set; } = "";
+ }
+
+ [CultDocument("gamecult.aetheria.daemon_frame", "gamecult.aetheria.daemon_frame.v1")]
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeDaemonFrameDocument
+ {
+ [Key(0)]
+ public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.Frame;
+
+ [Key(1)]
+ public string DaemonId { get; set; } = "local";
+
+ [Key(2)]
+ public string SessionId { get; set; } = "local";
+
+ [Key(3)]
+ public long FrameId { get; set; }
+
+ [Key(4)]
+ public string PublishedAtUtc { get; set; } = "";
+
+ [Key(5)]
+ public double SimulationTimeSeconds { get; set; }
+
+ [Key(6)]
+ public double FixedDeltaSeconds { get; set; }
+
+ [Key(7)]
+ public bool IsAuthoritative { get; set; } = true;
+
+ [Key(8)]
+ public string StateSource { get; set; } = "daemon";
+
+ [Key(9)]
+ public AetheriaRuntimeRunCheckpointCommit Run { get; set; } = new AetheriaRuntimeRunCheckpointCommit();
+
+ [Key(10)]
+ public IReadOnlyList Capabilities { get; set; } = Array.Empty();
+
+ [Key(11)]
+ public IReadOnlyList AppliedCommandIds { get; set; } = Array.Empty();
+
+ [Key(12)]
+ public IReadOnlyList RejectedCommandIds { get; set; } = Array.Empty();
+
+ public static AetheriaRuntimeDaemonFrameDocument Create(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string daemonId,
+ string sessionId,
+ long frameId,
+ double simulationTimeSeconds,
+ double fixedDeltaSeconds,
+ bool isAuthoritative = true,
+ string stateSource = "daemon")
+ {
+ return new AetheriaRuntimeDaemonFrameDocument
+ {
+ DaemonId = string.IsNullOrWhiteSpace(daemonId) ? "local" : daemonId,
+ SessionId = string.IsNullOrWhiteSpace(sessionId) ? "local" : sessionId,
+ FrameId = frameId,
+ PublishedAtUtc = DateTime.UtcNow.ToString("O"),
+ SimulationTimeSeconds = simulationTimeSeconds,
+ FixedDeltaSeconds = fixedDeltaSeconds,
+ IsAuthoritative = isAuthoritative,
+ StateSource = string.IsNullOrWhiteSpace(stateSource) ? "daemon" : stateSource,
+ Run = run ?? new AetheriaRuntimeRunCheckpointCommit()
+ };
+ }
+ }
+
+ [CultDocument("gamecult.aetheria.daemon_command", "gamecult.aetheria.daemon_command.v1")]
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeDaemonCommandDocument
+ {
+ [Key(0)]
+ public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.Command;
+
+ [Key(1)]
+ public string CommandId { get; set; } = "";
+
+ [Key(2)]
+ public string ClientId { get; set; } = "";
+
+ [Key(3)]
+ public string IssuedAtUtc { get; set; } = "";
+
+ [Key(4)]
+ public string SessionId { get; set; } = "";
+
+ [Key(5)]
+ public long ObservedFrameId { get; set; } = -1;
+
+ [Key(6)]
+ public AetheriaRuntimeDaemonCommandKinds Kind { get; set; } = AetheriaRuntimeDaemonCommandKinds.None;
+
+ [Key(7)]
+ public string ActorEntityKey { get; set; } = "";
+
+ [Key(8)]
+ public string TargetEntityKey { get; set; } = "";
+
+ [Key(9)]
+ public int TargetZoneIndex { get; set; } = -1;
+
+ [Key(10)]
+ public int EquipmentIndex { get; set; } = -1;
+
+ [Key(11)]
+ public int BehaviorIndex { get; set; } = -1;
+
+ [Key(12)]
+ public int WeaponGroup { get; set; } = -1;
+
+ [Key(13)]
+ public double PositionX { get; set; }
+
+ [Key(14)]
+ public double PositionY { get; set; }
+
+ [Key(15)]
+ public double PositionZ { get; set; }
+
+ [Key(16)]
+ public double DirectionX { get; set; }
+
+ [Key(17)]
+ public double DirectionY { get; set; }
+
+ [Key(18)]
+ public double ScalarValue { get; set; }
+
+ [Key(19)]
+ public string TextValue { get; set; } = "";
+
+ [Key(20)]
+ public AetheriaRuntimeActionBarBindingCommand ActionBarBinding { get; set; } = new AetheriaRuntimeActionBarBindingCommand();
+
+ [Key(21)]
+ public AetheriaRuntimeCargoTransferCommand CargoTransfer { get; set; } = new AetheriaRuntimeCargoTransferCommand();
+
+ [Key(22)]
+ public AetheriaRuntimeTradePurchaseCommand TradePurchase { get; set; } = new AetheriaRuntimeTradePurchaseCommand();
+
+ [Key(23)]
+ public AetheriaRuntimeLootPickupCommand LootPickup { get; set; } = new AetheriaRuntimeLootPickupCommand();
+
+ [Key(24)]
+ public AetheriaRuntimeLoadoutRestoreCommand LoadoutRestore { get; set; } = new AetheriaRuntimeLoadoutRestoreCommand();
+
+ [Key(25)]
+ public AetheriaRuntimeEquipmentTransferCommand EquipmentTransfer { get; set; } = new AetheriaRuntimeEquipmentTransferCommand();
+
+ [Key(26)]
+ public AetheriaRuntimeStoreItemCommand StoreItem { get; set; } = new AetheriaRuntimeStoreItemCommand();
+
+ public static AetheriaRuntimeDaemonCommandDocument Create(
+ AetheriaRuntimeDaemonCommandKinds kind,
+ string clientId,
+ string sessionId,
+ long observedFrameId,
+ string actorEntityKey)
+ {
+ return new AetheriaRuntimeDaemonCommandDocument
+ {
+ CommandId = Guid.NewGuid().ToString("N"),
+ ClientId = clientId ?? "",
+ IssuedAtUtc = DateTime.UtcNow.ToString("O"),
+ SessionId = sessionId ?? "",
+ ObservedFrameId = observedFrameId,
+ Kind = kind,
+ ActorEntityKey = actorEntityKey ?? ""
+ };
+ }
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeActionBarBindingCommand
+ {
+ [Key(0)]
+ public string Kind { get; set; } = "";
+
+ [Key(1)]
+ public string ItemKey { get; set; } = "";
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeCargoTransferCommand
+ {
+ [Key(0)]
+ public string OriginEntityKey { get; set; } = "";
+
+ [Key(1)]
+ public int OriginCargoIndex { get; set; } = -1;
+
+ [Key(2)]
+ public string DestinationEntityKey { get; set; } = "";
+
+ [Key(3)]
+ public int DestinationCargoIndex { get; set; } = -1;
+
+ [Key(4)]
+ public int SourceX { get; set; } = int.MinValue;
+
+ [Key(5)]
+ public int SourceY { get; set; } = int.MinValue;
+
+ [Key(6)]
+ public int DestinationX { get; set; }
+
+ [Key(7)]
+ public int DestinationY { get; set; }
+
+ [Key(8)]
+ public bool HasDestinationPosition { get; set; }
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeTradePurchaseCommand
+ {
+ [Key(0)]
+ public string PurchaseKind { get; set; } = "";
+
+ [Key(1)]
+ public string ItemKey { get; set; } = "";
+
+ [Key(2)]
+ public int Quantity { get; set; } = 1;
+
+ [Key(3)]
+ public int UnitPrice { get; set; }
+
+ [Key(4)]
+ public int TotalPrice { get; set; }
+
+ [Key(5)]
+ public string StationEntityKey { get; set; } = "";
+
+ [Key(6)]
+ public int StationCargoIndex { get; set; } = -1;
+
+ [Key(7)]
+ public string TargetEntityKey { get; set; } = "";
+
+ [Key(8)]
+ public int TargetCargoIndex { get; set; } = -1;
+
+ [Key(9)]
+ public int SourceX { get; set; } = int.MinValue;
+
+ [Key(10)]
+ public int SourceY { get; set; } = int.MinValue;
+
+ [Key(11)]
+ public bool CreatesDockedShip { get; set; }
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeLootPickupCommand
+ {
+ [Key(0)]
+ public string ItemKey { get; set; } = "";
+
+ [Key(1)]
+ public int Quantity { get; set; } = 1;
+
+ [Key(2)]
+ public double PositionX { get; set; }
+
+ [Key(3)]
+ public double PositionY { get; set; }
+
+ [Key(4)]
+ public double PositionZ { get; set; }
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeLoadoutRestoreCommand
+ {
+ [Key(0)]
+ public string DockedEntityKey { get; set; } = "";
+
+ [Key(1)]
+ public string TemplateName { get; set; } = "";
+
+ [Key(2)]
+ public int Price { get; set; }
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeEquipmentTransferCommand
+ {
+ [Key(0)]
+ public string SourceKind { get; set; } = "";
+
+ [Key(1)]
+ public string OriginEntityKey { get; set; } = "";
+
+ [Key(2)]
+ public int OriginIndex { get; set; } = -1;
+
+ [Key(3)]
+ public string DestinationEntityKey { get; set; } = "";
+
+ [Key(4)]
+ public int SourceX { get; set; } = int.MinValue;
+
+ [Key(5)]
+ public int SourceY { get; set; } = int.MinValue;
+
+ [Key(6)]
+ public int DestinationX { get; set; }
+
+ [Key(7)]
+ public int DestinationY { get; set; }
+
+ [Key(8)]
+ public bool HasDestinationPosition { get; set; }
+ }
+
+ [MessagePackObject]
+ public sealed class AetheriaRuntimeStoreItemCommand
+ {
+ [Key(0)]
+ public string OriginEntityKey { get; set; } = "";
+
+ [Key(1)]
+ public int SourceEquipmentIndex { get; set; } = -1;
+
+ [Key(2)]
+ public string DestinationEntityKey { get; set; } = "";
+
+ [Key(3)]
+ public int DestinationCargoIndex { get; set; } = -1;
+
+ [Key(4)]
+ public int DestinationX { get; set; }
+
+ [Key(5)]
+ public int DestinationY { get; set; }
+
+ [Key(6)]
+ public bool HasDestinationPosition { get; set; }
+ }
+}
diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperationClient.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperationClient.cs
new file mode 100644
index 000000000..20366a4ba
--- /dev/null
+++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperationClient.cs
@@ -0,0 +1,570 @@
+using System;
+
+#nullable enable
+
+namespace GameCult.Aetheria.State.Unity
+{
+ public sealed class AetheriaRuntimeDaemonOperationClient
+ {
+ public AetheriaRuntimeDaemonOperationClient(
+ string stateFilePath,
+ string clientId = "unity-observer",
+ string sessionId = "local")
+ {
+ if (string.IsNullOrWhiteSpace(stateFilePath))
+ throw new ArgumentException("State file path must be non-empty.", nameof(stateFilePath));
+
+ StateFilePath = stateFilePath;
+ ClientId = string.IsNullOrWhiteSpace(clientId) ? "unity-observer" : clientId;
+ SessionId = string.IsNullOrWhiteSpace(sessionId) ? "local" : sessionId;
+ }
+
+ public string StateFilePath { get; }
+ public string ClientId { get; }
+ public string SessionId { get; }
+
+ public AetheriaRuntimeDaemonCommandEnvelope Send(
+ AetheriaRuntimeDaemonCommandKinds kind,
+ AetheriaRuntimeObservedDaemonState? observed,
+ Action? configure = null)
+ {
+ var command = Create(kind, observed);
+ configure?.Invoke(command);
+ if (!TrySend(command, out var envelope, out var error))
+ {
+ throw new InvalidOperationException(
+ $"Failed to submit Aetheria daemon operation {kind}: {error}");
+ }
+
+ return envelope!;
+ }
+
+ public bool TrySend(
+ AetheriaRuntimeDaemonCommandKinds kind,
+ AetheriaRuntimeObservedDaemonState? observed,
+ Action? configure,
+ out AetheriaRuntimeDaemonCommandEnvelope? envelope,
+ out string error)
+ {
+ var command = Create(kind, observed);
+ configure?.Invoke(command);
+ return TrySend(command, out envelope, out error);
+ }
+
+ public bool TrySend(
+ AetheriaRuntimeDaemonCommandDocument command,
+ out AetheriaRuntimeDaemonCommandEnvelope? envelope,
+ out string error)
+ {
+ return AetheriaRuntimeCommandSubmitter.TrySubmitDaemonCommand(
+ StateFilePath,
+ command,
+ ClientId,
+ out envelope,
+ out error);
+ }
+
+ public AetheriaRuntimeDaemonCommandDocument Create(
+ AetheriaRuntimeDaemonCommandKinds kind,
+ AetheriaRuntimeObservedDaemonState? observed)
+ {
+ return AetheriaRuntimeDaemonCommandDocument.Create(
+ kind,
+ ClientId,
+ observed?.Frame.SessionId ?? SessionId,
+ observed?.Frame.FrameId ?? -1,
+ observed?.Run.CurrentEntityKey ?? "");
+ }
+
+ public static AetheriaRuntimeDaemonCommandEnvelope ToEnvelope(AetheriaRuntimeDaemonCommandDocument command)
+ {
+ return new AetheriaRuntimeDaemonCommandEnvelope(
+ command.Schema ?? "",
+ command.CommandId ?? "",
+ command.ClientId ?? "",
+ command.IssuedAtUtc ?? "",
+ command.SessionId ?? "",
+ command.ObservedFrameId,
+ command.Kind,
+ command.ActorEntityKey ?? "",
+ "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetTarget(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetTarget, observed, command =>
+ command.TargetEntityKey = targetEntityKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ClearTarget(AetheriaRuntimeObservedDaemonState? observed)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.ClearTarget, observed);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetMoveVector(
+ AetheriaRuntimeObservedDaemonState? observed,
+ double directionX,
+ double directionY,
+ double scalarValue = 1.0)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetMoveVector, observed, command =>
+ {
+ command.DirectionX = directionX;
+ command.DirectionY = directionY;
+ command.ScalarValue = scalarValue;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetLookDirection(
+ AetheriaRuntimeObservedDaemonState? observed,
+ double directionX,
+ double directionY,
+ double directionZ)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetLookDirection, observed, command =>
+ {
+ command.DirectionX = directionX;
+ command.DirectionY = directionY;
+ command.PositionZ = directionZ;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetTractorPower(
+ AetheriaRuntimeObservedDaemonState? observed,
+ double power)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetTractorPower, observed, command =>
+ command.ScalarValue = power);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope FireWeaponGroup(
+ AetheriaRuntimeObservedDaemonState? observed,
+ int weaponGroup)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, observed, command =>
+ command.WeaponGroup = weaponGroup);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupActive(
+ AetheriaRuntimeObservedDaemonState? observed,
+ int weaponGroup,
+ bool active)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupActive, observed, command =>
+ {
+ command.WeaponGroup = weaponGroup;
+ command.ScalarValue = active ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupMembership(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ int equipmentIndex,
+ int weaponGroup,
+ bool assigned)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.WeaponGroup = weaponGroup;
+ command.ScalarValue = assigned ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetBehaviorActive(
+ AetheriaRuntimeObservedDaemonState? observed,
+ int equipmentIndex,
+ int behaviorIndex,
+ bool active)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive, observed, command =>
+ {
+ command.EquipmentIndex = equipmentIndex;
+ command.BehaviorIndex = behaviorIndex;
+ command.ScalarValue = active ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ActivateConsumable(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string itemKey)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.ActivateConsumable, observed, command =>
+ command.TextValue = itemKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SensorPing(AetheriaRuntimeObservedDaemonState? observed)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SensorPing, observed);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetHeatsinksEnabled(
+ AetheriaRuntimeObservedDaemonState? observed,
+ bool enabled)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetHeatsinksEnabled, observed, command =>
+ command.ScalarValue = enabled ? 1.0 : 0.0);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetOverrideShutdown(
+ AetheriaRuntimeObservedDaemonState? observed,
+ bool enabled)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, observed, command =>
+ command.ScalarValue = enabled ? 1.0 : 0.0);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetOverrideShutdown(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ bool enabled)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.ScalarValue = enabled ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetItemEnabled(
+ AetheriaRuntimeObservedDaemonState? observed,
+ int equipmentIndex,
+ bool enabled)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetItemEnabled, observed, command =>
+ {
+ command.EquipmentIndex = equipmentIndex;
+ command.ScalarValue = enabled ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ToggleShieldEnabled(AetheriaRuntimeObservedDaemonState? observed)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled, observed);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetItemOverrideShutdown(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ int equipmentIndex,
+ bool enabled)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetItemOverrideShutdown, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.ScalarValue = enabled ? 1.0 : 0.0;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetThermotoggleTargetTemperature(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ int equipmentIndex,
+ int behaviorIndex,
+ double targetTemperature)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetThermotoggleTargetTemperature, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.BehaviorIndex = behaviorIndex;
+ command.ScalarValue = targetTemperature;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetShutdownPerformance(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ double shutdownPerformance)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.ScalarValue = shutdownPerformance;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetActionBarBinding(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string controlPath,
+ string kind,
+ string itemKey,
+ int equipmentIndex,
+ int behaviorIndex,
+ int weaponGroup)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding, observed, command =>
+ {
+ command.TextValue = controlPath ?? "";
+ command.EquipmentIndex = equipmentIndex;
+ command.BehaviorIndex = behaviorIndex;
+ command.WeaponGroup = weaponGroup;
+ command.ActionBarBinding.Kind = kind ?? "";
+ command.ActionBarBinding.ItemKey = itemKey ?? "";
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ClearActionBarBinding(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string controlPath)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.ClearActionBarBinding, observed, command =>
+ command.TextValue = controlPath ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope ToggleHullConductivity(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ int x,
+ int y,
+ int axis)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.ToggleHullConductivity, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.PositionX = x;
+ command.PositionY = y;
+ command.ScalarValue = axis;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetEntityName(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ string name)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetEntityName, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.TextValue = name ?? "";
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope Dock(AetheriaRuntimeObservedDaemonState? observed, string targetEntityKey)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.Dock, observed, command =>
+ command.TargetEntityKey = targetEntityKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope Undock(AetheriaRuntimeObservedDaemonState? observed)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.Undock, observed);
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope SetDockedCurrentShip(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.SetDockedCurrentShip, observed, command =>
+ command.TargetEntityKey = targetEntityKey ?? "");
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope EnterWormhole(
+ AetheriaRuntimeObservedDaemonState? observed,
+ int targetZoneIndex,
+ double positionX,
+ double positionY)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.EnterWormhole, observed, command =>
+ {
+ command.TargetZoneIndex = targetZoneIndex;
+ command.PositionX = positionX;
+ command.PositionY = positionY;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope TowToStation(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string stationEntityKey,
+ int targetZoneIndex,
+ double positionX,
+ double positionY)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.TowToStation, observed, command =>
+ {
+ command.TargetEntityKey = stationEntityKey ?? "";
+ command.TargetZoneIndex = targetZoneIndex;
+ command.PositionX = positionX;
+ command.PositionY = positionY;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope TransferCargoItem(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string originEntityKey,
+ int originCargoIndex,
+ string destinationEntityKey,
+ int destinationCargoIndex,
+ string itemKey,
+ int quantity,
+ int sourceX,
+ int sourceY,
+ int destinationX,
+ int destinationY,
+ bool hasDestinationPosition)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.TransferCargoItem, observed, command =>
+ {
+ command.TargetEntityKey = destinationEntityKey ?? "";
+ command.EquipmentIndex = destinationCargoIndex;
+ command.PositionX = destinationX;
+ command.PositionY = destinationY;
+ command.ScalarValue = quantity;
+ command.TextValue = itemKey ?? "";
+ command.CargoTransfer.OriginEntityKey = originEntityKey ?? "";
+ command.CargoTransfer.OriginCargoIndex = originCargoIndex;
+ command.CargoTransfer.DestinationEntityKey = destinationEntityKey ?? "";
+ command.CargoTransfer.DestinationCargoIndex = destinationCargoIndex;
+ command.CargoTransfer.SourceX = sourceX;
+ command.CargoTransfer.SourceY = sourceY;
+ command.CargoTransfer.DestinationX = destinationX;
+ command.CargoTransfer.DestinationY = destinationY;
+ command.CargoTransfer.HasDestinationPosition = hasDestinationPosition;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope TradePurchase(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string purchaseKind,
+ string itemKey,
+ int quantity,
+ int unitPrice,
+ int totalPrice,
+ string stationEntityKey,
+ int stationCargoIndex,
+ string targetEntityKey,
+ int targetCargoIndex,
+ int sourceX,
+ int sourceY,
+ bool createsDockedShip)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.TradePurchase, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.EquipmentIndex = targetCargoIndex;
+ command.PositionX = sourceX;
+ command.PositionY = sourceY;
+ command.ScalarValue = totalPrice;
+ command.TextValue = itemKey ?? "";
+ command.TradePurchase.PurchaseKind = purchaseKind ?? "";
+ command.TradePurchase.ItemKey = itemKey ?? "";
+ command.TradePurchase.Quantity = quantity;
+ command.TradePurchase.UnitPrice = unitPrice;
+ command.TradePurchase.TotalPrice = totalPrice;
+ command.TradePurchase.StationEntityKey = stationEntityKey ?? "";
+ command.TradePurchase.StationCargoIndex = stationCargoIndex;
+ command.TradePurchase.TargetEntityKey = targetEntityKey ?? "";
+ command.TradePurchase.TargetCargoIndex = targetCargoIndex;
+ command.TradePurchase.SourceX = sourceX;
+ command.TradePurchase.SourceY = sourceY;
+ command.TradePurchase.CreatesDockedShip = createsDockedShip;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope PickUpLoot(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string targetEntityKey,
+ string itemKey,
+ int quantity,
+ double positionX,
+ double positionY,
+ double positionZ)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.PickUpLoot, observed, command =>
+ {
+ command.TargetEntityKey = targetEntityKey ?? "";
+ command.TextValue = itemKey ?? "";
+ command.ScalarValue = quantity;
+ command.PositionX = positionX;
+ command.PositionY = positionY;
+ command.PositionZ = positionZ;
+ command.LootPickup.ItemKey = itemKey ?? "";
+ command.LootPickup.Quantity = quantity;
+ command.LootPickup.PositionX = positionX;
+ command.LootPickup.PositionY = positionY;
+ command.LootPickup.PositionZ = positionZ;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope RestoreLoadout(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string dockedEntityKey,
+ string templateName,
+ int price)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.RestoreLoadout, observed, command =>
+ {
+ command.TargetEntityKey = dockedEntityKey ?? "";
+ command.TextValue = templateName ?? "";
+ command.ScalarValue = price;
+ command.LoadoutRestore.DockedEntityKey = dockedEntityKey ?? "";
+ command.LoadoutRestore.TemplateName = templateName ?? "";
+ command.LoadoutRestore.Price = price;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope EquipItem(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string sourceKind,
+ string originEntityKey,
+ int originIndex,
+ string destinationEntityKey,
+ string itemKey,
+ int sourceX,
+ int sourceY,
+ int destinationX,
+ int destinationY,
+ bool hasDestinationPosition)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.EquipItem, observed, command =>
+ {
+ command.TargetEntityKey = destinationEntityKey ?? "";
+ command.PositionX = destinationX;
+ command.PositionY = destinationY;
+ command.TextValue = itemKey ?? "";
+ command.EquipmentTransfer.SourceKind = sourceKind ?? "";
+ command.EquipmentTransfer.OriginEntityKey = originEntityKey ?? "";
+ command.EquipmentTransfer.OriginIndex = originIndex;
+ command.EquipmentTransfer.DestinationEntityKey = destinationEntityKey ?? "";
+ command.EquipmentTransfer.SourceX = sourceX;
+ command.EquipmentTransfer.SourceY = sourceY;
+ command.EquipmentTransfer.DestinationX = destinationX;
+ command.EquipmentTransfer.DestinationY = destinationY;
+ command.EquipmentTransfer.HasDestinationPosition = hasDestinationPosition;
+ });
+ }
+
+ public AetheriaRuntimeDaemonCommandEnvelope StoreItem(
+ AetheriaRuntimeObservedDaemonState? observed,
+ string originEntityKey,
+ int sourceEquipmentIndex,
+ string destinationEntityKey,
+ int destinationCargoIndex,
+ string itemKey,
+ int destinationX,
+ int destinationY,
+ bool hasDestinationPosition)
+ {
+ return Send(AetheriaRuntimeDaemonCommandKinds.StoreItem, observed, command =>
+ {
+ command.TargetEntityKey = destinationEntityKey ?? "";
+ command.EquipmentIndex = sourceEquipmentIndex;
+ command.PositionX = destinationX;
+ command.PositionY = destinationY;
+ command.TextValue = itemKey ?? "";
+ command.StoreItem.OriginEntityKey = originEntityKey ?? "";
+ command.StoreItem.SourceEquipmentIndex = sourceEquipmentIndex;
+ command.StoreItem.DestinationEntityKey = destinationEntityKey ?? "";
+ command.StoreItem.DestinationCargoIndex = destinationCargoIndex;
+ command.StoreItem.DestinationX = destinationX;
+ command.StoreItem.DestinationY = destinationY;
+ command.StoreItem.HasDestinationPosition = hasDestinationPosition;
+ });
+ }
+ }
+}
diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperations.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperations.cs
new file mode 100644
index 000000000..54ba892d8
--- /dev/null
+++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperations.cs
@@ -0,0 +1,1573 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+
+#nullable enable
+
+namespace GameCult.Aetheria.State.Unity
+{
+ public sealed class AetheriaRuntimeDaemonOperationResult
+ {
+ public AetheriaRuntimeDaemonOperationResult(
+ AetheriaRuntimeRunCheckpointCommit run,
+ IReadOnlyList appliedCommandIds,
+ IReadOnlyList rejectedCommandIds,
+ AetheriaRuntimeDaemonIntentState? intents = null)
+ {
+ Run = run ?? new AetheriaRuntimeRunCheckpointCommit();
+ AppliedCommandIds = appliedCommandIds ?? Array.Empty();
+ RejectedCommandIds = rejectedCommandIds ?? Array.Empty();
+ Intents = intents ?? new AetheriaRuntimeDaemonIntentState();
+ }
+
+ public AetheriaRuntimeRunCheckpointCommit Run { get; }
+ public IReadOnlyList AppliedCommandIds { get; }
+ public IReadOnlyList RejectedCommandIds { get; }
+ public AetheriaRuntimeDaemonIntentState Intents { get; }
+ }
+
+ public sealed class AetheriaRuntimeDaemonOperationContext
+ {
+ public IReadOnlyList LoadoutTemplates { get; set; } =
+ Array.Empty();
+
+ public AetheriaRuntimeDaemonIntentState Intents { get; set; } = new AetheriaRuntimeDaemonIntentState();
+ }
+
+ public static class AetheriaRuntimeDaemonOperations
+ {
+ public static AetheriaRuntimeDaemonOperationResult Execute(
+ AetheriaRuntimeRunCheckpointCommit run,
+ IEnumerable commands)
+ {
+ return Execute(run, commands, new AetheriaRuntimeDaemonOperationContext());
+ }
+
+ public static AetheriaRuntimeDaemonOperationResult Execute(
+ AetheriaRuntimeRunCheckpointCommit run,
+ IEnumerable commands,
+ AetheriaRuntimeDaemonOperationContext context)
+ {
+ run ??= new AetheriaRuntimeRunCheckpointCommit();
+ context ??= new AetheriaRuntimeDaemonOperationContext();
+ var applied = new List();
+ var rejected = new List();
+
+ foreach (var command in commands ?? Enumerable.Empty())
+ {
+ if (command == null || string.IsNullOrWhiteSpace(command.CommandId))
+ continue;
+
+ if (ApplyOne(run, command, context))
+ applied.Add(command.CommandId);
+ else
+ rejected.Add(command.CommandId);
+ }
+
+ return new AetheriaRuntimeDaemonOperationResult(run, applied, rejected, context.Intents);
+ }
+
+ private static bool ApplyOne(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonOperationContext context)
+ {
+ switch (command.Kind)
+ {
+ case AetheriaRuntimeDaemonCommandKinds.SetTarget:
+ return ApplySetTarget(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.ClearTarget:
+ return ApplyClearTarget(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.SetLookDirection:
+ return ApplySetLookDirection(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.SetTractorPower:
+ if (!IsNormalizedScalar(command.ScalarValue))
+ return false;
+
+ return ApplyCurrentEntity(run, command, entity =>
+ entity.TractorPower = command.ScalarValue);
+ case AetheriaRuntimeDaemonCommandKinds.SetHeatsinksEnabled:
+ return ApplyCurrentEntity(run, command, entity =>
+ entity.HeatsinksEnabled = command.ScalarValue > 0.5);
+ case AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown:
+ return ApplyTargetOrCurrentEntity(run, command, entity =>
+ entity.OverrideShutdown = command.ScalarValue > 0.5);
+ case AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance:
+ if (command.ScalarValue < 0.0 || command.ScalarValue > 1.0)
+ return false;
+
+ return ApplyTargetEntity(run, command.TargetEntityKey, entity =>
+ entity.ShutdownPerformance = command.ScalarValue);
+ case AetheriaRuntimeDaemonCommandKinds.SetItemEnabled:
+ return ApplyCurrentEquipmentItem(run, command, item =>
+ item.Enabled = command.ScalarValue > 0.5);
+ case AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled:
+ return ApplyToggleEquipmentBehaviorItem(run, command, "Shield", item =>
+ item.Enabled = !item.Enabled);
+ case AetheriaRuntimeDaemonCommandKinds.SetItemOverrideShutdown:
+ return ApplyTargetEquipmentItem(run, command, item =>
+ item.OverrideShutdown = command.ScalarValue > 0.5);
+ case AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership:
+ return ApplySetWeaponGroupMembership(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.SetThermotoggleTargetTemperature:
+ return ApplySetThermotoggleTargetTemperature(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.SetEntityName:
+ return ApplyTargetEntity(run, command.TargetEntityKey, entity =>
+ entity.Name = command.TextValue ?? "");
+ case AetheriaRuntimeDaemonCommandKinds.DestroyEntity:
+ return ApplyDestroyEntity(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.SetDockedCurrentShip:
+ return ApplySetDockedCurrentShip(run, command.TargetEntityKey);
+ case AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding:
+ return ApplySetActionBarBinding(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.ClearActionBarBinding:
+ return ApplyClearActionBarBinding(run, command.TextValue);
+ case AetheriaRuntimeDaemonCommandKinds.TransferCargoItem:
+ return ApplyTransferCargoItem(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.EquipItem:
+ return ApplyEquipItem(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.StoreItem:
+ return ApplyStoreItem(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.PickUpLoot:
+ return ApplyPickUpLoot(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.ToggleHullConductivity:
+ return ApplyToggleHullConductivity(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.TradePurchase:
+ return ApplyTradePurchase(run, command);
+ case AetheriaRuntimeDaemonCommandKinds.RestoreLoadout:
+ return ApplyRestoreLoadout(run, command, context);
+ case AetheriaRuntimeDaemonCommandKinds.SetMoveVector:
+ return ApplySetMoveVector(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup:
+ return ApplyFireWeaponGroup(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupActive:
+ return ApplySetWeaponGroupActive(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive:
+ return ApplySetBehaviorActive(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.ActivateConsumable:
+ return ApplyActivateConsumable(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.SensorPing:
+ return ApplySensorPing(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.Dock:
+ return ApplyDockIntent(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.Undock:
+ return ApplyUndockIntent(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.EnterWormhole:
+ return ApplyEnterWormholeIntent(run, command, context.Intents);
+ case AetheriaRuntimeDaemonCommandKinds.TowToStation:
+ return ApplyTowToStationIntent(run, command, context.Intents);
+ default:
+ return false;
+ }
+ }
+
+ private static bool ApplySetTarget(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ var actorKey = string.IsNullOrWhiteSpace(command.ActorEntityKey)
+ ? run.CurrentEntityKey
+ : command.ActorEntityKey;
+ if (!TryResolveEntity(run, actorKey, out var actorZone, out var actorIndex, out var actor) ||
+ !TryResolveEntity(run, command.TargetEntityKey, out var targetZone, out var targetIndex, out _) ||
+ actorZone != targetZone ||
+ actorIndex == targetIndex)
+ {
+ return false;
+ }
+
+ if (!(actor.Contacts ?? Array.Empty())
+ .Any(contact => contact != null && contact.TargetEntityIndex == targetIndex && contact.Visible))
+ {
+ return false;
+ }
+
+ actor.TargetEntityIndex = targetIndex;
+ return true;
+ }
+
+ private static bool ApplyClearTarget(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ return ApplyCurrentEntity(run, command, entity => entity.TargetEntityIndex = -1);
+ }
+
+ private static bool ApplySetLookDirection(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ return ApplyCurrentEntity(run, command, entity =>
+ {
+ entity.DirectionX = command.DirectionX;
+ entity.DirectionY = command.PositionZ;
+ });
+ }
+
+ private static bool ApplySetCurrentEntity(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string entityKey)
+ {
+ if (!TryResolveEntity(run, entityKey, out var zoneIndex, out var entityIndex, out _))
+ return false;
+
+ run.CurrentZoneIndex = zoneIndex;
+ run.CurrentEntityKey = BuildEntityKey(run.RunId, zoneIndex, entityIndex);
+ return true;
+ }
+
+ private static bool ApplySetDockedCurrentShip(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string entityKey)
+ {
+ if (!TryResolveEntity(run, entityKey, out var zoneIndex, out var entityIndex, out _))
+ return false;
+
+ var zone = (run.Zones ?? Array.Empty())
+ .FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == zoneIndex);
+ if (zone == null)
+ return false;
+
+ var isDocked = (zone.Entities ?? Array.Empty())
+ .Any(entity =>
+ entity != null &&
+ entity.EntityIndex != entityIndex &&
+ (entity.DockingBayAssignments ?? Array.Empty()).Contains(entityIndex));
+ if (!isDocked)
+ return false;
+
+ run.CurrentZoneIndex = zoneIndex;
+ run.CurrentEntityKey = BuildEntityKey(run.RunId, zoneIndex, entityIndex);
+ return true;
+ }
+
+ private static bool ApplySetActionBarBinding(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ var controlPath = command.TextValue ?? "";
+ if (string.IsNullOrWhiteSpace(controlPath))
+ return false;
+
+ var bindingKind = command.ActionBarBinding.Kind ?? "";
+ if (string.Equals(bindingKind, "weapon_group", StringComparison.Ordinal))
+ {
+ var entityKey = string.IsNullOrWhiteSpace(command.ActorEntityKey)
+ ? run.CurrentEntityKey
+ : command.ActorEntityKey;
+ if (!TryResolveEntity(run, entityKey, out _, out _, out var entity))
+ return false;
+
+ var weaponGroups = entity.WeaponGroups ?? Array.Empty>();
+ if (command.WeaponGroup < 0 || command.WeaponGroup >= weaponGroups.Count)
+ return false;
+ }
+
+ var binding = new AetheriaRuntimeActionBarBindingCommit
+ {
+ ControlPath = controlPath,
+ Kind = bindingKind,
+ ItemKey = command.ActionBarBinding.ItemKey ?? "",
+ EquipmentIndex = command.EquipmentIndex,
+ BehaviorIndex = command.BehaviorIndex,
+ WeaponGroup = command.WeaponGroup
+ };
+
+ var bindings = (run.ActionBarBindings ?? Array.Empty())
+ .Where(existing => !string.Equals(existing?.ControlPath ?? "", controlPath, StringComparison.Ordinal))
+ .Concat(new[] { binding })
+ .ToArray();
+ run.ActionBarBindings = bindings;
+ return true;
+ }
+
+ private static bool ApplyClearActionBarBinding(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string controlPath)
+ {
+ if (string.IsNullOrWhiteSpace(controlPath))
+ return false;
+
+ run.ActionBarBindings = (run.ActionBarBindings ?? Array.Empty())
+ .Where(existing => !string.Equals(existing?.ControlPath ?? "", controlPath, StringComparison.Ordinal))
+ .ToArray();
+ return true;
+ }
+
+ private static bool ApplyTargetOrCurrentEntity(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ Action mutate)
+ {
+ return string.IsNullOrWhiteSpace(command.TargetEntityKey)
+ ? ApplyCurrentEntity(run, command, mutate)
+ : ApplyTargetEntity(run, command.TargetEntityKey, mutate);
+ }
+
+ private static bool ApplyCurrentEntity(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ Action mutate)
+ {
+ var entityKey = string.IsNullOrWhiteSpace(command.ActorEntityKey)
+ ? run.CurrentEntityKey
+ : command.ActorEntityKey;
+ return ApplyTargetEntity(run, entityKey, mutate);
+ }
+
+ private static bool ApplyCurrentEquipmentItem(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ Action mutate)
+ {
+ var entityKey = string.IsNullOrWhiteSpace(command.TargetEntityKey)
+ ? command.ActorEntityKey
+ : command.TargetEntityKey;
+ if (string.IsNullOrWhiteSpace(entityKey))
+ entityKey = run.CurrentEntityKey;
+
+ return ApplyTargetEquipmentItem(run, entityKey, command.EquipmentIndex, mutate);
+ }
+
+ private static bool ApplyTargetEquipmentItem(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ Action mutate)
+ {
+ return ApplyTargetEquipmentItem(run, command.TargetEntityKey, command.EquipmentIndex, mutate);
+ }
+
+ private static bool ApplyTargetEquipmentItem(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string entityKey,
+ int equipmentIndex,
+ Action mutate)
+ {
+ if (!TryResolveEntity(run, entityKey, out _, out _, out var entity))
+ return false;
+
+ var equipment = entity.Equipment ?? Array.Empty();
+ if (equipmentIndex < 0 || equipmentIndex >= equipment.Count)
+ return false;
+
+ var item = equipment[equipmentIndex]?.Item;
+ if (item == null)
+ return false;
+
+ mutate(item);
+ return true;
+ }
+
+ private static bool ApplySetWeaponGroupMembership(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ if (!TryResolveEntity(run, command.TargetEntityKey, out _, out _, out var entity) ||
+ command.EquipmentIndex < 0 ||
+ command.WeaponGroup < 0)
+ {
+ return false;
+ }
+
+ var equipment = entity.Equipment ?? Array.Empty();
+ if (command.EquipmentIndex >= equipment.Count ||
+ equipment[command.EquipmentIndex]?.Item == null)
+ {
+ return false;
+ }
+
+ var sourceGroups = entity.WeaponGroups ?? Array.Empty>();
+ var groupCount = Math.Max(sourceGroups.Count, command.WeaponGroup + 1);
+ var groups = new IReadOnlyList[groupCount];
+ for (var i = 0; i < groupCount; i++)
+ {
+ groups[i] = i < sourceGroups.Count
+ ? (sourceGroups[i] ?? Array.Empty()).ToArray()
+ : Array.Empty();
+ }
+
+ var members = groups[command.WeaponGroup]
+ .Where(index => index != command.EquipmentIndex)
+ .ToList();
+ if (command.ScalarValue > 0.5)
+ members.Add(command.EquipmentIndex);
+
+ groups[command.WeaponGroup] = members
+ .Distinct()
+ .OrderBy(index => index)
+ .ToArray();
+ entity.WeaponGroups = groups;
+ return true;
+ }
+
+ private static bool ApplySetThermotoggleTargetTemperature(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ if (!TryResolveEntity(run, command.TargetEntityKey, out _, out _, out var entity))
+ return false;
+
+ var behavior = (entity.BehaviorStates ?? Array.Empty())
+ .FirstOrDefault(candidate =>
+ candidate != null &&
+ string.Equals(candidate.OwnerKind, "equipment", StringComparison.Ordinal) &&
+ candidate.OwnerIndex == command.EquipmentIndex &&
+ candidate.BehaviorIndex == command.BehaviorIndex);
+ if (behavior == null)
+ return false;
+
+ behavior.ThermotoggleTargetTemperature = command.ScalarValue;
+ return true;
+ }
+
+ private static bool ApplyToggleEquipmentBehaviorItem(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ string behaviorKind,
+ Action mutate)
+ {
+ var entityKey = string.IsNullOrWhiteSpace(command.TargetEntityKey)
+ ? command.ActorEntityKey
+ : command.TargetEntityKey;
+ if (string.IsNullOrWhiteSpace(entityKey))
+ entityKey = run.CurrentEntityKey;
+
+ if (!TryResolveEntity(run, entityKey, out _, out _, out var entity))
+ return false;
+
+ var behavior = (entity.BehaviorStates ?? Array.Empty())
+ .FirstOrDefault(candidate =>
+ candidate != null &&
+ string.Equals(candidate.OwnerKind, "equipment", StringComparison.Ordinal) &&
+ string.Equals(candidate.BehaviorKind, behaviorKind, StringComparison.Ordinal));
+ if (behavior == null || behavior.OwnerIndex < 0)
+ return false;
+
+ var equipment = entity.Equipment ?? Array.Empty();
+ if (behavior.OwnerIndex >= equipment.Count)
+ return false;
+
+ var item = equipment[behavior.OwnerIndex]?.Item;
+ if (item == null)
+ return false;
+
+ mutate(item);
+ return true;
+ }
+
+ private static bool ApplyTransferCargoItem(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ var transfer = command.CargoTransfer ?? new AetheriaRuntimeCargoTransferCommand();
+ if (!TryResolveCargoBay(
+ run,
+ transfer.OriginEntityKey,
+ transfer.OriginCargoIndex,
+ out var originEntity,
+ out var originCargoIndex,
+ out _) ||
+ !TryResolveCargoBay(
+ run,
+ transfer.DestinationEntityKey,
+ transfer.DestinationCargoIndex,
+ out var destinationEntity,
+ out var destinationCargoIndex,
+ out _))
+ {
+ return false;
+ }
+
+ if (!transfer.HasDestinationPosition &&
+ string.Equals(transfer.OriginEntityKey ?? "", transfer.DestinationEntityKey ?? "", StringComparison.Ordinal) &&
+ transfer.OriginCargoIndex == transfer.DestinationCargoIndex)
+ {
+ return false;
+ }
+
+ var sourceX = transfer.SourceX;
+ var sourceY = transfer.SourceY;
+ if (!TryRemoveCargoItem(
+ originEntity,
+ originCargoIndex,
+ command.TextValue,
+ sourceX,
+ sourceY,
+ out var slot))
+ {
+ return false;
+ }
+
+ slot.X = transfer.HasDestinationPosition
+ ? transfer.DestinationX
+ : slot.X;
+ slot.Y = transfer.HasDestinationPosition
+ ? transfer.DestinationY
+ : slot.Y;
+ AddCargoItem(destinationEntity, destinationCargoIndex, slot);
+ return true;
+ }
+
+ private static bool ApplyEquipItem(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ var transfer = command.EquipmentTransfer ?? new AetheriaRuntimeEquipmentTransferCommand();
+ var sourceKind = transfer.SourceKind ?? "";
+ var originEntityKey = transfer.OriginEntityKey ?? "";
+ var originIndex = transfer.OriginIndex;
+ var sourceX = transfer.SourceX;
+ var sourceY = transfer.SourceY;
+
+ AetheriaRuntimeLoadoutItemSlotCommit slot;
+ if (string.Equals(sourceKind, "equipment", StringComparison.Ordinal))
+ {
+ if (!TryRemoveEquipmentItem(run, originEntityKey, originIndex, command.TextValue, out slot))
+ return false;
+ }
+ else
+ {
+ if (!TryResolveCargoBay(run, originEntityKey, originIndex, out var originEntity, out var originCargoIndex, out _) ||
+ !TryRemoveCargoItem(originEntity, originCargoIndex, command.TextValue, sourceX, sourceY, out slot))
+ {
+ return false;
+ }
+ }
+
+ if (!TryResolveEntity(run, transfer.DestinationEntityKey, out _, out _, out var destinationEntity))
+ return false;
+
+ slot.X = transfer.HasDestinationPosition
+ ? transfer.DestinationX
+ : slot.X;
+ slot.Y = transfer.HasDestinationPosition
+ ? transfer.DestinationY
+ : slot.Y;
+ AddEquipmentItem(destinationEntity, slot);
+ return true;
+ }
+
+ private static bool ApplyStoreItem(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ var store = command.StoreItem ?? new AetheriaRuntimeStoreItemCommand();
+ if (!TryRemoveEquipmentItem(
+ run,
+ store.OriginEntityKey,
+ store.SourceEquipmentIndex,
+ command.TextValue,
+ out var slot) ||
+ !TryResolveCargoBay(
+ run,
+ store.DestinationEntityKey,
+ store.DestinationCargoIndex,
+ out var destinationEntity,
+ out var destinationCargoIndex,
+ out _))
+ {
+ return false;
+ }
+
+ slot.X = store.HasDestinationPosition
+ ? store.DestinationX
+ : slot.X;
+ slot.Y = store.HasDestinationPosition
+ ? store.DestinationY
+ : slot.Y;
+ AddCargoItem(destinationEntity, destinationCargoIndex, slot);
+ return true;
+ }
+
+ private static bool ApplyPickUpLoot(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ if (!TryResolveEntity(run, command.TargetEntityKey, out var zoneIndex, out _, out var entity))
+ return false;
+
+ var zone = (run.Zones ?? Array.Empty())
+ .FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == zoneIndex);
+ if (zone == null)
+ return false;
+
+ var pickups = (zone.DroppedPickups ?? Array.Empty()).ToList();
+ var pickupIndex = pickups.FindIndex(pickup => IsPickupMatch(pickup, command));
+ if (pickupIndex < 0)
+ return false;
+
+ var pickup = pickups[pickupIndex];
+ pickups.RemoveAt(pickupIndex);
+ zone.DroppedPickups = pickups.ToArray();
+
+ AddCargoItem(entity, 0, new AetheriaRuntimeLoadoutItemSlotCommit
+ {
+ Item = pickup.Item ?? new AetheriaRuntimeLoadoutItemCommit
+ {
+ ItemKey = command.LootPickup.ItemKey ?? "",
+ Quantity = command.LootPickup.Quantity
+ }
+ });
+ return true;
+ }
+
+ private static bool ApplyToggleHullConductivity(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ if (!TryResolveEntity(run, command.TargetEntityKey, out _, out _, out var entity))
+ return false;
+
+ var x = (int)command.PositionX;
+ var y = (int)command.PositionY;
+ var axis = (int)command.ScalarValue;
+ var gridName = axis == 0 ? "hull_conductivity_x" : "hull_conductivity_y";
+ var grids = (entity.StatGrids ?? Array.Empty()).ToArray();
+ var grid = grids.FirstOrDefault(candidate =>
+ candidate != null &&
+ string.Equals(candidate.Name ?? "", gridName, StringComparison.Ordinal));
+ if (grid == null ||
+ x < 0 ||
+ y < 0 ||
+ x >= grid.Width ||
+ y >= grid.Height)
+ {
+ return false;
+ }
+
+ var values = (grid.Values ?? Array.Empty()).ToArray();
+ var index = y * grid.Width + x;
+ if (index < 0 || index >= values.Length)
+ return false;
+
+ values[index] = values[index] > 0.5 ? 0.0 : 1.0;
+ grid.Values = values;
+ entity.StatGrids = grids;
+ return true;
+ }
+
+ private static bool ApplyTradePurchase(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ var purchase = command.TradePurchase ?? new AetheriaRuntimeTradePurchaseCommand();
+ var totalPrice = purchase.TotalPrice;
+ if (totalPrice < 0 || run.Credits < totalPrice)
+ return false;
+
+ if (purchase.CreatesDockedShip)
+ {
+ run.Credits -= totalPrice;
+ return true;
+ }
+
+ if (!TryResolveCargoBay(
+ run,
+ purchase.StationEntityKey,
+ purchase.StationCargoIndex,
+ out var stationEntity,
+ out var stationCargoIndex,
+ out _) ||
+ !TryResolveCargoBay(
+ run,
+ purchase.TargetEntityKey,
+ purchase.TargetCargoIndex,
+ out var targetEntity,
+ out var targetCargoIndex,
+ out _))
+ {
+ return false;
+ }
+
+ var itemKey = purchase.ItemKey ?? "";
+ var quantity = Math.Max(1, purchase.Quantity);
+ if (!TryRemoveCargoItemQuantity(
+ stationEntity,
+ stationCargoIndex,
+ itemKey,
+ purchase.SourceX,
+ purchase.SourceY,
+ quantity,
+ out var purchasedSlot))
+ {
+ return false;
+ }
+
+ purchasedSlot.X = 0;
+ purchasedSlot.Y = 0;
+ AddCargoItem(targetEntity, targetCargoIndex, purchasedSlot);
+ run.Credits -= totalPrice;
+ return true;
+ }
+
+ private static bool ApplyRestoreLoadout(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonOperationContext context)
+ {
+ var restore = command.LoadoutRestore ?? new AetheriaRuntimeLoadoutRestoreCommand();
+ var price = restore.Price;
+ if (price < 0 || run.Credits < price)
+ return false;
+
+ var templateName = restore.TemplateName ?? "";
+ if (string.IsNullOrWhiteSpace(command.TargetEntityKey) ||
+ string.IsNullOrWhiteSpace(templateName))
+ {
+ return false;
+ }
+
+ var template = (context.LoadoutTemplates ?? Array.Empty())
+ .FirstOrDefault(candidate =>
+ candidate != null &&
+ string.Equals(candidate.Name ?? "", templateName, StringComparison.Ordinal));
+ if (template != null)
+ {
+ if (!TryParseEntityKey(command.TargetEntityKey, out var zoneIndex, out _))
+ return false;
+
+ var newEntityKey = AetheriaRuntimeLoadoutSnapshotProjector.AppendToZone(
+ run,
+ zoneIndex,
+ command.TargetEntityKey,
+ template);
+ if (string.IsNullOrWhiteSpace(newEntityKey))
+ return false;
+
+ run.CurrentEntityKey = newEntityKey;
+ }
+
+ run.Credits -= price;
+ return true;
+ }
+
+ private static bool ApplySetMoveVector(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (!TryResolveEntity(run, actor, out _, out _, out _) ||
+ !IsNormalizedScalar(command.ScalarValue) ||
+ !IsFinite(command.DirectionX) ||
+ !IsFinite(command.DirectionY))
+ {
+ return false;
+ }
+
+ intents.Movement = new AetheriaRuntimeDaemonMovementIntent
+ {
+ ActorEntityKey = actor,
+ DirectionX = command.DirectionX,
+ DirectionY = command.DirectionY,
+ Magnitude = command.ScalarValue
+ };
+ return true;
+ }
+
+ private static bool ApplyFireWeaponGroup(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (!TryResolveEntity(run, actor, out _, out _, out var entity) ||
+ !HasWeaponGroup(entity, command.WeaponGroup))
+ {
+ return false;
+ }
+
+ intents.WeaponGroups.Add(new AetheriaRuntimeDaemonWeaponGroupIntent
+ {
+ ActorEntityKey = actor,
+ WeaponGroup = command.WeaponGroup,
+ Fire = true,
+ Active = true
+ });
+ return true;
+ }
+
+ private static bool ApplySetWeaponGroupActive(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (!TryResolveEntity(run, actor, out _, out _, out var entity) ||
+ !HasWeaponGroup(entity, command.WeaponGroup))
+ {
+ return false;
+ }
+
+ intents.WeaponGroups.Add(new AetheriaRuntimeDaemonWeaponGroupIntent
+ {
+ ActorEntityKey = actor,
+ WeaponGroup = command.WeaponGroup,
+ Active = command.ScalarValue > 0.5
+ });
+ return true;
+ }
+
+ private static bool ApplySetBehaviorActive(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (string.IsNullOrWhiteSpace(actor) ||
+ command.EquipmentIndex < 0 ||
+ command.BehaviorIndex < 0 ||
+ !TryResolveEntity(run, actor, out _, out _, out var entity) ||
+ !HasEquipmentBehavior(entity, command.EquipmentIndex, command.BehaviorIndex))
+ {
+ return false;
+ }
+
+ intents.Behaviors.Add(new AetheriaRuntimeDaemonBehaviorIntent
+ {
+ ActorEntityKey = actor,
+ EquipmentIndex = command.EquipmentIndex,
+ BehaviorIndex = command.BehaviorIndex,
+ Active = command.ScalarValue > 0.5
+ });
+ return true;
+ }
+
+ private static bool HasWeaponGroup(AetheriaRuntimeEntitySnapshotCommit entity, int weaponGroup)
+ {
+ var weaponGroups = entity.WeaponGroups ?? Array.Empty>();
+ return weaponGroup >= 0 && weaponGroup < weaponGroups.Count;
+ }
+
+ private static bool HasEquipmentBehavior(
+ AetheriaRuntimeEntitySnapshotCommit entity,
+ int equipmentIndex,
+ int behaviorIndex)
+ {
+ return (entity.BehaviorStates ?? Array.Empty())
+ .Any(candidate =>
+ candidate != null &&
+ string.Equals(candidate.OwnerKind, "equipment", StringComparison.Ordinal) &&
+ candidate.OwnerIndex == equipmentIndex &&
+ candidate.BehaviorIndex == behaviorIndex);
+ }
+
+ private static bool IsNormalizedScalar(double value)
+ {
+ return IsFinite(value) && value >= 0.0 && value <= 1.0;
+ }
+
+ private static bool IsFinite(double value)
+ {
+ return !double.IsNaN(value) && !double.IsInfinity(value);
+ }
+
+ private static bool ApplyActivateConsumable(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (string.IsNullOrWhiteSpace(actor) || string.IsNullOrWhiteSpace(command.TextValue))
+ return false;
+
+ intents.Consumables.Add(new AetheriaRuntimeDaemonConsumableIntent
+ {
+ ActorEntityKey = actor,
+ ItemKey = command.TextValue ?? ""
+ });
+ return true;
+ }
+
+ private static bool ApplySensorPing(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ if (string.IsNullOrWhiteSpace(ResolveActorEntityKey(run, command)))
+ return false;
+
+ intents.SensorPingRequested = true;
+ return true;
+ }
+
+ private static bool ApplyDockIntent(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (string.IsNullOrWhiteSpace(actor) || string.IsNullOrWhiteSpace(command.TargetEntityKey))
+ return false;
+
+ if (!ApplyDockState(run, actor, command.TargetEntityKey))
+ return false;
+
+ intents.Docking.Add(new AetheriaRuntimeDaemonDockingIntent
+ {
+ ActorEntityKey = actor,
+ TargetEntityKey = command.TargetEntityKey ?? "",
+ Dock = true
+ });
+ return true;
+ }
+
+ private static bool ApplyUndockIntent(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (string.IsNullOrWhiteSpace(actor))
+ return false;
+
+ if (!ApplyUndockState(run, actor))
+ return false;
+
+ intents.Docking.Add(new AetheriaRuntimeDaemonDockingIntent
+ {
+ ActorEntityKey = actor,
+ Undock = true
+ });
+ return true;
+ }
+
+ private static bool ApplyDockState(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string actorEntityKey,
+ string targetEntityKey)
+ {
+ if (!TryResolveEntity(run, actorEntityKey, out var actorZoneIndex, out var actorIndex, out _) ||
+ !TryResolveEntity(run, targetEntityKey, out var targetZoneIndex, out var targetIndex, out var target))
+ {
+ return false;
+ }
+
+ if (actorZoneIndex != targetZoneIndex || actorIndex == targetIndex)
+ return false;
+
+ if (IsChildReferencedInZone(run, actorZoneIndex, actorIndex))
+ return false;
+
+ RemoveChildReferenceFromZone(run, actorZoneIndex, actorIndex);
+
+ var childIndices = (target.ChildEntityIndices ?? Array.Empty()).ToList();
+ if (!childIndices.Contains(actorIndex))
+ childIndices.Add(actorIndex);
+ target.ChildEntityIndices = childIndices.ToArray();
+
+ var assignments = (target.DockingBayAssignments ?? Array.Empty()).ToList();
+ var assigned = false;
+ for (var index = 0; index < assignments.Count; index++)
+ {
+ if (assignments[index] >= 0)
+ continue;
+
+ assignments[index] = actorIndex;
+ assigned = true;
+ break;
+ }
+
+ if (!assigned)
+ assignments.Add(actorIndex);
+ target.DockingBayAssignments = assignments.ToArray();
+ return true;
+ }
+
+ private static bool ApplyUndockState(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string actorEntityKey)
+ {
+ if (!TryResolveEntity(run, actorEntityKey, out var zoneIndex, out var actorIndex, out _))
+ return false;
+
+ return RemoveChildReferenceFromZone(run, zoneIndex, actorIndex);
+ }
+
+ private static bool IsChildReferencedInZone(
+ AetheriaRuntimeRunCheckpointCommit run,
+ int zoneIndex,
+ int childEntityIndex)
+ {
+ var zone = (run.Zones ?? Array.Empty())
+ .FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == zoneIndex);
+ if (zone == null)
+ return false;
+
+ foreach (var entity in zone.Entities ?? Array.Empty())
+ {
+ if (entity == null)
+ continue;
+
+ if ((entity.ChildEntityIndices ?? Array.Empty()).Contains(childEntityIndex))
+ return true;
+
+ if ((entity.DockingBayAssignments ?? Array.Empty()).Contains(childEntityIndex))
+ return true;
+ }
+
+ return false;
+ }
+
+ private static bool RemoveChildReferenceFromZone(
+ AetheriaRuntimeRunCheckpointCommit run,
+ int zoneIndex,
+ int childEntityIndex)
+ {
+ var zone = (run.Zones ?? Array.Empty())
+ .FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == zoneIndex);
+ if (zone == null)
+ return false;
+
+ var removed = false;
+ foreach (var entity in zone.Entities ?? Array.Empty())
+ {
+ if (entity == null)
+ continue;
+
+ var childIndices = (entity.ChildEntityIndices ?? Array.Empty()).ToList();
+ if (childIndices.RemoveAll(index => index == childEntityIndex) > 0)
+ {
+ entity.ChildEntityIndices = childIndices.ToArray();
+ removed = true;
+ }
+
+ var assignments = (entity.DockingBayAssignments ?? Array.Empty()).ToArray();
+ for (var index = 0; index < assignments.Length; index++)
+ {
+ if (assignments[index] != childEntityIndex)
+ continue;
+
+ assignments[index] = -1;
+ removed = true;
+ }
+
+ entity.DockingBayAssignments = assignments;
+ }
+
+ return removed;
+ }
+
+ private static bool ApplyEnterWormholeIntent(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (string.IsNullOrWhiteSpace(actor) || command.TargetZoneIndex < 0)
+ return false;
+
+ if (!MoveEntityToZone(run, actor, command.TargetZoneIndex, command.PositionX, command.PositionY, out var movedEntityKey))
+ return false;
+
+ intents.Wormholes.Add(new AetheriaRuntimeDaemonWormholeIntent
+ {
+ ActorEntityKey = movedEntityKey,
+ TargetZoneIndex = command.TargetZoneIndex,
+ PositionX = command.PositionX,
+ PositionY = command.PositionY
+ });
+ return true;
+ }
+
+ private static bool ApplyTowToStationIntent(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command,
+ AetheriaRuntimeDaemonIntentState intents)
+ {
+ var actor = ResolveActorEntityKey(run, command);
+ if (string.IsNullOrWhiteSpace(actor) ||
+ string.IsNullOrWhiteSpace(command.TargetEntityKey) ||
+ command.TargetZoneIndex < 0)
+ {
+ return false;
+ }
+
+ if (!MoveEntityToZone(run, actor, command.TargetZoneIndex, command.PositionX, command.PositionY, out var movedEntityKey))
+ return false;
+
+ intents.Towing.Add(new AetheriaRuntimeDaemonTowIntent
+ {
+ ActorEntityKey = movedEntityKey,
+ StationEntityKey = command.TargetEntityKey ?? "",
+ TargetZoneIndex = command.TargetZoneIndex,
+ PositionX = command.PositionX,
+ PositionY = command.PositionY
+ });
+ return true;
+ }
+
+ private static bool MoveEntityToZone(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string entityKey,
+ int targetZoneIndex,
+ double positionX,
+ double positionY,
+ out string movedEntityKey)
+ {
+ movedEntityKey = "";
+
+ if (!TryParseEntityKey(entityKey, out var sourceZoneIndex, out var sourceEntityIndex))
+ return false;
+
+ var zones = (run.Zones ?? Array.Empty()).ToList();
+ var sourceZone = zones.FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == sourceZoneIndex);
+ if (sourceZone == null)
+ return false;
+
+ var sourceEntities = (sourceZone.Entities ?? Array.Empty()).ToList();
+ if (sourceEntityIndex < 0 || sourceEntityIndex >= sourceEntities.Count)
+ return false;
+
+ var movedEntity = sourceEntities[sourceEntityIndex];
+ if (movedEntity == null)
+ return false;
+
+ if (IsChildReferencedInZone(run, sourceZoneIndex, sourceEntityIndex))
+ return false;
+
+ var movedCurrentEntity = TryParseEntityKey(run.CurrentEntityKey, out var currentZoneIndex, out var currentEntityIndex) &&
+ currentZoneIndex == sourceZoneIndex &&
+ currentEntityIndex == sourceEntityIndex;
+
+ RemoveChildReferenceFromZone(run, sourceZoneIndex, sourceEntityIndex);
+ sourceEntities.RemoveAt(sourceEntityIndex);
+ sourceZone.Entities = sourceEntities.ToArray();
+ ReindexZoneAfterEntityRemoval(sourceZone, sourceEntityIndex);
+
+ var targetZone = zones.FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == targetZoneIndex);
+ if (targetZone == null)
+ {
+ targetZone = new AetheriaRuntimeZoneSnapshotCommit
+ {
+ ZoneIndex = targetZoneIndex,
+ Entities = Array.Empty()
+ };
+ zones.Add(targetZone);
+ run.Zones = zones.ToArray();
+ }
+
+ var targetEntities = (targetZone.Entities ?? Array.Empty()).ToList();
+ var targetEntityIndex = targetEntities.Count;
+ movedEntity.EntityIndex = targetEntityIndex;
+ movedEntity.TargetEntityIndex = -1;
+ movedEntity.PositionX = positionX;
+ movedEntity.PositionZ = positionY;
+ targetEntities.Add(movedEntity);
+ targetZone.Entities = targetEntities.ToArray();
+
+ movedEntityKey = BuildEntityKey(run.RunId, targetZoneIndex, targetEntityIndex);
+ if (movedCurrentEntity)
+ {
+ run.CurrentZoneIndex = targetZoneIndex;
+ run.CurrentEntityKey = movedEntityKey;
+ }
+ else
+ {
+ ReindexCurrentEntityKeyAfterRemoval(run, sourceZoneIndex, sourceEntityIndex);
+ }
+
+ var discovered = (run.DiscoveredZoneIndices ?? Array.Empty()).ToList();
+ if (!discovered.Contains(targetZoneIndex))
+ {
+ discovered.Add(targetZoneIndex);
+ run.DiscoveredZoneIndices = discovered.ToArray();
+ }
+
+ return true;
+ }
+
+ private static bool ApplyDestroyEntity(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ if (!TryParseEntityKey(command.TargetEntityKey, out var zoneIndex, out var entityIndex))
+ return false;
+
+ var zones = (run.Zones ?? Array.Empty()).ToList();
+ var zone = zones.FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == zoneIndex);
+ if (zone == null)
+ return false;
+
+ var entities = (zone.Entities ?? Array.Empty()).ToList();
+ if (entityIndex < 0 || entityIndex >= entities.Count)
+ return false;
+
+ entities.RemoveAt(entityIndex);
+ zone.Entities = entities.ToArray();
+ ReindexZoneAfterEntityRemoval(zone, entityIndex);
+ ReindexCurrentEntityKeyAfterRemoval(run, zoneIndex, entityIndex);
+
+ return true;
+ }
+
+ private static void ReindexZoneAfterEntityRemoval(AetheriaRuntimeZoneSnapshotCommit zone, int removedEntityIndex)
+ {
+ var entities = zone.Entities ?? Array.Empty();
+ for (var index = 0; index < entities.Count; index++)
+ {
+ var entity = entities[index];
+ if (entity == null)
+ continue;
+
+ entity.EntityIndex = index;
+ entity.TargetEntityIndex = ReindexEntityReference(entity.TargetEntityIndex, removedEntityIndex);
+ entity.ChildEntityIndices = (entity.ChildEntityIndices ?? Array.Empty())
+ .Select(childIndex => ReindexEntityReference(childIndex, removedEntityIndex))
+ .Where(childIndex => childIndex >= 0)
+ .ToArray();
+ entity.DockingBayAssignments = (entity.DockingBayAssignments ?? Array.Empty())
+ .Select(childIndex => ReindexEntityReference(childIndex, removedEntityIndex))
+ .ToArray();
+ entity.Contacts = (entity.Contacts ?? Array.Empty())
+ .Select(contact =>
+ {
+ if (contact != null)
+ contact.TargetEntityIndex = ReindexEntityReference(contact.TargetEntityIndex, removedEntityIndex);
+ return contact;
+ })
+ .Where(contact => contact != null && contact.TargetEntityIndex >= 0)
+ .ToArray();
+ }
+ }
+
+ private static void ReindexCurrentEntityKeyAfterRemoval(
+ AetheriaRuntimeRunCheckpointCommit run,
+ int zoneIndex,
+ int removedEntityIndex)
+ {
+ if (!TryParseEntityKey(run.CurrentEntityKey, out var currentZoneIndex, out var currentEntityIndex) ||
+ currentZoneIndex != zoneIndex)
+ {
+ return;
+ }
+
+ var reindexedCurrent = ReindexEntityReference(currentEntityIndex, removedEntityIndex);
+ run.CurrentEntityKey = reindexedCurrent < 0
+ ? ""
+ : BuildEntityKey(run.RunId, zoneIndex, reindexedCurrent);
+ }
+
+ private static bool ApplyTargetEntity(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string entityKey,
+ Action mutate)
+ {
+ if (!TryResolveEntity(run, entityKey, out _, out _, out var entity))
+ return false;
+
+ mutate(entity);
+ return true;
+ }
+
+ private static bool TryResolveEntity(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string entityKey,
+ out int zoneIndex,
+ out int entityIndex,
+ out AetheriaRuntimeEntitySnapshotCommit entity)
+ {
+ entity = null!;
+ zoneIndex = -1;
+ entityIndex = -1;
+
+ if (!TryParseEntityKey(entityKey, out zoneIndex, out entityIndex))
+ return false;
+
+ var parsedZoneIndex = zoneIndex;
+ var zone = (run.Zones ?? Array.Empty())
+ .FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == parsedZoneIndex);
+ var entities = zone?.Entities ?? Array.Empty();
+ if (entityIndex < 0 || entityIndex >= entities.Count)
+ return false;
+
+ entity = entities[entityIndex];
+ return entity != null;
+ }
+
+ private static int ReindexEntityReference(int referencedEntityIndex, int removedEntityIndex)
+ {
+ if (referencedEntityIndex < 0)
+ return referencedEntityIndex;
+
+ if (referencedEntityIndex == removedEntityIndex)
+ return -1;
+
+ return referencedEntityIndex > removedEntityIndex
+ ? referencedEntityIndex - 1
+ : referencedEntityIndex;
+ }
+
+ private static string BuildEntityKey(string runId, int zoneIndex, int entityIndex)
+ {
+ var normalizedRunId = string.IsNullOrWhiteSpace(runId) ? "local" : runId;
+ return $"global:aetheria.run_state.{normalizedRunId}.zone.{zoneIndex}.entity.{entityIndex}.v1";
+ }
+
+ private static string ResolveActorEntityKey(
+ AetheriaRuntimeRunCheckpointCommit run,
+ AetheriaRuntimeDaemonCommandDocument command)
+ {
+ return string.IsNullOrWhiteSpace(command.ActorEntityKey)
+ ? run.CurrentEntityKey ?? ""
+ : command.ActorEntityKey ?? "";
+ }
+
+ private static bool TryResolveCargoBay(
+ AetheriaRuntimeRunCheckpointCommit run,
+ string entityKey,
+ int cargoIndex,
+ out AetheriaRuntimeEntitySnapshotCommit entity,
+ out int resolvedCargoIndex,
+ out AetheriaRuntimeCargoBayLoadoutCommit cargo)
+ {
+ entity = null!;
+ cargo = null!;
+ resolvedCargoIndex = -1;
+
+ if (!TryResolveEntity(run, entityKey, out _, out _, out entity))
+ return false;
+
+ var cargoContents = entity.CargoContents ?? Array.Empty();
+ if (cargoIndex < 0 || cargoIndex >= cargoContents.Count)
+ return false;
+
+ cargo = cargoContents[cargoIndex];
+ if (cargo == null)
+ return false;
+
+ resolvedCargoIndex = cargoIndex;
+ return true;
+ }
+
+ private static bool TryRemoveCargoItem(
+ AetheriaRuntimeEntitySnapshotCommit entity,
+ int cargoIndex,
+ string itemKey,
+ int x,
+ int y,
+ out AetheriaRuntimeLoadoutItemSlotCommit slot)
+ {
+ slot = null!;
+ var cargoContents = (entity.CargoContents ?? Array.Empty()).ToArray();
+ if (cargoIndex < 0 || cargoIndex >= cargoContents.Length || cargoContents[cargoIndex] == null)
+ return false;
+
+ var items = (cargoContents[cargoIndex].Items ?? Array.Empty()).ToList();
+ var itemIndex = items.FindIndex(candidate => IsCargoSlotMatch(candidate, itemKey, x, y));
+ if (itemIndex < 0)
+ return false;
+
+ slot = items[itemIndex];
+ items.RemoveAt(itemIndex);
+ cargoContents[cargoIndex] = new AetheriaRuntimeCargoBayLoadoutCommit
+ {
+ Items = items.ToArray()
+ };
+ entity.CargoContents = cargoContents;
+ return true;
+ }
+
+ private static bool TryRemoveCargoItemQuantity(
+ AetheriaRuntimeEntitySnapshotCommit entity,
+ int cargoIndex,
+ string itemKey,
+ int x,
+ int y,
+ int quantity,
+ out AetheriaRuntimeLoadoutItemSlotCommit slot)
+ {
+ slot = null!;
+ var cargoContents = (entity.CargoContents ?? Array.Empty()).ToArray();
+ if (cargoIndex < 0 || cargoIndex >= cargoContents.Length || cargoContents[cargoIndex] == null)
+ return false;
+
+ var items = (cargoContents[cargoIndex].Items ?? Array.Empty()).ToList();
+ var itemIndex = items.FindIndex(candidate => IsCargoSlotMatch(candidate, itemKey, x, y));
+ if (itemIndex < 0)
+ return false;
+
+ var source = items[itemIndex];
+ var sourceQuantity = Math.Max(1, source.Item?.Quantity ?? 1);
+ if (quantity <= 0 || quantity > sourceQuantity)
+ return false;
+
+ slot = CloneSlot(source);
+ slot.Item.Quantity = quantity;
+ if (quantity == sourceQuantity)
+ {
+ items.RemoveAt(itemIndex);
+ }
+ else
+ {
+ source.Item.Quantity = sourceQuantity - quantity;
+ }
+
+ cargoContents[cargoIndex] = new AetheriaRuntimeCargoBayLoadoutCommit
+ {
+ Items = items.ToArray()
+ };
+ entity.CargoContents = cargoContents;
+ return true;
+ }
+
+ private static void AddCargoItem(
+ AetheriaRuntimeEntitySnapshotCommit entity,
+ int cargoIndex,
+ AetheriaRuntimeLoadoutItemSlotCommit slot)
+ {
+ var cargoContents = EnsureCargoContents(entity, cargoIndex + 1);
+ var cargo = cargoContents[cargoIndex] ?? new AetheriaRuntimeCargoBayLoadoutCommit();
+ cargoContents[cargoIndex] = new AetheriaRuntimeCargoBayLoadoutCommit
+ {
+ Items = (cargo.Items ?? Array.Empty