mirror of
git://opensimulator.org/git/opensim
synced 2026-08-14 09:02:50 +00:00
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)
This commit is contained in:
committed by
Justin Clark-Casey (justincc)
parent
ed162a10be
commit
375fb66589
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user