From: terencehill Date: Wed, 11 Jul 2018 15:34:52 +0000 (+0200) Subject: Bot AI: fix bots sometimes getting stuck on a ledge above a jumppad (e.g. Mentalspace) X-Git-Tag: xonotic-v0.8.5~1923^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c4bce6d9a493a84cce1c213e4f85d4c47e2ee11e;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix bots sometimes getting stuck on a ledge above a jumppad (e.g. Mentalspace) --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index a2c6e2686..580d5ad7a 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -861,13 +861,18 @@ void havocbot_movetogoal(entity this) // if bot used the jumppad, push towards jumppad origin until jumppad waypoint gets removed destorg = this.goalcurrent.origin; } - else if (this.goalcurrent.wpisbox && boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z)) + else if (this.goalcurrent.wpisbox) { // if bot is inside the teleport waypoint, head to teleport origin until teleport gets used - bunnyhop_forbidden = true; - destorg = this.goalcurrent.origin; - if(destorg.z > this.origin.z) - PHYS_INPUT_BUTTON_JUMP(this) = true; + // do it even if bot is on a ledge above a teleport/jumppad so it doesn't get stuck + if (boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z) + || (this.absmin.z > destorg.z && destorg.x == this.origin.x && destorg.y == this.origin.y)) + { + bunnyhop_forbidden = true; + destorg = this.goalcurrent.origin; + if(destorg.z > this.origin.z) + PHYS_INPUT_BUTTON_JUMP(this) = true; + } } diff = destorg - this.origin;