Skip to content

Commit 5f353db

Browse files
committed
gameplay: add a cheat cvar for disabling demoman projectile randomness
Demoman's projectiles (grenades and stickybombs) are coded to have a random launch velocity and random spin however, some competitive environments would like to turn this functionality off for consistency (akin to nospread on hitscan weapons)
1 parent 995e67a commit 5f353db

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/game/shared/tf/tf_weaponbase_gun.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ DEFINE_THINKFUNC( ZoomIn ),
5757
END_DATADESC()
5858
#endif
5959

60+
#ifdef GAME_DLL
61+
ConVar tf_pipebomb_disable_random_launch("tf_pipebomb_disable_random_launch", "0", FCVAR_CHEAT, "Disable random velocity and spin when launching grenades and stickybombs.");
62+
#endif
63+
6064
//=============================================================================
6165
//
6266
// TFWeaponBase Gun functions.
@@ -701,8 +705,11 @@ CBaseEntity *CTFWeaponBaseGun::FirePipeBomb( CTFPlayer *pPlayer, int iPipeBombTy
701705

702706
float flLaunchSpeed = GetProjectileSpeed();
703707
CALL_ATTRIB_HOOK_FLOAT( flLaunchSpeed, mult_projectile_range );
704-
Vector vecVelocity = ( vecForward * flLaunchSpeed ) + ( vecUp * 200.0f ) + ( random->RandomFloat( -10.0f, 10.0f ) * vecRight ) +
705-
( random->RandomFloat( -10.0f, 10.0f ) * vecUp );
708+
Vector vecVelocity = ( vecForward * flLaunchSpeed ) + ( vecUp * 200.0f );
709+
if ( !tf_pipebomb_disable_random_launch.GetBool() )
710+
{
711+
vecVelocity += ( random->RandomFloat( -10.0f, 10.0f ) * vecRight ) + ( random->RandomFloat( -10.0f, 10.0f ) * vecUp );
712+
}
706713

707714
float flMultDmg = 1.f;
708715
CALL_ATTRIB_HOOK_FLOAT( flMultDmg, mult_dmg );
@@ -711,7 +718,7 @@ CBaseEntity *CTFWeaponBaseGun::FirePipeBomb( CTFPlayer *pPlayer, int iPipeBombTy
711718
Vector angImpulse = AngularImpulse( 600, random->RandomInt( -1200, 1200 ), 0 );
712719
int iNoSpin = 0;
713720
CALL_ATTRIB_HOOK_INT( iNoSpin, grenade_no_spin );
714-
if ( iNoSpin )
721+
if ( iNoSpin || tf_pipebomb_disable_random_launch.GetBool() )
715722
{
716723
angImpulse.Zero();
717724
}

0 commit comments

Comments
 (0)