From 2b17f02797c8c671e48c1557eb3e52edfbd045ae Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Mon, 17 Jan 2022 21:05:08 +0100 Subject: [PATCH] fix the floating spectator body bug in battle royale --- qcsrc/common/gamemodes/gamemode/br/sv_br.qc | 16 ++-------------- qcsrc/server/client.qc | 9 +++++++++ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc index 87a527f35..27200d025 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc @@ -115,23 +115,11 @@ MUTATOR_HOOKFUNCTION(br, PutClientInServer) return false; if (IN_SQUAD(player)) - { Send_Notification(NOTIF_ONE_ONLY, player, MSG_CENTER, CENTER_BR_JOIN_DEAD); - if(IS_REAL_CLIENT(player) && !player.br_squad.br_squad_dead) - { - SpectateNext(player); - TRANSMUTE(Spectator, player); - } - else - { - TRANSMUTE(Observer, player); - } - } else - { Send_Notification(NOTIF_ONE_ONLY, player, MSG_CENTER, CENTER_BR_JOIN_LATE); - TRANSMUTE(Observer, player); - } + + TRANSMUTE(Observer, player); } MUTATOR_HOOKFUNCTION(br, MakePlayerObserver) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 2cf6f95f6..34a44cdc4 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -234,6 +234,8 @@ void setplayermodel(entity e, string modelname) UpdatePlayerSounds(e); } +bool SpectateNext(entity this); + /** putting a client as observer in the server */ void PutObserverInServer(entity this, bool is_forced) { @@ -397,6 +399,13 @@ void PutObserverInServer(entity this, bool is_forced) if (CS(this).just_joined) CS(this).just_joined = false; + + // force members of alive squads to spectate another squadmate + if(IS_REAL_CLIENT(this) && IN_SQUAD(this) && !this.br_squad.br_squad_dead) + { + SpectateNext(this); + TRANSMUTE(Spectator, this); + } } int player_getspecies(entity this) -- 2.39.2