]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Global Announcer_Play(string) function
authorSamual <samual@xonotic.org>
Tue, 18 Oct 2011 15:15:14 +0000 (11:15 -0400)
committerSamual <samual@xonotic.org>
Tue, 18 Oct 2011 15:15:14 +0000 (11:15 -0400)
qcsrc/client/Main.qc
qcsrc/client/announcer.qc

index 81a04caf09fa7faf4db8d0a7ad025142f39b9403..c9593f344866ab0e5fa468f222a8bdd5dea8fb32 100644 (file)
@@ -1377,7 +1377,7 @@ float CSQC_Parse_TempEntity()
                        bHandled = true;
                        break;
                case TE_CSQC_ANNOUNCE:
-                       Net_Announcer(ReadString());
+                       Announcer_Play(ReadString());
                        bHandled = true;
                        break;
                case TE_CSQC_KILLNOTIFY:
index 0b404edab76bca094670a693352497dcba828dbc..0d64d65350c1af26da21b979a90871bdbe4588ff 100644 (file)
@@ -1,6 +1,15 @@
-void Net_Announcer(string announce_snd)
+float previous_announcement_time;
+string previous_announcement;
+
+void Announcer_Play(string announcement)
 {
-  sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/", announce_snd, ".wav"), VOL_BASEVOICE, ATTN_NONE);
+  if((announcement != previous_announcement) || (time >= (previous_announcement_time + 5)))
+  {
+    sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/", announcement, ".wav"), VOL_BASEVOICE, ATTN_NONE);
+    
+    previous_announcement = announcement;
+    previous_announcement_time = time;
+  }
 }
 
 /**