From: terencehill Date: Fri, 22 Jun 2018 17:41:50 +0000 (+0200) Subject: Bot AI: find another goal as soon as the current goal gets frozen X-Git-Tag: xonotic-v0.8.5~1923^2~21 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8dd5060f4ebfbac94d35cd293621249c7b2157b7;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: find another goal as soon as the current goal gets frozen --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index ded58bf3f..33aabfc54 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -780,10 +780,10 @@ void havocbot_movetogoal(entity this) } bool goalcurrent_can_be_removed = false; - if (IS_MOVABLE(this.goalcurrent)) + if (IS_PLAYER(this.goalcurrent) || IS_MONSTER(this.goalcurrent)) { - // if is movable => not frozen - if (IS_DEAD(this.goalcurrent) || (this.goalentity_shouldbefrozen && this.goalentity == this.goalcurrent)) + bool freeze_state_changed = (boolean(STAT(FROZEN, this.goalentity)) != this.goalentity_shouldbefrozen); + if (IS_DEAD(this.goalcurrent) || (this.goalentity == this.goalcurrent && freeze_state_changed)) { goalcurrent_can_be_removed = true; // don't remove if not visible @@ -793,7 +793,7 @@ void havocbot_movetogoal(entity this) return; } } - else if (this.bot_tracewalk_time < time) + else if (!(STAT(FROZEN, this.goalentity)) && this.bot_tracewalk_time < time) { set_tracewalk_dest(this.goalcurrent, this.origin, true); if (!(trace_ent == this || tracewalk(this, this.origin, this.mins, this.maxs, @@ -805,6 +805,7 @@ void havocbot_movetogoal(entity this) this.bot_tracewalk_time = max(time, this.bot_tracewalk_time) + 0.25; } } + if(!locked_goal) { // optimize path finding by anticipating goalrating when bot is near a waypoint;