bot: return of the cheat cvar yb_whose_your_daddy (resolved #513)

combat: resolve strafe movement issues
combat: resolve bots always standing still with pistols and shotguns
vision: take a look at recent victim for some time before changing view angles
control: allow bots to be killed silently (ref #514) via commands
control: bots that are killed with auto kill timer are now killed silently
This commit is contained in:
jeefo 2024-01-29 08:08:07 +03:00
commit d82124e595
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
14 changed files with 150 additions and 62 deletions

View file

@ -8,6 +8,7 @@
#include <yapb.h>
ConVar cv_max_nodes_for_predict ("max_nodes_for_predict", "25", "Maximum number for path length, to predict the enemy.", true, 15.0f, 256.0f);
ConVar cv_whose_your_daddy ("whose_your_daddy", "0", "Enables or disables extra hard difficulty for bots.");
// game console variables
ConVar mp_flashlight ("mp_flashlight", nullptr, Var::GameRef);
@ -58,7 +59,7 @@ bool Bot::seesEntity (const Vector &dest, bool fromBody) {
return tr.flFraction >= 1.0f;
}
void Bot::updateAimDir () {
void Bot::setAimDirection () {
uint32_t flags = m_aimFlags;
// don't allow bot to look at danger positions under certain circumstances
@ -220,6 +221,11 @@ void Bot::updateAimDir () {
}
}
// try to look at last victim for a little, maybe there's some one else
if (game.isNullEntity (m_enemy) && m_difficulty >= Difficulty::Normal && !m_forgetLastVictimTimer.elapsed () && !m_lastVictimOrigin.empty ()) {
m_lookAt = m_lastVictimOrigin;
}
// don't look at bottom of node, if reached it
if (m_lookAt == m_destOrigin && !onLadder) {
m_lookAt.z = getEyesPos ().z;
@ -299,6 +305,15 @@ void Bot::updateLookAngles () {
return;
}
// just force directioon
if (m_difficulty == Difficulty::Expert && (m_aimFlags & AimFlags::Enemy) && (m_wantsToFire || usesSniper ()) && cv_whose_your_daddy.bool_ ()) {
pev->v_angle = direction;
pev->v_angle.clampAngles ();
updateBodyAngles ();
return;
}
const float aimSkill = cr::clamp (static_cast <float> (m_difficulty), 1.0f, 4.0f) * 25.0f;
float accelerate = aimSkill * 30.0f;