* 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.0.6.6-post-fixes
parent
433ee75775
commit
c30b5ee014
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||
{
|
||||
|
@ -50,6 +51,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
IAvatar[] Avatars { get; }
|
||||
IParcel[] Parcels { get; }
|
||||
IHeightmap Terrain { get; }
|
||||
IWorldAudio Audio { get; }
|
||||
|
||||
|
||||
event OnChatDelegate OnChat;
|
||||
event OnNewUserDelegate OnNewUser;
|
||||
|
|
|
@ -26,13 +26,15 @@
|
|||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||
{
|
||||
public class World : System.MarshalByRefObject, IWorld
|
||||
public class World : System.MarshalByRefObject, IWorld, IWorldAudio
|
||||
{
|
||||
private readonly Scene m_internalScene;
|
||||
private readonly Heightmap m_heights;
|
||||
|
@ -93,6 +95,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
private event OnChatDelegate _OnChat;
|
||||
private bool _OnChatActive;
|
||||
|
||||
public IWorldAudio Audio
|
||||
{
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public event OnChatDelegate OnChat
|
||||
{
|
||||
add
|
||||
|
@ -211,5 +218,29 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get { return m_heights; }
|
||||
}
|
||||
|
||||
#region Implementation of IWorldAudio
|
||||
|
||||
public void PlaySound(UUID audio, Vector3 position, double volume)
|
||||
{
|
||||
ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>();
|
||||
if (soundModule != null)
|
||||
{
|
||||
soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position,
|
||||
m_internalScene.RegionInfo.RegionHandle);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(UUID audio, Vector3 position)
|
||||
{
|
||||
ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>();
|
||||
if (soundModule != null)
|
||||
{
|
||||
soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position,
|
||||
m_internalScene.RegionInfo.RegionHandle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX
|
||||
{
|
||||
public interface IWorldAudio
|
||||
{
|
||||
void PlaySound(UUID audio, Vector3 position, double volume);
|
||||
void PlaySound(UUID audio, Vector3 position);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue