Browse Source

Fix sniperrifle dropping when massn is gibbed (#244)

opforfixed
Roman Chistokhodov 3 years ago committed by GitHub
parent
commit
2ffa0261e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 42
      dlls/gearbox/massn.cpp

42
dlls/gearbox/massn.cpp

@ -72,6 +72,7 @@ class CMassn : public CHGrunt @@ -72,6 +72,7 @@ class CMassn : public CHGrunt
public:
int Classify(void);
void HandleAnimEvent(MonsterEvent_t *pEvent);
void GibMonster(void);
void Sniperrifle(void);
BOOL FOkToSpeak(void);
@ -229,6 +230,47 @@ void CMassn::HandleAnimEvent(MonsterEvent_t *pEvent) @@ -229,6 +230,47 @@ void CMassn::HandleAnimEvent(MonsterEvent_t *pEvent)
}
}
void CMassn::GibMonster()
{
Vector vecGunPos;
Vector vecGunAngles;
if( GetBodygroup( GUN_GROUP ) != GUN_NONE )
{
// throw a gun if the grunt has one
GetAttachment( 0, vecGunPos, vecGunAngles );
CBaseEntity *pGun;
if( FBitSet( pev->weapons, MASSN_SNIPERRIFLE ) )
{
pGun = DropItem( "weapon_sniperrifle", vecGunPos, vecGunAngles );
}
else
{
pGun = DropItem( "weapon_9mmAR", vecGunPos, vecGunAngles );
}
if( pGun )
{
pGun->pev->velocity = Vector( RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( 200, 300 ) );
pGun->pev->avelocity = Vector( 0, RANDOM_FLOAT( 200, 400 ), 0 );
}
if( FBitSet( pev->weapons, MASSN_GRENADELAUNCHER ) )
{
pGun = DropItem( "ammo_ARgrenades", vecGunPos, vecGunAngles );
if ( pGun )
{
pGun->pev->velocity = Vector( RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( 200, 300 ) );
pGun->pev->avelocity = Vector( 0, RANDOM_FLOAT( 200, 400 ), 0 );
}
}
}
CBaseMonster::GibMonster();
}
//=========================================================
// Spawn
//=========================================================

Loading…
Cancel
Save