From 9e4cc22b1c22cb2694abd03810957832fbf8e015 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Mon, 26 Sep 2022 15:23:16 +1000 Subject: [PATCH] g_warmup -1: abort countdown if player count falls too low Includes translatable chatcon + centreprint notification for this case. --- notifications.cfg | 13 ++++++++----- qcsrc/client/announcer.qc | 2 +- qcsrc/common/notifications/all.inc | 7 ++++++- qcsrc/server/client.qc | 4 ++-- qcsrc/server/command/vote.qc | 7 ++++++- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/notifications.cfg b/notifications.cfg index 1919601d5..440219064 100644 --- a/notifications.cfg +++ b/notifications.cfg @@ -93,12 +93,13 @@ seta notification_ANNCE_VOTE_ACCEPT "2" "0 = disabled, 1 = enabled if gentle mod seta notification_ANNCE_VOTE_CALL "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" seta notification_ANNCE_VOTE_FAIL "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" -// MSG_INFO notifications (count = 335): +// MSG_INFO notifications (count = 336): seta notification_INFO_CA_JOIN_LATE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_CA_LEAVE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_CHAT_NOSPECTATORS "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_COINTOSS "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_CONNECTING "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" +seta notification_INFO_COUNTDOWN_STOP "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_CTF_CAPTURE_BROKEN "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_CTF_CAPTURE_NEUTRAL "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_CTF_CAPTURE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" @@ -343,7 +344,7 @@ seta notification_INFO_WEAPON_TUBA_SUICIDE "1" "0 = off, 1 = print to console, 2 seta notification_INFO_WEAPON_VAPORIZER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_WEAPON_VORTEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" -// MSG_CENTER notifications (count = 242): +// MSG_CENTER notifications (count = 243): seta notification_CENTER_ALONE "1" "0 = off, 1 = centerprint" seta notification_CENTER_ASSAULT_ATTACKING "1" "0 = off, 1 = centerprint" seta notification_CENTER_ASSAULT_DEFENDING "1" "0 = off, 1 = centerprint" @@ -354,6 +355,7 @@ seta notification_CENTER_COUNTDOWN_BEGIN "1" "0 = off, 1 = centerprint" seta notification_CENTER_COUNTDOWN_GAMESTART "1" "0 = off, 1 = centerprint" seta notification_CENTER_COUNTDOWN_ROUNDSTART "1" "0 = off, 1 = centerprint" seta notification_CENTER_COUNTDOWN_ROUNDSTOP "1" "0 = off, 1 = centerprint" +seta notification_CENTER_COUNTDOWN_STOP "1" "0 = off, 1 = centerprint" seta notification_CENTER_CTF_CAPTURESHIELD_FREE "1" "0 = off, 1 = centerprint" seta notification_CENTER_CTF_CAPTURESHIELD_INACTIVE "1" "0 = off, 1 = centerprint" seta notification_CENTER_CTF_CAPTURESHIELD_SHIELDED "1" "0 = off, 1 = centerprint" @@ -539,7 +541,9 @@ seta notification_CENTER_VEHICLE_STEAL "1" "0 = off, 1 = centerprint" seta notification_CENTER_VEHICLE_STEAL_SELF "1" "0 = off, 1 = centerprint" seta notification_CENTER_WEAPON_MINELAYER_LIMIT "1" "0 = off, 1 = centerprint" -// MSG_MULTI notifications (count = 157): +// MSG_MULTI notifications (count = 158): +seta notification_COUNTDOWN_BEGIN "1" "Enable this multiple notification" +seta notification_COUNTDOWN_STOP "1" "Enable this multiple notification" seta notification_DEATH_MURDER_BUFF "1" "Enable this multiple notification" seta notification_DEATH_MURDER_CHEAT "1" "Enable this multiple notification" seta notification_DEATH_MURDER_DROWN "1" "Enable this multiple notification" @@ -632,7 +636,6 @@ seta notification_ITEM_WEAPON_NOAMMO "1" "Enable this multiple notification" seta notification_ITEM_WEAPON_PRIMORSEC "1" "Enable this multiple notification" seta notification_ITEM_WEAPON_UNAVAILABLE "1" "Enable this multiple notification" seta notification_MULTI_COINTOSS "1" "Enable this multiple notification" -seta notification_MULTI_COUNTDOWN_BEGIN "1" "Enable this multiple notification" seta notification_MULTI_INSTAGIB_FINDAMMO "1" "Enable this multiple notification" seta notification_WEAPON_ACCORDEON_MURDER "1" "Enable this multiple notification" seta notification_WEAPON_ACCORDEON_SUICIDE "1" "Enable this multiple notification" @@ -749,4 +752,4 @@ seta notification_show_sprees_info "3" "Show spree information in MSG_INFO messa seta notification_show_sprees_info_newline "1" "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself" seta notification_show_sprees_info_specialonly "1" "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement" -// Notification counts (total = 842): MSG_ANNCE = 80, MSG_INFO = 335, MSG_CENTER = 242, MSG_MULTI = 157, MSG_CHOICE = 28 +// Notification counts (total = 845): MSG_ANNCE = 80, MSG_INFO = 336, MSG_CENTER = 243, MSG_MULTI = 158, MSG_CHOICE = 28 diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 780b582de..70834c509 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -78,7 +78,7 @@ void Announcer_Countdown(entity this) if(countdown <= 0) // countdown has finished, starttime is now { Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN); - Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN); + Local_Notification(MSG_MULTI, COUNTDOWN_BEGIN); delete(this); announcer_countdown = NULL; Announcer_ClearTitle(); diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 440a5bcab..e9ac7fb4d 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -258,6 +258,8 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_INFO_NOTIF(CA_JOIN_LATE, N_CONSOLE, 0, 0, "", "", "", _("^F1Round already started, you will join the game in the next round"), "") MSG_INFO_NOTIF(CA_LEAVE, N_CONSOLE, 0, 0, "", "", "", _("^F2You will spectate in the next round"), "") + MSG_INFO_NOTIF(COUNTDOWN_STOP, N_CHATCON, 0, 0, "", "", "", _("^F4Countdown stopped!"), "") + MSG_INFO_NOTIF(DEATH_MURDER_BUFF, N_CONSOLE, 3, 3, "spree_inf s1 s2 f3buffname s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 was killed by ^BG%s^K1's ^BG%s^K1 buff ^K1%s%s"), _("^BG%s%s^K1 was scored against by ^BG%s^K1's ^BG%s^K1 buff ^K1%s%s")) MSG_INFO_NOTIF(DEATH_MURDER_CHEAT, N_CONSOLE, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_death", _("^BG%s%s^K1 was unfairly eliminated by ^BG%s^K1%s%s"), "") MSG_INFO_NOTIF(DEATH_MURDER_DROWN, N_CONSOLE, 3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1", "notify_water", _("^BG%s%s^K1 was drowned by ^BG%s^K1%s%s"), "") @@ -527,6 +529,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_CENTER_NOTIF(ASSAULT_DEFENDING, N_ENABLE, 0, 0, "", CPID_ASSAULT_ROLE, "0 0", _("^BGYou are defending!"), "") MSG_CENTER_NOTIF(ASSAULT_OBJ_DESTROYED, N_ENABLE, 0, 1, "f1time", CPID_ASSAULT_ROLE, "0 0", _("^BGObjective destroyed in ^F4%s^BG!"), "") + MSG_CENTER_NOTIF(COUNTDOWN_STOP, N_ENABLE, 0, 1, "f1", CPID_MISSING_PLAYERS, "4 0", strcat(BOLD(_("^F4Countdown stopped!")), "\n^BG", _("%s players are needed for this match.")), "") MSG_CENTER_NOTIF(COUNTDOWN_BEGIN, N_ENABLE, 0, 0, "", CPID_ROUND, "2 0", BOLD(_("^BGBegin!")), "") MSG_CENTER_NOTIF(COUNTDOWN_GAMESTART, N_ENABLE, 0, 1, "", CPID_ROUND, "1 f1", strcat(_("^BGGame starts in"), "\n", BOLD("^COUNT")), "") MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART, N_ENABLE, 0, 2, "f1", CPID_ROUND, "1 f2", strcat(_("^BGRound %s starts in"), "\n", BOLD("^COUNT")), "") @@ -793,6 +796,9 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_MULTI_NOTIF(prefix##_PINK, defaultvalue, anncepre##PINK, infopre##PINK, centerpre##PINK) // MSG_MULTI_NOTIFICATIONS + MSG_MULTI_NOTIF(COUNTDOWN_BEGIN, N_ENABLE, ANNCE_BEGIN, NULL, CENTER_COUNTDOWN_BEGIN) + MSG_MULTI_NOTIF(COUNTDOWN_STOP, N_ENABLE, NULL, INFO_COUNTDOWN_STOP, CENTER_COUNTDOWN_STOP) + MSG_MULTI_NOTIF(DEATH_MURDER_BUFF, N_ENABLE, NULL, INFO_DEATH_MURDER_BUFF, NULL) MSG_MULTI_NOTIF(DEATH_MURDER_CHEAT, N_ENABLE, NULL, INFO_DEATH_MURDER_CHEAT, NULL) MSG_MULTI_NOTIF(DEATH_MURDER_DROWN, N_ENABLE, NULL, INFO_DEATH_MURDER_DROWN, NULL) @@ -888,7 +894,6 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_MULTI_NOTIF(ITEM_WEAPON_UNAVAILABLE, N_ENABLE, NULL, INFO_ITEM_WEAPON_UNAVAILABLE, CENTER_ITEM_WEAPON_UNAVAILABLE) MSG_MULTI_NOTIF(MULTI_COINTOSS, N_ENABLE, NULL, INFO_COINTOSS, CENTER_COINTOSS) - MSG_MULTI_NOTIF(MULTI_COUNTDOWN_BEGIN, N_ENABLE, ANNCE_BEGIN, NULL, CENTER_COUNTDOWN_BEGIN) MSG_MULTI_NOTIF(MULTI_INSTAGIB_FINDAMMO, N_ENABLE, ANNCE_NUM_10, NULL, CENTER_INSTAGIB_FINDAMMO_FIRST) MSG_MULTI_NOTIF(WEAPON_ACCORDEON_MURDER, N_ENABLE, NULL, INFO_WEAPON_ACCORDEON_MURDER, NULL) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 17893200d..eb2ba1dcf 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -256,7 +256,7 @@ void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint) { if (vote_called) { VoteCount(false); } this.ready = false; - if (warmup_stage) recount_ready = true; + if (warmup_stage || game_starttime > time) recount_ready = true; } entcs_update_players(this); } @@ -1241,7 +1241,7 @@ void ClientDisconnect(entity this) if (this.personal) delete(this.personal); this.playerid = 0; - if (warmup_stage) ReadyCount(); + if (warmup_stage || game_starttime > time) ReadyCount(); if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false); player_powerups_remove_all(this); // stop powerup sound diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index ecadba2ea..372b370f0 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -526,7 +526,12 @@ void ReadyCount() if (t_players < map_minplayers) // map_minplayers will only be set if g_warmup -1 at worldspawn { - // TODO: handle player spectating/disconnecting during countdown + if (game_starttime > time) // someone bailed during countdown, back to warmup + { + warmup_stage = -1; // CAN change it AFTER calling Nagger_ReadyCounted() this frame + game_starttime = time; + Send_Notification(NOTIF_ALL, NULL, MSG_MULTI, COUNTDOWN_STOP, map_minplayers); + } if (warmup_limit > 0) warmup_limit = -1; return; // don't ReadyRestart if players are ready but too few -- 2.39.2