diff options
author | Melanie Thielker | 2008-09-26 02:51:00 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-26 02:51:00 +0000 |
commit | c21a8b99694e459408a9ccc43e525928038b2b22 (patch) | |
tree | 21190b513065cc7b1f3442d2cf2ed9ce1d2077f4 /OpenSim/Region/ScriptEngine/Common/ScriptEngineBase | |
parent | Mantis#2265. Thank you kindly, Idb for a patch that: (diff) | |
download | opensim-SC_OLD-c21a8b99694e459408a9ccc43e525928038b2b22.zip opensim-SC_OLD-c21a8b99694e459408a9ccc43e525928038b2b22.tar.gz opensim-SC_OLD-c21a8b99694e459408a9ccc43e525928038b2b22.tar.bz2 opensim-SC_OLD-c21a8b99694e459408a9ccc43e525928038b2b22.tar.xz |
Full API convergence. Api is back in LSL_Api.cs and OSSL_Api.cs.
The binaries are still different, but that is only a small step away now.
The OSSLPrim has been removed. This commit will breal all scripts
using Prim.Scale(), etc, syntax. It was not secure and will have to
be brought back in another form.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | 9 |
2 files changed, 79 insertions, 3 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 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 095e11f..987a0a0 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -120,12 +120,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
120 | m_scriptEngine = scriptEngine; | 120 | m_scriptEngine = scriptEngine; |
121 | } | 121 | } |
122 | public abstract void Initialize(); | 122 | public abstract void Initialize(); |
123 | public void Setup() | ||
124 | { | ||
125 | ReadConfig(); | ||
126 | Initialize(); | ||
127 | } | ||
123 | public void Start() | 128 | public void Start() |
124 | { | 129 | { |
125 | m_started = true; | 130 | m_started = true; |
126 | 131 | ||
127 | ReadConfig(); | ||
128 | Initialize(); | ||
129 | 132 | ||
130 | AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); | 133 | AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); |
131 | 134 | ||
@@ -225,6 +228,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
225 | { | 228 | { |
226 | if (LUQueue.Count > 0) | 229 | if (LUQueue.Count > 0) |
227 | { | 230 | { |
231 | m_scriptEngine.Log.InfoFormat("[{0}]: Loading script", m_scriptEngine.ScriptEngineName); | ||
228 | LUStruct item = LUQueue.Dequeue(); | 232 | LUStruct item = LUQueue.Dequeue(); |
229 | 233 | ||
230 | if (item.Action == LUType.Unload) | 234 | if (item.Action == LUType.Unload) |
@@ -281,6 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
281 | ls.startParam = startParam; | 285 | ls.startParam = startParam; |
282 | ls.postOnRez = postOnRez; | 286 | ls.postOnRez = postOnRez; |
283 | LUQueue.Enqueue(ls); | 287 | LUQueue.Enqueue(ls); |
288 | m_scriptEngine.Log.InfoFormat("[{0}]: Queued script for load", m_scriptEngine.ScriptEngineName); | ||
284 | } | 289 | } |
285 | } | 290 | } |
286 | 291 | ||