]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/aim.qc
Fix bots waiting for a teamed item to spawn again once they got it (e.g. megas and...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / aim.qc
index c278be915a2278a3eabd89966c990cf6ad44c75e..8f2abb3f824b5745448a5fb4c16ab21545e5451b 100644 (file)
@@ -1,5 +1,7 @@
 #include "aim.qh"
 
+#include <server/defs.qh>
+
 #include "cvars.qh"
 
 #include "bot.qh"
@@ -157,7 +159,7 @@ void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1,
                return;
        }
        this.bot_aimtarg = e1;
-       this.bot_aimlatency = this.ping; // FIXME?  Shouldn't this be in the lag item?
+       this.bot_aimlatency = CS(this).ping; // FIXME?  Shouldn't this be in the lag item?
        //this.bot_aimorigin = v1;
        //this.bot_aimvelocity = v2;
        this.bot_aimtargorigin = v3;
@@ -229,7 +231,7 @@ float bot_aimdir(entity this, vector v, float maxfiredeviation)
        this.bot_5th_order_aimfilter= this.bot_5th_order_aimfilter
                + (this.bot_4th_order_aimfilter - this.bot_5th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_5th,1);
 
-       //blend = (bound(0,skill,10)*0.1)*pow(1-bound(0,skill,10)*0.05,2.5)*5.656854249; //Plot formule before changing !
+       //blend = (bound(0,skill,10)*0.1)*((1-bound(0,skill,10)*0.05) ** 2.5)*5.656854249; //Plot formule before changing !
        blend = bound(0,skill+this.bot_aimskill,10)*0.1;
        desiredang = desiredang + blend *
        (
@@ -281,7 +283,7 @@ float bot_aimdir(entity this, vector v, float maxfiredeviation)
        blendrate = autocvar_bot_ai_aimskill_blendrate;
        r = max(fixedrate, blendrate);
        //this.v_angle = this.v_angle + diffang * bound(frametime, r * frametime * (2+skill*skill*0.05-random()*0.05*(10-skill)), 1);
-       this.v_angle = this.v_angle + diffang * bound(delta_t, r * delta_t * (2+pow(skill+this.bot_mouseskill,3)*0.005-random()), 1);
+       this.v_angle = this.v_angle + diffang * bound(delta_t, r * delta_t * (2 + ((skill + this.bot_mouseskill) ** 3) * 0.005 - random()), 1);
        this.v_angle = this.v_angle * bound(0,autocvar_bot_ai_aimskill_mouse,1) + desiredang * bound(0,(1-autocvar_bot_ai_aimskill_mouse),1);
        //this.v_angle = this.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
        //this.v_angle = this.v_angle + diffang * (1/ blendrate);
@@ -305,9 +307,7 @@ float bot_aimdir(entity this, vector v, float maxfiredeviation)
        //dprint("e ", vtos(diffang), " < ", ftos(maxfiredeviation), "\n");
 
        // decide whether to fire this time
-       // 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 (v * shotdir >= cos(maxfiredeviation * DEG2RAD))
        if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + this.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+this.bot_aggresskill)*0.05,1))
                this.bot_firetimer = time + bound(0.1, 0.5-(skill+this.bot_aggresskill)*0.05, 0.5);
        //traceline(shotorg,shotorg+shotdir*1000,false,NULL);