Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
38 changes: 36 additions & 2 deletions src/game/client/tf/c_tf_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1597,14 +1597,30 @@ void C_TFRagdoll::DissolveEntity( CBaseEntity* pEnt )
pDissolve->SetRenderColor( 255, 255, 255, 255 );

Vector vColor;
C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();
// If a player kills themselves with a weapon that dissolves ragdolls, set dissolving color to their own team
if ( m_iTeam == TF_TEAM_BLUE )
{
vColor = TF_PARTICLE_WEAPON_RED_1 * 255;
if (pLocalPlayer)
{
vColor = ( pLocalPlayer->IsDeathSuicide() ) ? TF_PARTICLE_WEAPON_BLUE_1 * 255 : TF_PARTICLE_WEAPON_RED_1 * 255;
}
else // Fallback to original code if pLocalPlayer is invalid
{
vColor = TF_PARTICLE_WEAPON_RED_1 * 255;
}
Comment thread
dilbertron2 marked this conversation as resolved.
Outdated
pDissolve->SetEffectColor( vColor );
}
else
{
vColor = TF_PARTICLE_WEAPON_BLUE_1 * 255;
if (pLocalPlayer)
{
vColor = ( pLocalPlayer->IsDeathSuicide() ) ? TF_PARTICLE_WEAPON_RED_1 * 255 : TF_PARTICLE_WEAPON_BLUE_1 * 255;
}
else // Fallback to original code if pLocalPlayer is invalid
{
vColor = TF_PARTICLE_WEAPON_BLUE_1 * 255;
}
pDissolve->SetEffectColor( vColor );
}

Expand Down Expand Up @@ -3993,6 +4009,7 @@ C_TFPlayer::C_TFPlayer() :
ListenForGameEvent( "player_abandoned_match" );
ListenForGameEvent( "rocketpack_launch" );
ListenForGameEvent( "rocketpack_landed" );
ListenForGameEvent( "player_death" );

//AddPhonemeFile
engine->AddPhonemeFile( "scripts/game_sounds_vo_phonemes.txt" );
Expand Down Expand Up @@ -11182,6 +11199,23 @@ void C_TFPlayer::FireGameEvent( IGameEvent *event )
}
}
}
else if (FStrEq(event->GetName(), "player_death" ) )
{
m_bIsSuicide = false;
const int iAttacker = engine->GetPlayerForUserID(event->GetInt("attacker"));
C_TFPlayer* pAttacker = ToTFPlayer(UTIL_PlayerByIndex(iAttacker));

const int iVictim = engine->GetPlayerForUserID(event->GetInt("userid"));
C_TFPlayer* pVictim = ToTFPlayer(UTIL_PlayerByIndex(iVictim));
Comment thread
dilbertron2 marked this conversation as resolved.
Outdated

if ( !pVictim )
return;

if ( !pAttacker || pAttacker == pVictim )
{
m_bIsSuicide = true;
}
}
BaseClass::FireGameEvent( event );
}

Expand Down
2 changes: 2 additions & 0 deletions src/game/client/tf/c_tf_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ class C_TFPlayer : public C_BasePlayer, public IHasAttributes, public IInventory
// Called by shared code.
public:
float GetClassChangeTime() const { return m_flChangeClassTime; }
bool IsDeathSuicide() const { return m_bIsSuicide; }
void SetFootStamps( int nFootStamps ) { m_nFootStamps = nFootStamps; }

void DoAnimationEvent( PlayerAnimEvent_t event, int nData = 0 );
Expand Down Expand Up @@ -675,6 +676,7 @@ class C_TFPlayer : public C_BasePlayer, public IHasAttributes, public IInventory
bool m_bSaveMeParity;
bool m_bOldSaveMeParity;
bool m_bIsCoaching;
bool m_bIsSuicide = false;
Comment thread
dilbertron2 marked this conversation as resolved.
Outdated

private:
void UpdateTauntItem();
Expand Down