]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: allow turning in a more natural way when a low skilled bot is walking
authorterencehill <piuntn@gmail.com>
Tue, 25 Dec 2018 18:49:40 +0000 (19:49 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 25 Dec 2018 18:49:40 +0000 (19:49 +0100)
qcsrc/server/bot/default/aim.qc

index 633fdf243663ca319131e5b7652dd65f5418b43c..c69442f19b0ee16c4a309d3b9124fd410eb0d8d1 100644 (file)
@@ -206,6 +206,11 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation)
        // invalid aim dir (can happen when bot overlaps target)
        if(!v) return;
 
+       float skill_save = skill;
+       // allow turning in a more natural way when bot is walking
+       if (!this.bot_aimtarg)
+               skill = max(4, skill);
+
        // get the desired angles to aim at
        //dprint(" at:", vtos(v));
        v = normalize(v);
@@ -326,6 +331,8 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation)
        //if (diffang_y >= 180)
        //      diffang_y = diffang_y - 360;
 
+       skill = skill_save;
+
        //dprint("e ", vtos(diffang), " < ", ftos(maxfiredeviation), "\n");
 
        // decide whether to fire this time
@@ -340,8 +347,6 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation)
        }
        //dprint(ftos(maxfiredeviation),"\n");
        //dprint(" diff:", vtos(diffang), "\n");
-
-       //return this.bot_canfire && (time < this.bot_firetimer);
 }
 
 vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay)