From 35c4195dacb4cbfad28f31090d1f0d06919dab96 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 16:20:02 +0100 Subject: [PATCH] Persist defensive behavior state in typed snapshots --- .voidbot/state/aetheria.cc | Bin 85577 -> 85681 bytes Aetheria.State.Smoke/Program.cs | 34 ++++++++++++++- Aetheria.State.Unity.Smoke/Program.cs | 39 +++++++++++++++++- .../AetheriaRuntimeCommitLogApplier.cs | 6 ++- .../AetheriaRuntimeStateDocuments.cs | 12 ++++++ Assets/Scripts/Gameplay/ActionGameManager.cs | 22 ++++++++++ .../Runtime/AetheriaRuntimeCatalogSnapshot.cs | 14 ++++++- .../Runtime/AetheriaRuntimeCatalogStore.cs | 12 +++++- .../AetheriaRuntimeStateCommitDocument.cs | 12 ++++++ docs/aetheria-perfect-machine-map.md | 6 ++- 10 files changed, 149 insertions(+), 8 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 9dedb5f8ac69329554fe0ba86b2e75e8350c6744..bbb302b0881e79e22a6f0cc574d909d0bfaf8b03 100644 GIT binary patch delta 695 zcma))!D|yi6vlZ?sun@;AYxC`62#iZO=H_6YPw14u}V-8DS}LQUv@_~JHza3Bq)js zp7bCA-$k!_sbIbIDuM^WzrcfDy$X8q%c{G#Xn#n`8GBwN5_^1Uhy4b-m z5Z_ z(14r`jm$`9`U+jPjy|b#unFI3x(=;LjBv=LqQAPZLL?LErBS-Hs9!B5LWBqoxJ}xLUD};BGg}gF5+@EK@*Fth zR*8fg7Y8>72mS*8fRjXGb$3(5ZQeIC-_Q5GH&kEd0|^NL{iKv%3Y)|Xg0gr=j1 zihWN=be9BPx$O%*C7~ujpl&xDxCsX!(bv#MnbMgsXou2;Efo{EGYHG!iAAp@)TBAS zN-V)GJ0}fp5~-+S#N?YqrxF{7AT;&*Id7XJqqEGq#SK$QLM@A#SyHyyG9)of%T^J> z3N&Xs9$Df-BM!tlbFpFLk={f~C;>oZxFL grid.Name == "temperature" && grid.Values.Length == 2 && grid.Values[1] == 281.0) && @@ -738,7 +770,7 @@ try packageEntities[0].WeaponStates[2].AmmoIntervalProgress != 0.6 || packageEntities[0].WeaponStates[3].LockProgress != 0.65 || packageEntities[0].WeaponStates[3].LockTargetEntityKey != "global:aetheria.run_state.smoke-run.zone.0.entity.0.v1" || - packageEntities[0].BehaviorStates.Count != 8 || + packageEntities[0].BehaviorStates.Count != 11 || packageEntities[0].BehaviorStates[3].CapacitorCharge != 7.5 || packageEntities[0].BehaviorStates[4].AetherDriveRpmY != 900.0 || packageEntities[0].BehaviorStates[4].AetherDriveMaximumRpm != 2400.0 || @@ -748,6 +780,9 @@ try packageEntities[0].BehaviorStates[6].MiningToolRange != 275.0 || packageEntities[0].BehaviorStates[7].ThrusterAxis != 0.8 || packageEntities[0].BehaviorStates[7].ThrusterThrust != 125.0 || + packageEntities[0].BehaviorStates[8].ShieldEfficiency != 0.7 || + packageEntities[0].BehaviorStates[9].VelocityLimit != 42.0 || + packageEntities[0].BehaviorStates[10].ThermotoggleTargetTemperature != 315.5 || packageEntities[0].StatGrids.Count != 2 || packageEntities[0].StatGrids.All(grid => grid.Name != "temperature" || grid.Values.Count != 2 || grid.Values[1] != 281.0)) { diff --git a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs index f1eef0479..3615bb0b0 100644 --- a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs +++ b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs @@ -510,7 +510,11 @@ public static class AetheriaRuntimeCommitLogApplier MiningToolRange = state.MiningToolRange, ThrusterAxis = state.ThrusterAxis, ThrusterThrust = state.ThrusterThrust, - ThrusterTorque = state.ThrusterTorque + ThrusterTorque = state.ThrusterTorque, + ShieldEfficiency = state.ShieldEfficiency, + ShieldEnergyUsage = state.ShieldEnergyUsage, + VelocityLimit = state.VelocityLimit, + ThermotoggleTargetTemperature = state.ThermotoggleTargetTemperature }) .ToArray(); } diff --git a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs index 8714e05cf..1dcb1b008 100644 --- a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs +++ b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs @@ -775,6 +775,18 @@ public sealed class AetheriaBehaviorStateSnapshot [Key(42)] public double ThrusterTorque { get; set; } + + [Key(43)] + public double ShieldEfficiency { get; set; } + + [Key(44)] + public double ShieldEnergyUsage { get; set; } + + [Key(45)] + public double VelocityLimit { get; set; } + + [Key(46)] + public double ThermotoggleTargetTemperature { get; set; } } [MessagePackObject] diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 3a50a9b94..a240c71be 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -936,6 +936,28 @@ public class ActionGameManager : MonoBehaviour 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 + }; + } if (state == null) continue; diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs index cbff4d1f2..8dc6c495a 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs @@ -1110,7 +1110,11 @@ namespace GameCult.Aetheria.State.Unity double miningToolRange, double thrusterAxis, double thrusterThrust, - double thrusterTorque) + double thrusterTorque, + double shieldEfficiency, + double shieldEnergyUsage, + double velocityLimit, + double thermotoggleTargetTemperature) { OwnerKind = ownerKind; OwnerIndex = ownerIndex; @@ -1155,6 +1159,10 @@ namespace GameCult.Aetheria.State.Unity ThrusterAxis = thrusterAxis; ThrusterThrust = thrusterThrust; ThrusterTorque = thrusterTorque; + ShieldEfficiency = shieldEfficiency; + ShieldEnergyUsage = shieldEnergyUsage; + VelocityLimit = velocityLimit; + ThermotoggleTargetTemperature = thermotoggleTargetTemperature; } public string OwnerKind { get; } @@ -1200,5 +1208,9 @@ namespace GameCult.Aetheria.State.Unity public double ThrusterAxis { get; } public double ThrusterThrust { get; } public double ThrusterTorque { get; } + public double ShieldEfficiency { get; } + public double ShieldEnergyUsage { get; } + public double VelocityLimit { get; } + public double ThermotoggleTargetTemperature { get; } } } diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index 80687e8f2..46eaee748 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -900,7 +900,11 @@ namespace GameCult.Aetheria.State.Unity var thrusterAxis = ReadFieldDouble(ref reader, behaviorFields, 40); var thrusterThrust = ReadFieldDouble(ref reader, behaviorFields, 41); var thrusterTorque = ReadFieldDouble(ref reader, behaviorFields, 42); - SkipRemaining(ref reader, behaviorFields, 43); + var shieldEfficiency = ReadFieldDouble(ref reader, behaviorFields, 43); + var shieldEnergyUsage = ReadFieldDouble(ref reader, behaviorFields, 44); + var velocityLimit = ReadFieldDouble(ref reader, behaviorFields, 45); + var thermotoggleTargetTemperature = ReadFieldDouble(ref reader, behaviorFields, 46); + SkipRemaining(ref reader, behaviorFields, 47); behaviorStates[behavior] = new AetheriaRuntimeBehaviorStateSnapshot( ownerKind, ownerIndex, @@ -944,7 +948,11 @@ namespace GameCult.Aetheria.State.Unity miningToolRange, thrusterAxis, thrusterThrust, - thrusterTorque); + thrusterTorque, + shieldEfficiency, + shieldEnergyUsage, + velocityLimit, + thermotoggleTargetTemperature); } return behaviorStates; diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs index da1a6fbe0..a290b4cbc 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs @@ -824,5 +824,17 @@ namespace GameCult.Aetheria.State.Unity [Key(42)] public double ThrusterTorque { get; set; } + + [Key(43)] + public double ShieldEfficiency { get; set; } + + [Key(44)] + public double ShieldEnergyUsage { get; set; } + + [Key(45)] + public double VelocityLimit { get; set; } + + [Key(46)] + public double ThermotoggleTargetTemperature { get; set; } } } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 245a3daf7..b212a27dc 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -175,7 +175,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. publish target body id, asteroid index, scan timer, range, minimum density, and scan duration rows. Mining tools publish asteroid belt id, asteroid index, and evaluated range rows. Thrusters publish analog axis input, - evaluated thrust, and torque rows. + evaluated thrust, and torque rows. Shields publish evaluated efficiency and + energy usage, velocity limiters publish evaluated limit, and thermotoggles + publish their active target temperature. `RuntimeEntityBlueprint` still exists for construction/loadout projection, but those live hull grids and session scalars are not blueprint fields and cannot be restored by the old blueprint projector path. @@ -818,6 +820,8 @@ First Aetheria surfaces to publish: snapshot/readback state. - Done: extend behavior state rows for Thruster axis, thrust, and torque, so analog propulsion state is typed snapshot/readback state. + - Done: extend behavior state rows for Shield efficiency/energy usage, + VelocityLimit limit, and Thermotoggle target temperature. - Done: cut live simulation grids out of `RuntimeEntityBlueprint`; loadout and construction templates no longer capture or restore temperature, armor, max-armor, or hull-conductivity state.