From: terencehill Date: Fri, 30 Mar 2018 13:41:39 +0000 (+0200) Subject: BOT AI: avoid sticking to players when chasing them as it was very annoying, especial... X-Git-Tag: xonotic-v0.8.5~2213 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=7a74b39abc98dbf54bb045a2a7f8bf596339f177;p=xonotic%2Fxonotic-data.pk3dir.git BOT AI: avoid sticking to players when chasing them as it was very annoying, especially for newbies --- 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) {