Fix attached sounds from HUDs erroneously being delivered to other avatars

avinationmerge
Melanie 2010-10-28 13:24:45 +01:00
parent 05dbe4f2c4
commit a51a545cb9
1 changed files with 19 additions and 0 deletions

View File

@ -62,6 +62,12 @@ namespace OpenSim.Region.CoreModules.World.Sound
public virtual void PlayAttachedSound( public virtual void PlayAttachedSound(
UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) 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) m_scene.ForEachScenePresence(delegate(ScenePresence sp)
{ {
if (sp.IsChildAgent) if (sp.IsChildAgent)
@ -71,6 +77,19 @@ namespace OpenSim.Region.CoreModules.World.Sound
if (dis > 100.0) // Max audio distance if (dis > 100.0) // Max audio distance
return; 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 // Scale by distance
if (radius == 0) if (radius == 0)
gain = (float)((double)gain * ((100.0 - dis) / 100.0)); gain = (float)((double)gain * ((100.0 - dis) / 100.0));