From 74ab8f6ab3ac4b44608a6c61cd0393202fd8fb4a Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 15 Aug 2022 13:29:07 +0200 Subject: [PATCH] Bot AI: fix bots randomly refusing to shoot with the devastator --- qcsrc/common/weapons/weapon/devastator.qc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index b4542a039..62d677df2 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -362,6 +362,18 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { + if (!WEP_CVAR(devastator, guidestop) && !actor.(weaponentity).rl_release) + { + int fired_rockets = 0; + IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket", + { + fired_rockets++; + }); + // release PHYS_INPUT_BUTTON_ATCK after all fired rocket exploded otherwise bot can't fire again + if (!fired_rockets) + return; + } + // 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); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! -- 2.39.2