aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2009-05-29 23:49:48 +0000
committerAdam Frisby2009-05-29 23:49:48 +0000
commitc30b5ee0144faf60bcdaf6f79c91e3eeb316f104 (patch)
tree4f22a6f2091707f3160b1efefe60b90cbca81cdc
parent* Protip: When you click 'make public' in resharper, note to save before comm... (diff)
downloadopensim-SC-c30b5ee0144faf60bcdaf6f79c91e3eeb316f104.zip
opensim-SC-c30b5ee0144faf60bcdaf6f79c91e3eeb316f104.tar.gz
opensim-SC-c30b5ee0144faf60bcdaf6f79c91e3eeb316f104.tar.bz2
opensim-SC-c30b5ee0144faf60bcdaf6f79c91e3eeb316f104.tar.xz
* Adds World.Audio.* to MRM
* This includes methods such as PlaySound which take a Position as an argument, allowing you to trigger sounds arbitrarily across the scene without needing a parent object in the position.
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs33
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/WorldX/IWorldAudio.cs13
3 files changed, 48 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs
index acb569f..3c14ed5 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX;
29 30
30namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 31namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
31{ 32{
@@ -50,6 +51,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
50 IAvatar[] Avatars { get; } 51 IAvatar[] Avatars { get; }
51 IParcel[] Parcels { get; } 52 IParcel[] Parcels { get; }
52 IHeightmap Terrain { get; } 53 IHeightmap Terrain { get; }
54 IWorldAudio Audio { get; }
55
53 56
54 event OnChatDelegate OnChat; 57 event OnChatDelegate OnChat;
55 event OnNewUserDelegate OnNewUser; 58 event OnNewUserDelegate OnNewUser;
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index dc80dcc..1ec4a33 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -26,13 +26,15 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenMetaverse;
29using OpenSim.Framework; 30using OpenSim.Framework;
30using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX;
32 34
33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 35namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
34{ 36{
35 public class World : System.MarshalByRefObject, IWorld 37 public class World : System.MarshalByRefObject, IWorld, IWorldAudio
36 { 38 {
37 private readonly Scene m_internalScene; 39 private readonly Scene m_internalScene;
38 private readonly Heightmap m_heights; 40 private readonly Heightmap m_heights;
@@ -93,6 +95,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
93 private event OnChatDelegate _OnChat; 95 private event OnChatDelegate _OnChat;
94 private bool _OnChatActive; 96 private bool _OnChatActive;
95 97
98 public IWorldAudio Audio
99 {
100 get { return this; }
101 }
102
96 public event OnChatDelegate OnChat 103 public event OnChatDelegate OnChat
97 { 104 {
98 add 105 add
@@ -211,5 +218,29 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
211 { 218 {
212 get { return m_heights; } 219 get { return m_heights; }
213 } 220 }
221
222 #region Implementation of IWorldAudio
223
224 public void PlaySound(UUID audio, Vector3 position, double volume)
225 {
226 ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>();
227 if (soundModule != null)
228 {
229 soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position,
230 m_internalScene.RegionInfo.RegionHandle);
231 }
232 }
233
234 public void PlaySound(UUID audio, Vector3 position)
235 {
236 ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>();
237 if (soundModule != null)
238 {
239 soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position,
240 m_internalScene.RegionInfo.RegionHandle);
241 }
242 }
243
244 #endregion
214 } 245 }
215} 246}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/WorldX/IWorldAudio.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/WorldX/IWorldAudio.cs
new file mode 100644
index 0000000..a131567
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/WorldX/IWorldAudio.cs
@@ -0,0 +1,13 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenMetaverse;
5
6namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX
7{
8 public interface IWorldAudio
9 {
10 void PlaySound(UUID audio, Vector3 position, double volume);
11 void PlaySound(UUID audio, Vector3 position);
12 }
13}