From 569a9b5ae26586c25c333c1646364249e6477335 Mon Sep 17 00:00:00 2001 From: rabscootle Date: Tue, 13 Jan 2026 21:12:19 -0600 Subject: [PATCH] Added support for dropped weapons to display strange count --- src/game/client/tf/c_tf_player.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/game/client/tf/c_tf_player.cpp b/src/game/client/tf/c_tf_player.cpp index 95cc480da..44933654f 100644 --- a/src/game/client/tf/c_tf_player.cpp +++ b/src/game/client/tf/c_tf_player.cpp @@ -3174,17 +3174,18 @@ bool CStatTrakDigitProxy::HelperOnBindGetStatTrakScore( void *pC_BaseEntity, int { CTFWeaponBase* pWeap = NULL; - // Check if it's an attachment model (world model) + // Check if it's an attachment for world model C_TFWeaponAttachmentModel* pAttachment = dynamic_cast(pEntity); if (pAttachment) { - // StatTrak will be child of world model it is attached to + // If we're dealing with a world model, Stat Clock will be it's child attachment C_BaseEntity* pParent = pAttachment->GetMoveParent(); if (pParent) { pWeap = dynamic_cast(pParent); } } + if (pWeap) { CEconItemView* pItem = pWeap->GetAttributeContainer()->GetItem(); @@ -3194,6 +3195,23 @@ bool CStatTrakDigitProxy::HelperOnBindGetStatTrakScore( void *pC_BaseEntity, int bReturnValue = true; } } + else + { + // Are we dealing with a dropped weapon? + C_BaseEntity* pParent = pEntity->GetMoveParent(); + CTFDroppedWeapon* pDroppedWeapon = dynamic_cast(pParent); + + if (pDroppedWeapon) + { + // We're able to extract item attributes from dropped weapons, including strange count + CEconItemView* pItem = pDroppedWeapon->GetItem(); + if (pItem && pItem->FindAttribute(GetKillEaterAttr_Score(0), &unScore)) + { + *piScore = unScore; + bReturnValue = true; + } + } + } } } else