diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 5159143ab..67aa294f6 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Aetheria.State.Smoke/Program.cs b/Aetheria.State.Smoke/Program.cs index df5861624..8c15f0443 100644 --- a/Aetheria.State.Smoke/Program.cs +++ b/Aetheria.State.Smoke/Program.cs @@ -186,7 +186,8 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s ItemKey = AetheriaCatalogKeys.ItemDefinitionFromLegacyId(itemLegacyId).ToString(), Quality = 0.95, Durability = 0.8, - Enabled = false + Enabled = false, + OverrideShutdown = true } } ], @@ -211,7 +212,8 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s Quality = 0.9, Durability = 0.8, Quantity = 1, - Enabled = false + Enabled = false, + OverrideShutdown = true } ], CargoContents = @@ -612,6 +614,7 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether if (loadout?.RootEntity.Hull.ItemKey != AetheriaCatalogKeys.ItemDefinitionFromLegacyId(itemLegacyId).ToString() || loadout.RootEntity.Equipment.Length != 1 || loadout.RootEntity.Equipment[0].Item.Enabled || + !loadout.RootEntity.Equipment[0].Item.OverrideShutdown || loadout.RootEntity.WeaponGroups.Length != 1) { throw new InvalidOperationException("Loadout template did not survive flush/reopen."); @@ -650,6 +653,7 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether entitySnapshot.Equipment[0].Durability != 0.8 || entitySnapshot.Equipment[0].Quantity != 1 || entitySnapshot.Equipment[0].Enabled || + !entitySnapshot.Equipment[0].OverrideShutdown || entitySnapshot.CargoContents.Length != 1 || entitySnapshot.CargoContents[0].Items[0].Item.Quantity != 7 || entitySnapshot.DockingBayAssignments.Length != 1 || diff --git a/Aetheria.State.Unity.Smoke/Program.cs b/Aetheria.State.Unity.Smoke/Program.cs index 54a107044..b37c78f23 100644 --- a/Aetheria.State.Unity.Smoke/Program.cs +++ b/Aetheria.State.Unity.Smoke/Program.cs @@ -202,7 +202,8 @@ try ItemKey = "aetheria.item_definition:legacy:smoke:weapon", Quality = 0.9, Durability = 0.8, - Enabled = false + Enabled = false, + OverrideShutdown = true } } }, @@ -363,7 +364,8 @@ try ItemKey = "aetheria.item_definition:legacy:smoke:weapon", Quality = 0.9, Durability = 0.8, - Enabled = false + Enabled = false, + OverrideShutdown = true } } }, @@ -690,6 +692,7 @@ try loadout.RootEntity.Equipment.Length == 1 && loadout.RootEntity.Equipment[0].Position.X == 1 && !loadout.RootEntity.Equipment[0].Item.Enabled && + loadout.RootEntity.Equipment[0].Item.OverrideShutdown && loadout.RootEntity.CargoContents.Length == 1 && loadout.RootEntity.CargoContents[0].Items[0].Item.Quantity == 5 && run?.ZoneKeys.Length == 1 && @@ -730,6 +733,7 @@ try entity.Equipment[0].Durability == 0.8 && entity.Equipment[0].Quantity == 1 && !entity.Equipment[0].Enabled && + entity.Equipment[0].OverrideShutdown && entity.Velocity.X == 4.0 && entity.Velocity.Y == -2.0 && entity.TargetEntityKey == "global:aetheria.run_state.smoke-run.zone.0.entity.0.v1" && @@ -846,6 +850,7 @@ try packageLoadouts[0].RootEntity.FactionKey != "aetheria.corporation:legacy:smoke:faction" || packageLoadouts[0].RootEntity.Equipment[0].X != 1 || packageLoadouts[0].RootEntity.Equipment[0].Item.Enabled || + !packageLoadouts[0].RootEntity.Equipment[0].Item.OverrideShutdown || packageLoadouts[0].RootEntity.CargoContents[0].Items[0].Item.Quantity != 5 || packageRuns.Count != 1 || packageRuns[0].RunId != "smoke-run" || @@ -877,6 +882,7 @@ try packageEntities[0].Equipment[0].Durability != 0.8 || packageEntities[0].Equipment[0].Quantity != 1 || packageEntities[0].Equipment[0].Enabled || + !packageEntities[0].Equipment[0].OverrideShutdown || packageEntities[0].VelocityX != 4.0 || packageEntities[0].VelocityY != -2.0 || packageEntities[0].TargetEntityKey != "global:aetheria.run_state.smoke-run.zone.0.entity.0.v1" || diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 6ee127843..b48dc8668 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -14,6 +14,7 @@ RequireNoRendererLocalConsole(root); RequireNoRendererLocalDebugPanels(root); RequireMainMenuSettingsCommit(root); RequirePropertiesPanelReadOnlyInspector(root); +RequireRuntimeSimulationTuningCommits(root); await using var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-state-verify"); @@ -457,6 +458,7 @@ Console.WriteLine("Renderer-local console authority: deleted; UI commands flow t Console.WriteLine("Renderer-local debug panels: obsolete uGUI field tester authority is deleted"); Console.WriteLine("Main-menu settings authority: gameplay and graphics settings return through typed player-settings commits"); Console.WriteLine("PropertiesPanel inspector authority: reflection inspection is read-only display"); +Console.WriteLine("Runtime simulation tuning authority: UI writes flow through gameplay checkpoint commits"); static void RequireCount(AetheriaMigrationLedger ledger, string documentType, int actual) { @@ -749,6 +751,57 @@ static void RequirePropertiesPanelReadOnlyInspector(string root) } } +static void RequireRuntimeSimulationTuningCommits(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[] + { + "CommitEntityOverrideShutdown", + "CommitEquippedItemOverrideShutdown", + "CommitThermotoggleTargetTemperature", + "CommitEntityShutdownPerformance" + }; + + var missingMethods = requiredCommitMethods + .Where(method => !actionGameManager.Contains(method, StringComparison.Ordinal)) + .ToArray(); + + if (missingMethods.Length > 0) + { + throw new InvalidOperationException( + "Runtime simulation tuning commit methods are missing from ActionGameManager: " + + string.Join(", ", missingMethods)); + } + + var forbiddenUiWrites = new[] + { + "EquippableItem.OverrideShutdown =", + "thermotoggle.TargetTemperature =", + "Settings.ShutdownPerformance =", + "CurrentEntity.OverrideShutdown =" + }; + + var uiRoot = Path.Combine(root, "Assets", "Scripts", "UI"); + var hits = Directory.EnumerateFiles(uiRoot, "*.cs", SearchOption.AllDirectories) + .SelectMany(path => File.ReadLines(path) + .Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line })) + .Where(line => forbiddenUiWrites.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal))) + .Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}") + .Take(10) + .ToArray(); + + if (hits.Length > 0) + { + throw new InvalidOperationException( + "Runtime simulation tuning still has renderer-local UI write authority: " + + string.Join("; ", hits)); + } +} + static string ExtractMethodBody(string source, string methodName) { var signature = "private void " + methodName + "()"; diff --git a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs index a9b786b7b..b6b76d678 100644 --- a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs +++ b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs @@ -168,7 +168,8 @@ public static class AetheriaRuntimeCommitLogApplier Quality = item.Quality, Durability = item.Durability, Quantity = item.Quantity, - Enabled = item.Enabled + Enabled = item.Enabled, + OverrideShutdown = item.OverrideShutdown }; } @@ -206,7 +207,8 @@ public static class AetheriaRuntimeCommitLogApplier Quality = item.Quality, Durability = item.Durability, Quantity = item.Quantity, - Enabled = item.Enabled + Enabled = item.Enabled, + OverrideShutdown = item.OverrideShutdown }; }) .ToArray(); diff --git a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs index 6096bad4e..a44effa48 100644 --- a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs +++ b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs @@ -171,6 +171,9 @@ public sealed class AetheriaLoadoutItem [Key(4)] public bool Enabled { get; set; } = true; + + [Key(5)] + public bool OverrideShutdown { get; set; } } [MessagePackObject] @@ -574,6 +577,9 @@ public sealed class AetheriaEntityItemSlot [Key(5)] public bool Enabled { get; set; } = true; + + [Key(6)] + public bool OverrideShutdown { get; set; } } [MessagePackObject] diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 40863b8bc..5e61c3048 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -526,7 +526,8 @@ public class ActionGameManager : MonoBehaviour Quality = item is CraftedItemInstance crafted ? crafted.Quality : 1.0, Durability = item is EquippableItem equippable ? equippable.Durability : 1.0, Quantity = item is SimpleCommodity commodity ? commodity.Quantity : 1, - Enabled = true + Enabled = true, + OverrideShutdown = item is EquippableItem overrideable && overrideable.OverrideShutdown }; } @@ -1349,7 +1350,8 @@ public class ActionGameManager : MonoBehaviour item.Quality, item.Durability, item.Quantity, - item.Enabled); + item.Enabled, + item.OverrideShutdown); } private static IReadOnlyList CreateRuntimeLoadoutItemSlotSnapshots( @@ -1404,6 +1406,42 @@ public class ActionGameManager : MonoBehaviour } } + public void CommitEntityOverrideShutdown(Entity entity, bool enabled) + { + if (entity == null) + return; + + entity.OverrideShutdown = enabled; + QueueRunCheckpoint("entity-override-shutdown"); + } + + public void CommitEquippedItemOverrideShutdown(EquippedItem item, bool enabled) + { + if (item?.EquippableItem == null) + return; + + item.EquippableItem.OverrideShutdown = enabled; + QueueRunCheckpoint("item-override-shutdown"); + } + + public void CommitThermotoggleTargetTemperature(Thermotoggle thermotoggle, float targetTemperature) + { + if (thermotoggle == null) + return; + + thermotoggle.TargetTemperature = targetTemperature; + QueueRunCheckpoint("thermotoggle-target-temperature"); + } + + public void CommitEntityShutdownPerformance(Entity entity, float shutdownPerformance) + { + if (entity?.Settings == null) + return; + + entity.Settings.ShutdownPerformance = shutdownPerformance; + QueueRunCheckpoint("entity-shutdown-performance"); + } + private void OnDisable() { Input.Dispose(); @@ -1515,7 +1553,8 @@ public class ActionGameManager : MonoBehaviour Input.Player.OverrideShutdown.performed += context => { - CurrentEntity.OverrideShutdown = !CurrentEntity.OverrideShutdown; + if (CurrentEntity != null) + CommitEntityOverrideShutdown(CurrentEntity, !CurrentEntity.OverrideShutdown); }; Input.Player.Ping.performed += context => diff --git a/Assets/Scripts/UI/Menu/InventoryMenu.cs b/Assets/Scripts/UI/Menu/InventoryMenu.cs index 7c023dcc4..18d1c1022 100644 --- a/Assets/Scripts/UI/Menu/InventoryMenu.cs +++ b/Assets/Scripts/UI/Menu/InventoryMenu.cs @@ -163,7 +163,7 @@ public class InventoryMenu : MonoBehaviour PropertiesPanel.Clear(); PropertiesPanel.AddField("Shutdown Threshold", () => GameManager.CurrentEntity.Settings.ShutdownPerformance, - f => GameManager.CurrentEntity.Settings.ShutdownPerformance = f, + f => GameManager.CommitEntityShutdownPerformance(GameManager.CurrentEntity, f), 0, 1); }); diff --git a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs index 698c5d121..7cd3c39cb 100644 --- a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs +++ b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs @@ -622,7 +622,9 @@ public class PropertiesPanel : MonoBehaviour AddEquippableItemProperties(item.EquippableItem, item.Evaluate); AddSpacer(); - AddField("Override Shutdown", () => item.EquippableItem.OverrideShutdown, b => item.EquippableItem.OverrideShutdown = b); + AddField("Override Shutdown", + () => item.EquippableItem.OverrideShutdown, + b => ActionGameManager.Instance?.CommitEquippedItemOverrideShutdown(item, b)); foreach (var behavior in item.Behaviors) { @@ -631,7 +633,7 @@ public class PropertiesPanel : MonoBehaviour case Thermotoggle thermotoggle when thermotoggle.Adjustable: AddField("Target Temperature", () => thermotoggle.TargetTemperature, - temp => thermotoggle.TargetTemperature = temp); + temp => ActionGameManager.Instance?.CommitThermotoggleTargetTemperature(thermotoggle, temp)); break; } } diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs index 62f92bda6..b84ee4b51 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs @@ -685,13 +685,14 @@ namespace GameCult.Aetheria.State.Unity public sealed class AetheriaRuntimeLoadoutItemSnapshot { - public AetheriaRuntimeLoadoutItemSnapshot(string itemKey, double quality, double durability, int quantity, bool enabled) + public AetheriaRuntimeLoadoutItemSnapshot(string itemKey, double quality, double durability, int quantity, bool enabled, bool overrideShutdown) { ItemKey = itemKey; Quality = quality; Durability = durability; Quantity = quantity; Enabled = enabled; + OverrideShutdown = overrideShutdown; } public string ItemKey { get; } @@ -699,6 +700,7 @@ namespace GameCult.Aetheria.State.Unity public double Durability { get; } public int Quantity { get; } public bool Enabled { get; } + public bool OverrideShutdown { get; } } public sealed class AetheriaRuntimeLoadoutItemSlotSnapshot @@ -1024,7 +1026,7 @@ namespace GameCult.Aetheria.State.Unity public sealed class AetheriaRuntimeEntityItemSlotSnapshot { - public AetheriaRuntimeEntityItemSlotSnapshot(int x, int y, string itemKey, double quality, double durability, int quantity, bool enabled) + public AetheriaRuntimeEntityItemSlotSnapshot(int x, int y, string itemKey, double quality, double durability, int quantity, bool enabled, bool overrideShutdown) { X = x; Y = y; @@ -1033,6 +1035,7 @@ namespace GameCult.Aetheria.State.Unity Durability = durability; Quantity = quantity; Enabled = enabled; + OverrideShutdown = overrideShutdown; } public int X { get; } @@ -1042,6 +1045,7 @@ namespace GameCult.Aetheria.State.Unity public double Durability { get; } public int Quantity { get; } public bool Enabled { get; } + public bool OverrideShutdown { get; } } public sealed class AetheriaRuntimeEntityStatGridSnapshot diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index 85bd0e07e..060a318eb 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -770,7 +770,8 @@ namespace GameCult.Aetheria.State.Unity var durability = ReadFieldDouble(ref reader, slotFields, 3, 1); var quantity = ReadFieldInt32(ref reader, slotFields, 4); var enabled = ReadFieldBool(ref reader, slotFields, 5, true); - SkipRemaining(ref reader, slotFields, 6); + var overrideShutdown = ReadFieldBool(ref reader, slotFields, 6); + SkipRemaining(ref reader, slotFields, 7); slots[slot] = new AetheriaRuntimeEntityItemSlotSnapshot( position.X, position.Y, @@ -778,7 +779,8 @@ namespace GameCult.Aetheria.State.Unity quality, durability, quantity <= 0 ? 1 : quantity, - enabled); + enabled, + overrideShutdown); } return slots; @@ -1228,13 +1230,14 @@ namespace GameCult.Aetheria.State.Unity var durability = ReadFieldDouble(ref reader, itemFields, 2, 1); var quantity = ReadFieldInt32(ref reader, itemFields, 3); var enabled = ReadFieldBool(ref reader, itemFields, 4, true); - SkipRemaining(ref reader, itemFields, 5); - return new AetheriaRuntimeLoadoutItemSnapshot(itemKey, quality, durability, quantity, enabled); + var overrideShutdown = ReadFieldBool(ref reader, itemFields, 5); + SkipRemaining(ref reader, itemFields, 6); + return new AetheriaRuntimeLoadoutItemSnapshot(itemKey, quality, durability, quantity, enabled, overrideShutdown); } private static AetheriaRuntimeLoadoutItemSnapshot EmptyLoadoutItem() { - return new AetheriaRuntimeLoadoutItemSnapshot("", 1, 1, 1, true); + return new AetheriaRuntimeLoadoutItemSnapshot("", 1, 1, 1, true, false); } private static IReadOnlyList ReadFieldLoadoutItemSlots(ref MessagePackReader reader, int fields, int index) diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs index 5dab5e8c3..7a3a51092 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs @@ -190,6 +190,9 @@ namespace GameCult.Aetheria.State.Unity [Key(5)] public string ItemKey { get; set; } = ""; + + [Key(6)] + public bool OverrideShutdown { get; set; } } [MessagePackObject] diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 239cae149..905714360 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -1368,6 +1368,13 @@ First Aetheria surfaces to publish: inspector can still project object fields for display, but `readWrite` mode and `FieldInfo.SetValue` mutation are gone; renderer-local object edits must become provider-owned typed commands or local simulation code. + - Done: route runtime simulation tuning controls through gameplay-owned + checkpoint commits. UI fields for entity override shutdown, per-item + override shutdown, thermotoggle target temperature, and entity shutdown + performance now call `ActionGameManager` commit methods instead of writing + simulation objects directly. The item override-shutdown bit is part of the + typed loadout/entity item-slot state so the checkpoint spine can see what + the simulation sees. - Replace the next concrete uGUI screen with an Eve-owned surface. - Move the staged packages into the Eve repo once its worktree is clean, then import them back into Aetheria from Eve instead of carrying a local copy. @@ -1681,7 +1688,10 @@ exist; the next cuts should remove remaining live predicates that still need legacy DTO vocabulary, keep package-level MessagePack/JSON at explicit boundaries, and replace runtime/operator UI truth with Eve surfaces. The old `PropertiesPanel` reflection inspector is display-only; do not restore writable -inspection as a shortcut around typed command/state ownership. Any +inspection as a shortcut around typed command/state ownership. Runtime simulation +tuning controls may remain temporarily on uGUI only when they delegate to +gameplay-owned commit methods that queue typed checkpoint state; direct UI +mutation of entity/item/behavior settings is obsolete authority. Any predicate that still needs legacy DTO objects must earn that dependency by using behavior objects or simulation-only methods that typed facets do not yet expose.