]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Set the persistent flag on the Superweapons status effect when the player has unlimit... 924/head
authorMario <mario.mario@y7mail.com>
Sun, 15 Aug 2021 13:12:31 +0000 (23:12 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 15 Aug 2021 13:12:31 +0000 (23:12 +1000)
qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qc
qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc

index 915bb8aca12ffa381dad33f21b7b99b6c261e841..f4707163aef8fe16b76194092a140f2bf00450b0 100644 (file)
@@ -1,5 +1,12 @@
 #include "superweapons.qh"
 
+#ifdef SVQC
+METHOD(Superweapons, m_persistent, bool(StatusEffects this, entity actor))
+{
+    return (actor.items & IT_UNLIMITED_SUPERWEAPONS);
+}
+#endif
+
 #ifdef CSQC
 METHOD(Superweapons, m_active, bool(StatusEffects this, entity actor))
 {
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);
 }