From: z411 Date: Thu, 27 Aug 2020 17:22:07 +0000 (-0400) Subject: Implemented chat sounds X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a9d14ebdfb8536cbe750e8963223977aad6bd8c8;p=xonotic%2Fxonotic-data.pk3dir.git Implemented chat sounds --- diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 99077dcfe..e153fdd5f 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -124,6 +124,9 @@ bool autocvar_g_chat_teamcolors; bool autocvar_g_chat_tellprivacy; bool autocvar_g_forced_respawn; string autocvar_g_forced_team_otherwise; // TODO: Move to teamplay.qc +bool autocvar_g_chat_sounds; // z411 +string autocvar_g_chat_sounds_list; // z411 +float autocvar_g_chat_sounds_flood; // z411 #define autocvar_g_friendlyfire cvar("g_friendlyfire") #define autocvar_g_friendlyfire_virtual cvar("g_friendlyfire_virtual") #define autocvar_g_friendlyfire_virtual_force cvar("g_friendlyfire_virtual_force") diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 0a9a38faf..fde395d7d 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -3174,6 +3174,25 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc if (autocvar_sv_eventlog && (event_log_msg != "")) { GameLogEcho(event_log_msg); } + + var .float flood_sound = floodcontrol_chatsound; + + if(autocvar_g_chat_sounds && sourcemsgstr != "" && ret > 0) { + bprintf("%d < %d", source.(flood_sound), time - autocvar_g_chat_sounds_flood); + + if (source.(flood_sound) < time - autocvar_g_chat_sounds_flood) { + string rawmsg; + rawmsg = strreplace("\n", " ", msgin); + + bprintf("msg is %s and list is %s\n", rawmsg, autocvar_g_chat_sounds_list); + if (findinlist_abbrev(rawmsg, autocvar_g_chat_sounds_list)) { + bprintf("IN LIST!!!\n"); + play2all(strcat("sound/chat/", rawmsg, ".ogg")); + + source.(flood_sound) = time; + } + } + } return ret; } diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index e288bebfc..448508017 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -272,6 +272,7 @@ bool independent_players; .float floodcontrol_chattell; .float floodcontrol_voice; .float floodcontrol_voiceteam; +.float floodcontrol_chatsound; // respawning .int respawn_flags;