This commit is contained in:
speedvoltage 2025-03-29 21:40:44 +01:00 committed by GitHub
commit ef84a0579c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 6 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 );
bool Deploy( void );
bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
@ -244,9 +244,21 @@ void CWeaponStunStick::ImpactEffect( trace_t &traceHit )
UTIL_ImpactTrace( &traceHit, DMG_CLUB );
}
void CWeaponStunStick::AddViewKick( void )
{
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( pPlayer == NULL )
return;
QAngle punchAng;
punchAng.x = SharedRandomFloat( "crowbarpax", 1.0f, 2.0f );
punchAng.y = SharedRandomFloat( "crowbarpay", -2.0f, -1.0f );
punchAng.z = 0.0f;
pPlayer->ViewPunch( punchAng );
}
#ifndef CLIENT_DLL
int CWeaponStunStick::WeaponMeleeAttack1Condition( float flDot, float flDist )
{
// Attempt to lead the target (needed because citizens can't hit manhacks with the crowbar!)