]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix the floating spectator body bug in battle royale
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 17 Jan 2022 20:05:08 +0000 (21:05 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 17 Jan 2022 20:05:08 +0000 (21:05 +0100)
qcsrc/common/gamemodes/gamemode/br/sv_br.qc
qcsrc/server/client.qc

index 87a527f35d0916d444db640879e9cbe2aa5c9cc2..27200d025e693d5c8eda01434a20de95564f6156 100644 (file)
@@ -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)
index 2cf6f95f6a4459a5eb2a0545c6503421e37415b8..34a44cdc4b039a76e272c263c98b11e613a8a955 100644 (file)
@@ -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)