]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make no sound if the waypoint isn't visible for the player
authorterencehill <piuntn@gmail.com>
Wed, 5 Aug 2015 17:41:26 +0000 (19:41 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 5 Aug 2015 17:41:26 +0000 (19:41 +0200)
qcsrc/server/t_items.qc

index 2ad260769979496d7f42108b26d290e598d81973..8b220661c3013d322bf047f642407ba6c4646082 100644 (file)
@@ -652,12 +652,25 @@ void Item_RespawnCountdown (void)
                                localcmd(sprintf("prvm_edict server %d\n", num_for_edict(self)));
                        }
                }
-               sound (self, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM);        // play respawn sound
+
                if(self.waypointsprite_attached)
                {
+                       entity e;
+                       entity it = self;
+                       self = self.waypointsprite_attached;
+                       FOR_EACH_REALCLIENT(e)
+                               if(self.waypointsprite_visible_for_player(e))
+                               {
+                                       msg_entity = e;
+                                       soundto(MSG_ONE, it, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM);        // play respawn sound
+                               }
+                       self = it;
+
                        WaypointSprite_Ping(self.waypointsprite_attached);
                        //WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count);
                }
+               else
+                       sound(self, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM); // play respawn sound
        }
 }