Added support for dropped weapons to display strange count

This commit is contained in:
rabscootle
2026-01-13 21:12:19 -06:00
committed by EricS-Valve
parent 62412617af
commit 569a9b5ae2
+20 -2
View File
@@ -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<C_TFWeaponAttachmentModel*>(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<CTFWeaponBase*>(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<CTFDroppedWeapon*>(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