aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
diff options
context:
space:
mode:
authorSignpostMarv2012-10-16 13:11:17 +0100
committerJustin Clark-Casey (justincc)2012-10-29 23:39:01 +0000
commita9999a9676d46669150343e4cdbf65428326a91d (patch)
tree24ef3fe7e99da2761d60fff37864aa22a81b3a9b /OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
parentfixing poorly-formatted xml doc string for Util.IsInsideBox (diff)
downloadopensim-SC_OLD-a9999a9676d46669150343e4cdbf65428326a91d.zip
opensim-SC_OLD-a9999a9676d46669150343e4cdbf65428326a91d.tar.gz
opensim-SC_OLD-a9999a9676d46669150343e4cdbf65428326a91d.tar.bz2
opensim-SC_OLD-a9999a9676d46669150343e4cdbf65428326a91d.tar.xz
Refactoring llTriggerSoundLimited with a new method on ISoundModule, as the LL Wiki spec for llTriggerSoundLimited states an axis-aligned bounding box, not radial constraint
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
index 417c071..ac7f7b4 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs
@@ -334,6 +334,36 @@ namespace OpenSim.Region.CoreModules.World.Sound
334 } 334 }
335 } 335 }
336 336
337 public void TriggerSoundLimited(UUID objectID, UUID sound,
338 double volume, Vector3 min, Vector3 max)
339 {
340 if (sound == UUID.Zero)
341 return;
342
343 SceneObjectPart part;
344 if (!m_scene.TryGetSceneObjectPart(objectID, out part))
345 return;
346
347 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
348 {
349 double dis = Util.GetDistanceTo(sp.AbsolutePosition,
350 part.AbsolutePosition);
351
352 if (dis > MaxDistance) // Max audio distance
353 return;
354 else if (!Util.IsInsideBox(sp.AbsolutePosition, min, max))
355 return;
356
357 // Scale by distance
358 double thisSpGain = volume * ((MaxDistance - dis) / MaxDistance);
359
360 sp.ControllingClient.SendTriggeredSound(sound, part.OwnerID,
361 part.UUID, part.ParentGroup.UUID,
362 m_scene.RegionInfo.RegionHandle,
363 part.AbsolutePosition, (float)thisSpGain);
364 });
365 }
366
337 #endregion 367 #endregion
338 } 368 }
339} 369}