aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/LightShare/LightShareModule.cs93
1 files changed, 55 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
index 16cbbf5..c9a263f 100644
--- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
+++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
@@ -37,11 +37,12 @@ using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 37using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40 40using Mono.Addins;
41 41
42namespace OpenSim.Region.CoreModules.World.LightShare 42namespace OpenSim.Region.CoreModules.World.LightShare
43{ 43{
44 public class LightShareModule : IRegionModule, ICommandableModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class LightShareModule : INonSharedRegionModule, ICommandableModule
45 { 46 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private readonly Commander m_commander = new Commander("windlight"); 48 private readonly Commander m_commander = new Commander("windlight");
@@ -70,12 +71,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare
70 } 71 }
71 } 72 }
72 73
73 public void Initialise(Scene scene, IConfigSource config) 74 public void Initialise(IConfigSource config)
74 { 75 {
75 m_scene = scene;
76 m_scene.RegisterModuleInterface<IRegionModule>(this);
77 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
78
79 // ini file settings 76 // ini file settings
80 try 77 try
81 { 78 {
@@ -86,19 +83,62 @@ namespace OpenSim.Region.CoreModules.World.LightShare
86 m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); 83 m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default");
87 } 84 }
88 85
89 if (m_enableWindlight) 86 m_log.DebugFormat("[WINDLIGHT]: windlight module {0}", (m_enableWindlight ? "enabled" : "disabled"));
90 { 87 }
91 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; 88
92 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; 89 public void AddRegion(Scene scene)
93 m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; 90 {
94 m_scene.LoadWindlightProfile(); 91 if (!m_enableWindlight)
95 } 92 return;
93
94 m_scene = scene;
95 //m_scene.RegisterModuleInterface<IRegionModule>(this);
96 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
97
98 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
99 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
100 m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted;
101 m_scene.LoadWindlightProfile();
96 102
97 InstallCommands(); 103 InstallCommands();
104 }
105
106 public void RemoveRegion(Scene scene)
107 {
108 if (!m_enableWindlight)
109 return;
110
111 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
112
113 m_scene.EventManager.OnMakeRootAgent -= EventManager_OnMakeRootAgent;
114 m_scene.EventManager.OnSaveNewWindlightProfile -= EventManager_OnSaveNewWindlightProfile;
115 m_scene.EventManager.OnSendNewWindlightProfileTargeted -= EventManager_OnSendNewWindlightProfileTargeted;
116
117 m_scene = null;
118 }
98 119
99 m_log.Debug("[WINDLIGHT]: Initialised windlight module"); 120 public void Close()
121 {
122 }
123
124 public string Name
125 {
126 get { return "LightShareModule"; }
100 } 127 }
101 128
129 public void RegionLoaded(Scene scene)
130 {
131 }
132
133 public Type ReplaceableInterface
134 {
135 get { return null; }
136 }
137
138 #endregion
139
140 #region events
141
102 private List<byte[]> compileWindlightSettings(RegionLightShareData wl) 142 private List<byte[]> compileWindlightSettings(RegionLightShareData wl)
103 { 143 {
104 byte[] mBlock = new Byte[249]; 144 byte[] mBlock = new Byte[249];
@@ -186,29 +226,6 @@ namespace OpenSim.Region.CoreModules.World.LightShare
186 m_scene.ForEachRootClient(SendProfileToClient); 226 m_scene.ForEachRootClient(SendProfileToClient);
187 } 227 }
188 228
189 public void PostInitialise()
190 {
191
192 }
193
194 public void Close()
195 {
196 }
197
198 public string Name
199 {
200 get { return "LightShareModule"; }
201 }
202
203 public bool IsSharedModule
204 {
205 get { return false; }
206 }
207
208 #endregion
209
210 #region events
211
212 #endregion 229 #endregion
213 230
214 #region ICommandableModule Members 231 #region ICommandableModule Members