Merge branch 'master' into Mario/notifications
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_triggers.qc
index 3a7bb36..f4fb67a 100644 (file)
@@ -61,14 +61,12 @@ void SUB_UseTargets()
 //
 // print the message
 //
-       if (IS_PLAYER(activator) && self.message != "")
+       if(IS_PLAYER(activator) && self.message != "")
+       if(IS_REAL_CLIENT(activator))
        {
-               if(IS_REAL_CLIENT(activator))
-               {
-                       centerprint (activator, self.message);
-                       if (self.noise == "")
-                               play2(activator, "misc/talk.wav");
-               }
+               centerprint(activator, self.message);
+               if (self.noise == "")
+                       play2(activator, "misc/talk.wav");
        }
 
 //
@@ -378,32 +376,26 @@ void spawnfunc_trigger_delay()
 
 void counter_use()
 {
-       self.count = self.count - 1;
+       self.count -= 1;
        if (self.count < 0)
                return;
 
-       if (self.count != 0)
+       if (self.count == 0)
        {
-               if (IS_PLAYER(activator)
-               && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
-               {
-                       if (self.count >= 4)
-                               centerprint (activator, "There are more to go...");
-                       else if (self.count == 3)
-                               centerprint (activator, "Only 3 more to go...");
-                       else if (self.count == 2)
-                               centerprint (activator, "Only 2 more to go...");
-                       else
-                               centerprint (activator, "Only 1 more to go...");
-               }
-               return;
+               if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+                       Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COMPLETED);
+                       
+               self.enemy = activator;
+               multi_trigger ();
+       }
+       else
+       {
+               if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+               if(self.count >= 4)
+                       Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER);
+               else
+                       Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, self.count);
        }
-
-       if (IS_PLAYER(activator)
-       && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
-               centerprint(activator, "Sequence completed!");
-       self.enemy = activator;
-       multi_trigger ();
 }
 
 void counter_reset()