Skip to content

Commit

Permalink
API: CSPlayer methods enhancement (#862)
Browse files Browse the repository at this point in the history
* Adding return type to DropShield and DropPlayerItem
* JoinTeam: force C4 drop when changing to SPEC
  • Loading branch information
dystopm authored Sep 28, 2023
1 parent d7b4409 commit 8a52b7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions regamedll/dlls/API/CSPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
pPlayer->pev->deadflag = DEAD_DEAD;
pPlayer->pev->health = 0;

if (pPlayer->m_bHasC4)
pPlayer->DropPlayerItem("weapon_c4");

pPlayer->RemoveAllItems(TRUE);
pPlayer->m_bHasC4 = false;

pPlayer->m_iTeam = SPECTATOR;
pPlayer->m_iJoiningState = JOINED;
Expand Down Expand Up @@ -292,14 +294,14 @@ EXT_FUNC void CCSPlayer::GiveShield(bool bDeploy)
BasePlayer()->GiveShield(bDeploy);
}

EXT_FUNC void CCSPlayer::DropShield(bool bDeploy)
EXT_FUNC CBaseEntity *CCSPlayer::DropShield(bool bDeploy)
{
BasePlayer()->DropShield(bDeploy);
return BasePlayer()->DropShield(bDeploy);
}

EXT_FUNC void CCSPlayer::DropPlayerItem(const char *pszItemName)
EXT_FUNC CBaseEntity *CCSPlayer::DropPlayerItem(const char *pszItemName)
{
BasePlayer()->DropPlayerItem(pszItemName);
return BasePlayer()->DropPlayerItem(pszItemName);
}

EXT_FUNC bool CCSPlayer::RemoveShield()
Expand Down
4 changes: 2 additions & 2 deletions regamedll/public/regamedll/API/CSPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class CCSPlayer: public CCSMonster {
virtual CBaseEntity *GiveNamedItemEx(const char *pszName);
virtual void GiveDefaultItems();
virtual void GiveShield(bool bDeploy = true);
virtual void DropShield(bool bDeploy = true);
virtual void DropPlayerItem(const char *pszItemName);
virtual CBaseEntity *DropShield(bool bDeploy = true);
virtual CBaseEntity* DropPlayerItem(const char *pszItemName);
virtual bool RemoveShield();
virtual void RemoveAllItems(bool bRemoveSuit);
virtual bool RemovePlayerItem(const char* pszItemName);
Expand Down

0 comments on commit 8a52b7e

Please sign in to comment.