From: terencehill Date: Wed, 17 Aug 2022 14:51:06 +0000 (+0200) Subject: Bot AI: improve rocket guide with the devastator X-Git-Tag: xonotic-v0.8.6~322^2~15 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=bfebc940a4be864b9b5aa88466e035e989ac23ce;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: improve rocket guide with the devastator --- diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 62d677df2..da5f1069c 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -375,7 +375,12 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponenti } // aim and decide to fire if appropriate - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); + float spd = WEP_CVAR(devastator, speed); + // simulate rocket guide by calculating rocket trajectory with higher speed + // 20 times faster at 90 degrees guide rate + if (actor.bot_aimtarg && WEP_CVAR(devastator, guiderate) > 0) + spd *= sqrt(WEP_CVAR(devastator, guiderate)) * (20 / 9.489); // 9.489 ~= sqrt(90) + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, spd, 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! { // decide whether to detonate rockets