Skip to content

Commit

Permalink
Lag-compensate all kinds of melee
Browse files Browse the repository at this point in the history
Previously, only primary attack brawl was lag-compensated.
  • Loading branch information
TomyLobo committed Nov 3, 2018
1 parent 238db2b commit 0eae253
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mp/src/game/server/sdk/sdk_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3787,7 +3787,7 @@ bool CSDKPlayer::WantsLagCompensationOnEntity( const CBasePlayer *pPlayer, const
{
// No need to lag compensate at all if we're not attacking in this command and
// we haven't attacked recently.
if ( !( pCmd->buttons & IN_ATTACK ) && (pCmd->command_number - m_iLastWeaponFireUsercmd > 5) )
if ( !( pCmd->buttons & (IN_ATTACK | IN_ATTACK2)) && (pCmd->command_number - m_iLastWeaponFireUsercmd > 5) )
return false;

if (!pPlayer->IsAlive())
Expand Down
6 changes: 0 additions & 6 deletions mp/src/game/shared/sdk/sdk_weapon_melee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ void CWeaponSDKMelee::ItemPostFrame( void )

void CWeaponSDKMelee::PrimaryAttack()
{

#ifndef CLIENT_DLL
CSDKPlayer *pPlayer = ToSDKPlayer( GetPlayerOwner() );
pPlayer->NoteWeaponFired();
#endif

StartSwing( false );
}

Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/shared/sdk/weapon_sdkbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ void CWeaponSDKBase::StartSwing(bool bIsSecondary, bool bIsStockAttack)
if (pOwner->GetCurrentTime() < m_flNextBrawlTime)
return;

pOwner->NoteWeaponFired();

bool bNeedsUnpause = false;
if (m_bInReload)
{
Expand Down

0 comments on commit 0eae253

Please sign in to comment.