]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implemented chat sounds
authorz411 <z411@omaera.org>
Thu, 27 Aug 2020 17:22:07 +0000 (13:22 -0400)
committerz411 <z411@omaera.org>
Thu, 27 Aug 2020 17:22:07 +0000 (13:22 -0400)
qcsrc/server/autocvars.qh
qcsrc/server/client.qc
qcsrc/server/client.qh

index 99077dcfe7b237fc8e1c5e59f888e6d666c4feb5..e153fdd5fb90e273702d3162d42b5e352741b229 100644 (file)
@@ -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")
index 0a9a38fafe3c6b68666345b36b46a000c08a5246..fde395d7d452bc7574300ae779acc16994851357 100644 (file)
@@ -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;
 }
index e288bebfcb27ad10248c46fdd8ec2acbb22f1ecd..4485080174026d14ceafa55954d68c93c1887916 100644 (file)
@@ -272,6 +272,7 @@ bool independent_players;
 .float floodcontrol_chattell;
 .float floodcontrol_voice;
 .float floodcontrol_voiceteam;
+.float floodcontrol_chatsound;
 
 // respawning
 .int respawn_flags;