Add ConVar to control view kick

► Added sv_melee_viewkick defaulted to 0 to control view kick.
This commit is contained in:
speedvoltage 2025-03-14 23:33:44 +01:00
parent 6e71a8ad85
commit f54f2d1cfa
5 changed files with 12 additions and 4 deletions

View file

@ -22,4 +22,10 @@ ConVar mp_ready_signal(
"mp_ready_signal",
"ready",
FCVAR_GAMEDLL,
"Text that each player must speak for the match to begin" );
"Text that each player must speak for the match to begin" );
ConVar sv_melee_viewkick(
"sv_melee_viewkick",
"0",
FCVAR_REPLICATED,
"Adds melee view kick" );

View file

@ -16,5 +16,6 @@
extern ConVar mp_restartround;
extern ConVar mp_readyrestart;
extern ConVar mp_ready_signal;
extern ConVar sv_melee_viewkick;
#endif //HL2MP_CVARS_H

View file

@ -51,7 +51,6 @@ extern CBaseEntity *g_pLastRebelSpawn;
#endif
REGISTER_GAMERULES_CLASS( CHL2MPRules );
BEGIN_NETWORK_TABLE_NOBASE( CHL2MPRules, DT_HL2MPRules )

View file

@ -21,6 +21,7 @@
#include "ndebugoverlay.h"
#include "te_effect_dispatch.h"
#include "ilagcompensationmanager.h"
#include "hl2mp_cvars.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
@ -135,7 +136,8 @@ void CBaseHL2MPBludgeonWeapon::Hit( trace_t &traceHit, Activity nHitActivity )
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
//Do view kick
AddViewKick();
if ( sv_melee_viewkick.GetBool() )
AddViewKick();
CBaseEntity *pHitEntity = traceHit.m_pEnt;

View file

@ -77,7 +77,7 @@ public:
float GetRange( void ) { return STUNSTICK_RANGE; }
float GetFireRate( void ) { return STUNSTICK_REFIRE; }
void AddViewKick( void ); // should be client-side, much like the crowbar
void AddViewKick( void );
bool Deploy( void );
bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );