0bot: allow bots to check breakable team (fix #693)

This commit is contained in:
jeefo 2025-06-19 00:21:34 +03:00
commit 1394d08a28
No known key found for this signature in database
GPG key ID: D696786B81B667C8
3 changed files with 21 additions and 2 deletions

View file

@ -114,7 +114,7 @@ CR_DECLARE_SCOPED_ENUM (CollisionState,
StrafeRight StrafeRight
) )
// counter-strike team id's // counter-strike team id's (internal for bot)
CR_DECLARE_SCOPED_ENUM (Team, CR_DECLARE_SCOPED_ENUM (Team,
Terrorist = 0, Terrorist = 0,
CT, CT,
@ -123,6 +123,14 @@ CR_DECLARE_SCOPED_ENUM (Team,
Invalid = -1 Invalid = -1
) )
// counter-strike team id's (used by gamedll, for reference)
CR_DECLARE_SCOPED_ENUM (CSTeam,
Unassigned = 0,
Terrorist,
CT,
Spectator
)
// item status for StatusIcon message // item status for StatusIcon message
CR_DECLARE_SCOPED_ENUM (ItemStatus, CR_DECLARE_SCOPED_ENUM (ItemStatus,
Nightvision = cr::bit (0), Nightvision = cr::bit (0),

View file

@ -366,7 +366,12 @@ public:
return util.getClient (indexOfPlayer (ent)).team2; return util.getClient (indexOfPlayer (ent)).team2;
} }
// sets the precache to uninitialize // get real gamedll team (matches gamedll indices)
int getGameTeam (edict_t *ent) const {
return getRealTeam (ent) + 1;
}
// sets the precache to uninitialized
void setUnprecached () { void setUnprecached () {
m_precached = false; m_precached = false;
} }

View file

@ -281,6 +281,12 @@ edict_t *Bot::lookupBreakable () {
if (game.isNullEntity (ent)) { if (game.isNullEntity (ent)) {
return false; return false;
} }
// check breakable team, needed for some plugins
if (ent->v.team > 0 && ent->v.team != game.getGameTeam (this->ent ())) {
return false;
}
for (const auto &br : m_ignoredBreakable) { for (const auto &br : m_ignoredBreakable) {
if (br == ent) { if (br == ent) {
return false; return false;