]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/aim.qc
also get rid of CHAN_WEAPON2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / aim.qc
index 1911daf9e6a3ad2f5504995fac11f68b3256f5f1..63e971b17da9c52cacc638e8ae6c3f006cff096f 100644 (file)
@@ -1,4 +1,5 @@
 
+entity ka_ball;
 // traces multiple trajectories to find one that will impact the target
 // 'end' vector is the place it aims for,
 // returns TRUE only if it hit targ (don't target non-solid entities)
@@ -104,7 +105,7 @@ float bot_shouldattack(entity e)
        {
                if (e == self)
                        return FALSE;
-               if (teams_matter)
+               if (teamplay)
                if (e.team != 0)
                        return FALSE;
        }
@@ -113,7 +114,13 @@ float bot_shouldattack(entity e)
                if(e.freezetag_frozen)
                        return FALSE;
 
-       if(teams_matter)
+       // If neither player has ball then don't attack unless the ball is on the
+       // ground.
+       if (g_keepaway)
+               if (!e.ballcarried && !self.ballcarried && ka_ball.owner)
+                       return FALSE;
+
+       if(teamplay)
        {
                if(e.team==0)
                        return FALSE;
@@ -353,18 +360,19 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
        {
                f = bot_aimdir(v - shotorg, r);
                //dprint("AIM: ");dprint(vtos(self.bot_aimtargorigin));dprint(" + ");dprint(vtos(self.bot_aimtargvelocity));dprint(" * ");dprint(ftos(self.bot_aimlatency + vlen(self.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
-               traceline(shotorg, shotorg + shotdir * 10000, FALSE, self);
-               if (trace_ent.takedamage)
-               if (trace_fraction < 1)
-               if (!bot_shouldattack(trace_ent))
-                       return FALSE;
+               //traceline(shotorg, shotorg + shotdir * 10000, FALSE, self);
+               //if (trace_ent.takedamage)
+               //if (trace_fraction < 1)
+               //if (!bot_shouldattack(trace_ent))
+               //      return FALSE;
                traceline(shotorg, self.bot_aimtargorigin, FALSE, self);
                if (trace_fraction < 1)
                if (trace_ent != self.enemy)
                if (!bot_shouldattack(trace_ent))
                        return FALSE;
        }
-       if (r > maxshottime * shotspeed)
-               return FALSE;
-       return f;
+
+       //if (r > maxshottime * shotspeed)
+       //      return FALSE;
+       return TRUE;
 };