diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index a044c1302..026627344 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Aetheria.State.Unity.Smoke/Program.cs b/Aetheria.State.Unity.Smoke/Program.cs index 8778c593a..4cf039a90 100644 --- a/Aetheria.State.Unity.Smoke/Program.cs +++ b/Aetheria.State.Unity.Smoke/Program.cs @@ -271,8 +271,8 @@ try { new AetheriaRuntimeOrbitSnapshotCommit { - OrbitLegacyId = "smoke:orbit", - ParentLegacyId = "smoke:parent-orbit", + OrbitKey = "aetheria.orbit:legacy:smoke:orbit", + ParentOrbitKey = "aetheria.orbit:legacy:smoke:parent-orbit", Distance = 100.0, Phase = 0.25, FixedPositionX = 5.0, @@ -283,10 +283,10 @@ try { new AetheriaRuntimeBodySnapshotCommit { - BodyLegacyId = "smoke:body", + BodyKey = "aetheria.body:legacy:smoke:body", Kind = "asteroid_belt", Name = "Smoke Belt", - OrbitLegacyId = "smoke:orbit", + OrbitKey = "aetheria.orbit:legacy:smoke:orbit", Mass = 42.0, Resources = new[] { @@ -702,9 +702,12 @@ try run.FactionRelationships[0].Standing == 3 && zone?.EntityKeys.Length == 1 && zone.Orbits.Length == 1 && - zone.Orbits[0].OrbitId == "smoke:orbit" && + zone.Orbits[0].OrbitId == "aetheria.orbit:legacy:smoke:orbit" && + zone.Orbits[0].ParentId == "aetheria.orbit:legacy:smoke:parent-orbit" && zone.Orbits[0].FixedPosition.X == 5.0 && zone.Bodies.Length == 1 && + zone.Bodies[0].BodyId == "aetheria.body:legacy:smoke:body" && + zone.Bodies[0].OrbitId == "aetheria.orbit:legacy:smoke:orbit" && zone.Bodies[0].Kind == "asteroid_belt" && zone.Bodies[0].Resources.Length == 1 && zone.Bodies[0].Resources[0].ItemKey == "aetheria.item_definition:legacy:smoke:ore" && @@ -849,8 +852,12 @@ try packageZones[0].Name != "Unity Smoke Zone" || packageZones[0].EntityKeys.Count != 1 || packageZones[0].Orbits.Count != 1 || + packageZones[0].Orbits[0].OrbitId != "aetheria.orbit:legacy:smoke:orbit" || + packageZones[0].Orbits[0].ParentId != "aetheria.orbit:legacy:smoke:parent-orbit" || packageZones[0].Orbits[0].FixedPositionX != 5.0 || packageZones[0].Bodies.Count != 1 || + packageZones[0].Bodies[0].BodyId != "aetheria.body:legacy:smoke:body" || + packageZones[0].Bodies[0].OrbitId != "aetheria.orbit:legacy:smoke:orbit" || packageZones[0].Bodies[0].ResourceCount != 1 || packageZones[0].Bodies[0].AsteroidCount != 1 || packageZones[0].Bodies[0].DamagedAsteroidCount != 1 || diff --git a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs index 7fe9992a3..5685e83cf 100644 --- a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs +++ b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs @@ -288,8 +288,8 @@ public static class AetheriaRuntimeCommitLogApplier return (orbits ?? Array.Empty()) .Select(orbit => new AetheriaOrbitSnapshot { - OrbitId = 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]