Skip to content

Commit

Permalink
xrGame/ai_stalker_alife.cpp: fix infinity the trying to attach an add…
Browse files Browse the repository at this point in the history
…on for a NPC
  • Loading branch information
ChugunovRoman committed Dec 19, 2024
1 parent c2bf09e commit d08123f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/xrGame/ai_stalker_alife.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ void CAI_Stalker::attach_available_addons(CWeapon* weapon)
PIItem pIItem = *l_it;

const CSilencer* pSilencer = smart_cast<const CSilencer*>(pIItem);
if (pSilencer && weapon->CanAttach(pIItem))
if (pSilencer && weapon->CanAttach(pIItem) && !weapon->IsSilencerAttached())
weapon->Attach(pIItem, true);

const CScope* pScope = smart_cast<const CScope*>(pIItem);
if (pScope && weapon->CanAttach(pIItem))
if (pScope && weapon->CanAttach(pIItem) && !weapon->IsScopeAttached())
weapon->Attach(pIItem, true);

const CGrenadeLauncher* pGrenadeLauncher = smart_cast<const CGrenadeLauncher*>(pIItem);
if (pGrenadeLauncher && weapon->CanAttach(pIItem))
if (pGrenadeLauncher && weapon->CanAttach(pIItem) && !weapon->IsGrenadeLauncherAttached())
weapon->Attach(pIItem, true);
}
}
Expand Down

0 comments on commit d08123f

Please sign in to comment.