From 0a2a9d21fe4952dfaa56a29a932b8b381ae579f1 Mon Sep 17 00:00:00 2001 From: mand1nga Date: Sun, 15 Mar 2009 01:01:55 +0000 Subject: [PATCH] Fixed bug in the routing to alternative goals. Don't rate enemies as goals when they're too close. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6170 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/havocbot.qc | 12 ++++-------- data/qcsrc/server/havocbot_roles.qc | 5 +++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/data/qcsrc/server/havocbot.qc b/data/qcsrc/server/havocbot.qc index 43ca054d2..30c023ace 100644 --- a/data/qcsrc/server/havocbot.qc +++ b/data/qcsrc/server/havocbot.qc @@ -388,14 +388,10 @@ void havocbot_movetogoal() } // use the alternative goal - if (bot_strategytoken == self) - if (!bot_strategytoken_taken) - { - navigation_findnearestwaypoint(self.alternativegoal, TRUE); - navigation_routetogoal(self.alternativegoal); - self.alternativegoal = world; - bot_strategytoken_taken = TRUE; - } + navigation_findnearestwaypoint(self.alternativegoal, TRUE); + navigation_routetogoal(self.alternativegoal); + self.alternativegoal = world; + bot_strategytoken_taken = TRUE; return; } diff --git a/data/qcsrc/server/havocbot_roles.qc b/data/qcsrc/server/havocbot_roles.qc index 2e17451b9..fa1816e65 100644 --- a/data/qcsrc/server/havocbot_roles.qc +++ b/data/qcsrc/server/havocbot_roles.qc @@ -254,7 +254,7 @@ void havocbot_goalrating_waypoints(float ratingscale, vector org, float sradius) void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius) { local entity head; - local float t, noteam; + local float t, noteam, distance; noteam = ((self.team == 0) || !teams_matter); // fteqcc sucks // don't chase players if we're under water @@ -268,7 +268,8 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi if (head.health > 0) if ((noteam && (!bot_ignore_bots || clienttype(head) == CLIENTTYPE_REAL)) || head.team != self.team) { - if (vlen(head.origin - org) > sradius) + distance = vlen(head.origin - org); + if (distance < 100 || distance > sradius) continue; if(g_minstagib) -- 2.39.2