From 2a047cba28eae60f2fd54337dfa451e351e9cacd Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 07:01:50 +0100 Subject: [PATCH] Restore Continue session facts from typed state --- .voidbot/state/aetheria.cc | Bin 148366 -> 148554 bytes Aetheria.State.Verify/Program.cs | 24 +++++++++++++++++ Aetheria.State/README.md | 8 +++--- Assets/Scripts/Gameplay/ActionGameManager.cs | 27 +++++++++++++++++++ Assets/Scripts/ServerShared/Entity.cs | 25 +++++++++++++++-- docs/aetheria-perfect-machine-map.md | 14 +++++----- 6 files changed, 86 insertions(+), 12 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 921f5fd50734fa5ba7bf3ea87c73ab84b33bf3df..bceb553d22e1d9ce9157b1f1b41a007f23830a06 100644 GIT binary patch delta 1814 zcmb7F-)kII6lSJ*XbOTT@dsLZY$!C6+3dz-H>p3GSc9Zkt2G8Gwe8)RGdq`^xp#W+ zovbTJkO(aZimWhyfT$=w*as;JRYZIdAAC)o{1*g$)-ykDHkBawurPb>ne(0Vo$tHz z!Oh8EZcTpunR|3``OJK~v9vJyHd5tN4fp!? zjdS%IP(=}h8~~NkS%MnOFvS4sVo(-?P%0oe@H3@Q7@!|FLkcOG^&+?j3)ZT`RPlrx zzJ^c2a-|&VMFR}zLFu{7LY!BMj_UhUZGNZZZ=Wn*$6La`hDs`rC7MKWt z2Bf-m%d8tCaD&NQF)tOA13h}@&*R%HH1xO3Wrm1p*v^O&8k5FJGE<)H4|1ub2{(w@ zgvDz$Xo*=L6%%YBF-T+;$g?nrI5jYitWzs%VTjwlA#fj4V>zw+D={kE0XLD%h|dCv ziyko5P|fX&MW+ ziP|(~!v<76AEe7>0vE)QV6mR1GQzuOzZ@xQnChXKBXt;J5(ZpRo3r54(7{|F{XS`B zOmVdy+WZzXS8%@}>XjM-fu*ogriy=+&a4DeW+F}PXoD;O8A3Of#1T<)Pu`flIjwM`s1BX6o$K}@>hR#PUaVn zIggw@TU(Nn&vW8H}gwhhmMWGYB*|Dbc`|mna`CqR&SMuif&Qx=E?iKP=A=v6>2!i6hx=#yu zKsEX5niJ(0A9Ei%efqFBw=6NejHy5|9_#$kZ=72zD^>Q>WMZXFfk4$$sZ49a6@t2(^M}MDxrUZZE*&2KhVNs|k$6_ha&H;s^;uvE% zm&N8K-i5kiO#W4Dn^_oZ~i z)BJqLJw?Z9$31DkNS#jcMapk?+#l-Da%^IKMkL zb9rvY+n<{uKhD)&VqhXrocVzihKmgRAX5s2@$t*ez&C>wLSGwZz}G1k_GFb@dim;l z=}v|0Qw7>c{Gk|&miK8IvjHetgrRLEll<7lyYl(TAzlik3aMhQ06b!X>Xh{b7ahtd zCR7IPQlVo!a7HO;3v?>GKsD=u-{vtsxx%X71~KEwZLhb%xYz)Zp>sT-8e#}cQC5t8 z+R(fmsxnX5^s0A!DEmUwNi!`e%_=7BfB-BE@`^hwX4`}54zTVF>jelaG?pyP9bHu+ z-H`&Ev5(btkN<6@){20lIpkxVa#qPeA2_S_c z*5gw72v3jMpC2GI_W5~o>P;M|;pkA3xd0=twBXG6B05Y#tsp_t(M+_t;5vfPKDFyT zO#b-YesqRBGb}EbLo9mDx#1W+5d~~>jq2;cmI>BbW+O z#?=Iy>i0|pkyK4+>n}$aFTT-iu8;NZBtiog$C@?^*{>H1qhQSIsPiqiGMcClN2eCj zsZ^ko1STu6uwS3>KCpMLc@Hks-W9lMu;HMKRgX7@7A)0~MERyT5>QClX1+4shC$Wd z{mrY5j(&CYz4wdDI&ph}X>@cqrb9Vpwa|oc25}aai>i>>)O;o)8?k?0877-beu$K$ z2}@~MOek|B*2t?QjltZ*^>W=!a4Kn3%(&o4K5|F>G3D>&QS~~`H*~{ss9)LrM%hpP z^j@%kEt6xG{@~qbFTLnJXU{!B9$j18bd910+HOU !entitySource.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + + if (missingEntityRestoreSymbols.Length > 0) + { + throw new InvalidOperationException( + "Entity no longer exposes narrow runtime-owned restore primitives for typed Continue state: " + + string.Join(", ", missingEntityRestoreSymbols)); + } } static void RequirePropertiesPanelReadOnlyInspector(string root) diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index ac4c85456..662968395 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -176,9 +176,11 @@ sessions publish typed state-host liveness. Zone checkpoints persist generated orbit/body rows into `AetheriaZoneState`, so `ZoneConstructionBlueprint` is a one-shot construction input rather than the retained surface carrying celestial graph facts. Entity checkpoints persist hull simulation grids into `AetheriaEntitySnapshot`, so -`RuntimeEntityBlueprint` is no longer the only surface carrying those live -values. Broader runtime object graphs and behavior-private simulation state -remain legacy until dedicated typed runtime documents exist. Live behavior +`EntityConstructionBlueprint` is no longer the only surface carrying those live +values. Continue restore lowers the current player entity from the exact typed +entity snapshot record, including position, velocity, shutdown/heatsink state, +thermal exposure, and active consumable timers. Broader runtime object graphs +and behavior-private simulation state remain legacy until dedicated typed runtime documents exist. Live behavior instances expose typed behavior kind and group through `Behavior.Kind` and `Behavior.Group`; behavior construction now reads typed payload fields through `RuntimeBehaviorDefinition` instead of projecting through config DTOs. Stat diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 04457c1b4..18447c545 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -2543,9 +2543,36 @@ public class ActionGameManager : MonoBehaviour entity.Zone = Zone; Zone.Entities.Add(entity); entity.Activate(); + entity.HeatsinksEnabled = entitySnapshot.HeatsinksEnabled; + entity.RestoreThermalExposure((float)entitySnapshot.Heatstroke, (float)entitySnapshot.Hypothermia); + RestoreActiveConsumablesFromTypedEntitySnapshot(entity, entitySnapshot); BindToEntity(entity); } + private void RestoreActiveConsumablesFromTypedEntitySnapshot(Entity entity, AetheriaRuntimeEntitySnapshot snapshot) + { + foreach (var activeConsumable in snapshot.ActiveConsumables) + { + var item = CreateLoadoutItem(new AetheriaRuntimeLoadoutItemSnapshot( + activeConsumable.ItemKey, + activeConsumable.Quality, + 1, + 1, + true, + false)) as ConsumableItem; + if (item == null) + { + Debug.LogWarning($"Typed active consumable {activeConsumable.ItemKey} could not be lowered for restored entity {snapshot.RecordKey}."); + continue; + } + + entity.RestoreActiveConsumable( + item, + (float)activeConsumable.RemainingDuration, + (float)activeConsumable.Duration); + } + } + private static GalaxyZone ResolveStartZone(AetheriaRuntimeRunStateSnapshot run) { if (CurrentGalaxy?.Zones == null || CurrentGalaxy.Zones.Length == 0) diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index 26fb259e4..f57559215 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -315,6 +315,20 @@ public abstract class Entity _activeConsumables.Add(new ConsumableItemEffect(item, this)); } + public void RestoreThermalExposure(float heatstroke, float hypothermia) + { + Heatstroke = saturate(heatstroke); + Hypothermia = saturate(hypothermia); + } + + public void RestoreActiveConsumable(ConsumableItem item, float remainingDuration, float duration) + { + if (item == null) + return; + + _activeConsumables.Add(new ConsumableItemEffect(item, this, remainingDuration, duration)); + } + public ConsumableItemEffect FindActiveConsumable(string itemKey) { return _activeConsumables.FirstOrDefault(ac => ac.Item?.ItemKey == itemKey); @@ -1182,13 +1196,20 @@ public class ConsumableItemEffect private readonly BezierCurve _effectiveness; public ConsumableItemEffect(ConsumableItem item, Entity entity) + : this(item, entity, null, null) + { + } + + public ConsumableItemEffect(ConsumableItem item, Entity entity, float? remainingDuration, float? duration) { Item = item; Entity = entity; RuntimeItem = entity.ItemManager.GetRuntimeItem(item); - _duration = RuntimeItem?.Duration > 0 ? (float)RuntimeItem.Duration : 0; + _duration = duration.GetValueOrDefault(RuntimeItem?.Duration > 0 ? (float)RuntimeItem.Duration : 0); _effectiveness = CreateEffectivenessCurve(RuntimeItem); - RemainingDuration = _duration; + RemainingDuration = remainingDuration.HasValue + ? clamp(remainingDuration.Value, 0, Duration) + : _duration; Behaviors = entity.ItemManager.CreateRuntimeBehaviors(this); } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index b7a9a3a07..56c2b59a4 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -974,16 +974,16 @@ First Aetheria surfaces to publish: `RunId + ZoneIndex + CurrentZoneEntityIndex` entity record, lowers it through the existing construction blueprint path, restores hull, equipment, cargo, docking contents, weapon groups, position, direction, - velocity, shutdown override, and tractor power, then binds the lowered - entity as the current player ship. + velocity, shutdown override, heatsink toggle, tractor power, + heatstroke/hypothermia exposure, and active consumable item/timer rows, + then binds the lowered entity as the current player ship. - Remaining: add typed documents/mappers for runtime object graphs, complete full Continue/run entity graph reconstruction from typed state for non-current entities, child/docked entity activation, targets, - contacts, active consumables, behavior-private state not covered by - progress, weapon, sensor, radiator, reactor, or capacitor rows, - heatstroke/hypothermia runtime restore, typed behavior factory - construction, and any catalog fields not covered by the stable - scalar/fingerprint/payload pass. + contacts, restored active-consumable behavior runtime internals, + behavior-private state not covered by progress, weapon, sensor, radiator, + reactor, or capacitor rows, typed behavior factory construction, and any + catalog fields not covered by the stable scalar/fingerprint/payload pass. 4. Runtime cutover - Done: add a Unity-facing typed catalog read facade and smoke proving it can