Recover retained route state and complete PostLoad availability tails

This commit is contained in:
UnixNight committed 2026-10-26 03:58:52 -04:00
1 parent 1dddfefc68
commit 9ad5a8ef6b
36 files changed
+1559 -32

No files matched your search

+33
View File
@@ -9,6 +9,7 @@ var tests = new (string Name, Action Check)[]
("60 simulation calls across 60/120/144 Hz presentation", ClockRates),
("clock remainder, stall bound, reset and invalid intervals", ClockBoundaries),
("physics consumes prior motion; fresh versus retained input order", FrameOrdering),
("ordinary route load retains scalars independently of body/jump reset", RetainedLevelState),
("source camera query origin, hit adjustment, gain and one query per input", CameraQueryConsumer),
("debug noclip bypasses walls/gravity/camera and exits without queued motion", Noclip),
("turn-only speed, forward acceleration/cap and release", SpeedLimits),
@@ -102,6 +103,38 @@ static void FrameOrdering()
Check(jump.MovementMode == 0, "reset restores stored walking input mode");
}
static void RetainedLevelState()
{
var state = new PlayerLevelState("LV1B", 3, 1, .625f, 6.125f);
foreach (var destination in new[] { "VR04", "LV1B", "LEV1" })
{
var next = FlatSimulation(); next.LevelCode = destination; next.InputAfterPlayerUpdate = true;
Check(next.ApplyRetainedLevelState(state), "Proven route accepts supported retained scalars");
Check(next.MovementMode == 1 && next.JumpState == 0 && next.JumpHoldSeconds == .625f
&& next.JetpackRemaining == 6.125f, "Jump reset does not imply mode/hold/fire reset");
Check(next.Speed == 0 && next.TurnRate == 0 && next.Velocity == Vector3.Zero
&& next.PendingImpulse == Vector3.Zero && !next.JetpackEffectVisible, "Body and effect presentation remain independently initialized");
next.RestoreReturnRoot(next.ActorRoot + Vector3.UnitY * 500);
next.Step(default);
Check(!next.Grounded && next.MovementMode == 1 && next.JumpState == 0,
"Airborne first destination tick keeps retained input mode after jump state reset");
Near(next.JetpackRemaining, 6.125f - FixedStepClock.Step, .00001f, "Fire timer advances in its own next-tick phase");
var carried = next.CaptureLevelState(-1)!;
Check(carried.SourceLevel == destination && carried.HoldSeconds == .625f, "Ordinary boundary captures current scalars");
next.Reset();
Check(next.MovementMode == 0 && next.JumpHoldSeconds == 0 && next.JetpackRemaining == 0, "Explicit modern reset clears transient carry state");
}
var grounded = FlatSimulation(); grounded.ApplyRetainedLevelState(state); grounded.Step(default);
Check(grounded.MovementMode == 0 && grounded.JetpackRemaining < 0,
"First grounded released controller/fire ticks clear mode and timer independently of loader");
var unsupported = FlatSimulation();
Check(!unsupported.ApplyRetainedLevelState(state with { SourceLevel = "LEV6" })
&& !unsupported.ApplyRetainedLevelState(state with { SelectedGadget = 0 }), "Unproven class cleanup/level states do not acquire carry policy");
unsupported.SetNoclip(true); Check(unsupported.CaptureLevelState(-1) == null, "Modern noclip does not leak flight into retained gameplay state");
Throws<ArgumentOutOfRangeException>(() => grounded.ApplyRetainedLevelState(state with { HoldSeconds = float.NaN }));
Throws<ArgumentOutOfRangeException>(() => grounded.ApplyRetainedLevelState(state with { EffectRemaining = float.PositiveInfinity }));
}
static void CameraQueryConsumer()
{
var enabled = false;