aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs73
1 files changed, 72 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index 18925e0..88f7b41 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -66,6 +66,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
66 private bool m_enabled = false; 66 private bool m_enabled = false;
67 private bool m_hookUpToServer = false; 67 private bool m_hookUpToServer = false;
68 68
69 public IConfig Config
70 {
71 get { return ScriptConfigSource; }
72 }
73
69 /// <summary> 74 /// <summary>
70 /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes. 75 /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes.
71 /// </summary> 76 /// </summary>
@@ -120,6 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
120 m_EventManager = new EventManager(this, HookUpToServer); 125 m_EventManager = new EventManager(this, HookUpToServer);
121 // We need to start it 126 // We need to start it
122 m_ScriptManager = newScriptManager; 127 m_ScriptManager = newScriptManager;
128 m_ScriptManager.Setup();
123 m_AppDomainManager = new AppDomainManager(this); 129 m_AppDomainManager = new AppDomainManager(this);
124 if (m_MaintenanceThread == null) 130 if (m_MaintenanceThread == null)
125 m_MaintenanceThread = new MaintenanceThread(); 131 m_MaintenanceThread = new MaintenanceThread();
@@ -229,23 +235,88 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
229 235
230 public void SetState(UUID itemID, string state) 236 public void SetState(UUID itemID, string state)
231 { 237 {
238 uint localID = m_ScriptManager.GetLocalID(itemID);
239 if (localID == 0)
240 return;
241
242 IScript Script = m_ScriptManager.GetScript(localID, itemID);
243
244 if (Script == null)
245 return;
246
247 string currentState = Script.State;
248
249 if (currentState != state)
250 {
251 try
252 {
253 m_EventManager.state_exit(localID);
254
255 }
256 catch (AppDomainUnloadedException)
257 {
258 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
259 }
260
261 Script.State = state;
262
263 try
264 {
265 int eventFlags = m_ScriptManager.GetStateEventFlags(localID, itemID);
266 SceneObjectPart part = m_Scene.GetSceneObjectPart(itemID);
267 if (part != null)
268 part.SetScriptEvents(itemID, eventFlags);
269 m_EventManager.state_entry(localID);
270 }
271 catch (AppDomainUnloadedException)
272 {
273 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
274 }
275 }
232 } 276 }
233 277
234 public bool GetScriptState(UUID itemID) 278 public bool GetScriptState(UUID itemID)
235 { 279 {
236 return true; 280 uint localID = m_ScriptManager.GetLocalID(itemID);
281 if (localID == 0)
282 return false;
283
284 IScript script = m_ScriptManager.GetScript(localID, itemID);
285 if (script == null)
286 return false;
287
288 return script.Exec.Running?true:false;
237 } 289 }
238 290
239 public void SetScriptState(UUID itemID, bool state) 291 public void SetScriptState(UUID itemID, bool state)
240 { 292 {
293 uint localID = m_ScriptManager.GetLocalID(itemID);
294 if (localID == 0)
295 return;
296
297 IScript script = m_ScriptManager.GetScript(localID, itemID);
298 if (script == null)
299 return;
300
301 script.Exec.Running = state;
241 } 302 }
242 303
243 public void ApiResetScript(UUID itemID) 304 public void ApiResetScript(UUID itemID)
244 { 305 {
306 uint localID = m_ScriptManager.GetLocalID(itemID);
307 if (localID == 0)
308 return;
309
310 m_ScriptManager.ResetScript(localID, itemID);
245 } 311 }
246 312
247 public void ResetScript(UUID itemID) 313 public void ResetScript(UUID itemID)
248 { 314 {
315 uint localID = m_ScriptManager.GetLocalID(itemID);
316 if (localID == 0)
317 return;
318
319 m_ScriptManager.ResetScript(localID, itemID);
249 } 320 }
250 } 321 }
251} 322}