From c4bce6d9a493a84cce1c213e4f85d4c47e2ee11e Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 11 Jul 2018 17:34:52 +0200 Subject: [PATCH] Bot AI: fix bots sometimes getting stuck on a ledge above a jumppad (e.g. Mentalspace) --- qcsrc/server/bot/default/havocbot/havocbot.qc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index a2c6e26863..580d5ad7ac 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; -- 2.39.2