From 442a4d60afa34a9a84ae2707b5ce5457525f82d9 Mon Sep 17 00:00:00 2001 From: "Dr. Jaska" Date: Mon, 1 Jul 2024 06:57:31 +0000 Subject: [PATCH] Only remove player status effects on player disconnect --- .../status_effects/sv_status_effects.qc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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 9d97e94b6..2f654333d 100644 --- a/qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc +++ b/qcsrc/common/mutators/mutator/status_effects/sv_status_effects.qc @@ -74,7 +74,13 @@ MUTATOR_HOOKFUNCTION(status_effects, ClientDisconnect) { entity player = M_ARGV(0, entity); - StatusEffects_removeall(player, STATUSEFFECT_REMOVE_NORMAL); // just to get rid of the pickup sound + // don't delete possible spectatee's effects! + if(player.statuseffects && player.statuseffects.owner == player) + { + // just to get rid of the pickup sound + StatusEffects_removeall(player, STATUSEFFECT_REMOVE_NORMAL); + } + return true; } @@ -82,8 +88,15 @@ MUTATOR_HOOKFUNCTION(status_effects, MakePlayerObserver) { entity player = M_ARGV(0, entity); - // no need to network updates, as there is no statuseffects object attached - StatusEffects_removeall(player, STATUSEFFECT_REMOVE_NORMAL); // just to get rid of the pickup sound + // don't delete spectatee's effects! + if(player.statuseffects && player.statuseffects.owner == player) + { + // just to get rid of the pickup sound + // no need to network updates, as there is no statuseffects object attached + StatusEffects_removeall(player, STATUSEFFECT_REMOVE_NORMAL); + } + + // spectator has their own ent StatusEffects_clearall(player.statuseffects_store); // don't delete spectatee's effects! -- 2.39.2