mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
- 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...
This commit is contained in:
@@ -59,13 +59,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>();
|
||||
|
||||
public Dictionary<string, IRegionModuleBase> RegionModules
|
||||
{
|
||||
get { return m_regionModules; }
|
||||
}
|
||||
private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>();
|
||||
|
||||
/// <value>
|
||||
/// The module interfaces available from this scene.
|
||||
/// </value>
|
||||
protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>();
|
||||
|
||||
protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
|
||||
|
||||
|
||||
/// <value>
|
||||
/// The module commanders available from this scene
|
||||
/// </value>
|
||||
@@ -235,7 +241,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
Modules.Clear();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
EventManager.TriggerShutdown();
|
||||
@@ -278,6 +284,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a region-module to this scene. TODO: This will replace AddModule in the future.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="module"></param>
|
||||
public void AddRegionModule(string name, IRegionModuleBase module)
|
||||
{
|
||||
if (!RegionModules.ContainsKey(name))
|
||||
{
|
||||
RegionModules.Add(name, module);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionModule(string name)
|
||||
{
|
||||
RegionModules.Remove(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a module commander.
|
||||
/// </summary>
|
||||
@@ -368,6 +392,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void UnregisterModuleInterface<M>(M mod)
|
||||
{
|
||||
List<Object> 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>(M mod)
|
||||
{
|
||||
List<Object> 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);
|
||||
|
||||
Reference in New Issue
Block a user