From a2a6997278dc3888be92d1715fe21ad64cacadcf Mon Sep 17 00:00:00 2001 From: s1lent Date: Wed, 11 Sep 2019 00:19:28 +0700 Subject: [PATCH] armoury_entity: Don't pick up dual elites if player carry shield. Minor refactoring --- regamedll/dlls/weapons.cpp | 11 +++++++---- regamedll/dlls/weapons.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 2101adad..011d0202 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -1679,7 +1679,7 @@ void CWeaponBox::Touch(CBaseEntity *pOther) while (pItem) { if ((pPlayer->HasShield() && pItem->m_iId == WEAPON_ELITE) - || (pPlayer->IsBot() && (TheCSBots() != nullptr && !TheCSBots()->IsWeaponUseable(pItem)))) + || (pPlayer->IsBot() && TheCSBots() && !TheCSBots()->IsWeaponUseable(pItem))) { return; } @@ -2095,7 +2095,7 @@ void CArmoury::Spawn() m_iCount = 1; } -#ifdef REGAMEDLL_ADD +#ifdef REGAMEDLL_FIXES // Cache the placed origin of source point pev->oldorigin = pev->origin; #endif @@ -2167,7 +2167,7 @@ void CArmoury::Restart() Draw(); -#ifdef REGAMEDLL_ADD +#ifdef REGAMEDLL_FIXES // Restored origin from the cache UTIL_SetOrigin(pev, pev->oldorigin); DROP_TO_FLOOR(edict()); @@ -2288,6 +2288,9 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther) if (pToucher->m_rgpPlayerItems[PISTOL_SLOT]) return; + if (pToucher->HasShield() && m_iItem == ARMOURY_ELITE) + return; + m_iCount--; auto item = &armouryItemInfo[m_iItem]; @@ -2381,7 +2384,7 @@ void CArmoury::KeyValue(KeyValueData *pkvd) } } -#ifdef REGAMEDLL_ADD +#ifdef REGAMEDLL_FIXES void CArmoury::SetObjectCollisionBox() { pev->absmin = pev->origin + Vector(-16, -16, 0); diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index bc39f86c..8286bcbe 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -143,7 +143,7 @@ public: virtual void Precache(); virtual void Restart(); virtual void KeyValue(KeyValueData *pkvd); -#ifdef REGAMEDLL_ADD +#ifdef REGAMEDLL_FIXES virtual void SetObjectCollisionBox(); #endif