From 083eb7679b8565757e025d8fe090e9d147fe132d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Oct 2013 17:32:17 -0700 Subject: Added SimulatorFeatures/OpenSimExtras: say-range, whisper-range, shout-range, at the request of Singularity dev Liru-Dargon --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 5229c08..27ace68 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -32,6 +32,7 @@ using log4net; using Nini.Config; using Mono.Addins; using OpenMetaverse; +using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -94,6 +95,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat public virtual void RegionLoaded(Scene scene) { + if (!m_enabled) + return; + + ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface(); + + if (featuresModule != null) + featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest; + } public virtual void RemoveRegion(Scene scene) @@ -353,5 +362,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat return true; } + + #region SimulatorFeaturesRequest + + static OSDInteger m_SayRange, m_WhisperRange, m_ShoutRange; + + private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) + { + OSD extras = new OSDMap(); + if (features.ContainsKey("OpenSimExtras")) + extras = features["OpenSimExtras"]; + else + features["OpenSimExtras"] = extras; + + if (m_SayRange == null) + { + // Do this only once + m_SayRange = new OSDInteger(m_saydistance); + m_WhisperRange = new OSDInteger(m_whisperdistance); + m_ShoutRange = new OSDInteger(m_shoutdistance); + } + + ((OSDMap)extras)["say-range"] = m_SayRange; + ((OSDMap)extras)["whisper-range"] = m_WhisperRange; + ((OSDMap)extras)["shout-range"] = m_ShoutRange; + + } + + #endregion } } \ No newline at end of file -- cgit v1.1