From: Mario Date: Tue, 21 Jun 2022 04:56:19 +0000 (+1000) Subject: Add an option to disable player chatting completely X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9496d28d71376274c34e17fb0782d834e396aed3;p=xonotic%2Fxonotic-data.pk3dir.git Add an option to disable player chatting completely --- diff --git a/notifications.cfg b/notifications.cfg index afae1593f..62b8aacef 100644 --- a/notifications.cfg +++ b/notifications.cfg @@ -93,9 +93,10 @@ 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 = 334): +// MSG_INFO notifications (count = 335): 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_DISABLED "2" "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)" @@ -746,4 +747,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 = 839): MSG_ANNCE = 80, MSG_INFO = 334, MSG_CENTER = 241, MSG_MULTI = 156, MSG_CHOICE = 28 +// Notification counts (total = 840): MSG_ANNCE = 80, MSG_INFO = 335, MSG_CENTER = 241, MSG_MULTI = 156, MSG_CHOICE = 28 diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 87398b11d..ca03509c6 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -223,6 +223,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_INFO_NOTIF_TEAM(NUM_TEAM_4, prefix##_PINK, prefix, defaultvalue, strnum, flnum, args, hudargs, multiteam_info_sprintf(icon, strtolower(STATIC_NAME_TEAM_4)), TCR(normal, type, 4), TCR(gentle, type, 4)) // MSG_INFO_NOTIFICATIONS + MSG_INFO_NOTIF(CHAT_DISABLED, N_CHATCON, 0, 0, "", "", "", _("^F4NOTE: ^BGChat is currently disabled on this server"), "") MSG_INFO_NOTIF(CHAT_NOSPECTATORS, N_CHATCON, 0, 0, "", "", "", _("^F4NOTE: ^BGSpectator chat is not sent to players during the match"), "") MULTITEAM_INFO(CTF_CAPTURE, N_CONSOLE, 1, 0, "s1", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag"), "", FLAG) diff --git a/qcsrc/server/chat.qc b/qcsrc/server/chat.qc index a73de2a1f..1d52dd8ae 100644 --- a/qcsrc/server/chat.qc +++ b/qcsrc/server/chat.qc @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,13 @@ */ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodcontrol) { + if(!autocvar_g_chat_allowed) + { + if(IS_REAL_CLIENT(source)) + Send_Notification(NOTIF_ONE_ONLY, source, MSG_INFO, INFO_CHAT_DISABLED); + return 0; // force a rejection (TODO: support magic ear map objects?) + } + if (!teamsay && !privatesay && substring(msgin, 0, 1) == " ") msgin = substring(msgin, 1, -1); // work around DP say bug (say_team does not have this!) diff --git a/qcsrc/server/chat.qh b/qcsrc/server/chat.qh index 500d757c0..0d764a424 100644 --- a/qcsrc/server/chat.qh +++ b/qcsrc/server/chat.qh @@ -1,5 +1,6 @@ #pragma once +bool autocvar_g_chat_allowed = true; float autocvar_g_chat_flood_burst; float autocvar_g_chat_flood_burst_team; float autocvar_g_chat_flood_burst_tell; diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 859314980..52364f7d2 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -367,6 +367,7 @@ set sv_vote_gametype_options "dm tdm ca ctf" "identifiers of gamemodes on the vo set sv_vote_gametype_timeout 20 "how long the gametype vote screen lasts" set sv_vote_gametype_default_current 1 "Keep the current gametype if no one votes" +set g_chat_allowed 1 "allow players to communicate via in-game chat" set g_chat_flood_spl 3 "normal chat: seconds between lines to not count as flooding" set g_chat_flood_lmax 2 "normal chat: maximum number of lines per chat message at once" set g_chat_flood_burst 2 "normal chat: allow bursts of so many chat lines"