Persist weapon runtime state in checkpoints

This commit is contained in:
Meta Vens 2026-06-14 14:19:21 +01:00
commit f98f650ab5
10 changed files with 287 additions and 8 deletions

View file

@ -441,10 +441,38 @@ public static class AetheriaRuntimeCommitLogApplier
.ToArray(),
StatGrids = ToEntityStatGrids(entity.StatGrids),
ActiveConsumables = ToActiveConsumables(entity.ActiveConsumables),
BehaviorProgress = ToBehaviorProgress(entity.BehaviorProgress)
BehaviorProgress = ToBehaviorProgress(entity.BehaviorProgress),
WeaponStates = ToWeaponStates(entity.WeaponStates)
};
}
private static AetheriaWeaponStateSnapshot[] ToWeaponStates(
IReadOnlyList<AetheriaRuntimeWeaponStateCommit>? states)
{
return (states ?? Array.Empty<AetheriaRuntimeWeaponStateCommit>())
.Select(state => new AetheriaWeaponStateSnapshot
{
OwnerKind = state.OwnerKind ?? "",
OwnerIndex = state.OwnerIndex,
BehaviorIndex = state.BehaviorIndex,
BehaviorKind = state.BehaviorKind ?? "",
Firing = state.Firing,
Ammo = state.Ammo,
BurstRemaining = state.BurstRemaining,
BurstTimer = state.BurstTimer,
BurstInterval = state.BurstInterval,
CooldownProgress = state.CooldownProgress,
CoolingDown = state.CoolingDown,
Charging = state.Charging,
Charged = state.Charged,
Charge = state.Charge,
Reloading = state.Reloading,
ReloadProgress = state.ReloadProgress,
AmmoIntervalProgress = state.AmmoIntervalProgress
})
.ToArray();
}
private static AetheriaBehaviorProgressSnapshot[] ToBehaviorProgress(
IReadOnlyList<AetheriaRuntimeBehaviorProgressCommit>? progress)
{