BotLib: Basic respect for bot_skill cvar.
This commit is contained in:
parent
87c706ded7
commit
08706fcacb
3 changed files with 39 additions and 3 deletions
|
@ -139,7 +139,20 @@ bot::SeeThink(void)
|
|||
if (autocvar_bot_pacifist)
|
||||
return;
|
||||
|
||||
m_flSeeTime = time + 0.25f;
|
||||
/* reaction time, in a way */
|
||||
switch (cvar("bot_skill")) {
|
||||
case 1:
|
||||
m_flSeeTime = time + 0.5f;
|
||||
break;
|
||||
case 2:
|
||||
m_flSeeTime = time + 0.25f;
|
||||
break;
|
||||
case 3:
|
||||
m_flSeeTime = time + 0.15f;
|
||||
break;
|
||||
default:
|
||||
m_flSeeTime = time + 1.0f;
|
||||
}
|
||||
|
||||
for (entity w = world; (w = findfloat(w, ::takedamage, DAMAGE_YES));) {
|
||||
float flDot;
|
||||
|
|
|
@ -93,8 +93,22 @@ bot::WeaponAttack(void)
|
|||
input_buttons |= INPUT_BUTTON0;
|
||||
}
|
||||
|
||||
if (m_wtWeaponType != WPNTYPE_FULLAUTO)
|
||||
m_flAttackTime = time + 0.1f;
|
||||
/* this might not affect much */
|
||||
if (m_wtWeaponType != WPNTYPE_FULLAUTO) {
|
||||
switch (cvar("bot_skill")) {
|
||||
case 1:
|
||||
m_flAttackTime = time + 0.25f;
|
||||
break;
|
||||
case 2:
|
||||
m_flAttackTime = time + 0.10f;
|
||||
break;
|
||||
case 3:
|
||||
m_flAttackTime = time + 0.05f;
|
||||
break;
|
||||
default:
|
||||
m_flAttackTime = time + 1.0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
input_buttons &= ~INPUT_BUTTON0;
|
||||
input_buttons &= ~INPUT_BUTTON4;
|
||||
|
|
|
@ -21,4 +21,13 @@ var int autocvar_bot_aimless = FALSE;
|
|||
var int autocvar_nav_linksize = 256;
|
||||
var int autocvar_nav_radius = 8;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BOTSKILL_EASY = 1,
|
||||
BOTSKILL_MEDIUM,
|
||||
BOTSKILL_HARD
|
||||
} botskill_e;
|
||||
|
||||
var botskill_e autocvar_bot_skill = 2;
|
||||
|
||||
var string autocvar_bot_prefix = "";
|
||||
|
|
Loading…
Reference in a new issue