feat(movement): wire server RunRate into player MotionInterpreter

Parse ForwardSpeed from UpdateMotion (0xF74C) InterpretedMotionState.
Feed server-echoed RunRate into the player's MotionInterpreter so
get_state_velocity produces the correct speed. Previously hardcoded
at 1.0 (4.0 m/s), now matches character's Run skill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-13 23:11:49 +02:00
parent 4988ea02c0
commit c7fa1d36fb
5 changed files with 71 additions and 7 deletions

View file

@ -651,4 +651,22 @@ public sealed class MotionInterpreterTests
Assert.Equal(2.0f, interp.MyRunRate, precision: 5);
}
[Fact]
public void ApplyCurrentMovement_RunForward_SetsMyRunRate()
{
// Verifies that wiring a server-echoed ForwardSpeed (from UpdateMotion
// 0xF74C InterpretedMotionState flag 0x10) into the MotionInterpreter
// produces the correct MyRunRate and get_state_velocity result.
var body = new PhysicsBody();
var mi = new MotionInterpreter(body);
mi.InterpretedState.ForwardCommand = MotionCommand.RunForward;
mi.InterpretedState.ForwardSpeed = 2.375f;
mi.apply_current_movement(cancelMoveTo: false, allowJump: true);
Assert.Equal(2.375f, mi.MyRunRate, precision: 3);
var vel = mi.get_state_velocity();
Assert.Equal(4.0f * 2.375f, vel.Y, precision: 2);
}
}