physics: send MSG_MOVE_JUMP on knockback to set FALLING flag correctly

applyKnockBack() sets grounded=false and applies vertical velocity, but
the normal jump detection path (nowJump && !wasJumping && grounded) never
fires during a server-driven knockback because no jump key is pressed.

Without MSG_MOVE_JUMP the game_handler never sets MovementFlags::FALLING
in movementInfo.flags, so all subsequent heartbeat packets carry incorrect
flags — the server sees the player as grounded while airborne.

Fix: fire movementCallback(MSG_MOVE_JUMP) directly from applyKnockBack()
so the FALLING flag is set immediately. MSG_MOVE_FALL_LAND is already sent
when grounded becomes true again (the existing wasFalling && grounded path).
This commit is contained in:
Kelsi 2026-03-10 12:30:13 -07:00
parent c622fde7be
commit 70abb12398

View file

@ -2124,6 +2124,13 @@ void CameraController::applyKnockBack(float vcos, float vsin, float hspeed, floa
grounded = false;
coyoteTimer = 0.0f;
jumpBufferTimer = 0.0f;
// Notify the server that the player left the ground so the FALLING flag is
// set in subsequent movement heartbeats. The normal jump detection
// (nowJump && grounded) does not fire during a server-driven knockback.
if (movementCallback) {
movementCallback(static_cast<uint32_t>(game::Opcode::MSG_MOVE_JUMP));
}
}
} // namespace rendering