diff options
author | Justin Clark-Casey (justincc) | 2012-07-18 21:52:07 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-18 21:52:07 +0100 |
commit | 4973fddc51a4a9e3952bd2decd0ea1842b742141 (patch) | |
tree | 8e525f6fbc4ea5ccfd9e8acbf36959c6f6249268 /OpenSim | |
parent | Pass entire scene object in OnLoginsEnabled event rather than just the region... (diff) | |
download | opensim-SC-4973fddc51a4a9e3952bd2decd0ea1842b742141.zip opensim-SC-4973fddc51a4a9e3952bd2decd0ea1842b742141.tar.gz opensim-SC-4973fddc51a4a9e3952bd2decd0ea1842b742141.tar.bz2 opensim-SC-4973fddc51a4a9e3952bd2decd0ea1842b742141.tar.xz |
Establish EventManager.OnRegionReady event. This will only be triggerred once when the region is ready.
Switch MapImageServiceModule to use this.
Diffstat (limited to 'OpenSim')
4 files changed, 39 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 9033460..5641804 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | |||
@@ -146,10 +146,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
146 | lock (m_scenes) | 146 | lock (m_scenes) |
147 | m_scenes[scene.RegionInfo.RegionID] = scene; | 147 | m_scenes[scene.RegionInfo.RegionID] = scene; |
148 | 148 | ||
149 | scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; | 149 | scene.EventManager.OnRegionReady += s => UploadMapTile(s); |
150 | } | 150 | } |
151 | 151 | ||
152 | |||
153 | ///<summary> | 152 | ///<summary> |
154 | /// | 153 | /// |
155 | ///</summary> | 154 | ///</summary> |
@@ -163,12 +162,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
163 | } | 162 | } |
164 | 163 | ||
165 | #endregion ISharedRegionModule | 164 | #endregion ISharedRegionModule |
166 | 165 | ||
167 | void OnLoginsEnabled(IScene scene) | ||
168 | { | ||
169 | UploadMapTile(scene); | ||
170 | } | ||
171 | |||
172 | ///<summary> | 166 | ///<summary> |
173 | /// | 167 | /// |
174 | ///</summary> | 168 | ///</summary> |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index e2380b7..714d70d 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -505,6 +505,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
505 | public delegate void LoginsEnabled(IScene scene); | 505 | public delegate void LoginsEnabled(IScene scene); |
506 | public event LoginsEnabled OnLoginsEnabled; | 506 | public event LoginsEnabled OnLoginsEnabled; |
507 | 507 | ||
508 | /// <summary> | ||
509 | /// Fired when a region is considered ready for use. | ||
510 | /// </summary> | ||
511 | /// <remarks> | ||
512 | /// A region is considered ready when startup operations such as loading of scripts already on the region | ||
513 | /// have been completed. | ||
514 | /// </remarks> | ||
515 | public delegate void RegionReady(IScene scene); | ||
516 | public event RegionReady OnRegionReady; | ||
517 | |||
508 | public delegate void PrimsLoaded(Scene s); | 518 | public delegate void PrimsLoaded(Scene s); |
509 | public event PrimsLoaded OnPrimsLoaded; | 519 | public event PrimsLoaded OnPrimsLoaded; |
510 | 520 | ||
@@ -2476,11 +2486,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2476 | } | 2486 | } |
2477 | } | 2487 | } |
2478 | 2488 | ||
2479 | public void TriggerLoginsEnabled(Scene scene) | 2489 | public void TriggerLoginsEnabled(IScene scene) |
2480 | { | 2490 | { |
2481 | LoginsEnabled handler = OnLoginsEnabled; | 2491 | LoginsEnabled handler = OnLoginsEnabled; |
2482 | 2492 | ||
2483 | if ( handler != null) | 2493 | if (handler != null) |
2484 | { | 2494 | { |
2485 | foreach (LoginsEnabled d in handler.GetInvocationList()) | 2495 | foreach (LoginsEnabled d in handler.GetInvocationList()) |
2486 | { | 2496 | { |
@@ -2490,7 +2500,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2490 | } | 2500 | } |
2491 | catch (Exception e) | 2501 | catch (Exception e) |
2492 | { | 2502 | { |
2493 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}", | 2503 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}", |
2504 | e.Message, e.StackTrace); | ||
2505 | } | ||
2506 | } | ||
2507 | } | ||
2508 | } | ||
2509 | |||
2510 | public void TriggerRegionReady(IScene scene) | ||
2511 | { | ||
2512 | RegionReady handler = OnRegionReady; | ||
2513 | |||
2514 | if (handler != null) | ||
2515 | { | ||
2516 | foreach (RegionReady d in handler.GetInvocationList()) | ||
2517 | { | ||
2518 | try | ||
2519 | { | ||
2520 | d(scene); | ||
2521 | } | ||
2522 | catch (Exception e) | ||
2523 | { | ||
2524 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}", | ||
2494 | e.Message, e.StackTrace); | 2525 | e.Message, e.StackTrace); |
2495 | } | 2526 | } |
2496 | } | 2527 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8a28ee4..12cc0d3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1501,6 +1501,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1501 | { | 1501 | { |
1502 | m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); | 1502 | m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); |
1503 | LoginsDisabled = false; | 1503 | LoginsDisabled = false; |
1504 | EventManager.TriggerRegionReady(this); | ||
1504 | } | 1505 | } |
1505 | 1506 | ||
1506 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1507 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 29515de..e09e633 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -238,6 +238,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
238 | { | 238 | { |
239 | RRAlert("enabled"); | 239 | RRAlert("enabled"); |
240 | } | 240 | } |
241 | |||
242 | m_scene.EventManager.TriggerRegionReady(m_scene); | ||
241 | } | 243 | } |
242 | 244 | ||
243 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; | 245 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; |