From: bones_was_here Date: Tue, 4 Jun 2024 12:15:37 +0000 (+1000) Subject: Allow g_balance_teams_prevent_imbalance without g_balance_teams X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9aadc9955061d8c520f7313701c82b6e50221306;p=xonotic%2Fxonotic-data.pk3dir.git Allow g_balance_teams_prevent_imbalance without g_balance_teams 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. --- diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index a1bd69fea..850efa1f3 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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); diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 1cdabcc34..6e6a3e1e2 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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; diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 8a98a2665..7aceeaa37 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -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)"