making the max distance for sounds to be heard from their origin a configurable option exposed via a public field on ISoundModule (with private setter in the implementation)

integration
SignpostMarv 2012-10-05 14:01:29 +01:00 committed by Justin Clark-Casey (justincc)
parent ed162a10be
commit 375fb66589
2 changed files with 11 additions and 3 deletions

View File

@ -48,13 +48,19 @@ namespace OpenSim.Region.CoreModules.World.Sound
public bool Enabled { get; private set; }
public float MaxDistance { get; private set; }
#region INonSharedRegionModule
public void Initialise(IConfigSource configSource)
{
IConfig config = configSource.Configs["Sounds"];
Enabled = (config != null && config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared");
if (config == null)
return;
Enabled = config.GetString("Module", "SoundModuleNonShared") == "SoundModuleNonShared";
MaxDistance = config.GetFloat("MaxDistance", 100.0f);
}
public void AddRegion(Scene scene) { }
@ -109,7 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
if (dis > 100.0) // Max audio distance
if (dis > MaxDistance) // Max audio distance
return;
if (grp.IsAttachment)
@ -158,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
{
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
if (dis > 100.0) // Max audio distance
if (dis > MaxDistance) // Max audio distance
return;
float thisSpGain;

View File

@ -32,6 +32,8 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface ISoundModule
{
float MaxDistance { get; }
void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius);
void TriggerSound(