Skip to content

Commit c7c62b0

Browse files
committed
Replace uses of GetOwnerEntity with GetThrower for baseballs and ornaments
GetOwnerEntity returns the 'owner entity' of the baseball/ornament, which is the player that originally threw it. However, this is used in multiple places where we really want to know who is responsible for the ball's damage (including who may have last reflected it) which is returned by GetThrower. This change should fix reflected baseball/ornament hits and kills being attributed to their original thrower rather than their reflector like other projectiles.
1 parent b47ef87 commit c7c62b0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/game/shared/tf/tf_weapon_bat.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ void CTFStunBall::ApplyBallImpactEffectOnVictim( CBaseEntity *pOther )
720720
if ( !pPlayer )
721721
return;
722722

723-
CTFPlayer *pOwner = ToTFPlayer( GetOwnerEntity() );
723+
CTFPlayer *pOwner = ToTFPlayer( GetThrower() );
724724
if ( !pOwner )
725725
return;
726726

@@ -782,7 +782,7 @@ void CTFStunBall::ApplyBallImpactEffectOnVictim( CBaseEntity *pOther )
782782

783783
CBaseEntity *pInflictor = GetLauncher();
784784
CTakeDamageInfo info;
785-
info.SetAttacker( GetOwnerEntity() );
785+
info.SetAttacker( pOwner );
786786
info.SetInflictor( pInflictor );
787787
info.SetWeapon( pInflictor );
788788
info.SetDamage( ( flLifeTimeRatio >= 1.f ) ? GetDamage() * 1.5f : GetDamage() );
@@ -838,7 +838,7 @@ void CTFStunBall::PipebombTouch( CBaseEntity *pOther )
838838
if ( !ShouldBallTouch( pOther ) )
839839
return;
840840

841-
CTFPlayer* pOwner = ToTFPlayer( GetOwnerEntity() );
841+
CTFPlayer* pOwner = ToTFPlayer( GetThrower() );
842842
if ( !pOwner )
843843
return;
844844

@@ -893,7 +893,7 @@ void CTFStunBall::PipebombTouch( CBaseEntity *pOther )
893893
//-----------------------------------------------------------------------------
894894
void CTFStunBall::VPhysicsCollision( int index, gamevcollisionevent_t *pEvent )
895895
{
896-
CTFPlayer* pOwner = ToTFPlayer( GetOwnerEntity() );
896+
CTFPlayer* pOwner = ToTFPlayer( GetThrower() );
897897
bool bWasTouched = m_bTouched;
898898
BaseClass::VPhysicsCollision( index, pEvent );
899899
if ( pOwner && !bWasTouched && m_bTouched )
@@ -939,7 +939,7 @@ void CTFStunBall::RemoveBallTrail( void )
939939
//-----------------------------------------------------------------------------
940940
bool CTFStunBall::ShouldBallTouch( CBaseEntity *pOther )
941941
{
942-
CTFPlayer* pOwner = ToTFPlayer( GetOwnerEntity() );
942+
CTFPlayer* pOwner = ToTFPlayer( GetThrower() );
943943
if ( !pOwner )
944944
return false;
945945

@@ -1174,7 +1174,7 @@ void CTFBall_Ornament::ApplyBallImpactEffectOnVictim( CBaseEntity *pOther )
11741174
if ( !pPlayer )
11751175
return;
11761176

1177-
CTFPlayer *pOwner = ToTFPlayer( GetOwnerEntity() );
1177+
CTFPlayer *pOwner = ToTFPlayer( GetThrower() );
11781178
if ( !pOwner )
11791179
return;
11801180

@@ -1210,7 +1210,7 @@ void CTFBall_Ornament::ApplyBallImpactEffectOnVictim( CBaseEntity *pOther )
12101210

12111211
CBaseEntity *pInflictor = GetLauncher();
12121212
CTakeDamageInfo info;
1213-
info.SetAttacker( GetOwnerEntity() );
1213+
info.SetAttacker( pOwner );
12141214
info.SetInflictor( pInflictor );
12151215
info.SetWeapon( pInflictor );
12161216
info.SetDamage( GetDamage() );

0 commit comments

Comments
 (0)