From 031fcc0eb498dab11d9dba6ca95d69a67c1c409b Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 5 Mar 2020 19:19:59 +0100 Subject: [PATCH] Bot AI: better implementation of keeping the current route while bot is jumping a gap --- qcsrc/server/bot/default/havocbot/havocbot.qc | 8 +++++--- qcsrc/server/bot/default/navigation.qc | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 19aada811..b1ce8a29c 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -47,8 +47,12 @@ void havocbot_ai(entity this) } else { - if (!this.jumppadcount && !STAT(FROZEN, this)) + if (!this.jumppadcount && !STAT(FROZEN, this) + && !(this.goalcurrent_prev && (this.goalcurrent_prev.wpflags & WAYPOINTFLAG_JUMP))) + { + // find a new goal this.havocbot_role(this); // little too far down the rabbit hole + } } // if we don't have a goal and we're under water look for a waypoint near the "shore" and push it @@ -943,8 +947,6 @@ void havocbot_movetogoal(entity this) { PHYS_INPUT_BUTTON_JUMP(this) = true; this.bot_jump_time = time; - // avoid changing route while bot is jumping a gap - navigation_goalrating_timeout_extend_if_needed(this, 1.5); } } else if (!this.goalstack01 || (this.goalcurrent.wpflags & (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_LADDER))) diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 57cf690ad..1f5377bb3 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -47,6 +47,7 @@ bool navigation_goalrating_timeout(entity this) return this.bot_strategytime < time; } +ERASEABLE void navigation_goalrating_timeout_extend_if_needed(entity this, float seconds) { this.bot_strategytime = max(this.bot_strategytime, time + seconds); -- 2.39.2