bot: added basic support for zombie plague warmup mode
Controllable via yb_ignore_enemies_after_spawn_time, and automatically set from zp_delay cvar.
This commit is contained in:
parent
c0715714d6
commit
7b7ae7020b
5 changed files with 20 additions and 3 deletions
|
|
@ -870,6 +870,7 @@ extern ConVar cv_graph_analyze_max_jump_height;
|
|||
extern ConVar cv_spraypaints;
|
||||
extern ConVar cv_whose_your_daddy;
|
||||
extern ConVar cv_grenadier_mode;
|
||||
extern ConVar cv_ignore_enemies_after_spawn_time;
|
||||
|
||||
extern ConVar mp_freezetime;
|
||||
extern ConVar mp_roundtime;
|
||||
|
|
|
|||
|
|
@ -3691,7 +3691,7 @@ bool Bot::isOutOfBombTimer () {
|
|||
}
|
||||
|
||||
void Bot::updateHearing () {
|
||||
if (game.is (GameFlags::FreeForAll)) {
|
||||
if (game.is (GameFlags::FreeForAll) || m_enemyIgnoreTimer > game.time ()) {
|
||||
return;
|
||||
}
|
||||
edict_t *hearedEnemy = nullptr;
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ bool Bot::lookupEnemies () {
|
|||
if (!game.isNullEntity (m_enemy) && (m_states & Sense::SeeingEnemy)) {
|
||||
m_states &= ~Sense::SuspectEnemy;
|
||||
}
|
||||
else if (game.isNullEntity (m_enemy) && m_seeEnemyTime + 1.0f > game.time () && util.isAlive (m_lastEnemy)) {
|
||||
else if (game.isNullEntity (m_enemy) && m_seeEnemyTime + 4.0f > game.time () && util.isAlive (m_lastEnemy)) {
|
||||
m_states |= Sense::SuspectEnemy;
|
||||
m_aimFlags |= AimFlags::LastEnemy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ ConVar cv_csdm_mode ("csdm_mode", "0", "Enables or disables CSDM / FFA mode for
|
|||
ConVar cv_ignore_map_prefix_game_mode ("ignore_map_prefix_game_mode", "0", "If enabled, bots will not apply game modes based on map name prefix (fy_ and ka_ specifically).");
|
||||
ConVar cv_threadpool_workers ("threadpool_workers", "-1", "Maximum number of threads bot will run to process some tasks. -1 means half of CPU cores used.", true, -1.0f, static_cast <float> (plat.hardwareConcurrency ()));
|
||||
ConVar cv_grenadier_mode ("grenadier_mode", "0", "If enabled, bots will not apply throwing condition on grenades.");
|
||||
ConVar cv_ignore_enemies_after_spawn_time ("ignore_enemies_after_spawn_time", "0", "Make bots ignore enemies for a specified here time in seconds on new round. Useful for Zombie Plague mods.", true, 0.0f, 540.0f);
|
||||
|
||||
ConVar sv_skycolor_r ("sv_skycolor_r", nullptr, Var::GameRef);
|
||||
ConVar sv_skycolor_g ("sv_skycolor_g", nullptr, Var::GameRef);
|
||||
|
|
@ -974,6 +975,14 @@ void Game::applyGameModes () {
|
|||
m_gameFlags &= ~(GameFlags::FreeForAll | GameFlags::CSDM);
|
||||
}
|
||||
}
|
||||
|
||||
// some little support for zombie plague
|
||||
static ConVarRef zp_delay ("zp_delay");
|
||||
|
||||
// update our ignore timer if zp_elay exists
|
||||
if (zp_delay.exists () && zp_delay.value () > 0.0f && cv_ignore_enemies_after_spawn_time.float_ () < 1.0f) {
|
||||
cv_ignore_enemies_after_spawn_time.set (zp_delay.value () + 2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::slowFrame () {
|
||||
|
|
|
|||
|
|
@ -1463,7 +1463,6 @@ void Bot::newRound () {
|
|||
|
||||
m_buttonPushTime = 0.0f;
|
||||
m_enemyUpdateTime = 0.0f;
|
||||
m_enemyIgnoreTimer = 0.0f;
|
||||
m_retreatTime = 0.0f;
|
||||
m_seeEnemyTime = 0.0f;
|
||||
m_shootAtDeadTime = 0.0f;
|
||||
|
|
@ -1582,6 +1581,14 @@ void Bot::newRound () {
|
|||
m_goalHist.clear ();
|
||||
m_ignoredBreakable.clear ();
|
||||
|
||||
// ignore enemies for some time if needed
|
||||
if (cv_ignore_enemies_after_spawn_time.float_ () > 0.0f) {
|
||||
m_enemyIgnoreTimer = game.time () + cv_ignore_enemies_after_spawn_time.float_ ();
|
||||
}
|
||||
else {
|
||||
m_enemyIgnoreTimer = 0.0f;
|
||||
}
|
||||
|
||||
// update refvec for blocked movement
|
||||
updateRightRef ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue