]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: fix aim think rate lower than expected (7.5 instead of 10 fps) for high skill...
authorterencehill <piuntn@gmail.com>
Mon, 22 Aug 2022 15:48:21 +0000 (17:48 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 22 Aug 2022 15:48:21 +0000 (17:48 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc

index af108f14900f3fe02d121e2b6fb41e273b3b5510..1ec1fde57da5e3cb166def50b0f11ec8a376e212 100644 (file)
@@ -1508,9 +1508,13 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
 
 void havocbot_aim(entity this)
 {
-       if (time < this.nextaim)
+       // if aim rate is a multiple of think rate due to precision errors the sum of multiple think times
+       // can be slightly greater than aim time and cause a jump of a whole think time (bot_netxtthink)
+       // in that case this small tolerance time makes so that aim time snaps to think time
+       if (time < this.nextaim - 0.01)
                return;
        this.nextaim = time + 0.1;
+
        vector myvel = this.velocity;
        if (!this.waterlevel)
                myvel.z = 0;