* Applying Mantis #1022 - Thanks Melanie!

0.6.0-stable
Adam Frisby 2008-04-23 11:54:35 +00:00
parent 163d254bb9
commit 8425d53d68
1 changed files with 11 additions and 2 deletions

View File

@ -1996,7 +1996,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart op = this; SceneObjectPart op = this;
foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory)
{ {
if (item.Value.Name == sound) if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
{ {
soundID = item.Value.ItemID; soundID = item.Value.ItemID;
break; break;
@ -2004,10 +2004,19 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
if(soundID == LLUUID.Zero)
return;
List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
foreach (ScenePresence p in avatarts) 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) if (triggered)
{ {
p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume);