From bfebc940a4be864b9b5aa88466e035e989ac23ce Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 17 Aug 2022 16:51:06 +0200 Subject: [PATCH] Bot AI: improve rocket guide with the devastator --- qcsrc/common/weapons/weapon/devastator.qc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.39.2