Persist behavior runtime state in checkpoints
This commit is contained in:
parent
f98f650ab5
commit
16a92b0173
8 changed files with 311 additions and 6 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -488,6 +488,9 @@ public sealed class AetheriaEntitySnapshot
|
|||
|
||||
[Key(22)]
|
||||
public AetheriaWeaponStateSnapshot[] WeaponStates { get; set; } = [];
|
||||
|
||||
[Key(23)]
|
||||
public AetheriaBehaviorStateSnapshot[] BehaviorStates { get; set; } = [];
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
@ -614,6 +617,67 @@ public sealed class AetheriaWeaponStateSnapshot
|
|||
public double AmmoIntervalProgress { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaBehaviorStateSnapshot
|
||||
{
|
||||
[Key(0)]
|
||||
public string OwnerKind { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public int OwnerIndex { get; set; } = -1;
|
||||
|
||||
[Key(2)]
|
||||
public int BehaviorIndex { get; set; } = -1;
|
||||
|
||||
[Key(3)]
|
||||
public string BehaviorKind { get; set; } = "";
|
||||
|
||||
[Key(4)]
|
||||
public bool Pinging { get; set; }
|
||||
|
||||
[Key(5)]
|
||||
public double PingCooldown { get; set; }
|
||||
|
||||
[Key(6)]
|
||||
public double PingLerp { get; set; }
|
||||
|
||||
[Key(7)]
|
||||
public double PingRadius { get; set; }
|
||||
|
||||
[Key(8)]
|
||||
public int PingedEntityCount { get; set; }
|
||||
|
||||
[Key(9)]
|
||||
public double RadiatorTemperature { get; set; }
|
||||
|
||||
[Key(10)]
|
||||
public double Emissivity { get; set; }
|
||||
|
||||
[Key(11)]
|
||||
public double PumpedHeat { get; set; }
|
||||
|
||||
[Key(12)]
|
||||
public double WasteHeat { get; set; }
|
||||
|
||||
[Key(13)]
|
||||
public double EnergyUsage { get; set; }
|
||||
|
||||
[Key(14)]
|
||||
public double ReactorDraw { get; set; }
|
||||
|
||||
[Key(15)]
|
||||
public double ReactorLoadRatio { get; set; }
|
||||
|
||||
[Key(16)]
|
||||
public double CapacitorCharge { get; set; }
|
||||
|
||||
[Key(17)]
|
||||
public double CapacitorCapacity { get; set; }
|
||||
|
||||
[Key(18)]
|
||||
public double CapacitorEfficiency { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaActionBarBinding
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue