armoury_entity: Don't pick up dual elites if player carry shield.

Minor refactoring
This commit is contained in:
s1lent 2019-09-11 00:19:28 +07:00
parent 7ac1e0db2f
commit a2a6997278
2 changed files with 8 additions and 5 deletions

View File

@ -1679,7 +1679,7 @@ void CWeaponBox::Touch(CBaseEntity *pOther)
while (pItem) while (pItem)
{ {
if ((pPlayer->HasShield() && pItem->m_iId == WEAPON_ELITE) if ((pPlayer->HasShield() && pItem->m_iId == WEAPON_ELITE)
|| (pPlayer->IsBot() && (TheCSBots() != nullptr && !TheCSBots()->IsWeaponUseable(pItem)))) || (pPlayer->IsBot() && TheCSBots() && !TheCSBots()->IsWeaponUseable(pItem)))
{ {
return; return;
} }
@ -2095,7 +2095,7 @@ void CArmoury::Spawn()
m_iCount = 1; m_iCount = 1;
} }
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_FIXES
// Cache the placed origin of source point // Cache the placed origin of source point
pev->oldorigin = pev->origin; pev->oldorigin = pev->origin;
#endif #endif
@ -2167,7 +2167,7 @@ void CArmoury::Restart()
Draw(); Draw();
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_FIXES
// Restored origin from the cache // Restored origin from the cache
UTIL_SetOrigin(pev, pev->oldorigin); UTIL_SetOrigin(pev, pev->oldorigin);
DROP_TO_FLOOR(edict()); DROP_TO_FLOOR(edict());
@ -2288,6 +2288,9 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
if (pToucher->m_rgpPlayerItems[PISTOL_SLOT]) if (pToucher->m_rgpPlayerItems[PISTOL_SLOT])
return; return;
if (pToucher->HasShield() && m_iItem == ARMOURY_ELITE)
return;
m_iCount--; m_iCount--;
auto item = &armouryItemInfo[m_iItem]; auto item = &armouryItemInfo[m_iItem];
@ -2381,7 +2384,7 @@ void CArmoury::KeyValue(KeyValueData *pkvd)
} }
} }
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_FIXES
void CArmoury::SetObjectCollisionBox() void CArmoury::SetObjectCollisionBox()
{ {
pev->absmin = pev->origin + Vector(-16, -16, 0); pev->absmin = pev->origin + Vector(-16, -16, 0);

View File

@ -143,7 +143,7 @@ public:
virtual void Precache(); virtual void Precache();
virtual void Restart(); virtual void Restart();
virtual void KeyValue(KeyValueData *pkvd); virtual void KeyValue(KeyValueData *pkvd);
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_FIXES
virtual void SetObjectCollisionBox(); virtual void SetObjectCollisionBox();
#endif #endif