NEO-93: Reset LastAdvancedUtc on dev fixture runtime clear.
Fixture reset cleared NPC rows but left a stale lazy-tick marker, causing catch-up bursts after re-acquire. Reset to MinValue with prototype rows. Co-authored-by: Cursor <cursoragent@cursor.com>pull/131/head
parent
9fa0fbef4b
commit
83d1bb13e4
|
|
@ -78,6 +78,8 @@ public sealed class InMemoryNpcRuntimeStateStoreTests
|
|||
Assert.Equal(NpcBehaviorState.Idle, snapshot.BehaviorState);
|
||||
Assert.Null(snapshot.ActiveTelegraph);
|
||||
}
|
||||
|
||||
Assert.Equal(DateTimeOffset.MinValue, store.LastAdvancedUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -258,4 +258,23 @@ public sealed class NpcRuntimeOperationsTests
|
|||
Assert.Equal(NpcBehaviorState.Recover, snapshot.BehaviorState);
|
||||
Assert.Equal(T0.AddSeconds(9), snapshot.PhaseStartedUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResetAllPrototypeRows_ShouldClearLastAdvancedUtc_ForFreshAdvanceBaseline()
|
||||
{
|
||||
// Arrange
|
||||
var (runtime, threat, behavior) = CreateFixture();
|
||||
SetHolder(threat, PrototypeNpcRegistry.PrototypeNpcMeleeId);
|
||||
Advance(T0, runtime, threat, behavior);
|
||||
runtime.LastAdvancedUtc = T0.AddHours(1);
|
||||
NpcRuntimeOperations.ResetAllPrototypeRows(runtime);
|
||||
SetHolder(threat, PrototypeNpcRegistry.PrototypeNpcMeleeId);
|
||||
// Act
|
||||
Advance(T0.AddHours(1).AddSeconds(10), runtime, threat, behavior, maxDeltaSeconds: 5);
|
||||
// Assert
|
||||
runtime.TryGet(PrototypeNpcRegistry.PrototypeNpcMeleeId, out var snapshot);
|
||||
Assert.Equal(NpcBehaviorState.Aggro, snapshot.BehaviorState);
|
||||
Assert.Equal(T0.AddHours(1).AddSeconds(10), snapshot.PhaseStartedUtc);
|
||||
Assert.Equal(T0.AddHours(1).AddSeconds(10), runtime.LastAdvancedUtc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ public sealed class InMemoryNpcRuntimeStateStore : INpcRuntimeStateStore
|
|||
{
|
||||
_ = TryResetPrototypeRow(npcInstanceId);
|
||||
}
|
||||
|
||||
LastAdvancedUtc = DateTimeOffset.MinValue;
|
||||
}
|
||||
|
||||
private static string NormalizeNpcInstanceId(string? npcInstanceId) =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue