Run body and fire phases during scripted control locks

This commit is contained in:
UnixNight committed 2026-10-26 12:21:25 -04:00
1 parent 5876da112c
commit c285b57091
35 files changed
+1503 -45

No files matched your search

+31 -6
View File
@@ -57,6 +57,9 @@ public sealed class LabSimulation
: jumpState.JumpState == 3 && jumpState.EffectRemaining > 0 ? PlayerPose.Fly
: !forceFall && Velocity.Y > 0 ? PlayerPose.Jump : PlayerPose.Fall;
public int Steps { get; private set; }
public int PhysicsSteps { get; private set; }
public int ControllerSteps { get; private set; }
public int EffectSteps { get; private set; }
public int Jumps { get; private set; }
public int Landings { get; private set; }
public int WallHits { get; private set; }
@@ -103,6 +106,7 @@ public sealed class LabSimulation
Grounded = true;
Noclip = HasNoclipEntry = false;
Steps = Jumps = Landings = WallHits = 0;
PhysicsSteps = ControllerSteps = EffectSteps = 0;
Travel = MaximumRise = 0;
CameraEye = DesiredEye().Eye;
}
@@ -144,21 +148,41 @@ public sealed class LabSimulation
return ((float)Math.Sin(radians), (float)Math.Cos(radians));
}
public void Step(PlayerInput input)
public void Step(PlayerInput input, bool controlled = true)
{
if (Noclip) { StepNoclip(input); return; }
//47E554 global body integration precedes473740 registry callbacks.
// This reconstructs the player/input/fire partial order, not the full
// scene registry, original cadence or original collision response.
StepPhysics();
if (!InputAfterPlayerUpdate) StepInput(input);
StepPlayer(input);
//42469F..4246DC reasserts ordinary grounded radius before ownership
//checks. The scooter's separate radius160 policy remains unimplemented.
if (Grounded) InteractionRadius = 60;
if (controlled && !InputAfterPlayerUpdate) StepInput(input);
if (controlled) StepPlayer(input);
var effect = JetpackBurst.StepEffect(jumpState, Grounded, FixedStepClock.Step, Energy, LevelCode);
jumpState = effect.State; Energy = effect.Energy; JetpackEffectVisible = effect.Visible;
if (InputAfterPlayerUpdate) StepInput(input);
EffectSteps++;
if (controlled && InputAfterPlayerUpdate) StepInput(input);
Steps++;
}
/// <summary>43A750 preparation clears speed and velocity XYZ only. Queued
/// impulse, acceleration, mode, jump/hold and owned fire timer survive.</summary>
public void PrepareForScript()
{
Speed = 0; Velocity = Vector3.Zero;
}
/// <summary>Authored AI root/Euler writes. They do not reset body motion or
/// destination yaw61C; the full logical/render Euler model remains separate.</summary>
public void ApplyAuthoredTransform(Vector3 root, float yaw)
{
if (!float.IsFinite(root.X) || !float.IsFinite(root.Y) || !float.IsFinite(root.Z) || !float.IsFinite(yaw))
throw new ArgumentOutOfRangeException(nameof(root));
Position = root - Vector3.UnitY * rootHeight; Yaw = yaw;
}
/// <summary>Modern debug movement; never serialized into original save state.</summary>
public bool SetNoclip(bool enabled)
{
@@ -239,6 +263,7 @@ public sealed class LabSimulation
private void StepPlayer(PlayerInput input)
{
ControllerSteps++;
const float dt = FixedStepClock.Step;
var yawError = MathF.IEEERemainder(targetYaw - Yaw, 360);
Yaw = (Yaw + yawError * dt * 3.7f) % 360;
@@ -249,7 +274,6 @@ public sealed class LabSimulation
{
movementMode = 0; TurnRate = 0;
}
if (Grounded) InteractionRadius = 60;
if (Velocity.LengthSquared() != 0 || movementMode == 0 && lateralContribution != 0)
Yaw = (Yaw + TurnRate * dt) % 360;
var (sin, cos) = Trig(Yaw);
@@ -277,6 +301,7 @@ public sealed class LabSimulation
private void StepPhysics()
{
PhysicsSteps++;
const float dt = FixedStepClock.Step;
var wasGrounded = Grounded;
var velocity = Velocity;
@@ -338,5 +363,5 @@ public sealed class LabSimulation
step is >= 80 and < 120, step is >= 60 and < 95, false, step < 180);
public bool SmokePassed => Steps >= 240 && Travel > 50 && MaximumRise > 20 && Jumps > 0 && Landings > 0 && Grounded;
public string Report => $"Walk checkpoint: steps={Steps}, travel={Travel:F2}, jumps={Jumps}, landings={Landings}, max rise={MaximumRise:F2}, wall hits={WallHits}, grounded={Grounded}, feet={Position}.";
public string Report => $"Walk checkpoint: steps={Steps}, controller={ControllerSteps}, physics={PhysicsSteps}, effect={EffectSteps}, travel={Travel:F2}, jumps={Jumps}, landings={Landings}, max rise={MaximumRise:F2}, wall hits={WallHits}, grounded={Grounded}, feet={Position}.";
}