From 648452dd91e07be4ec0e81793807e86bd48362c4 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Sun, 5 Apr 2009 17:08:11 +0000 Subject: - Add new RegionModulesControllerPlugin to the application modules - Change several classes to use the new plugin for handling of region-modules (NOTE: No regionmodule is using this yet) - Add necessary prebuild parts (don't forget to runprebuild) Attention: Work in progress. This shouldn't break anything, but you never know... --- OpenSim/Region/Application/OpenSimBase.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Application/OpenSimBase.cs') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f24cf99..fd3549e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -517,7 +517,7 @@ namespace OpenSim IClientNetworkServer clientServer; Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer); - m_log.Info("[MODULES]: Loading Region's modules"); + m_log.Info("[MODULES]: Loading Region's modules (old style)"); List modules = m_moduleLoader.PickupModules(scene, "."); @@ -525,6 +525,15 @@ namespace OpenSim // script module can pick up events exposed by a module m_moduleLoader.InitialiseSharedModules(scene); + // Use this in the future, the line above will be deprecated soon + m_log.Info("[MODULES]: Loading Region's modules (new style)"); + IRegionModulesController controller; + if (ApplicationRegistry.TryGet(out controller)) + { + controller.AddRegionToModules(scene); + } + else m_log.Error("[MODULES]: The new RegionModulesController is missing..."); + scene.SetModuleInterfaces(); // Prims have to be loaded after module configuration since some modules may be invoked during the load @@ -571,11 +580,22 @@ namespace OpenSim module.PostInitialise(); } } + scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; mscene = scene; return clientServer; } + private void ShutdownRegion(Scene scene) + { + m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); + IRegionModulesController controller; + if (ApplicationRegistry.TryGet(out controller)) + { + controller.RemoveRegionFromModules(scene); + } + } + public void RemoveRegion(Scene scene, bool cleanup) { // only need to check this if we are not at the -- cgit v1.1