From: terencehill Date: Sat, 11 Jun 2022 19:08:30 +0000 (+0200) Subject: Avoid checking Arc overheat twice X-Git-Tag: xonotic-v0.8.5~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5ab697b0184201b9fb2fe49fb33699cbde5d7f18;p=xonotic%2Fxonotic-data.pk3dir.git Avoid checking Arc overheat twice --- diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index fc31db887..54e7d99bd 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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; }