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.
0.7.4.1
Justin Clark-Casey (justincc) 2012-07-18 22:17:39 +01:00
parent 58b72933c8
commit d97e27434c
1 changed files with 23 additions and 30 deletions

View File

@ -99,14 +99,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_lastOarLoadedOk = true; m_lastOarLoadedOk = true;
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
m_scene.EventManager.OnRezScript += OnRezScript;
m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
if (m_disable_logins) if (m_disable_logins)
{ {
m_scene.LoginLock = true;
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; 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); m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
if (m_uri != string.Empty) 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) public void RemoveRegion(Scene scene)
{ {
if (!m_enabled) if (!m_enabled)
@ -134,7 +125,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
if (m_disable_logins) if (m_disable_logins)
{
m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
}
if (m_uri != string.Empty) 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 // Let's bypass this for now until some better feedback can be established
// //
return;
if (msg == "load") // if (msg == "load")
{ // {
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; // m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; // m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; // m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
m_scene.EventManager.OnRezScript += OnRezScript; // m_scene.EventManager.OnRezScript += OnRezScript;
m_oarFileLoading = true; // m_oarFileLoading = true;
m_firstEmptyCompileQueue = true; // m_firstEmptyCompileQueue = true;
//
m_scene.LoginsDisabled = true; // m_scene.LoginsDisabled = true;
m_scene.LoginLock = true; // m_scene.LoginLock = true;
if ( m_uri != string.Empty ) // if ( m_uri != string.Empty )
{ // {
RRAlert("loading oar"); // RRAlert("loading oar");
RRAlert("disabled"); // RRAlert("disabled");
} // }
} // }
} }
public void RRAlert(string status) public void RRAlert(string status)