Persist behavior runtime state in checkpoints

This commit is contained in:
Meta Vens 2026-06-14 14:29:04 +01:00
commit 16a92b0173
8 changed files with 311 additions and 6 deletions

View file

@ -442,10 +442,40 @@ public static class AetheriaRuntimeCommitLogApplier
StatGrids = ToEntityStatGrids(entity.StatGrids),
ActiveConsumables = ToActiveConsumables(entity.ActiveConsumables),
BehaviorProgress = ToBehaviorProgress(entity.BehaviorProgress),
WeaponStates = ToWeaponStates(entity.WeaponStates)
WeaponStates = ToWeaponStates(entity.WeaponStates),
BehaviorStates = ToBehaviorStates(entity.BehaviorStates)
};
}
private static AetheriaBehaviorStateSnapshot[] ToBehaviorStates(
IReadOnlyList<AetheriaRuntimeBehaviorStateCommit>? states)
{
return (states ?? Array.Empty<AetheriaRuntimeBehaviorStateCommit>())
.Select(state => new AetheriaBehaviorStateSnapshot
{
OwnerKind = state.OwnerKind ?? "",
OwnerIndex = state.OwnerIndex,
BehaviorIndex = state.BehaviorIndex,
BehaviorKind = state.BehaviorKind ?? "",
Pinging = state.Pinging,
PingCooldown = state.PingCooldown,
PingLerp = state.PingLerp,
PingRadius = state.PingRadius,
PingedEntityCount = state.PingedEntityCount,
RadiatorTemperature = state.RadiatorTemperature,
Emissivity = state.Emissivity,
PumpedHeat = state.PumpedHeat,
WasteHeat = state.WasteHeat,
EnergyUsage = state.EnergyUsage,
ReactorDraw = state.ReactorDraw,
ReactorLoadRatio = state.ReactorLoadRatio,
CapacitorCharge = state.CapacitorCharge,
CapacitorCapacity = state.CapacitorCapacity,
CapacitorEfficiency = state.CapacitorEfficiency
})
.ToArray();
}
private static AetheriaWeaponStateSnapshot[] ToWeaponStates(
IReadOnlyList<AetheriaRuntimeWeaponStateCommit>? states)
{