aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule
diff options
context:
space:
mode:
authorBlueWall2012-01-13 11:35:44 -0500
committerBlueWall2012-01-13 11:35:44 -0500
commit57ba9ef5ad05d2479a5bfb188d8a2827e63f0f0f (patch)
tree9388e3f00b2b92a20142d7025db988bc1ad3e5cf /OpenSim/Region/OptionalModules/Scripting/RegionReadyModule
parentUndo some prior work (diff)
downloadopensim-SC_OLD-57ba9ef5ad05d2479a5bfb188d8a2827e63f0f0f.zip
opensim-SC_OLD-57ba9ef5ad05d2479a5bfb188d8a2827e63f0f0f.tar.gz
opensim-SC_OLD-57ba9ef5ad05d2479a5bfb188d8a2827e63f0f0f.tar.bz2
opensim-SC_OLD-57ba9ef5ad05d2479a5bfb188d8a2827e63f0f0f.tar.xz
Update RegionReadyModule
Fix triggering of alerts when rezzing first script to an empty region, add login disable when loading oars.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/RegionReadyModule')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs57
1 files changed, 51 insertions, 6 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 4c4f5fb..f5d4da8 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -44,12 +44,13 @@ using OpenSim.Region.Framework.Scenes;
44 44
45namespace OpenSim.Region.OptionalModules.Scripting.RegionReady 45namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
46{ 46{
47 public class RegionReadyModule : INonSharedRegionModule 47 public class RegionReadyModule : IRegionReadyModule, INonSharedRegionModule
48 { 48 {
49 private static readonly ILog m_log = 49 private static readonly ILog m_log =
50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 private IConfig m_config = null; 52 private IConfig m_config = null;
53 private bool m_ScriptRez;
53 private bool m_firstEmptyCompileQueue; 54 private bool m_firstEmptyCompileQueue;
54 private bool m_oarFileLoading; 55 private bool m_oarFileLoading;
55 private bool m_lastOarLoadedOk; 56 private bool m_lastOarLoadedOk;
@@ -93,14 +94,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
93 if (!m_enabled) 94 if (!m_enabled)
94 return; 95 return;
95 96
97 m_scene = scene;
98
99 m_scene.RegisterModuleInterface<IRegionReadyModule>(this);
100
101 m_ScriptRez = false;
96 m_firstEmptyCompileQueue = true; 102 m_firstEmptyCompileQueue = true;
97 m_oarFileLoading = false; 103 m_oarFileLoading = false;
98 m_lastOarLoadedOk = true; 104 m_lastOarLoadedOk = true;
99 105
100 m_scene = scene;
101
102 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
103 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; 106 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
107 m_scene.EventManager.OnRezScript += OnRezScript;
104 m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; 108 m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
105 109
106 m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); 110 m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
@@ -118,6 +122,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
118 } 122 }
119 } 123 }
120 124
125 void OnRezScript (uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
126 {
127 if (!m_ScriptRez)
128 {
129 m_ScriptRez = true;
130 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
131 m_scene.EventManager.OnRezScript -= OnRezScript;
132 }
133 }
134
121 public void RemoveRegion(Scene scene) 135 public void RemoveRegion(Scene scene)
122 { 136 {
123 if (!m_enabled) 137 if (!m_enabled)
@@ -125,6 +139,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
125 139
126 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 140 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
127 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; 141 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
142 m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
128 143
129 if(m_uri != string.Empty) 144 if(m_uri != string.Empty)
130 { 145 {
@@ -148,9 +163,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
148 } 163 }
149 164
150 #endregion 165 #endregion
151 166
167
152 void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) 168 void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
153 { 169 {
170 m_log.InfoFormat("[RegionReady]: Script compile queue empty!");
171
154 if (m_firstEmptyCompileQueue || m_oarFileLoading) 172 if (m_firstEmptyCompileQueue || m_oarFileLoading)
155 { 173 {
156 OSChatMessage c = new OSChatMessage(); 174 OSChatMessage c = new OSChatMessage();
@@ -197,6 +215,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
197 } 215 }
198 } 216 }
199 217
218 // This will be triggerd by Scene if we have no scripts
219 // m_ScriptsRezzing will be false if there were none
220 // else it will be true and we should wait on the
221 // empty compile queue
200 void OnLoginsEnabled(string regionName) 222 void OnLoginsEnabled(string regionName)
201 { 223 {
202 if (m_disable_logins == true) 224 if (m_disable_logins == true)
@@ -205,7 +227,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
205 { 227 {
206 m_scene.LoginsDisabled = false; 228 m_scene.LoginsDisabled = false;
207 m_scene.LoginLock = false; 229 m_scene.LoginLock = false;
208 m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName); 230
231 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
232
233 m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
234 m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
235
209 if ( m_uri != string.Empty ) 236 if ( m_uri != string.Empty )
210 { 237 {
211 RRAlert("enabled"); 238 RRAlert("enabled");
@@ -214,6 +241,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
214 } 241 }
215 } 242 }
216 243
244 public void OarLoadingAlert(string msg)
245 {
246 if (msg == "load")
247 {
248 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
249 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
250 m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
251 m_scene.EventManager.OnRezScript += OnRezScript;
252 m_oarFileLoading = true;
253 m_firstEmptyCompileQueue = true;
254 // Will need some controls around this
255 m_scene.LoginsDisabled = true;
256 m_scene.LoginLock = true;
257 RRAlert("loading oar");
258 RRAlert("disabled");
259 }
260 }
261
217 public void RRAlert(string status) 262 public void RRAlert(string status)
218 { 263 {
219 string request_method = "POST"; 264 string request_method = "POST";