Run body and fire phases during scripted control locks
This commit is contained in:
1 parent
5876da112c
commit
c285b57091
35 files changed
+1503
-45
No files matched your search
@@ -10,6 +10,8 @@ var tests = new (string Name, Action Check)[]
|
||||
("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),
|
||||
("script preparation preserves queued work and uncontrolled physics consumes it", UncontrolledPhysics),
|
||||
("uncontrolled fire ticks while movement and grounded-release reset are gated", UncontrolledFire),
|
||||
("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),
|
||||
@@ -103,6 +105,60 @@ static void FrameOrdering()
|
||||
Check(jump.MovementMode == 0, "reset restores stored walking input mode");
|
||||
}
|
||||
|
||||
static void UncontrolledPhysics()
|
||||
{
|
||||
var cameraQueries = 0;
|
||||
var simulation = FlatSimulation(cameraRay: (_, _) => { cameraQueries++; return null; });
|
||||
simulation.Step(new(true, false, false, false, true));
|
||||
var pending = simulation.PendingImpulse;
|
||||
var mode = simulation.MovementMode; var jump = simulation.JumpState;
|
||||
var hold = simulation.JumpHoldSeconds; var fire = simulation.JetpackRemaining;
|
||||
var before = simulation.Position;
|
||||
simulation.PrepareForScript();
|
||||
Check(simulation.Speed == 0 && simulation.Velocity == Vector3.Zero && simulation.PendingImpulse == pending,
|
||||
"43A750 zeros speed/velocity while queued impulse survives");
|
||||
Check(simulation.MovementMode == mode && simulation.JumpState == jump && simulation.JumpHoldSeconds == hold
|
||||
&& simulation.JetpackRemaining == fire, "Preparation does not invent a mode/jump/hold/fire reset");
|
||||
var queries = cameraQueries;
|
||||
for (var tick = 0; tick < 8; tick++) simulation.Step(new(true, false, true, false, true), controlled: false);
|
||||
Check(simulation.Position.Y > before.Y && simulation.PendingImpulse == Vector3.Zero,
|
||||
"Uncontrolled body consumes the queued impulse once and keeps integrating");
|
||||
Check(simulation.Jumps == 1 && simulation.ControllerSteps == 1 && simulation.Speed == 0 && simulation.TurnRate == 0
|
||||
&& simulation.JumpState == jump && simulation.MovementMode == mode && simulation.JumpHoldSeconds == hold,
|
||||
"Held movement/turn/jump cannot enter the uncontrolled controller");
|
||||
Check(simulation.PhysicsSteps == 9 && simulation.EffectSteps == 9 && simulation.Steps == 9,
|
||||
"Body and fire callbacks remain distinct from controlled movement count");
|
||||
Check(cameraQueries == queries, "Uncontrolled input does not advance the follow-camera query");
|
||||
simulation.ApplyAuthoredTransform(simulation.ActorRoot + new Vector3(25, 0, 30), 85);
|
||||
Check(simulation.Velocity.Y > 0 && simulation.Jumps == 1,
|
||||
"Authored transform write is separate from body preparation");
|
||||
}
|
||||
|
||||
static void UncontrolledFire()
|
||||
{
|
||||
foreach (var code in new[] { "LV1B", "VR04" })
|
||||
{
|
||||
var simulation = FlatSimulation(); simulation.LevelCode = code;
|
||||
simulation.ApplyRetainedLevelState(new("LV1B", 3, 1, .625f, 6.125f));
|
||||
simulation.RestoreReturnRoot(simulation.ActorRoot + Vector3.UnitY * 500);
|
||||
var energy = simulation.Energy;
|
||||
simulation.PrepareForScript();
|
||||
simulation.Step(new(true, false, true, false, true), controlled: false);
|
||||
Near(simulation.JetpackRemaining, 6.125f - FixedStepClock.Step, .00001f, "Owned fire time continues during control lock");
|
||||
Near(simulation.Energy, code == "VR04" ? energy : energy - FixedStepClock.Step * .5f, .00001f,
|
||||
"Fire drain and tutorial immunity do not depend on raw control");
|
||||
Check(simulation.ControllerSteps == 0 && simulation.JumpState == 0 && simulation.MovementMode == 1
|
||||
&& simulation.JumpHoldSeconds == .625f && simulation.JetpackEffectVisible, "Controller scalars untouched while fire remains visible");
|
||||
}
|
||||
var grounded = FlatSimulation();
|
||||
grounded.ApplyRetainedLevelState(new("LV1B", 3, 1, .625f, 6.125f));
|
||||
grounded.Step(default, controlled: false);
|
||||
Check(grounded.Grounded && grounded.MovementMode == 1 && grounded.JetpackRemaining < 0
|
||||
&& grounded.Energy == 20, "Grounded fire clears independently of the gated grounded-release controller");
|
||||
grounded.Step(default);
|
||||
Check(grounded.MovementMode == 0 && grounded.ControllerSteps == 1, "Normal grounded-release reset resumes with control");
|
||||
}
|
||||
|
||||
static void RetainedLevelState()
|
||||
{
|
||||
var state = new PlayerLevelState("LV1B", 3, 1, .625f, 6.125f);
|
||||
|
||||
Reference in new issue
Block a user