Skip to content

Commit ad4ffaf

Browse files
committed
dont stop reloads when attack2 is held
1 parent dc40a95 commit ad4ffaf

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

src/game/shared/tf/tf_weaponbase.cpp

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6742,7 +6742,51 @@ void CTFWeaponBase::CheckReload( void )
67426742
}
67436743
else
67446744
{
6745-
BaseClass::CheckReload();
6745+
if ( m_bReloadsSingly )
6746+
{
6747+
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
6748+
if ( !pOwner )
6749+
return;
6750+
6751+
if ((m_bInReload) && (m_flNextPrimaryAttack <= gpGlobals->curtime))
6752+
{
6753+
// TODO(mcoms): what if we have a secondary fire action?
6754+
if ( pOwner->m_nButtons & IN_ATTACK && m_iClip1 > 0 )
6755+
{
6756+
m_bInReload = false;
6757+
return;
6758+
}
6759+
6760+
// If out of ammo end reload
6761+
if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <=0)
6762+
{
6763+
FinishReload();
6764+
return;
6765+
}
6766+
// If clip not full reload again
6767+
else if (m_iClip1 < GetMaxClip1())
6768+
{
6769+
// Add them to the clip
6770+
m_iClip1 += 1;
6771+
pOwner->RemoveAmmo( 1, m_iPrimaryAmmoType );
6772+
6773+
Reload();
6774+
return;
6775+
}
6776+
// Clip full, stop reloading
6777+
else
6778+
{
6779+
FinishReload();
6780+
m_flNextPrimaryAttack = gpGlobals->curtime;
6781+
m_flNextSecondaryAttack = gpGlobals->curtime;
6782+
return;
6783+
}
6784+
}
6785+
}
6786+
else
6787+
{
6788+
BaseClass::CheckReload();
6789+
}
67466790
}
67476791
}
67486792

0 commit comments

Comments
 (0)