]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/aim.qc
Teams: mark all uses
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / aim.qc
index d4614b84672902e555b57b9976fd1e07fedddfd8..34797a56f1d4f6aa7d7a7bee42152f7f20f6724b 100644 (file)
@@ -2,6 +2,9 @@
 
 #include "bot.qh"
 
+#include <common/physics/player.qh>
+#include <common/state.qh>
+
 #include "../weapons/weaponsystem.qh"
 
 #include "../mutators/all.qh"
@@ -113,16 +116,16 @@ float bot_shouldattack(entity e)
                if (e == self)
                        return false;
                if (teamplay)
-               if (e.team != 0)
+               if (TMID(e.team) != 0)
                        return false;
        }
 
-       if(e.frozen)
+       if(STAT(FROZEN, e))
                return false;
 
        if(teamplay)
        {
-               if(e.team==0)
+               if(TMID(e.team)==0)
                        return false;
        }
        else if(bot_ignore_bots)
@@ -131,9 +134,9 @@ float bot_shouldattack(entity e)
 
        if (!e.takedamage)
                return false;
-       if (e.deadflag)
+       if (IS_DEAD(e))
                return false;
-       if (e.BUTTON_CHAT)
+       if (PHYS_INPUT_BUTTON_CHAT(e))
                return false;
        if(e.flags & FL_NOTARGET)
                return false;
@@ -303,7 +306,7 @@ float bot_aimdir(vector v, float maxfiredeviation)
        // note the maxfiredeviation is in degrees so this has to convert to radians first
        //if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
        if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
-       if (vlen(trace_endpos-shotorg) < 500+500*bound(0, skill+self.bot_aggresskill, 10) || random()*random()>bound(0,(skill+self.bot_aggresskill)*0.05,1))
+       if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + self.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+self.bot_aggresskill)*0.05,1))
                self.bot_firetimer = time + bound(0.1, 0.5-(skill+self.bot_aggresskill)*0.05, 0.5);
        //traceline(shotorg,shotorg+shotdir*1000,false,world);
        //dprint(ftos(maxfiredeviation),"\n");
@@ -338,12 +341,12 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
        shotspeedupward *= W_WeaponSpeedFactor();
        if (!shotspeed)
        {
-               LOG_TRACE("bot_aim: WARNING: weapon ", Weapons_from(self.weapon).m_name, " shotspeed is zero!\n");
+               LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " shotspeed is zero!\n");
                shotspeed = 1000000;
        }
        if (!maxshottime)
        {
-               LOG_TRACE("bot_aim: WARNING: weapon ", Weapons_from(self.weapon).m_name, " maxshottime is zero!\n");
+               LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " maxshottime is zero!\n");
                maxshottime = 1;
        }
        makevectors(self.v_angle);