bot: add more support for zombie mod scenario (ref #563)

added multiple items to custom.cfg, so game delay timer cvar is now configurable, the infected team is configurable as well.

creature (well, just zombies) now correctly detects their "creature" status even with custom model names (assumes that bot is on an infected team = zombie)

Co-Authored-By: Max <161382234+dyspose@users.noreply.github.com>
This commit is contained in:
jeefo 2024-05-15 22:56:35 +03:00
commit dedbf8ab82
No known key found for this signature in database
GPG key ID: D696786B81B667C8
8 changed files with 91 additions and 14 deletions

View file

@ -814,7 +814,7 @@ void BotManager::setLastWinner (int winner) {
void BotManager::checkBotModel (edict_t *ent, char *infobuffer) {
for (const auto &bot : bots) {
if (bot->ent () == ent) {
bot->refreshModelName (infobuffer);
bot->refreshCreatureStatus (infobuffer);
break;
}
}
@ -829,6 +829,18 @@ void BotManager::checkNeedsToBeKicked () {
}
}
void BotManager::refreshCreatureStatus () {
if (!game.is (GameFlags::ZombieMod)) {
return;
}
for (const auto &bot : bots) {
if (bot->m_isAlive) {
bot->refreshCreatureStatus (nullptr);
}
}
}
void BotManager::setWeaponMode (int selection) {
// this function sets bots weapon mode
@ -1370,7 +1382,7 @@ void BotManager::handleDeath (edict_t *killer, edict_t *victim) {
}
}
// mark bot as "spawned", and reset it to new-round state when it dead (for csdm only)
// mark bot as "spawned", and reset it to new-round state when it dead (for csdm/zombie only)
if (victimBot != nullptr) {
victimBot->spawned ();
}
@ -1519,7 +1531,7 @@ void Bot::newRound () {
for (auto &timer : m_chatterTimes) {
timer = kMaxChatterRepeatInterval;
}
refreshModelName (nullptr);
refreshCreatureStatus (nullptr);
m_isReloading = false;
m_reloadState = Reload::None;