]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc
Set the persistent flag on the Superweapons status effect when the player has unlimit...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / status_effects / sv_status_effects.qc
index 0ec5d4d5c5760ac87fbc44b70b81637bb26a068f..90fda09cb47a52f7fe0c767c2072bc41d43be305 100644 (file)
@@ -39,12 +39,14 @@ METHOD(StatusEffects, m_apply, void(StatusEffects this, entity actor, float eff_
 
 METHOD(StatusEffects, m_remove, void(StatusEffects this, entity actor, int removal_type))
 {
-       if(!actor.statuseffects)
+       StatusEffects data = actor.statuseffects;
+       if(!data)
                return;
-       if(removal_type == STATUSEFFECT_REMOVE_NORMAL && this.m_active(this, actor))
+       // NOTE: persistent effects do not make a sound on removal, this is intended as a workaround for #2620
+       if(removal_type == STATUSEFFECT_REMOVE_NORMAL && !(data.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_PERSISTENT) && this.m_active(this, actor))
                sound(actor, CH_TRIGGER, this.m_sound_rm, VOL_BASE, ATTEN_NORM);
-       actor.statuseffects.statuseffect_time[this.m_id] = 0;
-       actor.statuseffects.statuseffect_flags[this.m_id] = 0;
+       data.statuseffect_time[this.m_id] = 0;
+       data.statuseffect_flags[this.m_id] = 0;
        StatusEffects_update(actor);
 }