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/Framework/Scenes/SceneBase.cs | 65 +++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneBase.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 3695b21..42f3d97 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -59,13 +59,19 @@ namespace OpenSim.Region.Framework.Scenes } protected Dictionary m_modules = new Dictionary(); + public Dictionary RegionModules + { + get { return m_regionModules; } + } + private Dictionary m_regionModules = new Dictionary(); + /// /// The module interfaces available from this scene. /// protected Dictionary> ModuleInterfaces = new Dictionary>(); protected Dictionary ModuleAPIMethods = new Dictionary(); - + /// /// The module commanders available from this scene /// @@ -235,7 +241,7 @@ namespace OpenSim.Region.Framework.Scenes } } Modules.Clear(); - + try { EventManager.TriggerShutdown(); @@ -279,6 +285,24 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Add a region-module to this scene. TODO: This will replace AddModule in the future. + /// + /// + /// + public void AddRegionModule(string name, IRegionModuleBase module) + { + if (!RegionModules.ContainsKey(name)) + { + RegionModules.Add(name, module); + } + } + + public void RemoveRegionModule(string name) + { + RegionModules.Remove(name); + } + + /// /// Register a module commander. /// /// @@ -368,6 +392,25 @@ namespace OpenSim.Region.Framework.Scenes } } + public void UnregisterModuleInterface(M mod) + { + List l; + if (ModuleInterfaces.TryGetValue(typeof(M), out l)) + { + if (l.Remove(mod)) + { + if (mod is IEntityCreator) + { + IEntityCreator entityCreator = (IEntityCreator)mod; + foreach (PCode pcode in entityCreator.CreationCapabilities) + { + m_entityCreators[pcode] = null; + } + } + } + } + } + public void StackModuleInterface(M mod) { List l; @@ -462,11 +505,19 @@ namespace OpenSim.Region.Framework.Scenes if (mod != null) { - if (!(mod is IRegionModule)) - throw new Exception("AddCommand module parameter must be IRegionModule"); - IRegionModule module = (IRegionModule)mod; - modulename = module.Name; - shared = module.IsSharedModule; + if (mod is IRegionModule) + { + IRegionModule module = (IRegionModule)mod; + modulename = module.Name; + shared = module.IsSharedModule; + } + else if (mod is IRegionModuleBase) + { + IRegionModuleBase module = (IRegionModuleBase)mod; + modulename = module.Name; + shared = mod is ISharedRegionModule; + } + else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); } MainConsole.Instance.Commands.AddCommand(modulename, shared, command, shorthelp, longhelp, callback); -- cgit v1.1