From: bones_was_here Date: Thu, 20 Oct 2022 15:29:06 +0000 (+1000) Subject: Implement g_warmup > 1: manual min player setting (overrides map settings) X-Git-Tag: xonotic-v0.8.6~179^2~13 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c88915306c11c228f92e605482ff612b59469910;p=xonotic%2Fxonotic-data.pk3dir.git Implement g_warmup > 1: manual min player setting (overrides map settings) --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f27a4e2a7..6d8ef921b 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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, ""); diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 03fbb019f..c4aec35b6 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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"); diff --git a/xonotic-server.cfg b/xonotic-server.cfg index cf7544a08..04a6da704 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -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"