Persist stat modifier state in typed snapshots
This commit is contained in:
parent
19fdaab6ab
commit
cd009fa9a9
11 changed files with 90 additions and 8 deletions
Binary file not shown.
|
|
@ -345,6 +345,16 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
BehaviorIndex = 8,
|
||||
BehaviorKind = "Trigger",
|
||||
TriggerPulled = true
|
||||
},
|
||||
new AetheriaBehaviorStateSnapshot
|
||||
{
|
||||
OwnerKind = "equipment",
|
||||
OwnerIndex = 0,
|
||||
BehaviorIndex = 9,
|
||||
BehaviorKind = "StatModifier",
|
||||
StatModifierApplied = true,
|
||||
StatModifierExecuted = true,
|
||||
StatModifierTargetStatCount = 2
|
||||
}
|
||||
],
|
||||
StatGrids =
|
||||
|
|
@ -608,7 +618,7 @@ 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 != 9 ||
|
||||
entitySnapshot.BehaviorStates.Length != 10 ||
|
||||
entitySnapshot.BehaviorStates[0].BehaviorKind != "AetherDrive" ||
|
||||
entitySnapshot.BehaviorStates[0].AetherDriveAxisX != 0.5 ||
|
||||
entitySnapshot.BehaviorStates[0].AetherDriveRpmY != 900.0 ||
|
||||
|
|
@ -637,6 +647,10 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
|
|||
!entitySnapshot.BehaviorStates[7].SwitchActivated ||
|
||||
entitySnapshot.BehaviorStates[8].BehaviorKind != "Trigger" ||
|
||||
!entitySnapshot.BehaviorStates[8].TriggerPulled ||
|
||||
entitySnapshot.BehaviorStates[9].BehaviorKind != "StatModifier" ||
|
||||
!entitySnapshot.BehaviorStates[9].StatModifierApplied ||
|
||||
!entitySnapshot.BehaviorStates[9].StatModifierExecuted ||
|
||||
entitySnapshot.BehaviorStates[9].StatModifierTargetStatCount != 2 ||
|
||||
entitySnapshot.StatGrids.Length != 1 ||
|
||||
entitySnapshot.StatGrids[0].Values.Length != 4)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -574,6 +574,16 @@ try
|
|||
BehaviorIndex = 0,
|
||||
BehaviorKind = "Trigger",
|
||||
TriggerPulled = true
|
||||
},
|
||||
new AetheriaRuntimeBehaviorStateCommit
|
||||
{
|
||||
OwnerKind = "equipment",
|
||||
OwnerIndex = 13,
|
||||
BehaviorIndex = 0,
|
||||
BehaviorKind = "StatModifier",
|
||||
StatModifierApplied = true,
|
||||
StatModifierExecuted = true,
|
||||
StatModifierTargetStatCount = 2
|
||||
}
|
||||
},
|
||||
StatGrids = new[]
|
||||
|
|
@ -694,7 +704,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 == 13 &&
|
||||
entity.BehaviorStates.Length == 14 &&
|
||||
entity.BehaviorStates[0].BehaviorKind == "Sensor" &&
|
||||
entity.BehaviorStates[0].Pinging &&
|
||||
entity.BehaviorStates[0].PingRadius == 1200.0 &&
|
||||
|
|
@ -735,6 +745,10 @@ try
|
|||
entity.BehaviorStates[11].SwitchActivated &&
|
||||
entity.BehaviorStates[12].BehaviorKind == "Trigger" &&
|
||||
entity.BehaviorStates[12].TriggerPulled &&
|
||||
entity.BehaviorStates[13].BehaviorKind == "StatModifier" &&
|
||||
entity.BehaviorStates[13].StatModifierApplied &&
|
||||
entity.BehaviorStates[13].StatModifierExecuted &&
|
||||
entity.BehaviorStates[13].StatModifierTargetStatCount == 2 &&
|
||||
entity.WeaponGroups.Length == 1 &&
|
||||
entity.StatGrids.Length == 2 &&
|
||||
entity.StatGrids.Any(grid => grid.Name == "temperature" && grid.Values.Length == 2 && grid.Values[1] == 281.0) &&
|
||||
|
|
@ -790,7 +804,7 @@ 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 != 13 ||
|
||||
packageEntities[0].BehaviorStates.Count != 14 ||
|
||||
packageEntities[0].BehaviorStates[3].CapacitorCharge != 7.5 ||
|
||||
packageEntities[0].BehaviorStates[4].AetherDriveRpmY != 900.0 ||
|
||||
packageEntities[0].BehaviorStates[4].AetherDriveMaximumRpm != 2400.0 ||
|
||||
|
|
@ -805,6 +819,8 @@ try
|
|||
packageEntities[0].BehaviorStates[10].ThermotoggleTargetTemperature != 315.5 ||
|
||||
!packageEntities[0].BehaviorStates[11].SwitchActivated ||
|
||||
!packageEntities[0].BehaviorStates[12].TriggerPulled ||
|
||||
!packageEntities[0].BehaviorStates[13].StatModifierApplied ||
|
||||
packageEntities[0].BehaviorStates[13].StatModifierTargetStatCount != 2 ||
|
||||
packageEntities[0].StatGrids.Count != 2 ||
|
||||
packageEntities[0].StatGrids.All(grid => grid.Name != "temperature" || grid.Values.Count != 2 || grid.Values[1] != 281.0))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -516,7 +516,10 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
VelocityLimit = state.VelocityLimit,
|
||||
ThermotoggleTargetTemperature = state.ThermotoggleTargetTemperature,
|
||||
SwitchActivated = state.SwitchActivated,
|
||||
TriggerPulled = state.TriggerPulled
|
||||
TriggerPulled = state.TriggerPulled,
|
||||
StatModifierApplied = state.StatModifierApplied,
|
||||
StatModifierExecuted = state.StatModifierExecuted,
|
||||
StatModifierTargetStatCount = state.StatModifierTargetStatCount
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -793,6 +793,15 @@ public sealed class AetheriaBehaviorStateSnapshot
|
|||
|
||||
[Key(48)]
|
||||
public bool TriggerPulled { get; set; }
|
||||
|
||||
[Key(49)]
|
||||
public bool StatModifierApplied { get; set; }
|
||||
|
||||
[Key(50)]
|
||||
public bool StatModifierExecuted { get; set; }
|
||||
|
||||
[Key(51)]
|
||||
public int StatModifierTargetStatCount { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -972,6 +972,15 @@ public class ActionGameManager : MonoBehaviour
|
|||
TriggerPulled = trigger.Pulled
|
||||
};
|
||||
}
|
||||
else if (behavior is StatModifier statModifier)
|
||||
{
|
||||
state = new AetheriaRuntimeBehaviorStateCommit
|
||||
{
|
||||
StatModifierApplied = statModifier.Applied,
|
||||
StatModifierExecuted = statModifier.Executed,
|
||||
StatModifierTargetStatCount = statModifier.TargetStatCount
|
||||
};
|
||||
}
|
||||
|
||||
if (state == null)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ public class StatModifier : Behavior, IInitializableBehavior, IDisposable, IAlwa
|
|||
private bool _applied;
|
||||
private bool _executed;
|
||||
|
||||
public bool Applied => _applied;
|
||||
public bool Executed => _executed;
|
||||
public int TargetStatCount => _stats?.Length ?? 0;
|
||||
|
||||
public StatModifier(StatModifierData data, EquippedItem item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
|
|
|
|||
|
|
@ -1116,7 +1116,10 @@ namespace GameCult.Aetheria.State.Unity
|
|||
double velocityLimit,
|
||||
double thermotoggleTargetTemperature,
|
||||
bool switchActivated,
|
||||
bool triggerPulled)
|
||||
bool triggerPulled,
|
||||
bool statModifierApplied,
|
||||
bool statModifierExecuted,
|
||||
int statModifierTargetStatCount)
|
||||
{
|
||||
OwnerKind = ownerKind;
|
||||
OwnerIndex = ownerIndex;
|
||||
|
|
@ -1167,6 +1170,9 @@ namespace GameCult.Aetheria.State.Unity
|
|||
ThermotoggleTargetTemperature = thermotoggleTargetTemperature;
|
||||
SwitchActivated = switchActivated;
|
||||
TriggerPulled = triggerPulled;
|
||||
StatModifierApplied = statModifierApplied;
|
||||
StatModifierExecuted = statModifierExecuted;
|
||||
StatModifierTargetStatCount = statModifierTargetStatCount;
|
||||
}
|
||||
|
||||
public string OwnerKind { get; }
|
||||
|
|
@ -1218,5 +1224,8 @@ namespace GameCult.Aetheria.State.Unity
|
|||
public double ThermotoggleTargetTemperature { get; }
|
||||
public bool SwitchActivated { get; }
|
||||
public bool TriggerPulled { get; }
|
||||
public bool StatModifierApplied { get; }
|
||||
public bool StatModifierExecuted { get; }
|
||||
public int StatModifierTargetStatCount { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -906,7 +906,10 @@ namespace GameCult.Aetheria.State.Unity
|
|||
var thermotoggleTargetTemperature = ReadFieldDouble(ref reader, behaviorFields, 46);
|
||||
var switchActivated = ReadFieldBool(ref reader, behaviorFields, 47);
|
||||
var triggerPulled = ReadFieldBool(ref reader, behaviorFields, 48);
|
||||
SkipRemaining(ref reader, behaviorFields, 49);
|
||||
var statModifierApplied = ReadFieldBool(ref reader, behaviorFields, 49);
|
||||
var statModifierExecuted = ReadFieldBool(ref reader, behaviorFields, 50);
|
||||
var statModifierTargetStatCount = ReadFieldInt32(ref reader, behaviorFields, 51);
|
||||
SkipRemaining(ref reader, behaviorFields, 52);
|
||||
behaviorStates[behavior] = new AetheriaRuntimeBehaviorStateSnapshot(
|
||||
ownerKind,
|
||||
ownerIndex,
|
||||
|
|
@ -956,7 +959,10 @@ namespace GameCult.Aetheria.State.Unity
|
|||
velocityLimit,
|
||||
thermotoggleTargetTemperature,
|
||||
switchActivated,
|
||||
triggerPulled);
|
||||
triggerPulled,
|
||||
statModifierApplied,
|
||||
statModifierExecuted,
|
||||
statModifierTargetStatCount);
|
||||
}
|
||||
|
||||
return behaviorStates;
|
||||
|
|
|
|||
|
|
@ -842,5 +842,14 @@ namespace GameCult.Aetheria.State.Unity
|
|||
|
||||
[Key(48)]
|
||||
public bool TriggerPulled { get; set; }
|
||||
|
||||
[Key(49)]
|
||||
public bool StatModifierApplied { get; set; }
|
||||
|
||||
[Key(50)]
|
||||
public bool StatModifierExecuted { get; set; }
|
||||
|
||||
[Key(51)]
|
||||
public int StatModifierTargetStatCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
evaluated thrust, and torque rows. Shields publish evaluated efficiency and
|
||||
energy usage, velocity limiters publish evaluated limit, and thermotoggles
|
||||
publish their active target temperature. Switches publish activated state,
|
||||
and triggers publish pending pulled state.
|
||||
triggers publish pending pulled state, and stat modifiers publish
|
||||
applied/executed flags plus target-stat count.
|
||||
`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.
|
||||
|
|
@ -825,6 +826,8 @@ First Aetheria surfaces to publish:
|
|||
VelocityLimit limit, and Thermotoggle target temperature.
|
||||
- Done: extend behavior state rows for Switch activation and Trigger
|
||||
pending pull state.
|
||||
- Done: extend behavior state rows for StatModifier applied/executed flags
|
||||
and target-stat count.
|
||||
- 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