Skip to content

Commit

Permalink
New flag SF_PLAYEREQUIP_REMOVEWEAPONS
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaqtincha committed Apr 29, 2021
1 parent bfe67e1 commit 15e5c4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions regamedll/dlls/maprules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,12 @@ void CGamePlayerEquip::EquipPlayer(CBaseEntity *pEntity)
return;

CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);

if (RemoveWeapons())
{
pPlayer->RemoveAllItems(FALSE);
}

for (int i = 0; i < MAX_EQUIP; i++)
{
if (FStringNull(m_weaponNames[i]))
Expand Down
2 changes: 2 additions & 0 deletions regamedll/dlls/maprules.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class CGameCounterSet: public CRulePointEntity
#define MAX_EQUIP 32
#define SF_PLAYEREQUIP_USEONLY BIT(0) // If set, the game_player_equip entity will not equip respawning players,
// but only react to direct triggering, equipping its activator. This makes its master obsolete.
#define SF_PLAYEREQUIP_REMOVEWEAPONS BIT(1) // Remove all weapons before give.

// Sets the default player equipment
class CGamePlayerEquip: public CRulePointEntity
Expand All @@ -256,6 +257,7 @@ class CGamePlayerEquip: public CRulePointEntity

public:
bool UseOnly() const { return (pev->spawnflags & SF_PLAYEREQUIP_USEONLY) == SF_PLAYEREQUIP_USEONLY; }
bool RemoveWeapons() const { return (pev->spawnflags & SF_PLAYEREQUIP_REMOVEWEAPONS) == SF_PLAYEREQUIP_REMOVEWEAPONS; }

private:
void EquipPlayer(CBaseEntity *pPlayer);
Expand Down

0 comments on commit 15e5c4b

Please sign in to comment.