One more module converted: LightShareModule.

integration
Diva Canto 2012-11-11 08:38:39 -08:00
parent d589a8bc04
commit 6cf90e5516
1 changed files with 56 additions and 39 deletions

View File

@ -37,11 +37,12 @@ using OpenSim.Framework;
using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.World.LightShare namespace OpenSim.Region.CoreModules.World.LightShare
{ {
public class LightShareModule : IRegionModule, ICommandableModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class LightShareModule : INonSharedRegionModule, ICommandableModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Commander m_commander = new Commander("windlight"); private readonly Commander m_commander = new Commander("windlight");
@ -70,12 +71,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare
} }
} }
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
m_scene = scene;
m_scene.RegisterModuleInterface<IRegionModule>(this);
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
// ini file settings // ini file settings
try try
{ {
@ -86,19 +83,62 @@ namespace OpenSim.Region.CoreModules.World.LightShare
m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default");
} }
if (m_enableWindlight) m_log.DebugFormat("[WINDLIGHT]: windlight module {0}", (m_enableWindlight ? "enabled" : "disabled"));
{ }
m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; public void AddRegion(Scene scene)
m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; {
m_scene.LoadWindlightProfile(); if (!m_enableWindlight)
} return;
m_scene = scene;
//m_scene.RegisterModuleInterface<IRegionModule>(this);
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted;
m_scene.LoadWindlightProfile();
InstallCommands(); InstallCommands();
m_log.Debug("[WINDLIGHT]: Initialised windlight module");
} }
public void RemoveRegion(Scene scene)
{
if (!m_enableWindlight)
return;
m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
m_scene.EventManager.OnMakeRootAgent -= EventManager_OnMakeRootAgent;
m_scene.EventManager.OnSaveNewWindlightProfile -= EventManager_OnSaveNewWindlightProfile;
m_scene.EventManager.OnSendNewWindlightProfileTargeted -= EventManager_OnSendNewWindlightProfileTargeted;
m_scene = null;
}
public void Close()
{
}
public string Name
{
get { return "LightShareModule"; }
}
public void RegionLoaded(Scene scene)
{
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
#region events
private List<byte[]> compileWindlightSettings(RegionLightShareData wl) private List<byte[]> compileWindlightSettings(RegionLightShareData wl)
{ {
byte[] mBlock = new Byte[249]; byte[] mBlock = new Byte[249];
@ -186,29 +226,6 @@ namespace OpenSim.Region.CoreModules.World.LightShare
m_scene.ForEachRootClient(SendProfileToClient); m_scene.ForEachRootClient(SendProfileToClient);
} }
public void PostInitialise()
{
}
public void Close()
{
}
public string Name
{
get { return "LightShareModule"; }
}
public bool IsSharedModule
{
get { return false; }
}
#endregion
#region events
#endregion #endregion
#region ICommandableModule Members #region ICommandableModule Members