From ec124bb9d4632916f7df99465ba2673d1bee2457 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 15 Jun 2026 16:27:23 +0100 Subject: [PATCH] Use typed orbit and body keys in run commits --- .voidbot/state/aetheria.cc | Bin 103097 -> 103221 bytes Aetheria.State.Unity.Smoke/Program.cs | 17 +++++++++---- .../AetheriaRuntimeCommitLogApplier.cs | 8 +++--- Aetheria.State/README.md | 4 +++ Assets/Scripts/Gameplay/ActionGameManager.cs | 24 +++++++++++++----- .../AetheriaRuntimeStateCommitDocument.cs | 12 +++++++++ 6 files changed, 49 insertions(+), 16 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index a044c130202bed399526be0d2718b9bf13c2ca12..026627344f29458325eaeb1fc6891c43f41bd618 100644 GIT binary patch delta 1355 zcmah}-)mGy6z(-K>Z1@TRjemqDJ^EB*)vDnd`f#}?%n+GrBA!_-7|B(?>pbj z?>Bqy-s<`J_J%D(hsp;_!$XzHuYzsa{SDU(;J}avRM*7KIKm6_*y24!Io&Rh(wuJ>1zng{jFF9=IjMsHb%IDWn#^YP`CaeQ-v+m)bTbl+ zH~tB_-lujtk(M{m{jTcBewgnYU6leS&Ws*6K>8Hew285+?l+cM+J{vnK@oz}3L%mP z-_^AOQi?k3TR7C8@AEZ|r;;Lt7&UJpRJCe=@Uo!FQN$*@vCucOxO7Hxn}XquL@>*h zbPP~SCJY$Mg@D8$oJe>Kj-E4blFTc4n+*9Qm_$1&i74?SfEn7Zs60erX>B4VC2Fut z*U$luS%XV1YhXWBN|+Lyu5$xXV#ypPYiPjMy;^~xd`xaQ zK@An7$j;yGoq2jp5hN3Y(7`R&Sff#iCO->y0|lWF>#W5|W6qYE#;Mm$kRnokl&=nj z=ypcttRJBvVYA2t4`;Y=e5y={kVR8~7n*`c+)pLtW_!teU0Q#;<;(Xa9Qq>z-gdyS)6yjx}jp2}z6c zL4nBbEKm1-m>;)3rjP&bean*?`=6VYrT<33(d>_BJ9od@Xqw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bitId = orbit.OrbitLegacyId ?? "", - ParentId = orbit.ParentLegacyId ?? "", + OrbitId = ReferenceKey(orbit.OrbitKey ?? "", "aetheria.orbit", orbit.OrbitLegacyId ?? ""), + ParentId = ReferenceKey(orbit.ParentOrbitKey ?? "", "aetheria.orbit", orbit.ParentLegacyId ?? ""), Distance = orbit.Distance, Phase = orbit.Phase, FixedPosition = new AetheriaVector2 @@ -309,10 +309,10 @@ public static class AetheriaRuntimeCommitLogApplier return (bodies ?? Array.Empty()) .Select(body => new AetheriaBodySnapshot { - BodyId = body.BodyLegacyId ?? "", + BodyId = ReferenceKey(body.BodyKey ?? "", "aetheria.body", body.BodyLegacyId ?? ""), Kind = body.Kind ?? "", Name = body.Name ?? "", - OrbitId = body.OrbitLegacyId ?? "", + OrbitId = ReferenceKey(body.OrbitKey ?? "", "aetheria.orbit", body.OrbitLegacyId ?? ""), Mass = body.Mass, Resources = ToBodyResources(body.Resources), BodyRadiusMultiplier = body.BodyRadiusMultiplier, diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index 4b6913688..017ba3514 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -102,6 +102,10 @@ Unity runtime commit DTOs now also carry typed `FactionKey` for loadout entities, run entity snapshots, and faction relationship state. The old `CorporationLegacyId` fields remain compatibility-only for older pending commits; current Unity projection does not write them. +Run checkpoint commit DTOs carry typed `OrbitKey`, `ParentOrbitKey`, and +`BodyKey` for zone orbit/body snapshots. The old `OrbitLegacyId`, +`ParentLegacyId`, and `BodyLegacyId` fields remain compatibility-only for older +pending commits; current Unity projection does not write them. The package runtime catalog snapshot indexes items by canonical item key; Unity gameplay, HUD, inventory, trade, ship, and zone helper lookups use `ItemKey` directly instead of deriving `ItemId` and searching by legacy GUID. diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 759863f26..7583595f4 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -639,8 +639,8 @@ public class ActionGameManager : MonoBehaviour .OrderBy(orbit => orbit.ID) .Select(orbit => new AetheriaRuntimeOrbitSnapshotCommit { - OrbitLegacyId = LegacyId(orbit.ID), - ParentLegacyId = LegacyId(orbit.Parent), + OrbitKey = OrbitKey(orbit.ID), + ParentOrbitKey = OrbitKey(orbit.Parent), Distance = orbit.Distance, Phase = orbit.Phase, FixedPositionX = orbit.FixedPosition.x, @@ -657,7 +657,7 @@ public class ActionGameManager : MonoBehaviour return zone.PlanetInstances.Values .Select(planet => ProjectZoneBody(planet)) .Concat(zone.AsteroidBelts.Values.Select(belt => ProjectZoneBody(zone, belt))) - .OrderBy(body => body.BodyLegacyId) + .OrderBy(body => body.BodyKey) .ToArray(); } @@ -665,10 +665,10 @@ public class ActionGameManager : MonoBehaviour { return new AetheriaRuntimeBodySnapshotCommit { - BodyLegacyId = LegacyId(planet.ID), + BodyKey = BodyKey(planet.ID), Kind = BodyKind(planet), Name = planet.Name, - OrbitLegacyId = LegacyId(planet.OrbitId), + OrbitKey = OrbitKey(planet.OrbitId), Mass = planet.Mass, Resources = planet.Resources? .OrderBy(pair => pair.Key) @@ -696,10 +696,10 @@ public class ActionGameManager : MonoBehaviour { return new AetheriaRuntimeBodySnapshotCommit { - BodyLegacyId = LegacyId(belt.ID), + BodyKey = BodyKey(belt.ID), Kind = "asteroid_belt", Name = belt.Name, - OrbitLegacyId = LegacyId(belt.Orbit), + OrbitKey = OrbitKey(belt.Orbit), Mass = belt.Mass, Resources = belt.Resources? .OrderBy(pair => pair.Key) @@ -1270,6 +1270,16 @@ public class ActionGameManager : MonoBehaviour return id == Guid.Empty ? "" : $"aetheria.corporation:legacy:{id:D}"; } + private static string OrbitKey(Guid id) + { + return id == Guid.Empty ? "" : $"aetheria.orbit:legacy:{id:D}"; + } + + private static string BodyKey(Guid id) + { + return id == Guid.Empty ? "" : $"aetheria.body:legacy:{id:D}"; + } + private static int ZoneIndex(GalaxyZone zone) { return CurrentGalaxy?.Zones == null || zone == null ? -1 : Array.IndexOf(CurrentGalaxy.Zones, zone); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs index bf2be8f61..5a46e8e2c 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs @@ -341,6 +341,12 @@ namespace GameCult.Aetheria.State.Unity [Key(5)] public double FixedPositionY { get; set; } + + [Key(6)] + public string OrbitKey { get; set; } = ""; + + [Key(7)] + public string ParentOrbitKey { get; set; } = ""; } [MessagePackObject] @@ -384,6 +390,12 @@ namespace GameCult.Aetheria.State.Unity [Key(12)] public AetheriaRuntimeSunVisualCommit SunVisual { get; set; } = new AetheriaRuntimeSunVisualCommit(); + + [Key(13)] + public string BodyKey { get; set; } = ""; + + [Key(14)] + public string OrbitKey { get; set; } = ""; } [MessagePackObject]