From: terencehill Date: Sun, 24 Jun 2018 13:33:26 +0000 (+0200) Subject: Bot AI: fix bots jumping over frozen players when trying to revive them X-Git-Tag: xonotic-v0.8.5~1923^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e92674bff49f97a68cd84bff7c9268753e22f91d;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix bots jumping over frozen players when trying to revive them --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 33aabfc54..50a706d7f 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -871,16 +871,31 @@ void havocbot_movetogoal(entity this) diff = destorg - this.origin; - // 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))) + if (this.goalcurrent == this.goalentity && time < this.goalentity_lock_timeout && vdist(diff, <, 10)) { + // stop if the locked goal has been reached destorg = this.origin; - diff = '0 0 0'; + diff = dir = '0 0 0'; } - - dir = normalize(diff); + else if (IS_PLAYER(this.goalcurrent) || IS_MONSTER(this.goalcurrent)) + { + if (vdist(diff, <, 80)) + { + // stop if too close to target player (even if frozen) + destorg = this.origin; + diff = dir = '0 0 0'; + } + else + { + // move destorg out of target players, otherwise bot will consider them + // an obstacle that needs to be jumped (especially if frozen) + dir = normalize(diff); + destorg -= dir * PL_MAX_CONST.x * M_SQRT2; + diff = destorg - this.origin; + } + } + else + dir = normalize(diff); flatdir = (diff.z == 0) ? dir : normalize(vec2(diff)); //if (this.bot_dodgevector_time < time)