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

@ -951,7 +951,11 @@ void Game::applyGameModes () {
return;
}
static ConVarRef csdm_active ("csdm_active");
static StringRef csdmActiveCvarName = conf.fetchCustom ("CSDMDetectCvar");
static StringRef zmActiveCvarName = conf.fetchCustom ("ZMDetectCvar");
static StringRef zmDelayCvarName = conf.fetchCustom ("ZMDelayCvar");
static ConVarRef csdm_active (csdmActiveCvarName);
static ConVarRef csdm_version ("csdm_version");
static ConVarRef redm_active ("redm_active");
static ConVarRef mp_freeforall ("mp_freeforall");
@ -976,12 +980,21 @@ void Game::applyGameModes () {
}
}
// some little support for zombie plague
static ConVarRef zp_delay ("zp_delay");
// does zombie mod is in use
static ConVarRef zm_active (zmActiveCvarName);
// update our ignore timer if zp_elay exists
if (zp_delay.exists () && zp_delay.value () > 0.0f) {
cv_ignore_enemies_after_spawn_time.set (zp_delay.value () + 3.0f);
// do a some little support for zombie plague
if (zm_active.exists ()) {
static ConVarRef zm_delay (zmDelayCvarName);
// update our ignore timer if zp_delay exists
if (zm_delay.exists () && zm_delay.value () > 0.0f) {
cv_ignore_enemies_after_spawn_time.set (zm_delay.value () + 3.5f);
}
m_gameFlags |= GameFlags::ZombieMod;
}
else {
m_gameFlags &= ~GameFlags::ZombieMod;
}
}
@ -1033,6 +1046,9 @@ void Game::slowFrame () {
// kick failed bots
bots.checkNeedsToBeKicked ();
// refresh bot infection (creature) status
bots.refreshCreatureStatus ();
// update next update time
m_oneSecondFrame = nextUpdate + time ();
}