From: Mario Date: Mon, 18 Jun 2018 05:12:13 +0000 (+1000) Subject: Add a few checks to the spam weapons to prevent them from firing when warmup is ending X-Git-Tag: xonotic-v0.8.5~2019 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d19446d08524471211e3f02ad2ccb3ea4f399a2d;p=xonotic%2Fxonotic-data.pk3dir.git Add a few checks to the spam weapons to prevent them from firing when warmup is ending --- diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 40f9ea765..c7066e6fb 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -191,11 +191,9 @@ void W_Arc_Beam_Think(entity this) if( !IS_PLAYER(own) || - (!thiswep.wr_checkammo1(thiswep, own, weaponentity) && !(own.items & IT_UNLIMITED_WEAPON_AMMO)) - || IS_DEAD(own) || - forbidWeaponUse(own) + !weapon_prepareattack_check(thiswep, own, weaponentity, this.beam_bursting, -1) || own.(weaponentity).m_switchweapon != WEP_ARC || diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index e8bfa4ce7..7e76ffb1c 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -255,9 +255,7 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity) void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) { // loadable hagar secondary attack, must always run each frame - if(round_handler_IsActive() && !round_handler_IsRoundStarted()) - return; - if(time < game_starttime) + if(!weapon_prepareattack_check(thiswep, actor, weaponentity, true, -1)) return; bool loaded = actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max); @@ -363,7 +361,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - if(!(fire & 1) || actor.(weaponentity).hagar_load || actor.(weaponentity).hagar_loadblock || actor.(weaponentity).m_switchweapon != WEP_HAGAR) + if(!(fire & 1) || actor.(weaponentity).hagar_load || actor.(weaponentity).hagar_loadblock || actor.(weaponentity).m_switchweapon != WEP_HAGAR || !weapon_prepareattack_check(thiswep, actor, weaponentity, false, -1)) { w_ready(thiswep, actor, weaponentity, fire); return; diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index b5c3bf2fa..6319dc36a 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -86,7 +86,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we // weapon frames void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - if(actor.(weaponentity).m_weapon != actor.(weaponentity).m_switchweapon) // abort immediately if switching + if(actor.(weaponentity).m_weapon != actor.(weaponentity).m_switchweapon || !weapon_prepareattack_check(thiswep, actor, weaponentity, (fire & 2), -1)) // abort immediately if switching { w_ready(thiswep, actor, weaponentity, fire); return; @@ -113,7 +113,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity { float machinegun_spread; - if(!(fire & 1)) + if(!(fire & 1) || !weapon_prepareattack_check(thiswep, actor, weaponentity, false, -1)) { w_ready(thiswep, actor, weaponentity, fire); return;