aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs128
1 files changed, 59 insertions, 69 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 600cafb..e49ad2a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -31,16 +31,14 @@ using System.Reflection;
31using System.Net; 31using System.Net;
32using System.IO; 32using System.IO;
33using System.Text; 33using System.Text;
34
35using log4net; 34using log4net;
36using Nini.Config; 35using Nini.Config;
37using OpenMetaverse; 36using OpenMetaverse;
38using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
39using OpenSim.Services.Interfaces;
40
41using OpenSim.Framework; 38using OpenSim.Framework;
42using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
44 42
45namespace OpenSim.Region.OptionalModules.Scripting.RegionReady 43namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
46{ 44{
@@ -56,10 +54,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
56 private bool m_lastOarLoadedOk; 54 private bool m_lastOarLoadedOk;
57 private int m_channelNotify = -1000; 55 private int m_channelNotify = -1000;
58 private bool m_enabled = false; 56 private bool m_enabled = false;
59 private bool m_disable_logins = false; 57 private bool m_disable_logins;
60 private string m_uri = string.Empty; 58 private string m_uri = string.Empty;
61 59
62 Scene m_scene = null; 60 Scene m_scene;
63 61
64 #region INonSharedRegionModule interface 62 #region INonSharedRegionModule interface
65 63
@@ -99,47 +97,35 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
99 m_lastOarLoadedOk = true; 97 m_lastOarLoadedOk = true;
100 98
101 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; 99 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
102 m_scene.EventManager.OnRezScript += OnRezScript;
103 m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
104 100
105 m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); 101 m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
106 102
107 if (m_disable_logins == true) 103 if (m_disable_logins)
108 { 104 {
109 scene.LoginLock = true; 105 m_scene.LoginLock = true;
110 scene.LoginsDisabled = true; 106 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
111 m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName); 107
108 m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
112 109
113 if(m_uri != string.Empty) 110 if (m_uri != string.Empty)
114 { 111 {
115 RRAlert("disabled"); 112 RRAlert("disabled");
116 } 113 }
117 } 114 }
118 } 115 }
119 116
120 void OnRezScript (uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
121 {
122 if (!m_ScriptRez)
123 {
124 m_ScriptRez = true;
125 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
126 m_scene.EventManager.OnRezScript -= OnRezScript;
127 }
128 }
129
130 public void RemoveRegion(Scene scene) 117 public void RemoveRegion(Scene scene)
131 { 118 {
132 if (!m_enabled) 119 if (!m_enabled)
133 return; 120 return;
134 121
135 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
136 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; 122 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
137 m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
138 123
139 if(m_uri != string.Empty) 124 if (m_disable_logins)
140 { 125 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
126
127 if (m_uri != string.Empty)
141 RRAlert("shutdown"); 128 RRAlert("shutdown");
142 }
143 129
144 m_scene = null; 130 m_scene = null;
145 } 131 }
@@ -159,7 +145,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
159 145
160 #endregion 146 #endregion
161 147
162
163 void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) 148 void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
164 { 149 {
165 m_log.DebugFormat("[RegionReady]: Script compile queue empty!"); 150 m_log.DebugFormat("[RegionReady]: Script compile queue empty!");
@@ -193,75 +178,80 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
193 m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); 178 m_scene.RegionInfo.RegionName, c.Message, m_channelNotify);
194 179
195 m_scene.EventManager.TriggerOnChatBroadcast(this, c); 180 m_scene.EventManager.TriggerOnChatBroadcast(this, c);
196 m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); 181
197 m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo); 182 TriggerRegionReady(m_scene);
198 } 183 }
199 } 184 }
200 185
201 void OnOarFileLoaded(Guid requestId, string message) 186 void OnOarFileLoaded(Guid requestId, string message)
202 { 187 {
203 m_oarFileLoading = true; 188 m_oarFileLoading = true;
189
204 if (message==String.Empty) 190 if (message==String.Empty)
205 { 191 {
206 m_lastOarLoadedOk = true; 192 m_lastOarLoadedOk = true;
207 } else { 193 }
194 else
195 {
208 m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message); 196 m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message);
209 m_lastOarLoadedOk = false; 197 m_lastOarLoadedOk = false;
210 } 198 }
211 } 199 }
212 200
213 // This will be triggerd by Scene if we have no scripts 201 /// <summary>
214 // m_ScriptsRezzing will be false if there were none 202 /// This will be triggered by Scene directly if it contains no scripts on startup. Otherwise it is triggered
215 // else it will be true and we should wait on the 203 /// when the script compile queue is empty after initial region startup.
216 // empty compile queue 204 /// </summary>
217 void OnLoginsEnabled(string regionName) 205 /// <param name='scene'></param>
206 public void TriggerRegionReady(IScene scene)
218 { 207 {
219 if (m_disable_logins == true) 208 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
209 m_scene.LoginLock = false;
210
211 if (!m_scene.StartDisabled)
220 { 212 {
221 if (m_scene.StartDisabled == false) 213 m_scene.LoginsEnabled = true;
222 {
223 m_scene.LoginsDisabled = false;
224 m_scene.LoginLock = false;
225 214
226 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 215 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
216 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
227 217
228 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", 218 m_log.InfoFormat(
229 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); 219 "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
220 }
230 221
231 m_log.InfoFormat( 222 m_scene.SceneGridService.InformNeighborsThatRegionisUp(
232 "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); 223 m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
233 224
234 if (m_uri != string.Empty) 225 if (m_uri != string.Empty)
235 { 226 {
236 RRAlert("enabled"); 227 RRAlert("enabled");
237 }
238 }
239 } 228 }
229
230 m_scene.EventManager.TriggerRegionReady(m_scene);
240 } 231 }
241 232
242 public void OarLoadingAlert(string msg) 233 public void OarLoadingAlert(string msg)
243 { 234 {
244 // Let's bypass this for now until some better feedback can be established 235 // Let's bypass this for now until some better feedback can be established
245 // 236 //
246 return;
247 237
248 if (msg == "load") 238// if (msg == "load")
249 { 239// {
250 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; 240// m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
251 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; 241// m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
252 m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; 242// m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
253 m_scene.EventManager.OnRezScript += OnRezScript; 243// m_scene.EventManager.OnRezScript += OnRezScript;
254 m_oarFileLoading = true; 244// m_oarFileLoading = true;
255 m_firstEmptyCompileQueue = true; 245// m_firstEmptyCompileQueue = true;
256 246//
257 m_scene.LoginsDisabled = true; 247// m_scene.LoginsDisabled = true;
258 m_scene.LoginLock = true; 248// m_scene.LoginLock = true;
259 if ( m_uri != string.Empty ) 249// if ( m_uri != string.Empty )
260 { 250// {
261 RRAlert("loading oar"); 251// RRAlert("loading oar");
262 RRAlert("disabled"); 252// RRAlert("disabled");
263 } 253// }
264 } 254// }
265 } 255 }
266 256
267 public void RRAlert(string status) 257 public void RRAlert(string status)