Skip to content

Commit

Permalink
fix worm medal being awarded to everyone in the lobby rather than jus…
Browse files Browse the repository at this point in the history
…t the worm-toucher
  • Loading branch information
BenLubar committed Nov 3, 2023
1 parent ce1aeea commit d74ced6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/game/shared/swarm/rd_inventory_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,12 @@ static class CRD_Inventory_Manager final : public CAutoGameSystem, public CGameE
{
int64_t iCounterBefore = instance.m_nCounter[iCombinedIndex];
#ifdef CLIENT_DLL
if ( engine->IsPlayingDemo() )
{
// watching a recording
return;
}

PendingDynamicPropertyUpdate_t *pUpdate = NULL;
FOR_EACH_VEC( m_PendingDynamicPropertyUpdates, j )
{
Expand Down Expand Up @@ -3437,6 +3443,13 @@ namespace ReactiveDropInventory

void OnHitConfirm( CBaseEntity *pAttacker, CBaseEntity *pTarget, Vector vecDamagePosition, bool bKilled, bool bDamageOverTime, bool bBlastDamage, int iDisposition, float flDamage, CBaseEntity *pWeapon )
{
#ifdef CLIENT_DLL
if ( engine->IsPlayingDemo() )
{
return;
}
#endif

CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
Expand All @@ -3452,16 +3465,18 @@ namespace ReactiveDropInventory
{
if ( pAttacker && pTarget && pTarget->IsInhabitableNPC() && !V_stricmp( IGameSystem::MapName(), "rd-reduction2" ) && !V_strcmp( pAttacker->GetClassname(), "trigger_hurt" ) && !V_strcmp( STRING( pAttacker->GetEntityName() ), "trigger_pitworm_hitbox" ) )
{
CASW_Inhabitable_NPC *pTargetNPC = assert_cast< CASW_Inhabitable_NPC * >( pTarget );

#ifdef CLIENT_DLL
static bool s_bRequestedWormToucherMedal = false;
if ( !s_bRequestedWormToucherMedal )
if ( !s_bRequestedWormToucherMedal && pTargetNPC->IsInhabited() && pTargetNPC->GetCommander() && pTargetNPC->GetCommander()->IsLocalPlayer() )
{
AddPromoItem( 42 );
s_bRequestedWormToucherMedal = true;
}
#endif

s_RD_Inventory_Manager.IncrementStrangePropertyOnEquippedItems( assert_cast< CASW_Inhabitable_NPC * >( pTarget ), 42, 1 );
s_RD_Inventory_Manager.IncrementStrangePropertyOnEquippedItems( pTargetNPC, 42, 1 );
}

return;
Expand Down

0 comments on commit d74ced6

Please sign in to comment.