]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
teamplay: display translated notifications for typical failures or state changes
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 14 Jun 2024 10:42:55 +0000 (20:42 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 5 Aug 2024 16:26:27 +0000 (02:26 +1000)
Fixes some uses of NOTIF_ONE where it should have been NOTIF_ONE_ONLY.

notifications.cfg
qcsrc/common/notifications/all.inc
qcsrc/server/command/cmd.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/teamplay.qc

index b1c203976c337b9404b92c0696db6aa054d07e9d..ee486bd42eee834f8e6bcc945ee8791532ae4b4d 100644 (file)
@@ -289,7 +289,11 @@ seta notification_INFO_SUPERWEAPON_PICKUP "1" "0 = off, 1 = print to console, 2
 seta notification_INFO_SURVIVAL_HUNTER_WIN "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_SURVIVAL_SURVIVOR_WIN "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_TEAMCHANGE_LARGERTEAM "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_TEAMCHANGE_LOCKED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_TEAMCHANGE_NOTALLOWED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_TEAMCHANGE_SAME "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_TEAMS_LOCKED "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_TEAMS_UNLOCKED "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_VERSION_BETA "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_VERSION_OLD "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_VERSION_OUTDATED "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
@@ -558,7 +562,11 @@ seta notification_CENTER_SURVIVAL_HUNTER_WIN "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_SURVIVAL_SURVIVOR "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_SURVIVAL_SURVIVOR_WIN "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TEAMCHANGE_AUTO "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_TEAMCHANGE_LARGERTEAM "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_TEAMCHANGE_LOCKED "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_TEAMCHANGE_NOTALLOWED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TEAMCHANGE "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_TEAMCHANGE_SAME "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TEAMCHANGE_SPECTATE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TEAMCHANGE_SUICIDE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TIMEOUT_BEGINNING "1" "0 = off, 1 = centerprint"
index 8e9a1ced60167ac1f4b7313dfaeb468e6514634f..23cf5e3e735808a29afef23d10ca247e2ac01565 100644 (file)
@@ -456,8 +456,13 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MSG_INFO_NOTIF(SURVIVAL_HUNTER_WIN,                     N_CONSOLE,  0, 0, "", "",           "",                     _("^K1Hunters^BG win the round"), "")
     MSG_INFO_NOTIF(SURVIVAL_SURVIVOR_WIN,                   N_CONSOLE,  0, 0, "", "",           "",                     _("^F1Survivors^BG win the round"), "")
 
-    MSG_INFO_NOTIF(TEAMCHANGE_LARGERTEAM,                   N_CONSOLE,  0, 0, "", "",           "",                     _("^BGYou cannot change to a larger team"), "")
-    MSG_INFO_NOTIF(TEAMCHANGE_NOTALLOWED,                   N_CONSOLE,  0, 0, "", "",           "",                     _("^BGYou are not allowed to change teams"), "")
+    MSG_INFO_NOTIF(TEAMCHANGE_LARGERTEAM,                   N_CONSOLE,  0, 0, "", "",           "",                     _("^K2You're not allowed to join a larger team!"), "")
+    MSG_INFO_NOTIF(TEAMCHANGE_NOTALLOWED,                   N_CONSOLE,  0, 0, "", "",           "",                     _("^K2You're not allowed to change teams!"), "")
+    MSG_INFO_NOTIF(TEAMCHANGE_LOCKED,                       N_CONSOLE,  0, 0, "", "",           "",                     _("^K2Teams are locked, you can't join or change teams until they're unlocked or the map changes."), "")
+    MSG_INFO_NOTIF(TEAMCHANGE_SAME,                         N_CONSOLE,  0, 0, "", "",           "",                     _("^K2You're already on that team!"), "")
+
+    MSG_INFO_NOTIF(TEAMS_LOCKED,                            N_CHATCON,  0, 0, "", "",           "",                     _("^F4The teams are now locked."), "")
+    MSG_INFO_NOTIF(TEAMS_UNLOCKED,                          N_CHATCON,  0, 0, "", "",           "",                     _("^F1The teams are now unlocked."), "")
 
     MSG_INFO_NOTIF(VERSION_BETA,                            N_CONSOLE,  2, 0, "s1 s2", "",      "",                     _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s (beta)^BG, you have ^F2Xonotic %s"), "")
     MSG_INFO_NOTIF(VERSION_OLD,                             N_CHATCON,  2, 0, "s1 s2", "",      "",                     _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s^BG, you have ^F2Xonotic %s"), "")
@@ -808,6 +813,10 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MSG_CENTER_NOTIF(TEAMCHANGE_AUTO,                   N_ENABLE,    0, 1, "",               CPID_TEAMCHANGE,        "1 f1", _("^K1Changing team in ^COUNT"), "")
     MSG_CENTER_NOTIF(TEAMCHANGE_SPECTATE,               N_ENABLE,    0, 1, "",               CPID_TEAMCHANGE,        "1 f1", _("^K1Spectating in ^COUNT"), "")
     MSG_CENTER_NOTIF(TEAMCHANGE_SUICIDE,                N_ENABLE,    0, 1, "",               CPID_TEAMCHANGE,        "1 f1", _("^K1Suicide in ^COUNT"), "")
+    MSG_CENTER_NOTIF(TEAMCHANGE_LARGERTEAM,             N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^K2You're not allowed to join a larger team!"), "")
+    MSG_CENTER_NOTIF(TEAMCHANGE_NOTALLOWED,             N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^K2You're not allowed to change teams!"), "")
+    MSG_CENTER_NOTIF(TEAMCHANGE_LOCKED,                 N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^K2Teams are locked, you can't join or change teams until they're unlocked or the map changes."), "")
+    MSG_CENTER_NOTIF(TEAMCHANGE_SAME,                   N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^K2You're already on that team!"), "")
 
     MSG_CENTER_NOTIF(TIMEOUT_BEGINNING,                 N_ENABLE,    0, 1, "",               CPID_TIMEOUT,           "1 f1", _("^F4Timeout begins in ^COUNT"), "")
     MSG_CENTER_NOTIF(TIMEOUT_ENDING,                    N_ENABLE,    0, 1, "",               CPID_TIMEIN,            "1 f1", _("^F4Timeout ends in ^COUNT"), "")
index 41e75d5a4de54dd1f91a40e130bce66bc562e42b..aaf1c11065025d6a4ccddb8bc205eff2e7e5fb00 100644 (file)
@@ -550,7 +550,8 @@ void ClientCommand_selectteam(entity caller, int request, int argc)
                        }
                        if (lockteams)
                        {
-                               sprint(caller, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
+                               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_INFO, INFO_TEAMCHANGE_LOCKED);
+                               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CENTER_TEAMCHANGE_LOCKED);
                                return;
                        }
 
@@ -559,12 +560,14 @@ void ClientCommand_selectteam(entity caller, int request, int argc)
                                return;
                        if (caller.team == team_num && team_num && !IS_DEAD(caller))
                        {
-                               sprint(caller, "^7You already are on that team.\n");
+                               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_INFO, INFO_TEAMCHANGE_SAME);
+                               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CENTER_TEAMCHANGE_SAME);
                                return;
                        }
                        if (CS(caller).wasplayer && autocvar_g_changeteam_banned)
                        {
-                               sprint(caller, "^1You cannot change team, forbidden by the server.\n");
+                               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED);
+                               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CENTER_TEAMCHANGE_NOTALLOWED);
                                return;
                        }
                        if (team_num && autocvar_g_balance_teams_prevent_imbalance && !warmup_stage)
@@ -574,7 +577,8 @@ void ClientCommand_selectteam(entity caller, int request, int argc)
                                if ((Team_IndexToBit(Team_TeamToIndex(team_num)) &
                                        TeamBalance_FindBestTeams(balance, caller, false)) == 0)
                                {
-                                       Send_Notification(NOTIF_ONE, caller, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
+                                       Send_Notification(NOTIF_ONE_ONLY, caller, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
+                                       Send_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CENTER_TEAMCHANGE_LARGERTEAM);
                                        TeamBalance_Destroy(balance);
                                        return;
                                }
index bb6074517ebe517aa4d926fd84a237ffcb47430b..23c0df96fe8ca38b1db1dc85d131bbf079d6ff71 100644 (file)
@@ -969,7 +969,7 @@ void GameCommand_lockteams(int request)
                        if (teamplay)
                        {
                                lockteams = 1;
-                               bprint("^1The teams are now locked.\n");
+                               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_TEAMS_LOCKED);
                        }
                        else
                        {
@@ -1645,7 +1645,7 @@ void GameCommand_unlockteams(int request)
                        if (teamplay)
                        {
                                lockteams = 0;
-                               bprint("^1The teams are now unlocked.\n");
+                               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_TEAMS_UNLOCKED);
                        }
                        else
                        {
index 4558eb723d08b67f1a154043708abd8c1b9c2b69..f9da5a2d43ea75b986f5ce00a6083b61a6389a21 100644 (file)
@@ -309,11 +309,12 @@ void Player_SetTeamIndexChecked(entity player, int team_index)
        {
                return;
        }
-       if ((autocvar_g_campaign) || (autocvar_g_changeteam_banned &&
-               CS(player).wasplayer))
+
+       // TODO: this is in ClientCommand_selectteam(), shouldn't be necessary to have it here too (refactor SV_ChangeTeam ?)
+       if ((autocvar_g_campaign) || (autocvar_g_changeteam_banned && CS(player).wasplayer))
        {
-               Send_Notification(NOTIF_ONE, player, MSG_INFO,
-                       INFO_TEAMCHANGE_NOTALLOWED);
+               Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED);
+               Send_Notification(NOTIF_ONE_ONLY, player, MSG_CENTER, CENTER_TEAMCHANGE_NOTALLOWED);
                return;
        }
        entity balance = TeamBalance_CheckAllowedTeams(player);
@@ -334,14 +335,15 @@ void Player_SetTeamIndexChecked(entity player, int team_index)
                team_index = 1;
        }
 
+       // TODO: this is in ClientCommand_selectteam(), shouldn't be necessary to have it here too (refactor SV_ChangeTeam ?)
        if (autocvar_g_balance_teams_prevent_imbalance && !warmup_stage)
        {
                TeamBalance_GetTeamCounts(balance, player);
                if ((Team_IndexToBit(team_index) & TeamBalance_FindBestTeams(balance,
                        player, false)) == 0)
                {
-                       Send_Notification(NOTIF_ONE, player, MSG_INFO,
-                               INFO_TEAMCHANGE_LARGERTEAM);
+                       Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
+                       Send_Notification(NOTIF_ONE_ONLY, player, MSG_CENTER, CENTER_TEAMCHANGE_LARGERTEAM);
                        TeamBalance_Destroy(balance);
                        return;
                }