Persist AetherDrive state in typed snapshots
This commit is contained in:
parent
6a6a19d08f
commit
0ffbaf9ce8
10 changed files with 227 additions and 7 deletions
Binary file not shown.
|
|
@ -251,6 +251,28 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
LockTargetEntityKey = entityKey.ToString()
|
||||
}
|
||||
],
|
||||
BehaviorStates =
|
||||
[
|
||||
new AetheriaBehaviorStateSnapshot
|
||||
{
|
||||
OwnerKind = "equipment",
|
||||
OwnerIndex = 0,
|
||||
BehaviorIndex = 0,
|
||||
BehaviorKind = "AetherDrive",
|
||||
AetherDriveAxisX = 0.5,
|
||||
AetherDriveAxisY = -0.25,
|
||||
AetherDriveAxisZ = 0.75,
|
||||
AetherDriveThrustX = 12.0,
|
||||
AetherDriveThrustY = 6.0,
|
||||
AetherDriveThrustZ = 3.0,
|
||||
AetherDriveRpmX = 1200.0,
|
||||
AetherDriveRpmY = 900.0,
|
||||
AetherDriveRpmZ = 450.0,
|
||||
AetherDriveMaximumRpm = 2400.0,
|
||||
AetherDriveThrustDirectionX = 1.5,
|
||||
AetherDriveThrustDirectionY = -0.5
|
||||
}
|
||||
],
|
||||
StatGrids =
|
||||
[
|
||||
new AetheriaEntityStatGrid
|
||||
|
|
@ -512,6 +534,11 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
|
|||
entitySnapshot.WeaponStates[0].BehaviorKind != "LockWeapon" ||
|
||||
entitySnapshot.WeaponStates[0].LockProgress != 0.65 ||
|
||||
entitySnapshot.WeaponStates[0].LockTargetEntityKey != entityKey.ToString() ||
|
||||
entitySnapshot.BehaviorStates.Length != 1 ||
|
||||
entitySnapshot.BehaviorStates[0].BehaviorKind != "AetherDrive" ||
|
||||
entitySnapshot.BehaviorStates[0].AetherDriveAxisX != 0.5 ||
|
||||
entitySnapshot.BehaviorStates[0].AetherDriveRpmY != 900.0 ||
|
||||
entitySnapshot.BehaviorStates[0].AetherDriveMaximumRpm != 2400.0 ||
|
||||
entitySnapshot.StatGrids.Length != 1 ||
|
||||
entitySnapshot.StatGrids[0].Values.Length != 4)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -481,6 +481,25 @@ try
|
|||
CapacitorCharge = 7.5,
|
||||
CapacitorCapacity = 10.0,
|
||||
CapacitorEfficiency = 0.95
|
||||
},
|
||||
new AetheriaRuntimeBehaviorStateCommit
|
||||
{
|
||||
OwnerKind = "equipment",
|
||||
OwnerIndex = 4,
|
||||
BehaviorIndex = 0,
|
||||
BehaviorKind = "AetherDrive",
|
||||
AetherDriveAxisX = 0.5,
|
||||
AetherDriveAxisY = -0.25,
|
||||
AetherDriveAxisZ = 0.75,
|
||||
AetherDriveThrustX = 12.0,
|
||||
AetherDriveThrustY = 6.0,
|
||||
AetherDriveThrustZ = 3.0,
|
||||
AetherDriveRpmX = 1200.0,
|
||||
AetherDriveRpmY = 900.0,
|
||||
AetherDriveRpmZ = 450.0,
|
||||
AetherDriveMaximumRpm = 2400.0,
|
||||
AetherDriveThrustDirectionX = 1.5,
|
||||
AetherDriveThrustDirectionY = -0.5
|
||||
}
|
||||
},
|
||||
StatGrids = new[]
|
||||
|
|
@ -601,7 +620,7 @@ try
|
|||
entity.WeaponStates[3].BehaviorKind == "LockWeapon" &&
|
||||
entity.WeaponStates[3].LockProgress == 0.65 &&
|
||||
entity.WeaponStates[3].LockTargetEntityKey == "global:aetheria.run_state.smoke-run.zone.0.entity.0.v1" &&
|
||||
entity.BehaviorStates.Length == 4 &&
|
||||
entity.BehaviorStates.Length == 5 &&
|
||||
entity.BehaviorStates[0].BehaviorKind == "Sensor" &&
|
||||
entity.BehaviorStates[0].Pinging &&
|
||||
entity.BehaviorStates[0].PingRadius == 1200.0 &&
|
||||
|
|
@ -613,6 +632,11 @@ try
|
|||
entity.BehaviorStates[3].BehaviorKind == "Capacitor" &&
|
||||
entity.BehaviorStates[3].CapacitorCharge == 7.5 &&
|
||||
entity.BehaviorStates[3].CapacitorEfficiency == 0.95 &&
|
||||
entity.BehaviorStates[4].BehaviorKind == "AetherDrive" &&
|
||||
entity.BehaviorStates[4].AetherDriveAxisX == 0.5 &&
|
||||
entity.BehaviorStates[4].AetherDriveRpmY == 900.0 &&
|
||||
entity.BehaviorStates[4].AetherDriveMaximumRpm == 2400.0 &&
|
||||
entity.BehaviorStates[4].AetherDriveThrustDirectionY == -0.5 &&
|
||||
entity.WeaponGroups.Length == 1 &&
|
||||
entity.StatGrids.Length == 2 &&
|
||||
entity.StatGrids.Any(grid => grid.Name == "temperature" && grid.Values.Length == 2 && grid.Values[1] == 281.0) &&
|
||||
|
|
@ -668,8 +692,10 @@ try
|
|||
packageEntities[0].WeaponStates[2].AmmoIntervalProgress != 0.6 ||
|
||||
packageEntities[0].WeaponStates[3].LockProgress != 0.65 ||
|
||||
packageEntities[0].WeaponStates[3].LockTargetEntityKey != "global:aetheria.run_state.smoke-run.zone.0.entity.0.v1" ||
|
||||
packageEntities[0].BehaviorStates.Count != 4 ||
|
||||
packageEntities[0].BehaviorStates.Count != 5 ||
|
||||
packageEntities[0].BehaviorStates[3].CapacitorCharge != 7.5 ||
|
||||
packageEntities[0].BehaviorStates[4].AetherDriveRpmY != 900.0 ||
|
||||
packageEntities[0].BehaviorStates[4].AetherDriveMaximumRpm != 2400.0 ||
|
||||
packageEntities[0].StatGrids.Count != 2 ||
|
||||
packageEntities[0].StatGrids.All(grid => grid.Name != "temperature" || grid.Values.Count != 2 || grid.Values[1] != 281.0))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -486,7 +486,19 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
ReactorLoadRatio = state.ReactorLoadRatio,
|
||||
CapacitorCharge = state.CapacitorCharge,
|
||||
CapacitorCapacity = state.CapacitorCapacity,
|
||||
CapacitorEfficiency = state.CapacitorEfficiency
|
||||
CapacitorEfficiency = state.CapacitorEfficiency,
|
||||
AetherDriveAxisX = state.AetherDriveAxisX,
|
||||
AetherDriveAxisY = state.AetherDriveAxisY,
|
||||
AetherDriveAxisZ = state.AetherDriveAxisZ,
|
||||
AetherDriveThrustX = state.AetherDriveThrustX,
|
||||
AetherDriveThrustY = state.AetherDriveThrustY,
|
||||
AetherDriveThrustZ = state.AetherDriveThrustZ,
|
||||
AetherDriveRpmX = state.AetherDriveRpmX,
|
||||
AetherDriveRpmY = state.AetherDriveRpmY,
|
||||
AetherDriveRpmZ = state.AetherDriveRpmZ,
|
||||
AetherDriveMaximumRpm = state.AetherDriveMaximumRpm,
|
||||
AetherDriveThrustDirectionX = state.AetherDriveThrustDirectionX,
|
||||
AetherDriveThrustDirectionY = state.AetherDriveThrustDirectionY
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -703,6 +703,42 @@ public sealed class AetheriaBehaviorStateSnapshot
|
|||
|
||||
[Key(18)]
|
||||
public double CapacitorEfficiency { get; set; }
|
||||
|
||||
[Key(19)]
|
||||
public double AetherDriveAxisX { get; set; }
|
||||
|
||||
[Key(20)]
|
||||
public double AetherDriveAxisY { get; set; }
|
||||
|
||||
[Key(21)]
|
||||
public double AetherDriveAxisZ { get; set; }
|
||||
|
||||
[Key(22)]
|
||||
public double AetherDriveThrustX { get; set; }
|
||||
|
||||
[Key(23)]
|
||||
public double AetherDriveThrustY { get; set; }
|
||||
|
||||
[Key(24)]
|
||||
public double AetherDriveThrustZ { get; set; }
|
||||
|
||||
[Key(25)]
|
||||
public double AetherDriveRpmX { get; set; }
|
||||
|
||||
[Key(26)]
|
||||
public double AetherDriveRpmY { get; set; }
|
||||
|
||||
[Key(27)]
|
||||
public double AetherDriveRpmZ { get; set; }
|
||||
|
||||
[Key(28)]
|
||||
public double AetherDriveMaximumRpm { get; set; }
|
||||
|
||||
[Key(29)]
|
||||
public double AetherDriveThrustDirectionX { get; set; }
|
||||
|
||||
[Key(30)]
|
||||
public double AetherDriveThrustDirectionY { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -884,6 +884,24 @@ public class ActionGameManager : MonoBehaviour
|
|||
CapacitorEfficiency = capacitor.Efficiency
|
||||
};
|
||||
}
|
||||
else if (behavior is AetherDrive drive)
|
||||
{
|
||||
state = new AetheriaRuntimeBehaviorStateCommit
|
||||
{
|
||||
AetherDriveAxisX = drive.Axis.x,
|
||||
AetherDriveAxisY = drive.Axis.y,
|
||||
AetherDriveAxisZ = drive.Axis.z,
|
||||
AetherDriveThrustX = drive.Thrust.x,
|
||||
AetherDriveThrustY = drive.Thrust.y,
|
||||
AetherDriveThrustZ = drive.Thrust.z,
|
||||
AetherDriveRpmX = drive.Rpm.x,
|
||||
AetherDriveRpmY = drive.Rpm.y,
|
||||
AetherDriveRpmZ = drive.Rpm.z,
|
||||
AetherDriveMaximumRpm = drive.MaximumRpm,
|
||||
AetherDriveThrustDirectionX = drive.ThrustDirection.x,
|
||||
AetherDriveThrustDirectionY = drive.ThrustDirection.y
|
||||
};
|
||||
}
|
||||
|
||||
if (state == null)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1086,7 +1086,19 @@ namespace GameCult.Aetheria.State.Unity
|
|||
double reactorLoadRatio,
|
||||
double capacitorCharge,
|
||||
double capacitorCapacity,
|
||||
double capacitorEfficiency)
|
||||
double capacitorEfficiency,
|
||||
double aetherDriveAxisX,
|
||||
double aetherDriveAxisY,
|
||||
double aetherDriveAxisZ,
|
||||
double aetherDriveThrustX,
|
||||
double aetherDriveThrustY,
|
||||
double aetherDriveThrustZ,
|
||||
double aetherDriveRpmX,
|
||||
double aetherDriveRpmY,
|
||||
double aetherDriveRpmZ,
|
||||
double aetherDriveMaximumRpm,
|
||||
double aetherDriveThrustDirectionX,
|
||||
double aetherDriveThrustDirectionY)
|
||||
{
|
||||
OwnerKind = ownerKind;
|
||||
OwnerIndex = ownerIndex;
|
||||
|
|
@ -1107,6 +1119,18 @@ namespace GameCult.Aetheria.State.Unity
|
|||
CapacitorCharge = capacitorCharge;
|
||||
CapacitorCapacity = capacitorCapacity;
|
||||
CapacitorEfficiency = capacitorEfficiency;
|
||||
AetherDriveAxisX = aetherDriveAxisX;
|
||||
AetherDriveAxisY = aetherDriveAxisY;
|
||||
AetherDriveAxisZ = aetherDriveAxisZ;
|
||||
AetherDriveThrustX = aetherDriveThrustX;
|
||||
AetherDriveThrustY = aetherDriveThrustY;
|
||||
AetherDriveThrustZ = aetherDriveThrustZ;
|
||||
AetherDriveRpmX = aetherDriveRpmX;
|
||||
AetherDriveRpmY = aetherDriveRpmY;
|
||||
AetherDriveRpmZ = aetherDriveRpmZ;
|
||||
AetherDriveMaximumRpm = aetherDriveMaximumRpm;
|
||||
AetherDriveThrustDirectionX = aetherDriveThrustDirectionX;
|
||||
AetherDriveThrustDirectionY = aetherDriveThrustDirectionY;
|
||||
}
|
||||
|
||||
public string OwnerKind { get; }
|
||||
|
|
@ -1128,5 +1152,17 @@ namespace GameCult.Aetheria.State.Unity
|
|||
public double CapacitorCharge { get; }
|
||||
public double CapacitorCapacity { get; }
|
||||
public double CapacitorEfficiency { get; }
|
||||
public double AetherDriveAxisX { get; }
|
||||
public double AetherDriveAxisY { get; }
|
||||
public double AetherDriveAxisZ { get; }
|
||||
public double AetherDriveThrustX { get; }
|
||||
public double AetherDriveThrustY { get; }
|
||||
public double AetherDriveThrustZ { get; }
|
||||
public double AetherDriveRpmX { get; }
|
||||
public double AetherDriveRpmY { get; }
|
||||
public double AetherDriveRpmZ { get; }
|
||||
public double AetherDriveMaximumRpm { get; }
|
||||
public double AetherDriveThrustDirectionX { get; }
|
||||
public double AetherDriveThrustDirectionY { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -876,7 +876,19 @@ namespace GameCult.Aetheria.State.Unity
|
|||
var capacitorCharge = ReadFieldDouble(ref reader, behaviorFields, 16);
|
||||
var capacitorCapacity = ReadFieldDouble(ref reader, behaviorFields, 17);
|
||||
var capacitorEfficiency = ReadFieldDouble(ref reader, behaviorFields, 18);
|
||||
SkipRemaining(ref reader, behaviorFields, 19);
|
||||
var aetherDriveAxisX = ReadFieldDouble(ref reader, behaviorFields, 19);
|
||||
var aetherDriveAxisY = ReadFieldDouble(ref reader, behaviorFields, 20);
|
||||
var aetherDriveAxisZ = ReadFieldDouble(ref reader, behaviorFields, 21);
|
||||
var aetherDriveThrustX = ReadFieldDouble(ref reader, behaviorFields, 22);
|
||||
var aetherDriveThrustY = ReadFieldDouble(ref reader, behaviorFields, 23);
|
||||
var aetherDriveThrustZ = ReadFieldDouble(ref reader, behaviorFields, 24);
|
||||
var aetherDriveRpmX = ReadFieldDouble(ref reader, behaviorFields, 25);
|
||||
var aetherDriveRpmY = ReadFieldDouble(ref reader, behaviorFields, 26);
|
||||
var aetherDriveRpmZ = ReadFieldDouble(ref reader, behaviorFields, 27);
|
||||
var aetherDriveMaximumRpm = ReadFieldDouble(ref reader, behaviorFields, 28);
|
||||
var aetherDriveThrustDirectionX = ReadFieldDouble(ref reader, behaviorFields, 29);
|
||||
var aetherDriveThrustDirectionY = ReadFieldDouble(ref reader, behaviorFields, 30);
|
||||
SkipRemaining(ref reader, behaviorFields, 31);
|
||||
behaviorStates[behavior] = new AetheriaRuntimeBehaviorStateSnapshot(
|
||||
ownerKind,
|
||||
ownerIndex,
|
||||
|
|
@ -896,7 +908,19 @@ namespace GameCult.Aetheria.State.Unity
|
|||
reactorLoadRatio,
|
||||
capacitorCharge,
|
||||
capacitorCapacity,
|
||||
capacitorEfficiency);
|
||||
capacitorEfficiency,
|
||||
aetherDriveAxisX,
|
||||
aetherDriveAxisY,
|
||||
aetherDriveAxisZ,
|
||||
aetherDriveThrustX,
|
||||
aetherDriveThrustY,
|
||||
aetherDriveThrustZ,
|
||||
aetherDriveRpmX,
|
||||
aetherDriveRpmY,
|
||||
aetherDriveRpmZ,
|
||||
aetherDriveMaximumRpm,
|
||||
aetherDriveThrustDirectionX,
|
||||
aetherDriveThrustDirectionY);
|
||||
}
|
||||
|
||||
return behaviorStates;
|
||||
|
|
|
|||
|
|
@ -752,5 +752,41 @@ namespace GameCult.Aetheria.State.Unity
|
|||
|
||||
[Key(18)]
|
||||
public double CapacitorEfficiency { get; set; }
|
||||
|
||||
[Key(19)]
|
||||
public double AetherDriveAxisX { get; set; }
|
||||
|
||||
[Key(20)]
|
||||
public double AetherDriveAxisY { get; set; }
|
||||
|
||||
[Key(21)]
|
||||
public double AetherDriveAxisZ { get; set; }
|
||||
|
||||
[Key(22)]
|
||||
public double AetherDriveThrustX { get; set; }
|
||||
|
||||
[Key(23)]
|
||||
public double AetherDriveThrustY { get; set; }
|
||||
|
||||
[Key(24)]
|
||||
public double AetherDriveThrustZ { get; set; }
|
||||
|
||||
[Key(25)]
|
||||
public double AetherDriveRpmX { get; set; }
|
||||
|
||||
[Key(26)]
|
||||
public double AetherDriveRpmY { get; set; }
|
||||
|
||||
[Key(27)]
|
||||
public double AetherDriveRpmZ { get; set; }
|
||||
|
||||
[Key(28)]
|
||||
public double AetherDriveMaximumRpm { get; set; }
|
||||
|
||||
[Key(29)]
|
||||
public double AetherDriveThrustDirectionX { get; set; }
|
||||
|
||||
[Key(30)]
|
||||
public double AetherDriveThrustDirectionY { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
plus target entity reference.
|
||||
Sensor, radiator, reactor, and capacitor behaviors publish typed state rows
|
||||
for ping state, radiator temperature/throughput, reactor draw/load, and
|
||||
capacitor charge/capacity/efficiency.
|
||||
capacitor charge/capacity/efficiency. Aether drives publish typed axis,
|
||||
thrust, RPM, maximum RPM, and thrust-direction rows, so rotor simulation
|
||||
state is no longer trapped inside live behavior memory.
|
||||
`RuntimeEntityBlueprint` still exists for construction/loadout projection,
|
||||
but those live hull grids and session scalars are not blueprint fields and
|
||||
cannot be restored by the old blueprint projector path.
|
||||
|
|
@ -801,6 +803,9 @@ First Aetheria surfaces to publish:
|
|||
- Done: extend run checkpoint commits and smoke coverage to carry typed
|
||||
behavior state rows for sensor ping state plus radiator, reactor, and
|
||||
capacitor runtime internals.
|
||||
- Done: extend behavior state rows for AetherDrive axis, thrust, RPM,
|
||||
maximum RPM, and thrust direction, so drive rotor state has a typed
|
||||
snapshot/readback path.
|
||||
- Done: cut live simulation grids out of `RuntimeEntityBlueprint`; loadout
|
||||
and construction templates no longer capture or restore temperature,
|
||||
armor, max-armor, or hull-conductivity state.
|
||||
|
|
|
|||
Loading…
Reference in a new issue