From: terencehill Date: Thu, 5 Mar 2020 18:19:59 +0000 (+0100) Subject: Bot AI: better implementation of keeping the current route while bot is jumping a gap X-Git-Tag: xonotic-v0.8.5~1148 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=031fcc0eb498dab11d9dba6ca95d69a67c1c409b;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: better implementation of keeping the current route while bot is jumping a gap --- 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);