Establish EventManager.OnRegionReady event. This will only be triggerred once when the region is ready.
Switch MapImageServiceModule to use this.0.7.4.1
parent
6460e587c4
commit
4973fddc51
|
@ -146,10 +146,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
|
|||
lock (m_scenes)
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
|
||||
scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
|
||||
scene.EventManager.OnRegionReady += s => UploadMapTile(s);
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
|
@ -164,11 +163,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
|
|||
|
||||
#endregion ISharedRegionModule
|
||||
|
||||
void OnLoginsEnabled(IScene scene)
|
||||
{
|
||||
UploadMapTile(scene);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
|
|
|
@ -505,6 +505,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate void LoginsEnabled(IScene scene);
|
||||
public event LoginsEnabled OnLoginsEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a region is considered ready for use.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A region is considered ready when startup operations such as loading of scripts already on the region
|
||||
/// have been completed.
|
||||
/// </remarks>
|
||||
public delegate void RegionReady(IScene scene);
|
||||
public event RegionReady OnRegionReady;
|
||||
|
||||
public delegate void PrimsLoaded(Scene s);
|
||||
public event PrimsLoaded OnPrimsLoaded;
|
||||
|
||||
|
@ -2476,11 +2486,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerLoginsEnabled(Scene scene)
|
||||
public void TriggerLoginsEnabled(IScene scene)
|
||||
{
|
||||
LoginsEnabled handler = OnLoginsEnabled;
|
||||
|
||||
if ( handler != null)
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (LoginsEnabled d in handler.GetInvocationList())
|
||||
{
|
||||
|
@ -2490,7 +2500,28 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}",
|
||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerRegionReady(IScene scene)
|
||||
{
|
||||
RegionReady handler = OnRegionReady;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (RegionReady d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(scene);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1501,6 +1501,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
||||
LoginsDisabled = false;
|
||||
EventManager.TriggerRegionReady(this);
|
||||
}
|
||||
|
||||
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
|
||||
|
|
|
@ -238,6 +238,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
|||
{
|
||||
RRAlert("enabled");
|
||||
}
|
||||
|
||||
m_scene.EventManager.TriggerRegionReady(m_scene);
|
||||
}
|
||||
|
||||
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
|
||||
|
|
Loading…
Reference in New Issue