From 7a74b39abc98dbf54bb045a2a7f8bf596339f177 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 30 Mar 2018 15:41:39 +0200 Subject: [PATCH] BOT AI: avoid sticking to players when chasing them as it was very annoying, especially for newbies --- qcsrc/server/bot/default/havocbot/havocbot.qc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 2a0d0c850..7ce6efa45 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -885,17 +885,17 @@ void havocbot_movetogoal(entity this) diff = destorg - this.origin; - if (fabs(diff.x) < 10 && fabs(diff.y) < 10 - && this.goalcurrent == this.goalentity && time < this.goalentity_lock_timeout) + // 1. stop if too close to target player (even if frozen) + // 2. stop if the locked goal has been reached + if ((IS_PLAYER(this.goalcurrent) && vdist(diff, <, 80)) + || (this.goalcurrent == this.goalentity && time < this.goalentity_lock_timeout && vdist(diff, <, 10))) { destorg = this.origin; - diff.x = 0; - diff.y = 0; + diff = '0 0 0'; } dir = normalize(diff); - flatdir = diff;flatdir.z = 0; - flatdir = normalize(flatdir); + flatdir = (diff.z == 0) ? dir : normalize(vec2(diff)); //if (this.bot_dodgevector_time < time) { -- 2.39.2