Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/game/shared/tf/tf_gamemovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ ConVar tf_movement_lost_footing_restick( "tf_movement_lost_footing_restick", "50
ConVar tf_movement_lost_footing_friction( "tf_movement_lost_footing_friction", "0.1", FCVAR_REPLICATED | FCVAR_CHEAT,
"Ground friction for players who have lost their footing" );

// Bunnyhopping related
ConVar tf_restrict_bunnyhopping( "tf_restrict_bunnyhopping", "1", FCVAR_REPLICATED | FCVAR_CHEAT,"Restrict speed gain from bunnyhopping" );
ConVar tf_automatic_bunnyhopping( "tf_automatic_bunnyhopping", "0", FCVAR_REPLICATED | FCVAR_CHEAT,"Automatically bunnyhop when holding jump" );

extern ConVar cl_forwardspeed;
extern ConVar cl_backspeed;
extern ConVar cl_sidespeed;
Expand Down Expand Up @@ -1285,7 +1289,8 @@ bool CTFGameMovement::CheckJumpButton()
return false;

// Cannot jump again until the jump button has been released.
if ( mv->m_nOldButtons & IN_JUMP )
// Unless the automatic bunnyhopping cvar is enabled and the player is on the ground.
if ( mv->m_nOldButtons & IN_JUMP && (!tf_automatic_bunnyhopping.GetBool() || !bOnGround) )
return false;

// In air, so ignore jumps
Expand All @@ -1312,7 +1317,12 @@ bool CTFGameMovement::CheckJumpButton()
return true;
}

PreventBunnyJumping();
// We restrict bunnyhopping by default, the same as base TF2.
// But now the cvar can now be used to disable this restriction.
if ( tf_restrict_bunnyhopping.GetBool() )
{
PreventBunnyJumping();
}

// Start jump animation and player sound (specific TF animation and flags).
m_pTFPlayer->DoAnimationEvent( PLAYERANIMEVENT_JUMP );
Expand Down