From cd6d7429f86eda4040cde664de4d690945d8be6b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 21:03:35 +0100 Subject: Only listen to LoginsEnabled event in RegionReadyModule if it has been asked to disable logins until all scripts have been compiled --- .../RegionReadyModule/RegionReadyModule.cs | 48 ++++++++++------------ 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 600cafb..aeab61c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady private bool m_lastOarLoadedOk; private int m_channelNotify = -1000; private bool m_enabled = false; - private bool m_disable_logins = false; + private bool m_disable_logins; private string m_uri = string.Empty; Scene m_scene = null; @@ -100,24 +100,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; m_scene.EventManager.OnRezScript += OnRezScript; - m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); - if (m_disable_logins == true) + if (m_disable_logins) { + m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; scene.LoginLock = true; - scene.LoginsDisabled = true; - m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName); + m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); - if(m_uri != string.Empty) + if (m_uri != string.Empty) { RRAlert("disabled"); } } } - void OnRezScript (uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) + void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) { if (!m_ScriptRez) { @@ -132,11 +131,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady if (!m_enabled) return; - m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; - m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; - if(m_uri != string.Empty) + if (m_disable_logins) + m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; + + if (m_uri != string.Empty) { RRAlert("shutdown"); } @@ -159,7 +159,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady #endregion - void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) { m_log.DebugFormat("[RegionReady]: Script compile queue empty!"); @@ -216,27 +215,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady // empty compile queue void OnLoginsEnabled(string regionName) { - if (m_disable_logins == true) + if (m_scene.StartDisabled == false) { - if (m_scene.StartDisabled == false) - { - m_scene.LoginsDisabled = false; - m_scene.LoginLock = false; + m_scene.LoginsDisabled = false; + m_scene.LoginLock = false; - m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", + // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); - // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", - // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); + m_log.InfoFormat( + "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); - m_log.InfoFormat( - "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); - - if (m_uri != string.Empty) - { - RRAlert("enabled"); - } + if (m_uri != string.Empty) + { + RRAlert("enabled"); } } + + m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; } public void OarLoadingAlert(string msg) -- cgit v1.1 From 6460e587c470361173291337ad222f48c13a10ce Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 21:29:12 +0100 Subject: Pass entire scene object in OnLoginsEnabled event rather than just the region name. This saves listeners from having to re-retrieve the scene from their own lists, which won't work anyway if multiple regions with the same name have been allowed --- .../RegionReadyModule/RegionReadyModule.cs | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index aeab61c..29515de 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady private bool m_disable_logins; private string m_uri = string.Empty; - Scene m_scene = null; + Scene m_scene; #region INonSharedRegionModule interface @@ -192,7 +192,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); m_scene.EventManager.TriggerOnChatBroadcast(this, c); - m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); + m_scene.EventManager.TriggerLoginsEnabled(m_scene); m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface(), m_scene.RegionInfo); } } @@ -200,20 +200,28 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady void OnOarFileLoaded(Guid requestId, string message) { m_oarFileLoading = true; + if (message==String.Empty) { m_lastOarLoadedOk = true; - } else { + } + else + { m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message); m_lastOarLoadedOk = false; } } - // This will be triggerd by Scene if we have no scripts - // m_ScriptsRezzing will be false if there were none - // else it will be true and we should wait on the - // empty compile queue - void OnLoginsEnabled(string regionName) + /// + /// This will be triggered by Scene directly if it contains no scripts on startup. + /// + /// + /// m_ScriptsRezzing will be false if there were none + /// else it will be true and we should wait on the + /// empty compile queue + /// + /// + void OnLoginsEnabled(IScene scene) { if (m_scene.StartDisabled == false) { -- cgit v1.1 From 4973fddc51a4a9e3952bd2decd0ea1842b742141 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 21:52:07 +0100 Subject: Establish EventManager.OnRegionReady event. This will only be triggerred once when the region is ready. Switch MapImageServiceModule to use this. --- .../OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 29515de..e09e633 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -238,6 +238,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { RRAlert("enabled"); } + + m_scene.EventManager.TriggerRegionReady(m_scene); } m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; -- cgit v1.1 From d97e27434c27b02e1b104abb5577d42452b39452 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 22:17:39 +0100 Subject: Fix bug where region ready would be triggered a second time if a script was rezzed on a previously script-free region. There is no need to listen for OnRezScript in RegionReadyModule since OnEmptyScriptCompileQueue will only fire if scripts were compiled. --- .../RegionReadyModule/RegionReadyModule.cs | 53 ++++++++++------------ 1 file changed, 23 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index e09e633..6b09c3b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -99,14 +99,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_lastOarLoadedOk = true; m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; - m_scene.EventManager.OnRezScript += OnRezScript; m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); if (m_disable_logins) { + m_scene.LoginLock = true; m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; - scene.LoginLock = true; + m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; + m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); if (m_uri != string.Empty) @@ -116,16 +117,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady } } - void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) - { - if (!m_ScriptRez) - { - m_ScriptRez = true; - m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; - m_scene.EventManager.OnRezScript -= OnRezScript; - } - } - public void RemoveRegion(Scene scene) { if (!m_enabled) @@ -134,7 +125,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; if (m_disable_logins) + { m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; + m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + } if (m_uri != string.Empty) { @@ -249,25 +243,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { // Let's bypass this for now until some better feedback can be established // - return; - if (msg == "load") - { - m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; - m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; - m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; - m_scene.EventManager.OnRezScript += OnRezScript; - m_oarFileLoading = true; - m_firstEmptyCompileQueue = true; - - m_scene.LoginsDisabled = true; - m_scene.LoginLock = true; - if ( m_uri != string.Empty ) - { - RRAlert("loading oar"); - RRAlert("disabled"); - } - } +// if (msg == "load") +// { +// m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; +// m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; +// m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; +// m_scene.EventManager.OnRezScript += OnRezScript; +// m_oarFileLoading = true; +// m_firstEmptyCompileQueue = true; +// +// m_scene.LoginsDisabled = true; +// m_scene.LoginLock = true; +// if ( m_uri != string.Empty ) +// { +// RRAlert("loading oar"); +// RRAlert("disabled"); +// } +// } } public void RRAlert(string status) -- cgit v1.1 From 528004d34988d8d2349f18ff7d78c6dd50ab8b2d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 23:35:05 +0100 Subject: Perform other region ready actions even if simulator is configured to leave logins disabled on startup. --- .../RegionReadyModule/RegionReadyModule.cs | 45 +++++++++------------- 1 file changed, 19 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 6b09c3b..8d5b25f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -31,16 +31,14 @@ using System.Reflection; using System.Net; using System.IO; using System.Text; - using log4net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; -using OpenSim.Services.Interfaces; - using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { @@ -105,7 +103,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady if (m_disable_logins) { m_scene.LoginLock = true; - m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); @@ -125,15 +122,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; if (m_disable_logins) - { - m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; - } if (m_uri != string.Empty) - { RRAlert("shutdown"); - } m_scene = null; } @@ -186,8 +178,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); m_scene.EventManager.TriggerOnChatBroadcast(this, c); - m_scene.EventManager.TriggerLoginsEnabled(m_scene); - m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface(), m_scene.RegionInfo); + + TriggerRegionReady(m_scene); } } @@ -207,20 +199,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady } /// - /// This will be triggered by Scene directly if it contains no scripts on startup. + /// This will be triggered by Scene directly if it contains no scripts on startup. Otherwise it is triggered + /// when the script compile queue is empty after initial region startup. /// - /// - /// m_ScriptsRezzing will be false if there were none - /// else it will be true and we should wait on the - /// empty compile queue - /// /// - void OnLoginsEnabled(IScene scene) + public void TriggerRegionReady(IScene scene) { - if (m_scene.StartDisabled == false) + m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + m_scene.LoginLock = false; + + if (!m_scene.StartDisabled) { m_scene.LoginsDisabled = false; - m_scene.LoginLock = false; // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); @@ -228,15 +218,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_log.InfoFormat( "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); - if (m_uri != string.Empty) - { - RRAlert("enabled"); - } + m_scene.EventManager.TriggerLoginsEnabled(m_scene); + } + + m_scene.SceneGridService.InformNeighborsThatRegionisUp( + m_scene.RequestModuleInterface(), m_scene.RegionInfo); - m_scene.EventManager.TriggerRegionReady(m_scene); + if (m_uri != string.Empty) + { + RRAlert("enabled"); } - m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + m_scene.EventManager.TriggerRegionReady(m_scene); } public void OarLoadingAlert(string msg) -- cgit v1.1 From 6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jul 2012 00:09:22 +0100 Subject: Add EventManager.OnRegionLoginsStatusChange fired whenever logins are enabled or disabled at any point, not just during initial startup. This replaces EventManager.OnLoginsEnabled which only fired when logins were first enabled and was affected by a bug where it would never fire if the region started with logins disabled. --- .../OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 8d5b25f..e49ad2a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -210,15 +210,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady if (!m_scene.StartDisabled) { - m_scene.LoginsDisabled = false; + m_scene.LoginsEnabled = true; // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); m_log.InfoFormat( "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); - - m_scene.EventManager.TriggerLoginsEnabled(m_scene); } m_scene.SceneGridService.InformNeighborsThatRegionisUp( -- cgit v1.1 From ccc7e75ce4773d0dd5fa2f28a76da57cde76c126 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jul 2012 22:37:48 +0100 Subject: minor: remove some mono compiler warnings --- .../OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index e49ad2a..f459b8c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -48,7 +48,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IConfig m_config = null; - private bool m_ScriptRez; private bool m_firstEmptyCompileQueue; private bool m_oarFileLoading; private bool m_lastOarLoadedOk; @@ -91,7 +90,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.RegisterModuleInterface(this); - m_ScriptRez = false; m_firstEmptyCompileQueue = true; m_oarFileLoading = false; m_lastOarLoadedOk = true; -- cgit v1.1 From 31304c222df1e5a832afd0ebcf7d3ed403543e54 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Jul 2012 21:00:59 +0100 Subject: Make SceneManager.OnRegionsReadyStatusChange event available. This is fired when all regions are ready or when at least one region becomes not ready. Recently added EventManager.OnRegionReady becomes OnRegionReadyStatusChange to match OnLoginsEnabledStatusChange --- .../OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index f459b8c..fff3a32 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -225,7 +225,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady RRAlert("enabled"); } - m_scene.EventManager.TriggerRegionReady(m_scene); + m_scene.Ready = true; } public void OarLoadingAlert(string msg) -- cgit v1.1 From a76a289d11086dd99d345390e58a43b66b053470 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 31 Jul 2012 10:45:37 -0700 Subject: Adds support to ScriptModuleComms for region modules to export constants to the script engine. --- .../ScriptModuleComms/ScriptModuleCommsModule.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'OpenSim/Region/OptionalModules/Scripting') diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 74a85e2..705a847 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -46,6 +46,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Dictionary m_constants = new Dictionary(); + #region ScriptInvocation protected class ScriptInvocationData { @@ -269,6 +271,37 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms Delegate fn = LookupScriptInvocation(fname); return fn.DynamicInvoke(olist.ToArray()); } + + /// + /// Operation to for a region module to register a constant to be used + /// by the script engine + /// + public void RegisterConstant(string cname, object value) + { + m_log.DebugFormat("[MODULE COMMANDS] register constant <{0}> with value {1}",cname,value.ToString()); + lock (m_constants) + { + m_constants.Add(cname,value); + } + } + + /// + /// Operation to check for a registered constant + /// + public object LookupModConstant(string cname) + { + // m_log.DebugFormat("[MODULE COMMANDS] lookup constant <{0}>",cname); + + lock (m_constants) + { + object value = null; + if (m_constants.TryGetValue(cname,out value)) + return value; + } + + return null; + } + #endregion } -- cgit v1.1