From: drjaska Date: Wed, 28 Dec 2022 11:54:57 +0000 (+0200) Subject: mortar wr_aim slightly less duplication X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1c4b1e8cdfba62f81a4d27c716cbc4bd816e3fe7;p=xonotic%2Fxonotic-data.pk3dir.git mortar wr_aim slightly less duplication --- diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 52b8a571a..9dcd03ec8 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -254,17 +254,15 @@ METHOD(Mortar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { PHYS_INPUT_BUTTON_ATCK(actor) = false; PHYS_INPUT_BUTTON_ATCK2(actor) = false; - if(actor.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH + int sec = actor.bot_secondary_grenademooth; // is secondary? + if(bot_aim(actor, weaponentity, WEP_CVAR_BOTH(mortar, sec, speed), WEP_CVAR_BOTH(mortar, sec, speed_up), WEP_CVAR_BOTH(mortar, sec, lifetime), true, true)) { - if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true, true)) + if(sec == 0) { PHYS_INPUT_BUTTON_ATCK(actor) = true; if(random() < 0.01) actor.bot_secondary_grenademooth = 1; } - } - else - { - if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true, true)) + else { PHYS_INPUT_BUTTON_ATCK2(actor) = true; if(random() < 0.02) actor.bot_secondary_grenademooth = 0;