]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow g_balance_teams_prevent_imbalance without g_balance_teams
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 4 Jun 2024 12:15:37 +0000 (22:15 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 5 Aug 2024 16:26:20 +0000 (02:26 +1000)
I disagree with the comment because g_balance_teams is a misnomer: all
it does is change whether the team selection UI appears when pressing
+jump. Selecting a team manually can improve balance when players know
each other's skills, and the fact that's in use doesn't automatically
mean that people should be allowed to stack mid-match.

Added a condition to only enforce during the match or countdown, because
it's easier to reorganise teams during warmup when players can directly
switch to their team, instead of one of them needing to spec before the
other can swap.

qcsrc/server/command/cmd.qc
qcsrc/server/teamplay.qc
xonotic-server.cfg

index a1bd69feab392cc4a88acc170f5e56f2ee1c27af..850efa1f3009fe90140bc277ba05717bac193b6d 100644 (file)
@@ -568,7 +568,7 @@ void ClientCommand_selectteam(entity caller, int request, int argc)
                                sprint(caller, "^1You cannot change team, forbidden by the server.\n");
                                return;
                        }
-                       if (team_num && autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance)
+                       if (team_num && autocvar_g_balance_teams_prevent_imbalance && !warmup_stage)
                        {
                                entity balance = TeamBalance_CheckAllowedTeams(caller);
                                TeamBalance_GetTeamCounts(balance, caller);
index 1cdabcc3421a8e9bdb0ecc7df65e7d4ad99019e9..6e6a3e1e260001ec5df430dd6eedfd6443d3961d 100644 (file)
@@ -333,8 +333,8 @@ void Player_SetTeamIndexChecked(entity player, int team_index)
        {
                team_index = 1;
        }
-       // autocvar_g_balance_teams_prevent_imbalance only makes sense if autocvar_g_balance_teams is on, as it makes the team selection dialog pointless
-       if (autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance)
+
+       if (autocvar_g_balance_teams_prevent_imbalance && !warmup_stage)
        {
                TeamBalance_GetTeamCounts(balance, player);
                if ((Team_IndexToBit(team_index) & TeamBalance_FindBestTeams(balance,
@@ -1095,7 +1095,7 @@ int TeamBalance_CompareTeams(entity balance, int team_index_a, int team_index_b,
 void TeamBalance_AutoBalanceBots()
 {
        // checks disabled because we always want auto-balanced bots
-       //if (!(autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance))
+       //if (!autocvar_g_balance_teams_prevent_imbalance)
        //      return;
 
        if (intermission_running) return;
index 8a98a2665802b3c98cdcb5fd3804324fec717109..7aceeaa37b221d5e953f864432c1645894af1c65 100644 (file)
@@ -280,7 +280,7 @@ set g_teamdamage_threshold 40       "for teamplay_mode 4: threshold over which t
 set g_teamdamage_resetspeed 20      "for teamplay_mode 4: how fast player's teamdamage count decreases"
 
 set g_balance_teams 1 "automatically balance out players entering instead of asking them for their preferred team"
-set g_balance_teams_prevent_imbalance 1 "prevent players from changing to larger teams"
+set g_balance_teams_prevent_imbalance 1 "prevent players from changing to larger teams during the match"
 set g_balance_teams_queue 0 "queue players to maintain balance when they join during the match"
 set g_balance_teams_remove 0 "remove excess players from teams to maintain balance when someone leaves (currently does nothing in matches with more than 2 teams)"
 set g_balance_teams_remove_wait 10 "seconds to warn everyone before removing an excess player (0 = immediately)"