From 70abb12398ddaa58ea446990a0b62404a2b2dd12 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 10 Mar 2026 12:30:13 -0700 Subject: [PATCH] physics: send MSG_MOVE_JUMP on knockback to set FALLING flag correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- src/rendering/camera_controller.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rendering/camera_controller.cpp b/src/rendering/camera_controller.cpp index bceb41ba..0e6f9f43 100644 --- a/src/rendering/camera_controller.cpp +++ b/src/rendering/camera_controller.cpp @@ -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(game::Opcode::MSG_MOVE_JUMP)); + } } } // namespace rendering