Persist entity simulation grids in checkpoints

This commit is contained in:
Meta Vens 2026-06-14 13:03:57 +01:00
commit f276f9bcb3
7 changed files with 140 additions and 14 deletions

View file

@ -424,10 +424,25 @@ public static class AetheriaRuntimeCommitLogApplier
.ToArray(),
WeaponGroups = ToIntArrayArray(entity.WeaponGroups)
.Select(group => new AetheriaWeaponGroupSnapshot { EquipmentIndices = group })
.ToArray()
.ToArray(),
StatGrids = ToEntityStatGrids(entity.StatGrids)
};
}
private static AetheriaEntityStatGrid[] ToEntityStatGrids(
IReadOnlyList<AetheriaRuntimeEntityStatGridCommit>? grids)
{
return (grids ?? Array.Empty<AetheriaRuntimeEntityStatGridCommit>())
.Select(grid => new AetheriaEntityStatGrid
{
Name = grid.Name ?? "",
Width = grid.Width,
Height = grid.Height,
Values = (grid.Values ?? Array.Empty<double>()).ToArray()
})
.ToArray();
}
private static int[] ToIntArray(IReadOnlyList<int>? values)
{
return (values ?? Array.Empty<int>()).ToArray();