Skip to content

Commit

Permalink
Fix JS exploit
Browse files Browse the repository at this point in the history
  • Loading branch information
zer0k-z committed Nov 27, 2024
1 parent dba8f07 commit ce38b44
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/movement/mv_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}

0 comments on commit ce38b44

Please sign in to comment.