diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 13 |
1 files changed, 11 insertions, 2 deletions
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 | |||
1996 | SceneObjectPart op = this; | 1996 | SceneObjectPart op = this; |
1997 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | 1997 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) |
1998 | { | 1998 | { |
1999 | if (item.Value.Name == sound) | 1999 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
2000 | { | 2000 | { |
2001 | soundID = item.Value.ItemID; | 2001 | soundID = item.Value.ItemID; |
2002 | break; | 2002 | break; |
@@ -2004,10 +2004,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
2004 | } | 2004 | } |
2005 | } | 2005 | } |
2006 | 2006 | ||
2007 | if(soundID == LLUUID.Zero) | ||
2008 | return; | ||
2009 | |||
2007 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2010 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
2008 | foreach (ScenePresence p in avatarts) | 2011 | foreach (ScenePresence p in avatarts) |
2009 | { | 2012 | { |
2010 | // TODO: some filtering by distance of avatar | 2013 | double dis=Util.GetDistanceTo(p.AbsolutePosition, position); |
2014 | if(dis > 100.0) // Max audio distance | ||
2015 | continue; | ||
2016 | |||
2017 | // Scale by distance | ||
2018 | volume*=((100.0-dis)/100.0); | ||
2019 | |||
2011 | if (triggered) | 2020 | if (triggered) |
2012 | { | 2021 | { |
2013 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); | 2022 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); |