Skip to content

Commit f558c13

Browse files
committed
Die() vscript function for inhabitable npcs
1 parent 2b1f418 commit f558c13

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/game/server/swarm/asw_inhabitable_npc.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ BEGIN_ENT_SCRIPTDESC( CASW_Inhabitable_NPC, CBaseCombatCharacter, "Alien Swarm I
151151
DEFINE_SCRIPTFUNC( SetHealthBarColor, "Sets the health bar color. Cheaper than spawning an asw_health_bar. Set alpha to 0 to disable the health bar." )
152152
DEFINE_SCRIPTFUNC( SetHealthBarScale, "Sets the health bar scale. Negative scales hide the health bar if the alien's health is full." )
153153
DEFINE_SCRIPTFUNC( SetHealthBarOffset, "Sets the health bar offset in local space." )
154+
DEFINE_SCRIPTFUNC( Die, "Simple kill function for aliens and marines." )
154155
END_SCRIPTDESC()
155156

156157
CASW_Inhabitable_NPC::CASW_Inhabitable_NPC()
@@ -344,6 +345,17 @@ void CASW_Inhabitable_NPC::Suicide()
344345
TakeDamage( info );
345346
}
346347

348+
void CASW_Inhabitable_NPC::Die()
349+
{
350+
if ( !IsAlive() )
351+
return;
352+
353+
SetHealth( 1 );
354+
355+
CTakeDamageInfo info( NULL, NULL, 100, DMG_FALL );
356+
TakeDamage( info );
357+
}
358+
347359
// using entities over time
348360
bool CASW_Inhabitable_NPC::StartUsing( CBaseEntity *pEntity )
349361
{

src/game/server/swarm/asw_inhabitable_npc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class CASW_Inhabitable_NPC : public CAI_PlayerAlly, public IASW_Spawnable_NPC
5050
char m_szInitialCommanderNetworkID[64]; // ASWNetworkID of the first commander for this marine in this mission
5151
const char *GetPlayerName() const;
5252
virtual void Suicide();
53+
void Die();
5354

5455
// gun
5556
CASW_Weapon *GetASWWeapon( int index ) const;

0 commit comments

Comments
 (0)