Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/game/server/swarm/asw_gamerules_vscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,7 @@ class CASW_Challenge_Thinker : public CLogicalEntity
g_pScriptVM->SetValue( hScope, "OnMissionStart", SCRIPT_VARIANT_NULL );
g_pScriptVM->SetValue( hScope, "OnGameplayStart", SCRIPT_VARIANT_NULL );
g_pScriptVM->SetValue( hScope, "OnReceivedTextMessage", SCRIPT_VARIANT_NULL );
g_pScriptVM->SetValue( hScope, "AlterDeathMessage", SCRIPT_VARIANT_NULL );

s_Thinkers.AddToTail( this );
}
Expand Down
40 changes: 38 additions & 2 deletions src/game/server/swarm/asw_marine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4358,6 +4358,44 @@ void CASW_Marine::Event_Killed( const CTakeDamageInfo &info )
if ( ASWDeathmatchMode() )
ASWDeathmatchMode()->OnMarineKilled( info, this );

m_bSlowHeal = false; // no healing if we're dead!

PrintDeathMessage( info );
}

void CASW_Marine::PrintDeathMessage( const CTakeDamageInfo &info )
{
CASW_Marine_Resource *pMR = GetMarineResource();

// print a custom death message if we have one
CAlienSwarm *pAlienSwarm = ASWGameRules();
if ( pAlienSwarm )
{
ScriptVariant_t args[7];
ScriptVariant_t retvalue;

args[0] = ToHScript( this );
args[1] = ToHScript( info.GetInflictor() );
args[2] = ToHScript( info.GetAttacker() );
args[3] = ToHScript( info.GetWeapon() );
args[4] = info.GetDamage();
args[5] = info.GetDamageType();
args[6] = info.GetAmmoName();

pAlienSwarm->RunScriptFunctionInListenerScopes( "AlterDeathMessage", &retvalue, NELEMS( args ), args );

if ( retvalue.m_type == FIELD_CSTRING )
{
char szName[256];
pMR->GetDisplayName( szName, sizeof( szName ) );

UTIL_ClientPrintAll( ASW_HUD_PRINTTALKANDCONSOLE, retvalue.m_pszString, szName );

return;
}
}

CBaseEntity *pAttacker = info.GetAttacker();
// print a message if marine was killed by another marine
if ( pAttacker && pAttacker->Classify() == CLASS_ASW_MARINE )
{
Expand Down Expand Up @@ -4411,8 +4449,6 @@ void CASW_Marine::Event_Killed( const CTakeDamageInfo &info )
UTIL_ClientPrintAll( ASW_HUD_PRINTTALKANDCONSOLE, "#asw_chat_died", szName );
}
}

m_bSlowHeal = false; // no healing if we're dead!
}

void CASW_Marine::AimGun()
Expand Down
1 change: 1 addition & 0 deletions src/game/server/swarm/asw_marine.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ class CASW_Marine : public CASW_VPhysics_NPC, public IASWPlayerAnimStateHelpers,
float m_flLastBurnSoundTime;
float m_fNextPainSoundTime;
virtual void Event_Killed( const CTakeDamageInfo &info );
void PrintDeathMessage( const CTakeDamageInfo &info );
bool CanBecomeRagdoll();
virtual bool BecomeRagdollOnClient( const Vector &force );
void Suicide();
Expand Down