Fixed ForcePrimaryFire not working on RPG

This commit is contained in:
Blixibon 2021-11-18 23:23:58 -06:00
parent 013da89b27
commit db0b51bf76
2 changed files with 51 additions and 0 deletions

View File

@ -1589,6 +1589,54 @@ void CWeaponRPG::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatChara
}
}
#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponRPG::Operator_ForceNPCFire( CBaseCombatCharacter *pOperator, bool bSecondary )
{
if ( m_hMissile != NULL )
return;
Vector muzzlePoint, vecShootDir;
QAngle angShootDir;
GetAttachment( LookupAttachment( "muzzle" ), muzzlePoint, angShootDir );
AngleVectors( angShootDir, &vecShootDir );
// look for a better launch location
Vector altLaunchPoint;
if (GetAttachment( "missile", altLaunchPoint ))
{
// check to see if it's relativly free
trace_t tr;
AI_TraceHull( altLaunchPoint, altLaunchPoint + vecShootDir * (10.0f*12.0f), Vector( -24, -24, -24 ), Vector( 24, 24, 24 ), MASK_NPCSOLID, NULL, &tr );
if( tr.fraction == 1.0)
{
muzzlePoint = altLaunchPoint;
}
}
m_hMissile = CMissile::Create( muzzlePoint, angShootDir, pOperator->edict() );
m_hMissile->m_hOwner = this;
// NPCs always get a grace period
m_hMissile->SetGracePeriod( 0.5 );
pOperator->DoMuzzleFlash();
WeaponSound( SINGLE_NPC );
// Make sure our laserdot is off
m_bGuiding = false;
if ( m_hLaserDot )
{
m_hLaserDot->TurnOff();
}
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------

View File

@ -216,6 +216,9 @@ public:
int WeaponRangeAttack1Condition( float flDot, float flDist );
void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
#ifdef MAPBASE
void Operator_ForceNPCFire( CBaseCombatCharacter *pOperator, bool bSecondary );
#endif
void StartGuiding( void );
void StopGuiding( void );
void ToggleGuiding( void );