]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Avoid checking Arc overheat twice
authorterencehill <piuntn@gmail.com>
Sat, 11 Jun 2022 19:08:30 +0000 (21:08 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 11 Jun 2022 19:08:30 +0000 (21:08 +0200)
qcsrc/common/weapons/weapon/arc.qc

index fc31db88754e76bc486b81fa24df7306d340718d..54e7d99bd54cb1d31e09cf038ce0fa02493f6637 100644 (file)
@@ -226,18 +226,20 @@ void W_Arc_Beam_Think(entity this)
                                cooldown_speed = this.beam_heat / WEP_CVAR(arc, beam_refire);
                        }
 
+                       bool overheat = (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max));
+                       if (overheat)
+                       {
+                               Send_Effect(EFFECT_ARC_OVERHEAT, this.beam_start, this.beam_wantdir, 1);
+                               sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
+                       }
+
                        if ( cooldown_speed )
                        {
-                               if ( WEP_CVAR(arc, cooldown_release) || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) )
+                               if (WEP_CVAR(arc, cooldown_release) || overheat)
                                        own.arc_overheat = time + this.beam_heat / cooldown_speed;
                                own.arc_cooldown = cooldown_speed;
                        }
 
-                       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);
-                               sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
-                       }
                }
 
                if(this == own.(weaponentity).arc_beam) { own.(weaponentity).arc_beam = NULL; }