From 57ba9ef5ad05d2479a5bfb188d8a2827e63f0f0f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 13 Jan 2012 11:35:44 -0500 Subject: Update RegionReadyModule Fix triggering of alerts when rezzing first script to an empty region, add login disable when loading oars. --- .../RegionReadyModule/RegionReadyModule.cs | 57 +++++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/RegionReadyModule') diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 4c4f5fb..f5d4da8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -44,12 +44,13 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { - public class RegionReadyModule : INonSharedRegionModule + public class RegionReadyModule : IRegionReadyModule, INonSharedRegionModule { private static readonly ILog m_log = 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; @@ -93,14 +94,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady if (!m_enabled) return; + m_scene = scene; + + m_scene.RegisterModuleInterface(this); + + m_ScriptRez = false; m_firstEmptyCompileQueue = true; m_oarFileLoading = false; m_lastOarLoadedOk = true; - m_scene = scene; - - m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; 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); @@ -118,6 +122,16 @@ 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) @@ -125,6 +139,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; + m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; if(m_uri != string.Empty) { @@ -148,9 +163,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady } #endregion - + + void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) { + m_log.InfoFormat("[RegionReady]: Script compile queue empty!"); + if (m_firstEmptyCompileQueue || m_oarFileLoading) { OSChatMessage c = new OSChatMessage(); @@ -197,6 +215,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady } } + // 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) { if (m_disable_logins == true) @@ -205,7 +227,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { m_scene.LoginsDisabled = false; m_scene.LoginLock = false; - m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName); + + m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + + m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", + m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); + if ( m_uri != string.Empty ) { RRAlert("enabled"); @@ -214,6 +241,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady } } + public void OarLoadingAlert(string msg) + { + 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; + // Will need some controls around this + m_scene.LoginsDisabled = true; + m_scene.LoginLock = true; + RRAlert("loading oar"); + RRAlert("disabled"); + } + } + public void RRAlert(string status) { string request_method = "POST"; -- cgit v1.1