From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Thu, 27 Jan 2022 01:42:06 +0000 (+0100) Subject: minor fixes for the battle royale gamemode, also fixed a crash when the last player... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8d411e4a69c8c7aa6440a66858ccd8d004f3e9ff;p=xonotic%2Fxonotic-data.pk3dir.git minor fixes for the battle royale gamemode, also fixed a crash when the last player of the squad gets force spectated --- diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc index 8b36a8d6a..659167f64 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc @@ -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; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f5f656924..34a44cdc4 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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) {