From ce38b4431fa8af5dd21b9374410be25d0d6c9ad2 Mon Sep 17 00:00:00 2001 From: "zer0.k" <zer0kams@gmail.com> Date: Wed, 27 Nov 2024 18:17:34 +0100 Subject: [PATCH] Fix JS exploit --- src/movement/mv_player.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/movement/mv_player.cpp b/src/movement/mv_player.cpp index 2c858887..822cdcc4 100644 --- a/src/movement/mv_player.cpp +++ b/src/movement/mv_player.cpp @@ -383,6 +383,7 @@ void MovementPlayer::Reset() this->pendingEndTouchTriggers.RemoveAll(); this->touchedTriggers.RemoveAll(); this->collidingWithWorld = false; + this->previousOnGround = false; } META_RES MovementPlayer::GetPlayerMaxSpeed(f32 &maxSpeed) @@ -406,9 +407,24 @@ void MovementPlayer::OnPhysicsSimulate() { this->OnChangeMoveType(this->lastKnownMoveType); } + bool onGround = this->GetPlayerPawn()->m_fFlags() & FL_ONGROUND; + if (!this->previousOnGround && onGround) + { + Vector velocity; + this->GetVelocity(&velocity); + this->RegisterLanding(velocity, false); + this->OnStartTouchGround(); + } + else if (this->previousOnGround && !onGround) + { + this->RegisterTakeoff(false); + this->takeoffFromLadder = false; + this->OnStopTouchGround(); + } } void MovementPlayer::OnPhysicsSimulatePost() { this->lastKnownMoveType = this->GetMoveType(); + this->previousOnGround = this->GetPlayerPawn()->m_fFlags() & FL_ONGROUND; }