]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/teleporters.qc
Use old style sound names (fixes heavy server lag when triggering target_items a...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / teleporters.qc
index b4dc20a7d767aacb9c5b5a496c3a4b3d3f0cdc25..eae31ead021891d6b9f8e8803175a4bbda5363b1 100644 (file)
@@ -85,7 +85,19 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
                if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
                {
                        if(tflags & TELEPORT_FLAG_SOUND)
-                               sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM);
+                       {
+                               string thesound = SND(TELEPORT);
+                               if(teleporter.noise != "")
+                               {
+                                       RandomSelection_Init();
+                                       FOREACH_WORD(teleporter.noise, true,
+                                       {
+                                               RandomSelection_Add(NULL, 0, it, 1, 1);
+                                       });
+                                       thesound = RandomSelection_chosen_string;
+                               }
+                               _sound (player, CH_TRIGGER, thesound, VOL_BASE, ATTEN_NORM);
+                       }
                        if(tflags & TELEPORT_FLAG_PARTICLES)
                        {
                                Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1);
@@ -203,21 +215,21 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
 
 #ifdef SVQC
        if(e.speed)
-               if(vlen(player.velocity) > e.speed)
+               if(vdist(player.velocity, >, e.speed))
                        player.velocity = normalize(player.velocity) * max(0, e.speed);
 #elif defined(CSQC)
        if(e.speed)
-               if(vlen(player.move_velocity) > e.speed)
+               if(vdist(player.move_velocity, >, e.speed))
                        player.move_velocity = normalize(player.move_velocity) * max(0, e.speed);
 #endif
 
 #ifdef SVQC
        if(STAT(TELEPORT_MAXSPEED, player))
-               if(vlen(player.velocity) > STAT(TELEPORT_MAXSPEED, player))
+               if(vdist(player.velocity, >, STAT(TELEPORT_MAXSPEED, player)))
                        player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
 #elif defined(CSQC)
        if(STAT(TELEPORT_MAXSPEED, player))
-               if(vlen(player.move_velocity) > STAT(TELEPORT_MAXSPEED, player))
+               if(vdist(player.move_velocity, >, STAT(TELEPORT_MAXSPEED, player)))
                        player.move_velocity = normalize(player.move_velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
 #endif