From 5ab697b0184201b9fb2fe49fb33699cbde5d7f18 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 11 Jun 2022 21:08:30 +0200 Subject: [PATCH] Avoid checking Arc overheat twice --- qcsrc/common/weapons/weapon/arc.qc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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; } -- 2.39.2