Use typed body keys in behavior state commits
This commit is contained in:
parent
ec124bb9d4
commit
71f2c14c33
8 changed files with 33 additions and 18 deletions
Binary file not shown.
|
|
@ -292,7 +292,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
OwnerIndex = 0,
|
||||
BehaviorIndex = 1,
|
||||
BehaviorKind = "ResourceScanner",
|
||||
ResourceScannerTargetBodyId = "smoke:body",
|
||||
ResourceScannerTargetBodyId = "aetheria.body:legacy:smoke:body",
|
||||
ResourceScannerAsteroidIndex = 2,
|
||||
ResourceScannerScanTime = 1.25,
|
||||
ResourceScannerRange = 500.0,
|
||||
|
|
@ -305,7 +305,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
OwnerIndex = 0,
|
||||
BehaviorIndex = 2,
|
||||
BehaviorKind = "MiningTool",
|
||||
MiningToolAsteroidBeltId = "smoke:body",
|
||||
MiningToolAsteroidBeltId = "aetheria.body:legacy:smoke:body",
|
||||
MiningToolAsteroidIndex = 3,
|
||||
MiningToolRange = 275.0
|
||||
},
|
||||
|
|
@ -672,12 +672,12 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
|
|||
entitySnapshot.BehaviorStates[0].AetherDriveRpmY != 900.0 ||
|
||||
entitySnapshot.BehaviorStates[0].AetherDriveMaximumRpm != 2400.0 ||
|
||||
entitySnapshot.BehaviorStates[1].BehaviorKind != "ResourceScanner" ||
|
||||
entitySnapshot.BehaviorStates[1].ResourceScannerTargetBodyId != "smoke:body" ||
|
||||
entitySnapshot.BehaviorStates[1].ResourceScannerTargetBodyId != "aetheria.body:legacy:smoke:body" ||
|
||||
entitySnapshot.BehaviorStates[1].ResourceScannerAsteroidIndex != 2 ||
|
||||
entitySnapshot.BehaviorStates[1].ResourceScannerScanTime != 1.25 ||
|
||||
entitySnapshot.BehaviorStates[1].ResourceScannerScanDuration != 3.5 ||
|
||||
entitySnapshot.BehaviorStates[2].BehaviorKind != "MiningTool" ||
|
||||
entitySnapshot.BehaviorStates[2].MiningToolAsteroidBeltId != "smoke:body" ||
|
||||
entitySnapshot.BehaviorStates[2].MiningToolAsteroidBeltId != "aetheria.body:legacy:smoke:body" ||
|
||||
entitySnapshot.BehaviorStates[2].MiningToolAsteroidIndex != 3 ||
|
||||
entitySnapshot.BehaviorStates[2].MiningToolRange != 275.0 ||
|
||||
entitySnapshot.BehaviorStates[3].BehaviorKind != "Thruster" ||
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ try
|
|||
OwnerIndex = 5,
|
||||
BehaviorIndex = 0,
|
||||
BehaviorKind = "ResourceScanner",
|
||||
ResourceScannerTargetBodyId = "smoke:body",
|
||||
ResourceScannerTargetBodyKey = "aetheria.body:legacy:smoke:body",
|
||||
ResourceScannerAsteroidIndex = 2,
|
||||
ResourceScannerScanTime = 1.25,
|
||||
ResourceScannerRange = 500.0,
|
||||
|
|
@ -555,7 +555,7 @@ try
|
|||
OwnerIndex = 6,
|
||||
BehaviorIndex = 0,
|
||||
BehaviorKind = "MiningTool",
|
||||
MiningToolAsteroidBeltId = "smoke:body",
|
||||
MiningToolAsteroidBeltKey = "aetheria.body:legacy:smoke:body",
|
||||
MiningToolAsteroidIndex = 3,
|
||||
MiningToolRange = 275.0
|
||||
},
|
||||
|
|
@ -787,12 +787,12 @@ try
|
|||
entity.BehaviorStates[4].AetherDriveMaximumRpm == 2400.0 &&
|
||||
entity.BehaviorStates[4].AetherDriveThrustDirectionY == -0.5 &&
|
||||
entity.BehaviorStates[5].BehaviorKind == "ResourceScanner" &&
|
||||
entity.BehaviorStates[5].ResourceScannerTargetBodyId == "smoke:body" &&
|
||||
entity.BehaviorStates[5].ResourceScannerTargetBodyId == "aetheria.body:legacy:smoke:body" &&
|
||||
entity.BehaviorStates[5].ResourceScannerAsteroidIndex == 2 &&
|
||||
entity.BehaviorStates[5].ResourceScannerScanTime == 1.25 &&
|
||||
entity.BehaviorStates[5].ResourceScannerScanDuration == 3.5 &&
|
||||
entity.BehaviorStates[6].BehaviorKind == "MiningTool" &&
|
||||
entity.BehaviorStates[6].MiningToolAsteroidBeltId == "smoke:body" &&
|
||||
entity.BehaviorStates[6].MiningToolAsteroidBeltId == "aetheria.body:legacy:smoke:body" &&
|
||||
entity.BehaviorStates[6].MiningToolAsteroidIndex == 3 &&
|
||||
entity.BehaviorStates[6].MiningToolRange == 275.0 &&
|
||||
entity.BehaviorStates[7].BehaviorKind == "Thruster" &&
|
||||
|
|
@ -895,9 +895,9 @@ try
|
|||
packageEntities[0].BehaviorStates[3].CapacitorCharge != 7.5 ||
|
||||
packageEntities[0].BehaviorStates[4].AetherDriveRpmY != 900.0 ||
|
||||
packageEntities[0].BehaviorStates[4].AetherDriveMaximumRpm != 2400.0 ||
|
||||
packageEntities[0].BehaviorStates[5].ResourceScannerTargetBodyId != "smoke:body" ||
|
||||
packageEntities[0].BehaviorStates[5].ResourceScannerTargetBodyId != "aetheria.body:legacy:smoke:body" ||
|
||||
packageEntities[0].BehaviorStates[5].ResourceScannerScanDuration != 3.5 ||
|
||||
packageEntities[0].BehaviorStates[6].MiningToolAsteroidBeltId != "smoke:body" ||
|
||||
packageEntities[0].BehaviorStates[6].MiningToolAsteroidBeltId != "aetheria.body:legacy:smoke:body" ||
|
||||
packageEntities[0].BehaviorStates[6].MiningToolRange != 275.0 ||
|
||||
packageEntities[0].BehaviorStates[7].ThrusterAxis != 0.8 ||
|
||||
packageEntities[0].BehaviorStates[7].ThrusterThrust != 125.0 ||
|
||||
|
|
|
|||
|
|
@ -542,13 +542,19 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
AetherDriveMaximumRpm = state.AetherDriveMaximumRpm,
|
||||
AetherDriveThrustDirectionX = state.AetherDriveThrustDirectionX,
|
||||
AetherDriveThrustDirectionY = state.AetherDriveThrustDirectionY,
|
||||
ResourceScannerTargetBodyId = state.ResourceScannerTargetBodyId ?? "",
|
||||
ResourceScannerTargetBodyId = ReferenceKey(
|
||||
state.ResourceScannerTargetBodyKey ?? "",
|
||||
"aetheria.body",
|
||||
state.ResourceScannerTargetBodyId ?? ""),
|
||||
ResourceScannerAsteroidIndex = state.ResourceScannerAsteroidIndex,
|
||||
ResourceScannerScanTime = state.ResourceScannerScanTime,
|
||||
ResourceScannerRange = state.ResourceScannerRange,
|
||||
ResourceScannerMinimumDensity = state.ResourceScannerMinimumDensity,
|
||||
ResourceScannerScanDuration = state.ResourceScannerScanDuration,
|
||||
MiningToolAsteroidBeltId = state.MiningToolAsteroidBeltId ?? "",
|
||||
MiningToolAsteroidBeltId = ReferenceKey(
|
||||
state.MiningToolAsteroidBeltKey ?? "",
|
||||
"aetheria.body",
|
||||
state.MiningToolAsteroidBeltId ?? ""),
|
||||
MiningToolAsteroidIndex = state.MiningToolAsteroidIndex,
|
||||
MiningToolRange = state.MiningToolRange,
|
||||
ThrusterAxis = state.ThrusterAxis,
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@ 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.
|
||||
Behavior-state runtime commits carry typed body keys for resource scanner targets
|
||||
and mining tool asteroid belts. The old raw body ID commit 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.
|
||||
|
|
|
|||
|
|
@ -971,9 +971,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
{
|
||||
state = new AetheriaRuntimeBehaviorStateCommit
|
||||
{
|
||||
ResourceScannerTargetBodyId = resourceScanner.ScanTarget == Guid.Empty
|
||||
? ""
|
||||
: resourceScanner.ScanTarget.ToString("D"),
|
||||
ResourceScannerTargetBodyKey = BodyKey(resourceScanner.ScanTarget),
|
||||
ResourceScannerAsteroidIndex = resourceScanner.Asteroid,
|
||||
ResourceScannerScanTime = resourceScanner.ScanTime,
|
||||
ResourceScannerRange = resourceScanner.Range,
|
||||
|
|
@ -985,9 +983,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
{
|
||||
state = new AetheriaRuntimeBehaviorStateCommit
|
||||
{
|
||||
MiningToolAsteroidBeltId = miningTool.AsteroidBelt == Guid.Empty
|
||||
? ""
|
||||
: miningTool.AsteroidBelt.ToString("D"),
|
||||
MiningToolAsteroidBeltKey = BodyKey(miningTool.AsteroidBelt),
|
||||
MiningToolAsteroidIndex = miningTool.Asteroid,
|
||||
MiningToolRange = miningTool.Range
|
||||
};
|
||||
|
|
|
|||
|
|
@ -928,5 +928,11 @@ namespace GameCult.Aetheria.State.Unity
|
|||
|
||||
[Key(54)]
|
||||
public bool TurretControllerPredictShots { get; set; }
|
||||
|
||||
[Key(55)]
|
||||
public string ResourceScannerTargetBodyKey { get; set; } = "";
|
||||
|
||||
[Key(56)]
|
||||
public string MiningToolAsteroidBeltKey { get; set; } = "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1241,6 +1241,9 @@ First Aetheria surfaces to publish:
|
|||
- Done: move zone body resource dictionaries from legacy item GUID keys to
|
||||
typed item-key strings; runtime body resource commit projection no longer
|
||||
calls `FromLegacyId`.
|
||||
- Done: move resource scanner targets and mining tool asteroid belts to
|
||||
typed body-key runtime commit fields; raw body ID commit fields are now
|
||||
compatibility-only fallback input.
|
||||
- Remove runtime dependency on `ItemData` DTOs as item instance owners.
|
||||
|
||||
5. Mesh host
|
||||
|
|
|
|||
Loading…
Reference in a new issue