From 9bc8ec125dedd9cf8591f5d37cb698509ea90e2b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 17:27:28 +0100 Subject: [PATCH] Demote current entity slot from canonical run state --- .voidbot/state/aetheria.cc | Bin 188419 -> 188901 bytes Aetheria.State.Smoke/Program.cs | 1 - Aetheria.State.Unity.Smoke/Program.cs | 1 - Aetheria.State.Verify/Program.cs | 19 +++++++++- .../AetheriaRuntimeCommitLogApplier.cs | 1 - .../AetheriaRuntimeStateDocuments.cs | 3 -- Aetheria.State/README.md | 4 ++- Assets/Scripts/Gameplay/ActionGameManager.cs | 16 +++------ .../Runtime/AetheriaRuntimeCatalogSnapshot.cs | 3 -- .../Runtime/AetheriaRuntimeCatalogStore.cs | 34 ++++++++++++++++-- docs/aetheria-perfect-machine-map.md | 4 ++- 11 files changed, 60 insertions(+), 26 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 9bd61e2bdd4c524e4cc01ff96b4e709d3d033c4f..3baabdc07bf55b829f2177d78c0d61752eeed404 100644 GIT binary patch delta 1072 zcmZ`&O=uHA6lS+YT5GYOwO9ln2ttL#lK$6=QhLyOvQj1JVY2&@4BgDEGqY*8mr#m$ z5|kk8$x|D}gGetCyeJ-f&|*`_&5H-`diU)nX;knKGW%xtec$)q_icR``2K0&ZO!h_ zOwUhEr|0HoqoD))Ty@WWcswr6q{qiI*{9ZURrYKgRi=_kU+;N)|JBx5Z+)!S%DkxD zUtmHC?l2EjAV3>t5Oh%no(n=6SVi=KffFc&!ldZOO$gefD=u7I2Pqr`6Z+^v`*IaS z4Y`R)h!FCD320jFDgHSjBSA2w zXgdmtG7U}tJ z%NKVYS@Ow7Iqp$RQn8hG9WT%Z)jU~RnG~H$k7UiN%bHzI^>x}*Klh9#ai;8Mrs6m^ uk~?~wh&CJc2u1l=bi859PM#;`;yg#s8}??WG?|3HK6_|?>_4i_WPbx(3yGNk delta 735 zcmZWnF>ljA6qel#DP0)a0R-Z$m6Ehhs|JdYkSYdXp<#FQ~S~=UN8lzF(;KvSM1|&!`0GcwPe*_5Bwb|3>PtiLT#i% z&|Mh^KDb=?V7drVz!Fq|L^BDv378~8pXi=cKJ+lDfRHA8$RMGOiakRF9S}+)_^9^I z3m6Yihs{`kHq0PZ?14b^2O4%_rAYkNO#dz>!1T;l?g_GOO9kGXQO#S(8@*mswxqy$ z_3g|JxCT##5i{K7LDn-BaGxfWB1mdugFR%kDt7P2iW;2D{fG<5=Nsr!I%T5I%=Ji;I{!Fll{>|tL=uq~M&OVv7IVI>x zx)P}ZY;^O%%5olG?E@2DSE?qq^{dIR1M9w(z8PD0&gU!S)LRFJb@V9xJ+{`K>>gT^ z-9x)yEmq8_k4_dY discoveredZoneIndices, IReadOnlyList zoneKeys, @@ -704,7 +703,6 @@ namespace GameCult.Aetheria.State.Unity EntranceZoneIndex = entranceZoneIndex; ExitZoneIndex = exitZoneIndex; CurrentZoneIndex = currentZoneIndex; - CurrentZoneEntityIndex = currentZoneEntityIndex; CurrentEntityKey = currentEntityKey; DiscoveredZoneIndices = discoveredZoneIndices; ZoneKeys = zoneKeys; @@ -719,7 +717,6 @@ namespace GameCult.Aetheria.State.Unity public int EntranceZoneIndex { get; } public int ExitZoneIndex { get; } public int CurrentZoneIndex { get; } - public int CurrentZoneEntityIndex { get; } public string CurrentEntityKey { get; } public IReadOnlyList DiscoveredZoneIndices { get; } public IReadOnlyList ZoneKeys { get; } diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index e47eaea05..9ec079692 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -456,7 +456,7 @@ namespace GameCult.Aetheria.State.Unity var entranceZoneIndex = ReadFieldInt32(ref reader, fields, 2); var exitZoneIndex = ReadFieldInt32(ref reader, fields, 3); var currentZoneIndex = ReadFieldInt32(ref reader, fields, 4); - var currentZoneEntityIndex = ReadFieldInt32(ref reader, fields, 5); + var legacyCurrentZoneEntityIndex = ReadFieldInt32(ref reader, fields, 5, -1); var discoveredZoneIndices = ReadFieldInt32Array(ref reader, fields, 6); var zoneKeys = ReadFieldStringArray(ref reader, fields, 7); var actionBarBindings = ReadFieldActionBarBindings(ref reader, fields, 8); @@ -464,6 +464,11 @@ namespace GameCult.Aetheria.State.Unity var updatedAtUtc = ReadFieldString(ref reader, fields, 10); var generationSeed = ReadFieldUInt32(ref reader, fields, 11); var currentEntityKey = ReadFieldString(ref reader, fields, 12); + if (string.IsNullOrWhiteSpace(currentEntityKey)) + { + currentEntityKey = LegacyCurrentEntityKey(runId, currentZoneIndex, legacyCurrentZoneEntityIndex); + } + SkipRemaining(ref reader, fields, 13); return new AetheriaRuntimeRunStateSnapshot( runId, @@ -471,7 +476,6 @@ namespace GameCult.Aetheria.State.Unity entranceZoneIndex, exitZoneIndex, currentZoneIndex, - currentZoneEntityIndex, currentEntityKey, discoveredZoneIndices, zoneKeys, @@ -1085,6 +1089,22 @@ namespace GameCult.Aetheria.State.Unity return index >= fields ? 0 : reader.ReadInt32(); } + private static int ReadFieldInt32(ref MessagePackReader reader, int fields, int index, int fallback) + { + if (index >= fields) + { + return fallback; + } + + if (reader.NextMessagePackType == MessagePackType.Nil) + { + reader.ReadNil(); + return fallback; + } + + return reader.ReadInt32(); + } + private static uint ReadFieldUInt32(ref MessagePackReader reader, int fields, int index) { return index >= fields ? 0 : reader.ReadUInt32(); @@ -1689,6 +1709,16 @@ namespace GameCult.Aetheria.State.Unity : $"aetheria.item_definition:legacy:{legacyItemId.Trim()}"; } + private static string LegacyCurrentEntityKey(string runId, int zoneIndex, int entityIndex) + { + if (string.IsNullOrWhiteSpace(runId) || zoneIndex < 0 || entityIndex < 0) + { + return ""; + } + + return $"global:aetheria.run_state.{runId}.zone.{zoneIndex}.entity.{entityIndex}.v1"; + } + private static string CorporationKey(string legacyCorporationId) { return string.IsNullOrWhiteSpace(legacyCorporationId) diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 8f1a6503e..fe6167e6a 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -995,7 +995,9 @@ First Aetheria surfaces to publish: into live behavior instances, and binds the saved current entity by `AetheriaRunState.CurrentEntityKey` so Continue restore follows exact typed entity identity instead of reconstructing the player ship from an integer - slot. + slot. Canonical run state and package runtime snapshots no longer keep the + old current-entity slot field; the package reader only synthesizes the key + from older stored runs when that compatibility seam is encountered. - Done: project run checkpoint entity snapshots from the flattened live entity graph, not only `Zone.Entities`, so docked child ships can receive typed entity records and stable child/docking references instead of