From 75d3f05fd9b385faf2bacc1dce79cc881374844f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 07:18:14 +0100 Subject: [PATCH] Restore Continue stat grids from typed state --- .voidbot/state/aetheria.cc | Bin 148554 -> 148555 bytes Aetheria.State.Verify/Program.cs | 3 + Aetheria.State/README.md | 3 +- Assets/Scripts/Gameplay/ActionGameManager.cs | 1 + Assets/Scripts/ServerShared/Entity.cs | 70 +++++++++++++++++++ docs/aetheria-perfect-machine-map.md | 6 +- 6 files changed, 80 insertions(+), 3 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index bceb553d22e1d9ce9157b1f1b41a007f23830a06..0ebdf5bdd51bdc9b5d5889084e60286122df49ea 100644 GIT binary patch delta 1812 zcmZuy&5ImG6sIeTuqv{G8v{wOB$tetX=gT>%&RkI>u{7CeWTTS+5a{Wj34%Q`;^-zF$2^GXhzTAtgF=Knfm9=9O)YZ8 zOVfQ+E3Fh5b0nD?3X=?Lcp6bWTN`ChN38}ThfML*XeyO0lA5QdB5ZiTjbds_ha5ym z$EXviLVn|I&H^Tcm6l@%Iqr=rM;4|Xv1Xz75FseDv`eG>`^L5Z$lJKVR0QT_?9E_7 zO$9#_#w|UnA!8^r&}gPu7ME5k9rKK4N)7}hbN~U%HBeJR(S4X|+&{!4jihx-Dns!> zAQcA0>Lyb$wbs>+5u3F!8WadLaw$EL{-I$x4lh|6rXp<*%^9>G)lCx(GtpyK}E~~qJ{ea zStY@Wnwelz>#pDdH^^on^E5;@s0_Lz#fYJVt~s1ApS~$Eh-d>Q2PgylM4b|@F&q&F z%QkOk$r)fHMn8HRkut_@n=-@nqx1q?$jb2G61KO9;B%4tIY-CS9 zJSNTw3%N4V%*Ni1jrD3Q)xQ5djCcse{Y&Ilv-v*WP3Syx!x)xVg46t%G{x>!FD~9Y zO-`OWcWB$FmL$rV3Td9%`>6P@OYS`PV^ye8EUPTu71QF(HSeY3R+l_G-+1SO1>Agm z-Df>=YOUArw2Oxa-r19vZ?x@?e!G34-NFC&42$&F#cw@w{;BU4TIu4S9_hMmt!?tc z@{M%qqJ1M3$u{|EWwBSirk*H1*dfXCLAO&@|FuJAD~nybcrfdepVwDbcW(X<1hkW- delta 1797 zcmb7FO^6&t6s9{%V1r^H_=}R~Z8uKO&$=_SGyY`PILL~L5;hCwkff%&db*hIs!mn) z%+6^7E4Vk2L0az-5j=R2pb!L)=HfLudG;pgIlk(j=`}2fhZ(x7-mCAu?|om_gQL}7 zk5<3GYd_WQw|o7KPJL^0^ZMu3vnk)QPcI(WhsQR0W@8~v9h_MPw-RL}9uCIK$ zzGB^5U$K8$Kfg_=4ya_raRt|mC)80?DJHn%6IZ8?9eXmreW}<3NtG6o0vA)j1eHWo zfu6L>)2Zm^#QeW62_>*@UY4*KSBy z^vD|TxSGuce~(1;GT~%IWm$tN&vuHl14^`Fd<;qxO>2<7YbnOG5zJy?+KdxC%F7EvG(wz7jSF&)Tk)C>4HMW2hV5?DrxVW=y z@@h`jo&hG|puo*wi!IaLgd)30qyewNG+H=p)P83z$NFSQr96aG}9Z@OelBGGRhG8Fk2T9Fkcb z^74+8Qw9R#NCzjOs^KZz`PY~kRkb;2B1cp=P$e2!gDI1Yk80pzgI>cE?idGO(V0&J z6)?fsE$hig37ls7iitFvdHbajW1<6v grids) + { + if (grids == null) + return; + + foreach (var grid in grids) + { + switch (grid.Name) + { + case "temperature": + RestoreFloatGrid(grid, Temperature); + RestoreFloatGrid(grid, NewTemperature); + break; + case "thermal_mass": + RestoreFloatGrid(grid, ThermalMass); + break; + case "armor": + RestoreFloatGrid(grid, Armor); + break; + case "max_armor": + RestoreFloatGrid(grid, MaxArmor); + break; + case "hull_conductivity_x": + RestoreHullConductivityGrid(grid, axis: 0); + break; + case "hull_conductivity_y": + RestoreHullConductivityGrid(grid, axis: 1); + break; + } + } + } + public ConsumableItemEffect FindActiveConsumable(string itemKey) { return _activeConsumables.FirstOrDefault(ac => ac.Item?.ItemKey == itemKey); } + private static void RestoreFloatGrid(AetheriaRuntimeEntityStatGridSnapshot grid, float[,] target) + { + if (!CanRestoreGrid(grid, target)) + return; + + var index = 0; + for (var y = 0; y < grid.Height; y++) + for (var x = 0; x < grid.Width; x++) + target[x, y] = (float)grid.Values[index++]; + } + + private void RestoreHullConductivityGrid(AetheriaRuntimeEntityStatGridSnapshot grid, int axis) + { + if (!CanRestoreGrid(grid, HullConductivity)) + return; + + var index = 0; + for (var y = 0; y < grid.Height; y++) + for (var x = 0; x < grid.Width; x++) + { + var conductivity = HullConductivity[x, y]; + if (axis == 0) + conductivity.x = grid.Values[index++] >= 0.5; + else + conductivity.y = grid.Values[index++] >= 0.5; + HullConductivity[x, y] = conductivity; + } + } + + private static bool CanRestoreGrid(AetheriaRuntimeEntityStatGridSnapshot grid, T[,] target) + { + return grid != null && + target != null && + grid.Width == target.GetLength(0) && + grid.Height == target.GetLength(1) && + grid.Values?.Count == grid.Width * grid.Height; + } + public bool CanActivateConsumable(AetheriaRuntimeCatalogItem item) { var itemKey = GetItemKey(item); diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 56c2b59a4..ebf7c4556 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -975,8 +975,10 @@ First Aetheria surfaces to publish: through the existing construction blueprint path, restores hull, equipment, cargo, docking contents, weapon groups, position, direction, 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. + heatstroke/hypothermia exposure, active consumable item/timer rows, + and typed stat grids for temperature, thermal mass, armor, max armor, + and hull-conductivity axes, 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,