mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2026-08-03 20:24:36 +02:00
Added support for dropped weapons to display strange count
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user