]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
join queue: disable in singleplayer, improve description
authorbones_was_here <bones_was_here@xonotic.au>
Sun, 9 Jun 2024 18:09:31 +0000 (04:09 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 5 Aug 2024 16:26:25 +0000 (02:26 +1000)
Fixes https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2905

qcsrc/server/client.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh
xonotic-server.cfg

index e41cd9d4d3f67dee221eba53cfbaf9e199d96ed6..0a4a085022dd66ba6be46441c6ca3c8eb30a0983 100644 (file)
@@ -2148,7 +2148,7 @@ int nJoinAllowed(entity this, entity ignore)
 
 bool queuePlayer(entity this, int team_index)
 {
-       if(IS_BOT_CLIENT(this) || !IS_QUEUE_NEEDED(this) || QueuedPlayersReady(this, false))
+       if(IS_BOT_CLIENT(this) || !QueueNeeded(this) || QueuedPlayersReady(this, false))
                return false;
 
        if(team_index <= 0)
index feee31c9b950dc8bfe62bc67fd4708ccd6517200..f2c35665cc0411b42594f3a3bdd23974f78afffd 100644 (file)
@@ -353,7 +353,7 @@ void Player_SetTeamIndexChecked(entity player, int team_index)
 
        // g_balance_teams_queue: before joining the queue,
        // check if a queued player already chose the selected team
-       if (!IS_BOT_CLIENT(player) && IS_QUEUE_NEEDED(player))
+       if (!IS_BOT_CLIENT(player) && QueueNeeded(player))
        {
                FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != player && it.wants_join == team_index,
                {
@@ -1390,3 +1390,17 @@ void SV_ChangeTeam(entity player, int new_color)
        }
        Player_SetTeamIndexChecked(player, Team_TeamToIndex((new_color & 0x0F) + 1));
 }
+
+bool QueueNeeded(entity ignore)
+{
+       if (!teamplay || warmup_stage || !autocvar_g_balance_teams_queue || autocvar_g_campaign)
+               return false;
+
+       int human_clients = 0;
+       FOREACH_CLIENT(IS_REAL_CLIENT(it),
+       {
+               if (++human_clients > 1)
+                       return TeamBalance_AreEqual(ignore, true);
+       });
+       return false;
+}
index 9a75a03d950f2c64c010e5badeb3125f9595e059..b1f1255c1d20347e31c60142a6e3f3708df2455a 100644 (file)
@@ -17,9 +17,6 @@ bool lockteams;
 
 .int team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
 
-#define IS_QUEUE_NEEDED(ignore) \
-       (teamplay && !warmup_stage && autocvar_g_balance_teams_queue && !autocvar_g_campaign \
-       && TeamBalance_AreEqual(ignore, true))
 
 // ========================== Global teams API ================================
 
@@ -361,3 +358,6 @@ int TeamBalance_CompareTeamsInternal(entity team_a, entity team_index_b,
 /// \param[in,out] player Player that requested a new color.
 /// \param[in] new_color Requested color.
 void SV_ChangeTeam(entity player, int new_color);
+
+
+bool QueueNeeded(entity ignore);
index 5e4ec73c261284bcf98aaf76e060ae6842c3cf4c..f160255dee5fedce2a77a94a7d42d88e23e3c839 100644 (file)
@@ -281,7 +281,7 @@ set g_teamdamage_resetspeed 20      "for teamplay_mode 4: how fast player's team
 
 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 during the match"
-set g_balance_teams_queue 0 "queue players to maintain balance when they join during the match"
+set g_balance_teams_queue 0 "queue players to maintain balance when they join during the match, any bots should be added with minplayers_per_team instead of bot_number so humans can replace them instead of waiting in queue while a bot plays"
 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)"
 set g_changeteam_banned 0 "not allowed to change team"