From: terencehill Date: Mon, 22 Aug 2022 15:48:21 +0000 (+0200) Subject: Bot AI: fix aim think rate lower than expected (7.5 instead of 10 fps) for high skill... X-Git-Tag: xonotic-v0.8.6~322^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aea5c72f582bf0364874ed0284410be552b5ce09;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix aim think rate lower than expected (7.5 instead of 10 fps) for high skill bots due to extremely small precision errors --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index af108f149..1ec1fde57 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -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;