]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/announcer.qc
Entity debugger
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / announcer.qc
index e20557fa741300f05bb7dfd5027a7832f5b70638..a2e13be53d12bd8901437715a28451a8aedc1c39 100644 (file)
@@ -1,10 +1,20 @@
 #include "announcer.qh"
 
+#include "mutators/events.qh"
+
 #include "../common/notifications.qh"
 #include "../common/stats.qh"
 
 bool announcer_1min;
 bool announcer_5min;
+string AnnouncerOption()
+{
+       if(MUTATOR_CALLHOOK(AnnouncerOption, ret_string))
+               return ret_string;
+
+       return autocvar_cl_announcer;
+}
+
 void Announcer_Countdown()
 {
        SELFPARAM();
@@ -68,19 +78,18 @@ void Announcer_Gamestart()
        {
                if(time < startTime)
                {
-                       entity e = find(world, classname, "announcer_countdown");
-                       if (!e)
+                       static entity announcer_countdown;
+                       if (!announcer_countdown)
                        {
-                               e = spawn();
-                               e.classname = "announcer_countdown";
-                               e.think = Announcer_Countdown;
+                               announcer_countdown = new(announcer_countdown);
+                               announcer_countdown.think = Announcer_Countdown;
                        }
 
                        if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle
-                       if(time > e.nextthink) // don't play it again if countdown was already going
+                       if(time > announcer_countdown.nextthink) // don't play it again if countdown was already going
                                Local_Notification(MSG_ANNCE, ANNCE_PREPARE);
 
-                       e.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime
+                       announcer_countdown.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime
                }
        }