Fixed reloading for certain weapons on certain NPCs

This commit is contained in:
Blixibon 2021-09-28 12:10:25 -05:00
parent 6d04c46dc0
commit 7702ce96d4
2 changed files with 22 additions and 1 deletions

View File

@ -2339,6 +2339,27 @@ bool CBaseCombatWeapon::Reload( void )
return DefaultReload( GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD );
}
#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseCombatWeapon::Reload_NPC( void )
{
WeaponSound( RELOAD_NPC );
if (UsesClipsForAmmo1())
{
m_iClip1 = GetMaxClip1();
}
else
{
// For weapons which don't use clips, give the owner ammo.
if (GetOwner())
GetOwner()->SetAmmoCount( GetDefaultClip1(), m_iPrimaryAmmoType );
}
}
#endif
//=========================================================
void CBaseCombatWeapon::WeaponIdle( void )
{

View File

@ -319,7 +319,7 @@ public:
bool ReloadsSingly( void ) const;
#ifdef MAPBASE
// Originally created for the crossbow, can be used to add special NPC reloading behavior
virtual void Reload_NPC( void ) { WeaponSound(RELOAD_NPC); m_iClip1 = GetMaxClip1(); }
virtual void Reload_NPC( void );
#endif
virtual bool AutoFiresFullClip( void ) { return false; }