From: terencehill Date: Mon, 15 Aug 2022 11:29:07 +0000 (+0200) Subject: Bot AI: fix bots randomly refusing to shoot with the devastator X-Git-Tag: xonotic-v0.8.6~322^2~16 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=74ab8f6ab3ac4b44608a6c61cd0393202fd8fb4a;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix bots randomly refusing to shoot with the devastator --- 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!