[HL25] New item flag NOAUTOSWITCHTO for RPG

Prevents the RPG from being auto-switched to on auto weapon switch events
This commit is contained in:
Daniel Walder 2024-08-29 17:32:44 +10:00 committed by Joël Troch
parent 8d3d368e90
commit 2353ca4a4b
3 changed files with 7 additions and 1 deletions

View file

@ -53,6 +53,11 @@ CBasePlayerItem* CGameRules::FindNextBestWeapon(CBasePlayer* pPlayer, CBasePlaye
continue;
}
if ((pCheck->iFlags() & ITEM_FLAG_NOAUTOSWITCHTO) != 0)
{
continue;
}
if (pCheck->iWeight() > -1 && pCheck->iWeight() == currentWeight)
{
// this weapon is from the same category.

View file

@ -410,7 +410,7 @@ bool CRpg::GetItemInfo(ItemInfo* p)
p->iSlot = 3;
p->iPosition = 0;
p->iId = m_iId = WEAPON_RPG;
p->iFlags = 0;
p->iFlags = ITEM_FLAG_NOAUTOSWITCHTO;
p->iWeight = RPG_WEIGHT;
return true;

View file

@ -172,6 +172,7 @@ typedef enum
#define ITEM_FLAG_NOAUTOSWITCHEMPTY 4
#define ITEM_FLAG_LIMITINWORLD 8
#define ITEM_FLAG_EXHAUSTIBLE 16 // A player can totally exhaust their ammo supply and lose this weapon
#define ITEM_FLAG_NOAUTOSWITCHTO 32
#define WEAPON_IS_ONTARGET 0x40