From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sat, 10 Jun 2023 01:34:23 +0000 (+0200) Subject: battle royale: add option to automatically determine squad size X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e728a131dd8d27aa2e5a9a9a4e061fa9ddfd9a4f;p=xonotic%2Fxonotic-data.pk3dir.git battle royale: add option to automatically determine squad size --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 06717d27b..eb4d0a869 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -578,7 +578,7 @@ set g_br_not_assault_maps 0 "when this is set, CTF maps will NOT be listed in BR set g_br_not_ctf_maps 0 "when this is set, CTF maps will NOT be listed in BR" set g_br_not_dm_maps 0 "when this is set, DM maps will NOT be listed in BR" set g_br_minplayers 2 "minimum players to start the BR match" -set g_br_squad_size 3 "maximum squad size" +set g_br_squad_size 3 "maximum squad size, use 0 or a negative number to determine squad size based on the amount of players up to the specified number or unlimited if 0" set g_br_squad_colors 1 "assign each squad a random color scheme and force players to use it" set g_br_squad_waypoint_distance 1500 "minimum distance required to show an ally waypoint" set g_br_startweapons 0 "when disabled, players land from the dropship without weapons" diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc index 09abdd58f..899d05298 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc @@ -1328,9 +1328,12 @@ void br_Start(){ ++num_players; }); - max_squad_size = max(autocvar_g_br_squad_size, 1); - if(num_players <= max_squad_size) - max_squad_size = ceil(num_players / 2); + if(autocvar_g_br_squad_size >= 1) + max_squad_size = min(autocvar_g_br_squad_size, ceil(num_players / 2)); + else if(autocvar_g_br_squad_size <= -1) + max_squad_size = min(-autocvar_g_br_squad_size, floor(num_players / 2)); + else + max_squad_size = floor(num_players / 2); for(int num_squads = 0; (num_squads * max_squad_size) < num_players; ++num_squads) {