diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index ddfb413..6795c0a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -37,6 +37,7 @@ using log4net; | |||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenMetaverse.Packets; | 38 | using OpenMetaverse.Packets; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Region.Environment.Interfaces; | ||
40 | using OpenSim.Region.Environment.Scenes.Scripting; | 41 | using OpenSim.Region.Environment.Scenes.Scripting; |
41 | using OpenSim.Region.Physics.Manager; | 42 | using OpenSim.Region.Physics.Manager; |
42 | 43 | ||
@@ -2362,24 +2363,13 @@ if (m_shape != null) { | |||
2362 | if (soundID == UUID.Zero) | 2363 | if (soundID == UUID.Zero) |
2363 | return; | 2364 | return; |
2364 | 2365 | ||
2365 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2366 | ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); |
2366 | foreach (ScenePresence p in avatarts) | 2367 | if (soundModule != null) |
2367 | { | 2368 | { |
2368 | double dis=Util.GetDistanceTo(p.AbsolutePosition, position); | ||
2369 | if (dis > 100.0) // Max audio distance | ||
2370 | continue; | ||
2371 | |||
2372 | // Scale by distance | ||
2373 | volume*=((100.0-dis)/100.0); | ||
2374 | |||
2375 | if (triggered) | 2369 | if (triggered) |
2376 | { | 2370 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle); |
2377 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); | ||
2378 | } | ||
2379 | else | 2371 | else |
2380 | { | 2372 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags); |
2381 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags); | ||
2382 | } | ||
2383 | } | 2373 | } |
2384 | } | 2374 | } |
2385 | 2375 | ||