mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 06:45:31 +03:00
Integrated Reload_NPC into more animation events and changed weapon_crossbow to be able to use a bodygroup instead of a skin for the empty bolt
This commit is contained in:
parent
0ce4251ba3
commit
c3176b34d0
@ -9723,7 +9723,7 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent )
|
||||
if ( GetActiveWeapon() )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
GetActiveWeapon()->Reload_NPC();
|
||||
GetActiveWeapon()->Reload_NPC( true );
|
||||
#else
|
||||
GetActiveWeapon()->WeaponSound( RELOAD_NPC );
|
||||
GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1();
|
||||
@ -9747,8 +9747,12 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent )
|
||||
case EVENT_WEAPON_RELOAD_FILL_CLIP:
|
||||
{
|
||||
if ( GetActiveWeapon() )
|
||||
{
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
GetActiveWeapon()->Reload_NPC( false );
|
||||
#else
|
||||
GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1();
|
||||
#endif
|
||||
ClearCondition(COND_LOW_PRIMARY_AMMO);
|
||||
ClearCondition(COND_NO_PRIMARY_AMMO);
|
||||
ClearCondition(COND_NO_SECONDARY_AMMO);
|
||||
|
@ -542,7 +542,7 @@ public:
|
||||
virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
|
||||
virtual bool Reload( void );
|
||||
#ifdef MAPBASE
|
||||
virtual void Reload_NPC( void );
|
||||
virtual void Reload_NPC( bool bPlaySound = true );
|
||||
#endif
|
||||
virtual void ItemPostFrame( void );
|
||||
virtual void ItemBusyFrame( void );
|
||||
@ -819,11 +819,15 @@ bool CWeaponCrossbow::Reload( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CWeaponCrossbow::Reload_NPC( void )
|
||||
void CWeaponCrossbow::Reload_NPC( bool bPlaySound )
|
||||
{
|
||||
BaseClass::Reload_NPC();
|
||||
BaseClass::Reload_NPC( bPlaySound );
|
||||
|
||||
m_nSkin = 0;
|
||||
int iBody = FindBodygroupByName( "bolt" );
|
||||
if (iBody != -1)
|
||||
SetBodygroup( iBody, 0 );
|
||||
else
|
||||
m_nSkin = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -973,7 +977,11 @@ void CWeaponCrossbow::FireNPCBolt( CAI_BaseNPC *pOwner, Vector &vecShootOrigin,
|
||||
|
||||
m_iClip1--;
|
||||
|
||||
m_nSkin = 1;
|
||||
int iBody = FindBodygroupByName( "bolt" );
|
||||
if (iBody != -1)
|
||||
SetBodygroup( iBody, 1 );
|
||||
else
|
||||
m_nSkin = 1;
|
||||
|
||||
WeaponSound( SINGLE_NPC );
|
||||
WeaponSound( SPECIAL2 );
|
||||
|
@ -2374,9 +2374,10 @@ bool CBaseCombatWeapon::Reload( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseCombatWeapon::Reload_NPC( void )
|
||||
void CBaseCombatWeapon::Reload_NPC( bool bPlaySound )
|
||||
{
|
||||
WeaponSound( RELOAD_NPC );
|
||||
if (bPlaySound)
|
||||
WeaponSound( RELOAD_NPC );
|
||||
|
||||
if (UsesClipsForAmmo1())
|
||||
{
|
||||
|
@ -321,7 +321,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 );
|
||||
virtual void Reload_NPC( bool bPlaySound = true );
|
||||
#endif
|
||||
|
||||
virtual bool AutoFiresFullClip( void ) { return false; }
|
||||
|
@ -398,9 +398,10 @@ bool CWeaponCustomScripted::Reload( void )
|
||||
return BaseClass::Reload();
|
||||
}
|
||||
|
||||
void CWeaponCustomScripted::Reload_NPC( void )
|
||||
void CWeaponCustomScripted::Reload_NPC( bool bPlaySound )
|
||||
{
|
||||
SIMPLE_VOID_OVERRIDE( Reload_NPC, NULL );
|
||||
ScriptVariant_t pArgs[] = { bPlaySound };
|
||||
SIMPLE_VOID_OVERRIDE( Reload_NPC, pArgs );
|
||||
|
||||
BaseClass::Reload_NPC();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
void FinishReload( void );
|
||||
void AbortReload( void );
|
||||
bool Reload( void );
|
||||
void Reload_NPC( void );
|
||||
void Reload_NPC( bool bPlaySound = true );
|
||||
|
||||
// Weapon firing
|
||||
void PrimaryAttack( void ); // do "+ATTACK"
|
||||
|
Loading…
Reference in New Issue
Block a user