From: Mario Date: Sun, 15 Aug 2021 13:12:31 +0000 (+1000) Subject: Set the persistent flag on the Superweapons status effect when the player has unlimit... X-Git-Tag: xonotic-v0.8.5~365^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=56a76f26d01e2c48273ee2a446d3afaedcf325d9;p=xonotic%2Fxonotic-data.pk3dir.git Set the persistent flag on the Superweapons status effect when the player has unlimited superweapons, don't play a sound when dropping persistent status effects, fixes #2620 --- diff --git a/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qc b/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qc index 915bb8aca..f4707163a 100644 --- a/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qc +++ b/qcsrc/common/mutators/mutator/status_effects/status_effect/superweapons.qc @@ -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)) { diff --git a/qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc b/qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc index 0ec5d4d5c..90fda09cb 100644 --- a/qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc +++ b/qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc @@ -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); }