mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
physics: block client-side movement when server roots the player
When SMSG_FORCE_MOVE_ROOT sets ROOT in movementInfo.flags, the camera controller was not aware and continued to accept directional input. This caused position desync (client moves, server sees player as rooted). - Add movementRooted_ flag to CameraController with setter/getter. - Block nowForward/nowBackward/nowStrafe when movementRooted_ is set. - Sync isPlayerRooted() from GameHandler to CameraController each frame alongside the existing run-speed sync in application.cpp. - Add GameHandler::isPlayerRooted() convenience accessor.
This commit is contained in:
parent
ea291179dd
commit
21604461fc
4 changed files with 12 additions and 2 deletions
|
|
@ -1009,6 +1009,7 @@ void Application::update(float deltaTime) {
|
|||
runInGameStage("post-update sync", [&] {
|
||||
if (renderer && gameHandler && renderer->getCameraController()) {
|
||||
renderer->getCameraController()->setRunSpeedOverride(gameHandler->getServerRunSpeed());
|
||||
renderer->getCameraController()->setMovementRooted(gameHandler->isPlayerRooted());
|
||||
}
|
||||
|
||||
bool onTaxi = gameHandler &&
|
||||
|
|
|
|||
|
|
@ -275,8 +275,10 @@ void CameraController::update(float deltaTime) {
|
|||
if (mouseAutorun) {
|
||||
autoRunning = false;
|
||||
}
|
||||
bool nowForward = keyW || mouseAutorun || autoRunning;
|
||||
bool nowBackward = keyS;
|
||||
// When the server has rooted the player, suppress all horizontal movement input.
|
||||
const bool movBlocked = movementRooted_;
|
||||
bool nowForward = !movBlocked && (keyW || mouseAutorun || autoRunning);
|
||||
bool nowBackward = !movBlocked && keyS;
|
||||
bool nowStrafeLeft = false;
|
||||
bool nowStrafeRight = false;
|
||||
bool nowTurnLeft = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue