From: Mario Date: Mon, 15 Oct 2018 13:53:29 +0000 (+1000) Subject: Tweak alternating dual wielding so weapons fire in time X-Git-Tag: xonotic-v0.8.5~1770 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c434451ebffdc5d152d958d1de3f24346df16bca;p=xonotic%2Fxonotic-data.pk3dir.git Tweak alternating dual wielding so weapons fire in time --- diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 29c4018bd..52a1934e5 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -319,7 +319,8 @@ void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, ATTACK_FINISHED(actor, slot) = time; // dprint("resetting attack finished to ", ftos(time), "\n"); } - ATTACK_FINISHED(actor, slot) = ATTACK_FINISHED(actor, slot) + attacktime * W_WeaponRateFactor(actor); + float arate = W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, slot) = ATTACK_FINISHED(actor, slot) + attacktime * arate; if(autocvar_g_weaponswitch_debug_alternate && W_DualWielding(actor)) { @@ -330,9 +331,11 @@ void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, .entity wepent = weaponentities[wepslot]; if(actor.(wepent) && actor.(wepent).m_weapon != WEP_Null) { + if(ATTACK_FINISHED(actor, wepslot) > time + actor.(wepent).weapon_frametime * 0.5) + continue; // still cooling down! if (ATTACK_FINISHED(actor, wepslot) < time - actor.(wepent).weapon_frametime * 1.5) ATTACK_FINISHED(actor, wepslot) = time; - ATTACK_FINISHED(actor, wepslot) = ATTACK_FINISHED(actor, wepslot) + (attacktime * W_WeaponRateFactor(actor)) * 0.5; + ATTACK_FINISHED(actor, wepslot) = ATTACK_FINISHED(actor, wepslot) + (attacktime * arate) * 0.5; } } }