]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
minor fixes for the battle royale gamemode, also fixed a crash when the last player...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Thu, 27 Jan 2022 01:42:06 +0000 (02:42 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Thu, 27 Jan 2022 01:42:06 +0000 (02:42 +0100)
qcsrc/common/gamemodes/gamemode/br/sv_br.qc
qcsrc/server/client.qc

index 8b36a8d6acb45c8ad617300dc0c51f9658502053..659167f646376ec7ec3611afe48748fcddf000ba 100644 (file)
@@ -136,6 +136,13 @@ MUTATOR_HOOKFUNCTION(br, PutClientInServer)
 MUTATOR_HOOKFUNCTION(br, MakePlayerObserver)
 {
     entity player = M_ARGV(0, entity);
+    bool is_forced = M_ARGV(1, bool);
+
+    if(is_forced && IN_SQUAD(player))
+    {
+        br_SquadMember_Remove(player);
+        br_SquadUpdateInfo();
+    }
 
     if(IN_SQUAD(player))
     {
@@ -320,7 +327,7 @@ MUTATOR_HOOKFUNCTION(br, PlayerPreThink, CBC_ORDER_FIRST)
                 player.velocity = player.br_drop_velocity;
                 player.angles = player.br_drop_angles;
 
-                if(IN_SQUAD(player) && (IS_REAL_CLIENT(player) || br_SquadIsBotsOnly(player.br_squad)))
+                if(IN_SQUAD(player) && ((IS_REAL_CLIENT(player) && (player.br_drop_launch == 2)) || br_SquadIsBotsOnly(player.br_squad)))
                 {
                     player.br_squad.br_squad_drop_leader = player;
 
index f5f656924949fc4880c68e699530d9f0eea08aae..34a44cdc4b039a76e272c263c98b11e613a8a955 100644 (file)
@@ -234,7 +234,7 @@ void setplayermodel(entity e, string modelname)
                UpdatePlayerSounds(e);
 }
 
-.bool would_spectate;
+bool SpectateNext(entity this);
 
 /** putting a client as observer in the server */
 void PutObserverInServer(entity this, bool is_forced)
@@ -402,7 +402,10 @@ void PutObserverInServer(entity this, bool is_forced)
 
        // force members of alive squads to spectate another squadmate
        if(IS_REAL_CLIENT(this) && IN_SQUAD(this) && !this.br_squad.br_squad_dead)
-               this.would_spectate = true;
+       {
+               SpectateNext(this);
+               TRANSMUTE(Spectator, this);
+       }
 }
 
 int player_getspecies(entity this)
@@ -2256,6 +2259,7 @@ bool PlayerThink(entity this)
        return true;
 }
 
+.bool would_spectate;
 // merged SpectatorThink and ObserverThink (old names are here so you can grep for them)
 void ObserverOrSpectatorThink(entity this)
 {