]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/arc.qc
Compact some conditions in the Arc code
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / arc.qc
index c4c396fce597d44f796b826ccfebeb41a95a9307..fc31db88754e76bc486b81fa24df7306d340718d 100644 (file)
@@ -208,25 +208,11 @@ void W_Arc_Beam_Think(entity this)
        Weapon thiswep = WEP_ARC;
 
        // TODO: use standard weapon use checks here!
        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 )
                {
        {
                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) )
                        {
 
                        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);
                        }
                }
                                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);
 
                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)
                {
                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));
                        if(SAME_TEAM(own, trace_ent))
                        {
                                float roothealth = ((burst) ? WEP_CVAR(arc, burst_healing_hps) : WEP_CVAR(arc, beam_healing_hps));