Update RegionReadyModule
Fix triggering of alerts when rezzing first script to an empty region, add login disable when loading oars.iar_mods
parent
c5594e839e
commit
57ba9ef5ad
|
@ -98,6 +98,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
|
||||
OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; });
|
||||
options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; });
|
||||
|
||||
// Send a message to the region ready module
|
||||
IRegionReadyModule rready = m_scene.RequestModuleInterface<IRegionReadyModule>();
|
||||
|
||||
if (rready != null)
|
||||
{
|
||||
rready.OarLoadingAlert("load");
|
||||
}
|
||||
|
||||
List<string> mainParams = options.Parse(cmdparams);
|
||||
|
||||
|
@ -125,7 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
|
||||
OptionSet ops = new OptionSet();
|
||||
|
||||
|
||||
// legacy argument [obsolete]
|
||||
ops.Add("p|profile=", delegate(string v) { Console.WriteLine("\n WARNING: -profile option is obsolete and it will not work. Use -home instead.\n"); });
|
||||
// preferred
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IRegionReadyModule
|
||||
{
|
||||
void OarLoadingAlert(string msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -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<IRegionReadyModule>(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";
|
||||
|
|
Loading…
Reference in New Issue