]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement g_warmup > 1: manual min player setting (overrides map settings)
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 20 Oct 2022 15:29:06 +0000 (01:29 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 6 Jan 2023 07:16:09 +0000 (17:16 +1000)
qcsrc/server/client.qc
qcsrc/server/command/vote.qc
xonotic-server.cfg

index f27a4e2a7b0185e657e79cae19326a87c35d34c5..6d8ef921b1f4b9bc0679cb97feb3ed7aafe7c0d1 100644 (file)
@@ -812,7 +812,7 @@ void PutPlayerInServer(entity this)
 
        antilag_clear(this, CS(this));
 
-       if (warmup_stage == -1)
+       if (warmup_stage < 0 || warmup_stage > 1)
                ReadyCount();
 }
 
@@ -1042,7 +1042,7 @@ void SendWelcomeMessage(entity this, int msg_type)
        WriteString(msg_type, autocvar_g_xonoticversion);
        WriteByte(msg_type, CS(this).version_mismatch);
        WriteByte(msg_type, (CS(this).version < autocvar_gameversion));
-       WriteByte(msg_type, map_minplayers);
+       WriteByte(msg_type, autocvar_g_warmup > 1 ? autocvar_g_warmup : map_minplayers);
        WriteByte(msg_type, GetPlayerLimit());
 
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
index 03fbb019f379a6c2492a55146dd93f24cbeb6ef5..c4aec35b6d6e2d48387812e6bf106cb378e97ede 100644 (file)
@@ -524,19 +524,24 @@ void ReadyCount()
 
        Nagger_ReadyCounted();
 
-       if (t_players < map_minplayers) // map_minplayers will only be set if g_warmup -1 at worldspawn
+       // can't read warmup_stage here as it could have been set to 0 by ReadyRestart()
+       // and we need to use this when checking if we should abort the countdown
+       // map_minplayers can only be > 0 if g_warmup was -1 at worldspawn
+       int minplayers = autocvar_g_warmup > 1 ? autocvar_g_warmup : map_minplayers;
+
+       if (t_players < minplayers)
        {
                if (game_starttime > time) // someone bailed during countdown, back to warmup
                {
-                       warmup_stage = -1; // CAN change it AFTER calling Nagger_ReadyCounted() this frame
+                       warmup_stage = autocvar_g_warmup; // CAN change it AFTER calling Nagger_ReadyCounted() this frame
                        game_starttime = time;
-                       Send_Notification(NOTIF_ALL, NULL, MSG_MULTI, COUNTDOWN_STOP, map_minplayers);
+                       Send_Notification(NOTIF_ALL, NULL, MSG_MULTI, COUNTDOWN_STOP, minplayers);
                }
                if (warmup_limit > 0)
                        warmup_limit = -1;
                return; // don't ReadyRestart if players are ready but too few
        }
-       else if (map_minplayers && warmup_limit <= 0)
+       else if (minplayers && warmup_limit <= 0)
        {
                // there's enough players now but we're still in infinite warmup
                warmup_limit = cvar("g_warmup_limit");
index cf7544a08194a07f7965bebe78ce5adaaebe42e6..04a6da7048241e2484a9ba262e1f85ae2c858f51 100644 (file)
@@ -30,7 +30,7 @@ set g_maxplayers 0 "maximum number of players allowed to play at the same time,
 set g_maxplayers_spectator_blocktime 5 "if the players voted for the \"nospectators\" command, this setting defines the number of seconds a observer/spectator has time to join the game before he gets kicked"
 
 // tournament mod
-set g_warmup 0 "split the game into a warmup- and match-stage, -1 means stay in warmup until enough (set by map, lower bound of 2 or 2 per team) players join, then g_warmup_limit and readiness apply"
+set g_warmup 0 "splits the game into warmup and match stages, 1 means the match starts when g_warmup_majority_factor of players are ready OR g_warmup_limit is hit, >1 also requires at least g_warmup players (including bots) to join, -1 means that minimum player requrement is set by the map (lower bound of 2 or 2 per team)"
 set g_warmup_limit 180 "limit warmup-stage to this time (in seconds); if set to -1 the warmup-stage is not affected by any timelimit, if set to 0 the usual timelimit also affects warmup-stage"
 set g_warmup_allow_timeout 0 "allow calling timeouts in the warmup-stage (if sv_timeout is set to 1)"
 set g_warmup_allguns 1 "provide more weapons on start while in warmup: 0 = normal start weapons, 1 = all guns available on the map, 2 = all normal weapons"