diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 99bbdee..60333b1 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -31,7 +31,7 @@ using System.IO; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Runtime.Serialization.Formatters.Binary; | 32 | using System.Runtime.Serialization.Formatters.Binary; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | using libsecondlife; | 34 | using OpenMetaverse; |
35 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
36 | 36 | ||
37 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | 37 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase |
@@ -69,7 +69,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
69 | private struct LUStruct | 69 | private struct LUStruct |
70 | { | 70 | { |
71 | public uint localID; | 71 | public uint localID; |
72 | public LLUUID itemID; | 72 | public UUID itemID; |
73 | public string script; | 73 | public string script; |
74 | public LUType Action; | 74 | public LUType Action; |
75 | public int startParam; | 75 | public int startParam; |
@@ -84,13 +84,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
84 | } | 84 | } |
85 | 85 | ||
86 | // Xantor 20080525: Keep a list of compiled scripts this session for reuse | 86 | // Xantor 20080525: Keep a list of compiled scripts this session for reuse |
87 | public Dictionary<LLUUID, String> scriptList = new Dictionary<LLUUID, string>(); | 87 | public Dictionary<UUID, String> scriptList = new Dictionary<UUID, string>(); |
88 | 88 | ||
89 | // Object<string, Script<string, script>> | 89 | // Object<string, Script<string, script>> |
90 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. | 90 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. |
91 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | 91 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! |
92 | public Dictionary<uint, Dictionary<LLUUID, IScript>> Scripts = | 92 | public Dictionary<uint, Dictionary<UUID, IScript>> Scripts = |
93 | new Dictionary<uint, Dictionary<LLUUID, IScript>>(); | 93 | new Dictionary<uint, Dictionary<UUID, IScript>>(); |
94 | 94 | ||
95 | 95 | ||
96 | public Scene World | 96 | public Scene World |
@@ -254,7 +254,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
254 | /// </summary> | 254 | /// </summary> |
255 | /// <param name="itemID"></param> | 255 | /// <param name="itemID"></param> |
256 | /// <param name="localID"></param> | 256 | /// <param name="localID"></param> |
257 | public void StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez) | 257 | public void StartScript(uint localID, UUID itemID, string Script, int startParam, bool postOnRez) |
258 | { | 258 | { |
259 | lock (LUQueue) | 259 | lock (LUQueue) |
260 | { | 260 | { |
@@ -280,7 +280,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
280 | /// </summary> | 280 | /// </summary> |
281 | /// <param name="localID"></param> | 281 | /// <param name="localID"></param> |
282 | /// <param name="itemID"></param> | 282 | /// <param name="itemID"></param> |
283 | public void StopScript(uint localID, LLUUID itemID) | 283 | public void StopScript(uint localID, UUID itemID) |
284 | { | 284 | { |
285 | LUStruct ls = new LUStruct(); | 285 | LUStruct ls = new LUStruct(); |
286 | ls.localID = localID; | 286 | ls.localID = localID; |
@@ -297,8 +297,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
297 | // Create a new instance of the compiler (reuse) | 297 | // Create a new instance of the compiler (reuse) |
298 | //private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); | 298 | //private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); |
299 | 299 | ||
300 | public abstract void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez); | 300 | public abstract void _StartScript(uint localID, UUID itemID, string Script, int startParam, bool postOnRez); |
301 | public abstract void _StopScript(uint localID, LLUUID itemID); | 301 | public abstract void _StopScript(uint localID, UUID itemID); |
302 | 302 | ||
303 | 303 | ||
304 | #endregion | 304 | #endregion |
@@ -312,7 +312,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
312 | /// <param name="itemID">Script ID</param> | 312 | /// <param name="itemID">Script ID</param> |
313 | /// <param name="FunctionName">Name of function</param> | 313 | /// <param name="FunctionName">Name of function</param> |
314 | /// <param name="args">Arguments to pass to function</param> | 314 | /// <param name="args">Arguments to pass to function</param> |
315 | internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, EventQueueManager.Queue_llDetectParams_Struct qParams, object[] args) | 315 | internal void ExecuteEvent(uint localID, UUID itemID, string FunctionName, EventQueueManager.Queue_llDetectParams_Struct qParams, object[] args) |
316 | { | 316 | { |
317 | //cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined | 317 | //cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined |
318 | ///#if DEBUG | 318 | ///#if DEBUG |
@@ -335,7 +335,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
335 | Script.Exec.ExecuteEvent(FunctionName, args); | 335 | Script.Exec.ExecuteEvent(FunctionName, args); |
336 | } | 336 | } |
337 | 337 | ||
338 | public int GetStateEventFlags(uint localID, LLUUID itemID) | 338 | public int GetStateEventFlags(uint localID, UUID itemID) |
339 | { | 339 | { |
340 | // Console.WriteLine("GetStateEventFlags for <" + localID + "," + itemID + ">"); | 340 | // Console.WriteLine("GetStateEventFlags for <" + localID + "," + itemID + ">"); |
341 | try | 341 | try |
@@ -360,25 +360,25 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
360 | 360 | ||
361 | #region Internal functions to keep track of script | 361 | #region Internal functions to keep track of script |
362 | 362 | ||
363 | public Dictionary<LLUUID, IScript>.KeyCollection GetScriptKeys(uint localID) | 363 | public Dictionary<UUID, IScript>.KeyCollection GetScriptKeys(uint localID) |
364 | { | 364 | { |
365 | if (Scripts.ContainsKey(localID) == false) | 365 | if (Scripts.ContainsKey(localID) == false) |
366 | return null; | 366 | return null; |
367 | 367 | ||
368 | Dictionary<LLUUID, IScript> Obj; | 368 | Dictionary<UUID, IScript> Obj; |
369 | Scripts.TryGetValue(localID, out Obj); | 369 | Scripts.TryGetValue(localID, out Obj); |
370 | 370 | ||
371 | return Obj.Keys; | 371 | return Obj.Keys; |
372 | } | 372 | } |
373 | 373 | ||
374 | public IScript GetScript(uint localID, LLUUID itemID) | 374 | public IScript GetScript(uint localID, UUID itemID) |
375 | { | 375 | { |
376 | lock (scriptLock) | 376 | lock (scriptLock) |
377 | { | 377 | { |
378 | if (Scripts.ContainsKey(localID) == false) | 378 | if (Scripts.ContainsKey(localID) == false) |
379 | return null; | 379 | return null; |
380 | 380 | ||
381 | Dictionary<LLUUID, IScript> Obj; | 381 | Dictionary<UUID, IScript> Obj; |
382 | Scripts.TryGetValue(localID, out Obj); | 382 | Scripts.TryGetValue(localID, out Obj); |
383 | if (Obj.ContainsKey(itemID) == false) | 383 | if (Obj.ContainsKey(itemID) == false) |
384 | return null; | 384 | return null; |
@@ -390,18 +390,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
390 | } | 390 | } |
391 | } | 391 | } |
392 | 392 | ||
393 | public void SetScript(uint localID, LLUUID itemID, IScript Script) | 393 | public void SetScript(uint localID, UUID itemID, IScript Script) |
394 | { | 394 | { |
395 | lock (scriptLock) | 395 | lock (scriptLock) |
396 | { | 396 | { |
397 | // Create object if it doesn't exist | 397 | // Create object if it doesn't exist |
398 | if (Scripts.ContainsKey(localID) == false) | 398 | if (Scripts.ContainsKey(localID) == false) |
399 | { | 399 | { |
400 | Scripts.Add(localID, new Dictionary<LLUUID, IScript>()); | 400 | Scripts.Add(localID, new Dictionary<UUID, IScript>()); |
401 | } | 401 | } |
402 | 402 | ||
403 | // Delete script if it exists | 403 | // Delete script if it exists |
404 | Dictionary<LLUUID, IScript> Obj; | 404 | Dictionary<UUID, IScript> Obj; |
405 | Scripts.TryGetValue(localID, out Obj); | 405 | Scripts.TryGetValue(localID, out Obj); |
406 | if (Obj.ContainsKey(itemID) == true) | 406 | if (Obj.ContainsKey(itemID) == true) |
407 | Obj.Remove(itemID); | 407 | Obj.Remove(itemID); |
@@ -411,14 +411,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | public void RemoveScript(uint localID, LLUUID itemID) | 414 | public void RemoveScript(uint localID, UUID itemID) |
415 | { | 415 | { |
416 | // Don't have that object? | 416 | // Don't have that object? |
417 | if (Scripts.ContainsKey(localID) == false) | 417 | if (Scripts.ContainsKey(localID) == false) |
418 | return; | 418 | return; |
419 | 419 | ||
420 | // Delete script if it exists | 420 | // Delete script if it exists |
421 | Dictionary<LLUUID, IScript> Obj; | 421 | Dictionary<UUID, IScript> Obj; |
422 | Scripts.TryGetValue(localID, out Obj); | 422 | Scripts.TryGetValue(localID, out Obj); |
423 | if (Obj.ContainsKey(itemID) == true) | 423 | if (Obj.ContainsKey(itemID) == true) |
424 | Obj.Remove(itemID); | 424 | Obj.Remove(itemID); |
@@ -427,21 +427,21 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
427 | #endregion | 427 | #endregion |
428 | 428 | ||
429 | 429 | ||
430 | public void ResetScript(uint localID, LLUUID itemID) | 430 | public void ResetScript(uint localID, UUID itemID) |
431 | { | 431 | { |
432 | IScript s = GetScript(localID, itemID); | 432 | IScript s = GetScript(localID, itemID); |
433 | string script = s.Source; | 433 | string script = s.Source; |
434 | StopScript(localID, itemID); | 434 | StopScript(localID, itemID); |
435 | SceneObjectPart part = World.GetSceneObjectPart(localID); | 435 | SceneObjectPart part = World.GetSceneObjectPart(localID); |
436 | part.GetInventoryItem(itemID).PermsMask = 0; | 436 | part.GetInventoryItem(itemID).PermsMask = 0; |
437 | part.GetInventoryItem(itemID).PermsGranter = LLUUID.Zero; | 437 | part.GetInventoryItem(itemID).PermsGranter = UUID.Zero; |
438 | StartScript(localID, itemID, script, s.StartParam, false); | 438 | StartScript(localID, itemID, script, s.StartParam, false); |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
442 | #region Script serialization/deserialization | 442 | #region Script serialization/deserialization |
443 | 443 | ||
444 | public void GetSerializedScript(uint localID, LLUUID itemID) | 444 | public void GetSerializedScript(uint localID, UUID itemID) |
445 | { | 445 | { |
446 | // Serialize the script and return it | 446 | // Serialize the script and return it |
447 | // Should not be a problem | 447 | // Should not be a problem |
@@ -451,7 +451,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
451 | fs.Close(); | 451 | fs.Close(); |
452 | } | 452 | } |
453 | 453 | ||
454 | public void PutSerializedScript(uint localID, LLUUID itemID) | 454 | public void PutSerializedScript(uint localID, UUID itemID) |
455 | { | 455 | { |
456 | // Deserialize the script and inject it into an AppDomain | 456 | // Deserialize the script and inject it into an AppDomain |
457 | 457 | ||