aboutsummaryrefslogtreecommitdiffstatshomepage
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
parentfixing poorly-formatted xml doc string for Util.IsInsideBox (diff)
downloadopensim-SC-a9999a9676d46669150343e4cdbf65428326a91d.zip
opensim-SC-a9999a9676d46669150343e4cdbf65428326a91d.tar.gz
opensim-SC-a9999a9676d46669150343e4cdbf65428326a91d.tar.bz2
opensim-SC-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 '')
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs30
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs9
3 files changed, 36 insertions, 6 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}
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 5d1bb63..2e53b16 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -111,5 +111,8 @@ namespace OpenSim.Region.Framework.Interfaces
111 void SendSound(UUID objectID, UUID sound, double volume, 111 void SendSound(UUID objectID, UUID sound, double volume,
112 bool triggered, byte flags, float radius, bool useMaster, 112 bool triggered, byte flags, float radius, bool useMaster,
113 bool isMaster); 113 bool isMaster);
114
115 void TriggerSoundLimited(UUID objectID, UUID sound, double volume,
116 Vector3 min, Vector3 max);
114 } 117 }
115} \ No newline at end of file 118} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 99b6189..aeb74a5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5876,12 +5876,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5876 m_host.AddScriptLPS(1); 5876 m_host.AddScriptLPS(1);
5877 if (m_SoundModule != null) 5877 if (m_SoundModule != null)
5878 { 5878 {
5879 double radius1 = VecDist(m_host.GetWorldPosition(), top_north_east); 5879 m_SoundModule.TriggerSoundLimited(m_host.UUID,
5880 double radius2 = VecDist(m_host.GetWorldPosition(), bottom_south_west); 5880 KeyOrName(sound, AssetType.Sound), volume,
5881 double radius = Math.Abs(radius1 - radius2); 5881 bottom_south_west, top_north_east);
5882 m_SoundModule.SendSound(m_host.UUID,
5883 KeyOrName(sound, AssetType.Sound), volume, true, 0,
5884 (float)radius, false, false);
5885 } 5882 }
5886 } 5883 }
5887 5884