From 8425d53d689f61a97874f9f5fbfc3ca01ddf320e Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 23 Apr 2008 11:54:35 +0000 Subject: * Applying Mantis #1022 - Thanks Melanie! --- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 48ca582..4c781c5 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1996,7 +1996,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart op = this; foreach (KeyValuePair item in op.TaskInventory) { - if (item.Value.Name == sound) + if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) { soundID = item.Value.ItemID; break; @@ -2004,10 +2004,19 @@ namespace OpenSim.Region.Environment.Scenes } } + if(soundID == LLUUID.Zero) + return; + List avatarts = m_parentGroup.Scene.GetAvatars(); foreach (ScenePresence p in avatarts) { - // TODO: some filtering by distance of avatar + double dis=Util.GetDistanceTo(p.AbsolutePosition, position); + if(dis > 100.0) // Max audio distance + continue; + + // Scale by distance + volume*=((100.0-dis)/100.0); + if (triggered) { p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); -- cgit v1.1