Add the RegionLoaded(Scene) API to the new region module interface to allow

region modules to use another region module's interfaces and events in
a scene context
0.6.5-rc1
Melanie Thielker 2009-04-14 03:22:02 +00:00
parent 6204f23230
commit 285dfe3055
3 changed files with 37 additions and 0 deletions

View File

@ -174,6 +174,26 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
module.AddRegion(scene);
scene.AddRegionModule(module.Name, module);
}
// This is needed for all module types. Modules will register
// Interfaces with scene in AddScene, and will also need a means
// to access interfaces registered by other modules. Without
// this extra method, a module attempting to use another modules's
// interface would be successful only depending on load order,
// which can't be depended upon, or modules would need to resort
// to ugly kludges to attempt to request interfaces when needed
// and unneccessary caching logic repeated in all modules.
// The extra function stub is just that much cleaner
//
foreach (ISharedRegionModule module in m_sharedInstances)
{
module.RegionLoaded(scene);
}
foreach (INonSharedRegionModule module in list)
{
module.RegionLoaded(scene);
}
}
public void RemoveRegionFromModules (Scene scene)

View File

@ -136,6 +136,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
LoadPlugins();
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
lock (m_scene)

View File

@ -71,6 +71,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// A <see cref="Scene"/>
/// </param>
void RemoveRegion(Scene scene);
/// <summary>
/// This will be called once for every scene loaded. In a shared module
/// this will be multiple times in one instance, while a nonshared
/// module instance will only be called once.
/// This method is called after AddRegion has been called in all
/// modules for that scene, providing an opportunity to request
/// another module's interface, or hook an event from another module.
/// </summary>
/// <param name="scene">
/// A <see cref="Scene"/>
/// </param>
void RegionLoaded(Scene scene);
}
}