diff options
author | Justin Clarke Casey | 2008-12-23 17:54:13 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-23 17:54:13 +0000 |
commit | cce1b096dbd8aba46c405b7654d67d3ba96de33a (patch) | |
tree | ae8208af8343d8d82df1343038855e1d3c91eba0 /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | * Add a method to allow friendship offers to a logged in client from an offli... (diff) | |
download | opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.zip opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.gz opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.bz2 opensim-SC_OLD-cce1b096dbd8aba46c405b7654d67d3ba96de33a.tar.xz |
* refactor: Replace part of SceneObjectPart with the identical sound playing code in the SoundModule
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-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 | ||