From: Dr. Jaska Date: Mon, 1 Jul 2024 06:57:31 +0000 (+0000) Subject: Only remove player status effects on player disconnect X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=442a4d60afa34a9a84ae2707b5ce5457525f82d9;p=xonotic%2Fxonotic-data.pk3dir.git Only remove player status effects on player disconnect --- 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!