From e078c57bf09cc70f3026096002d3b6f279657ce7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 28 Oct 2010 13:24:45 +0100 Subject: Fix attached sounds from HUDs erroneously being delivered to other avatars --- OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index a52fea4..e77062b 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -62,6 +62,12 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void PlayAttachedSound( UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if (part == null) + return; + + SceneObjectGroup grp = part.ParentGroup; + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.IsChildAgent) @@ -71,6 +77,19 @@ namespace OpenSim.Region.CoreModules.World.Sound if (dis > 100.0) // Max audio distance return; + if (grp.IsAttachment) + { + + if (grp.GetAttachmentPoint() > 30) // HUD + { + if (sp.ControllingClient.AgentId != grp.OwnerID) + return; + } + + if (sp.ControllingClient.AgentId == grp.OwnerID) + dis = 0; + } + // Scale by distance if (radius == 0) gain = (float)((double)gain * ((100.0 - dis) / 100.0)); -- cgit v1.1