]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Teleporter: support random teleportation sounds
authorMario <mario@smbclan.net>
Fri, 1 Jan 2016 13:06:04 +0000 (23:06 +1000)
committerMario <mario@smbclan.net>
Fri, 1 Jan 2016 13:06:04 +0000 (23:06 +1000)
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/teleport.qc

index d646a631c928d4f99550e5d9347d428fc286caf9..c00a4de26c558e1ab772198738acd8eabd6b475f 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, ((teleporter.noise != "") ? teleporter.noise : 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);
index 37c4d1def7b0a82f0ed76910ac1bcc817d94a858..e289064c8b0413b1af161b3e7858659dc038741f 100644 (file)
@@ -87,7 +87,7 @@ spawnfunc(trigger_teleport)
        self.use = trigger_teleport_use;
 
        if(self.noise != "")
-               precache_sound(self.noise);
+               FOREACH_WORD(self.noise, true, LAMBDA(precache_sound(it)));
 
        // this must be called to spawn the teleport waypoints for bots
        InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);