- if(self.owner.ballcarried)
- { // add points for holding the ball after a certain amount of time
- if(autocvar_g_keepaway_score_timepoints)
- PlayerScore_Add(self.owner, SP_SCORE, autocvar_g_keepaway_score_timepoints);
-
- PlayerScore_Add(self.owner, SP_KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds"
- self.nextthink = time + autocvar_g_keepaway_score_timeinterval;
+ float t;
+ entity ball_owner;
+ ball_owner = ka_ball.owner;
+
+ if (ball_owner == self)
+ return;
+
+ // If ball is carried by player then hunt them down.
+ if (ball_owner)
+ {
+ t = (self.health + self.armorvalue) / (ball_owner.health + ball_owner.armorvalue);
+ navigation_routerating(ball_owner, t * ratingscale, 2000);
+ }
+
+ // Ball has been dropped so collect.
+ navigation_routerating(ka_ball, ratingscale, 2000);
+}
+
+void havocbot_role_ka_carrier()
+{
+ if (self.deadflag != DEAD_NO)
+ return;
+
+ if (time > self.bot_strategytime)
+ {
+ self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+
+ navigation_goalrating_start();
+ havocbot_goalrating_items(10000, self.origin, 10000);
+ havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
+ //havocbot_goalrating_waypoints(1, self.origin, 1000);
+ navigation_goalrating_end();
+ }
+
+ if (!self.ballcarried)
+ {
+ self.havocbot_role = havocbot_role_ka_collector;
+ self.bot_strategytime = 0;
+ }
+}
+
+void havocbot_role_ka_collector()
+{
+ if (self.deadflag != DEAD_NO)
+ return;
+
+ if (time > self.bot_strategytime)
+ {
+ self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+
+ navigation_goalrating_start();
+ havocbot_goalrating_items(10000, self.origin, 10000);
+ havocbot_goalrating_enemyplayers(1000, self.origin, 10000);
+ havocbot_goalrating_ball(20000, self.origin);
+ navigation_goalrating_end();
+ }
+
+ if (self.ballcarried)
+ {
+ self.havocbot_role = havocbot_role_ka_carrier;
+ self.bot_strategytime = 0;