float autocvar_bot_ai_dangerdetectioninterval;
float autocvar_bot_ai_dangerdetectionupdates;
float autocvar_bot_ai_enemydetectioninterval;
+float autocvar_bot_ai_enemydetectioninterval_stickingtoenemy;
float autocvar_bot_ai_enemydetectionradius;
float autocvar_bot_ai_friends_aware_pickup_radius;
float autocvar_bot_ai_ignoregoal_timeout;
this.enemy = NULL;
return;
}
+
if (this.enemy)
{
if (!bot_shouldattack(this, this.enemy))
this.enemy = NULL;
this.havocbot_chooseenemy_finished = time;
}
- else if (this.havocbot_stickenemy)
+ else if (this.havocbot_stickenemy_time && time < this.havocbot_stickenemy_time)
{
// tracking last chosen enemy
- // if enemy is visible
- // and not really really far away
- // and we're not severely injured
- // then keep tracking for a half second into the future
vector targ_pos = (this.enemy.absmin + this.enemy.absmax) * 0.5;
traceline(this.origin + this.view_ofs, targ_pos, false, NULL);
if (trace_ent == this.enemy || trace_fraction == 1)
if (vdist(targ_pos - this.origin, <, 1000))
- if (GetResource(this, RES_HEALTH) > 30)
{
// remain tracking him for a shot while (case he went after a small corner or pilar
this.havocbot_chooseenemy_finished = time + 0.5;
return;
}
- // enemy isn't visible, or is far away, or we're injured severely
- // so stop preferring this enemy
- // (it will still take a half second until a new one is chosen)
- this.havocbot_stickenemy = 0;
+
+ // stop preferring this enemy
+ this.havocbot_stickenemy_time = 0;
}
}
if (time < this.havocbot_chooseenemy_finished)
this.dphitcontentsmask = hf;
this.enemy = best;
- this.havocbot_stickenemy = true;
+ this.havocbot_stickenemy_time = time + autocvar_bot_ai_enemydetectioninterval_stickingtoenemy;
if(best && best.classname == "misc_breakablemodel")
- this.havocbot_stickenemy = false;
+ this.havocbot_stickenemy_time = 0;
}
float havocbot_chooseweapon_checkreload(entity this, .entity weaponentity, int new_weapon)
set bot_ai_thinkinterval 0.05 "Frame rate at which bots update their navigation and aiming, scales by skill"
set bot_ai_strategyinterval 7 "How often a new objective is chosen"
set bot_ai_strategyinterval_movingtarget 5.5 "How often a new objective is chosen when current objective can move"
-set bot_ai_enemydetectioninterval 2 "How often bots pick a new target"
+set bot_ai_enemydetectioninterval 2 "How often bots try to pick a new target if no suitable target is found"
+set bot_ai_enemydetectioninterval_stickingtoenemy 4 "How often bots try to pick a new target while targetting an enemy"
set bot_ai_enemydetectionradius 10000 "How far bots can see enemies"
set bot_ai_dodgeupdateinterval 0.2 "How often scan for items to dodge. Currently not in use."
set bot_ai_chooseweaponinterval 0.5 "How often the best weapon according to the situation will be chosen"