Establish EventManager.OnRegionReady event. This will only be triggerred once when the region is ready.

Switch MapImageServiceModule to use this.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-07-18 21:52:07 +01:00
parent 6460e587c4
commit 4973fddc51
4 changed files with 39 additions and 11 deletions

View File

@@ -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);
}
}

View File

@@ -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);