diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 30 |
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 | } |