Skip to content

Commit b49548a

Browse files
committed
Fix reserve ammo disappearing when carrying multiple weapons with the same ammo type
1 parent 6cc2937 commit b49548a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

sp/src/game/shared/hl2/basehlcombatweapon_shared.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ void CBaseHLCombatWeapon::ItemHolsterFrame( void )
6767
if ( GetOwner()->GetActiveWeapon() == this )
6868
return;
6969

70+
#ifdef MAPBASE
71+
if ( GetOwner()->GetActiveWeapon() )
72+
{
73+
// Player can't be holding another weapon that shares our ammo
74+
CBaseCombatWeapon *pWeapon = GetOwner()->GetActiveWeapon();
75+
if ( pWeapon->m_iPrimaryAmmoType == m_iPrimaryAmmoType || pWeapon->m_iSecondaryAmmoType == m_iSecondaryAmmoType )
76+
return;
77+
}
78+
#endif
79+
7080
// If it's been longer than three seconds, reload
7181
if ( ( gpGlobals->curtime - m_flHolsterTime ) > sk_auto_reload_time.GetFloat() )
7282
{

0 commit comments

Comments
 (0)