From cdeed9b19ab431d579c81007ba58e7deb708f781 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 11 Jun 2022 20:40:35 +0200 Subject: [PATCH] Compact some conditions in the Arc code --- qcsrc/common/weapons/weapon/arc.qc | 36 ++++++------------------------ 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index c4c396fce..fc31db887 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -208,25 +208,11 @@ void W_Arc_Beam_Think(entity this) Weapon thiswep = WEP_ARC; // TODO: use standard weapon use checks here! - if( - !IS_PLAYER(own) - || - IS_DEAD(own) - || - STAT(FROZEN, own) - || - game_stopped - || - !weapon_prepareattack_check(thiswep, own, weaponentity, this.beam_bursting, -1) - || - own.(weaponentity).m_switchweapon != WEP_ARC - || - (!PHYS_INPUT_BUTTON_ATCK(own) && !burst ) - || - own.vehicle - || - (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) - ) + if(!IS_PLAYER(own) || IS_DEAD(own) || STAT(FROZEN, own) || game_stopped || own.vehicle + || !weapon_prepareattack_check(thiswep, own, weaponentity, this.beam_bursting, -1) + || own.(weaponentity).m_switchweapon != WEP_ARC + || (!PHYS_INPUT_BUTTON_ATCK(own) && !burst) + || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) ) { if ( WEP_CVAR(arc, cooldown) > 0 ) { @@ -249,8 +235,7 @@ void W_Arc_Beam_Think(entity this) if ( WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max) ) { - Send_Effect(EFFECT_ARC_OVERHEAT, - this.beam_start, this.beam_wantdir, 1 ); + Send_Effect(EFFECT_ARC_OVERHEAT, this.beam_start, this.beam_wantdir, 1); sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM); } } @@ -438,16 +423,9 @@ void W_Arc_Beam_Think(entity this) beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos); new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir); - bool is_player = ( - IS_PLAYER(trace_ent) - || - trace_ent.classname == "body" - || - IS_MONSTER(trace_ent) - ); - if(trace_ent) { + bool is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent)); if(SAME_TEAM(own, trace_ent)) { float roothealth = ((burst) ? WEP_CVAR(arc, burst_healing_hps) : WEP_CVAR(arc, beam_healing_hps)); -- 2.39.2