aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-23 20:02:32 +0000
committerMelanie Thielker2008-09-23 20:02:32 +0000
commit88277366bf2cad50947c55d1bf6bf6115ec98fe5 (patch)
tree2788e3338deee3e639f76e5a3dbe349c30174645 /OpenSim
parent* OGP GET, look for Accept header application/llsd+xml with an optional ?q= (diff)
downloadopensim-SC-88277366bf2cad50947c55d1bf6bf6115ec98fe5.zip
opensim-SC-88277366bf2cad50947c55d1bf6bf6115ec98fe5.tar.gz
opensim-SC-88277366bf2cad50947c55d1bf6bf6115ec98fe5.tar.bz2
opensim-SC-88277366bf2cad50947c55d1bf6bf6115ec98fe5.tar.xz
Switches the direct event postings in the API file over to the Shared/
new style of parameter passing, using the IEventReceiver interface.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs148
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs29
4 files changed, 131 insertions, 56 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index bbf8426..ade6d04 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -44,6 +44,7 @@ using OpenSim.Region.Environment.Modules.World.Land;
44using OpenSim.Region.Environment.Scenes; 44using OpenSim.Region.Environment.Scenes;
45using OpenSim.Region.Physics.Manager; 45using OpenSim.Region.Physics.Manager;
46using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; 46using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
47using OpenSim.Region.ScriptEngine.Shared;
47 48
48using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 49using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
49using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 50using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
@@ -156,6 +157,59 @@ namespace OpenSim.Region.ScriptEngine.Common
156 return World.GetCommander(name); 157 return World.GetCommander(name);
157 } 158 }
158 159
160 private List<SceneObjectPart> GetLinkParts(int linkType)
161 {
162 List<SceneObjectPart> ret = new List<SceneObjectPart>();
163 ret.Add(m_host);
164
165 switch (linkType)
166 {
167 case BuiltIn_Commands_BaseClass.LINK_SET:
168 if (m_host.ParentGroup != null)
169 return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
170 return ret;
171
172 case BuiltIn_Commands_BaseClass.LINK_ROOT:
173 if (m_host.ParentGroup != null)
174 {
175 ret = new List<SceneObjectPart>();
176 ret.Add(m_host.ParentGroup.RootPart);
177 return ret;
178 }
179 return ret;
180
181 case BuiltIn_Commands_BaseClass.LINK_ALL_OTHERS:
182 if (m_host.ParentGroup == null)
183 return new List<SceneObjectPart>();
184 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
185 if (ret.Contains(m_host))
186 ret.Remove(m_host);
187 return ret;
188
189 case BuiltIn_Commands_BaseClass.LINK_ALL_CHILDREN:
190 if (m_host.ParentGroup == null)
191 return new List<SceneObjectPart>();
192 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
193 if (ret.Contains(m_host.ParentGroup.RootPart))
194 ret.Remove(m_host.ParentGroup.RootPart);
195 return ret;
196
197 case BuiltIn_Commands_BaseClass.LINK_THIS:
198 return ret;
199
200 default:
201 if (linkType < 0 || m_host.ParentGroup == null)
202 return new List<SceneObjectPart>();
203 SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType);
204 if (target == null)
205 return new List<SceneObjectPart>();
206 ret = new List<SceneObjectPart>();
207 ret.Add(target);
208 return ret;
209
210 }
211 }
212
159 private UUID InventorySelf() 213 private UUID InventorySelf()
160 { 214 {
161 UUID invItemID = new UUID(); 215 UUID invItemID = new UUID();
@@ -2431,20 +2485,23 @@ namespace OpenSim.Region.ScriptEngine.Common
2431 // objects rezzed with this method are die_at_edge by default. 2485 // objects rezzed with this method are die_at_edge by default.
2432 new_group.RootPart.SetDieAtEdge(true); 2486 new_group.RootPart.SetDieAtEdge(true);
2433 2487
2434 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "object_rez", EventQueueManager.llDetectNull, new Object[] { new LSL_String(new_group.RootPart.ToString()) }); 2488 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2489 "object_rez", new Object[] {
2490 new LSL_String(
2491 new_group.RootPart.UUID.ToString()) },
2492 new DetectParams[0]));
2493
2435 float groupmass = new_group.GetMass(); 2494 float groupmass = new_group.GetMass();
2436 2495
2437 //Recoil. 2496 //Recoil.
2438 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2497 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2439 found = true;
2440 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 2498 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2441 ScriptSleep((int)((groupmass * velmag) / 10)); 2499 ScriptSleep((int)((groupmass * velmag) / 10));
2442 // ScriptSleep(100); 2500 // ScriptSleep(100);
2443 break; 2501 return;
2444 } 2502 }
2445 } 2503 }
2446 if (!found) 2504 llSay(0, "Could not find object " + inventory);
2447 llSay(0, "Could not find object " + inventory);
2448 } 2505 }
2449 2506
2450 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) 2507 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
@@ -2807,8 +2864,10 @@ namespace OpenSim.Region.ScriptEngine.Common
2807 m_host.TaskInventory[invItemID].PermsGranter=UUID.Zero; 2864 m_host.TaskInventory[invItemID].PermsGranter=UUID.Zero;
2808 m_host.TaskInventory[invItemID].PermsMask=0; 2865 m_host.TaskInventory[invItemID].PermsMask=0;
2809 2866
2810 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2867 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2811 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(0)}); 2868 "run_time_permissions", new Object[] {
2869 new LSL_Integer(0) },
2870 new DetectParams[0]));
2812 2871
2813 return; 2872 return;
2814 } 2873 }
@@ -2831,8 +2890,10 @@ namespace OpenSim.Region.ScriptEngine.Common
2831 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2890 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2832 m_host.TaskInventory[invItemID].PermsMask=perm; 2891 m_host.TaskInventory[invItemID].PermsMask=perm;
2833 2892
2834 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2893 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2835 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(perm)}); 2894 "run_time_permissions", new Object[] {
2895 new LSL_Integer(perm) },
2896 new DetectParams[0]));
2836 2897
2837 return; 2898 return;
2838 } 2899 }
@@ -2849,8 +2910,10 @@ namespace OpenSim.Region.ScriptEngine.Common
2849 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2910 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2850 m_host.TaskInventory[invItemID].PermsMask=perm; 2911 m_host.TaskInventory[invItemID].PermsMask=perm;
2851 2912
2852 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2913 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2853 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(perm)}); 2914 "run_time_permissions", new Object[] {
2915 new LSL_Integer(perm) },
2916 new DetectParams[0]));
2854 2917
2855 return; 2918 return;
2856 } 2919 }
@@ -2877,8 +2940,10 @@ namespace OpenSim.Region.ScriptEngine.Common
2877 } 2940 }
2878 2941
2879 // Requested agent is not in range, refuse perms 2942 // Requested agent is not in range, refuse perms
2880 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2943 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2881 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(0)}); 2944 "run_time_permissions", new Object[] {
2945 new LSL_Integer(0) },
2946 new DetectParams[0]));
2882 } 2947 }
2883 2948
2884 void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) 2949 void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer)
@@ -2894,9 +2959,14 @@ namespace OpenSim.Region.ScriptEngine.Common
2894 client.OnScriptAnswer-=handleScriptAnswer; 2959 client.OnScriptAnswer-=handleScriptAnswer;
2895 m_waitingForScriptAnswer=false; 2960 m_waitingForScriptAnswer=false;
2896 2961
2962 if ((answer & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) == 0)
2963 llReleaseControls();
2964
2897 m_host.TaskInventory[invItemID].PermsMask=answer; 2965 m_host.TaskInventory[invItemID].PermsMask=answer;
2898 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2966 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
2899 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(answer)}); 2967 "run_time_permissions", new Object[] {
2968 new LSL_Integer(answer) },
2969 new DetectParams[0]));
2900 } 2970 }
2901 2971
2902 public LSL_String llGetPermissionsKey() 2972 public LSL_String llGetPermissionsKey()
@@ -3515,9 +3585,9 @@ namespace OpenSim.Region.ScriptEngine.Common
3515 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id) 3585 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3516 }; 3586 };
3517 3587
3518 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3588 m_ScriptEngine.PostScriptEvent(partItemID,
3519 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj 3589 new EventParams("link_message",
3520 ); 3590 resobj, new DetectParams[0]));
3521 } 3591 }
3522 } 3592 }
3523 3593
@@ -3532,16 +3602,16 @@ namespace OpenSim.Region.ScriptEngine.Common
3532 { 3602 {
3533 if (item.Type == 10) 3603 if (item.Type == 10)
3534 { 3604 {
3535 partLocalID = partInst.LocalId; 3605 // partLocalID = partInst.LocalId;
3536 partItemID = item.ItemID; 3606 partItemID = item.ItemID;
3537 Object[] resobj = new object[] 3607 Object[] resobj = new object[]
3538 { 3608 {
3539 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id) 3609 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3540 }; 3610 };
3541 3611
3542 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3612 m_ScriptEngine.PostScriptEvent(partItemID,
3543 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj 3613 new EventParams("link_message",
3544 ); 3614 resobj, new DetectParams[0]));
3545 } 3615 }
3546 } 3616 }
3547 } 3617 }
@@ -3560,16 +3630,16 @@ namespace OpenSim.Region.ScriptEngine.Common
3560 { 3630 {
3561 if (item.Type == 10) 3631 if (item.Type == 10)
3562 { 3632 {
3563 partLocalID = partInst.LocalId; 3633 // partLocalID = partInst.LocalId;
3564 partItemID = item.ItemID; 3634 partItemID = item.ItemID;
3565 Object[] resobj = new object[] 3635 Object[] resobj = new object[]
3566 { 3636 {
3567 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id) 3637 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3568 }; 3638 };
3569 3639
3570 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3640 m_ScriptEngine.PostScriptEvent(partItemID,
3571 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj 3641 new EventParams("link_message",
3572 ); 3642 resobj, new DetectParams[0]));
3573 } 3643 }
3574 } 3644 }
3575 3645
@@ -3590,16 +3660,16 @@ namespace OpenSim.Region.ScriptEngine.Common
3590 { 3660 {
3591 if (item.Type == 10) 3661 if (item.Type == 10)
3592 { 3662 {
3593 partLocalID = partInst.LocalId; 3663 // partLocalID = partInst.LocalId;
3594 partItemID = item.ItemID; 3664 partItemID = item.ItemID;
3595 Object[] resobj = new object[] 3665 Object[] resobj = new object[]
3596 { 3666 {
3597 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id) 3667 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3598 }; 3668 };
3599 3669
3600 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3670 m_ScriptEngine.PostScriptEvent(partItemID,
3601 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj 3671 new EventParams("link_message",
3602 ); 3672 resobj, new DetectParams[0]));
3603 } 3673 }
3604 } 3674 }
3605 3675
@@ -3621,9 +3691,9 @@ namespace OpenSim.Region.ScriptEngine.Common
3621 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id) 3691 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3622 }; 3692 };
3623 3693
3624 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3694 m_ScriptEngine.PostScriptEvent(partItemID,
3625 m_localID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj 3695 new EventParams("link_message",
3626 ); 3696 resobj, new DetectParams[0]));
3627 } 3697 }
3628 } 3698 }
3629 3699
@@ -3641,16 +3711,16 @@ namespace OpenSim.Region.ScriptEngine.Common
3641 { 3711 {
3642 if (item.Type == 10) 3712 if (item.Type == 10)
3643 { 3713 {
3644 partLocalID = partInst.LocalId; 3714 // partLocalID = partInst.LocalId;
3645 partItemID = item.ItemID; 3715 partItemID = item.ItemID;
3646 Object[] resObjDef = new object[] 3716 Object[] resObjDef = new object[]
3647 { 3717 {
3648 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id) 3718 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3649 }; 3719 };
3650 3720
3651 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3721 m_ScriptEngine.PostScriptEvent(partItemID,
3652 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resObjDef 3722 new EventParams("link_message",
3653 ); 3723 resObjDef, new DetectParams[0]));
3654 } 3724 }
3655 } 3725 }
3656 3726
@@ -5589,7 +5659,9 @@ namespace OpenSim.Region.ScriptEngine.Common
5589 { 5659 {
5590 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); 5660 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero);
5591 object[] resobj = new object[] { new LSL_Integer(1), new LSL_String(channelID.ToString()), new LSL_String(UUID.Zero.ToString()), new LSL_String(String.Empty), new LSL_Integer(0), new LSL_String(String.Empty) }; 5661 object[] resobj = new object[] { new LSL_Integer(1), new LSL_String(channelID.ToString()), new LSL_String(UUID.Zero.ToString()), new LSL_String(String.Empty), new LSL_Integer(0), new LSL_String(String.Empty) };
5592 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); 5662 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
5663 "remote_data", resobj,
5664 new DetectParams[0]));
5593 } 5665 }
5594 // ScriptSleep(1000); 5666 // ScriptSleep(1000);
5595 } 5667 }
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
index ac0ab7e..8538c13 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
@@ -355,10 +355,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
355 /// <param name="param">Array of parameters to match event mask</param> 355 /// <param name="param">Array of parameters to match event mask</param>
356 public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) 356 public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param)
357 { 357 {
358 List<UUID> keylist = new List<UUID>(m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID)); 358 List<UUID> keylist = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
359 359
360System.Console.WriteLine("==> got {0} keys", keylist.Count);
360 if (!keylist.Contains(itemID)) // We don't manage that script 361 if (!keylist.Contains(itemID)) // We don't manage that script
362 {
363System.Console.WriteLine("==> Script not found");
361 return false; 364 return false;
365 }
362 366
363 lock (eventQueue) 367 lock (eventQueue)
364 { 368 {
@@ -379,6 +383,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
379 383
380 // Add it to queue 384 // Add it to queue
381 eventQueue.Enqueue(QIS); 385 eventQueue.Enqueue(QIS);
386System.Console.WriteLine("==> PostedEvent");
382 } 387 }
383 return true; 388 return true;
384 } 389 }
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index 79f521d..01af0af 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -197,7 +197,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
197 197
198 public bool PostScriptEvent(UUID itemID, EventParams p) 198 public bool PostScriptEvent(UUID itemID, EventParams p)
199 { 199 {
200 return m_EventQueueManager.AddToScriptQueue(0, itemID, p.EventName, EventQueueManager.llDetectNull, p.Params); 200 uint localID = m_ScriptManager.GetLocalID(itemID);
201 return m_EventQueueManager.AddToScriptQueue(localID, itemID, p.EventName, EventQueueManager.llDetectNull, p.Params);
201 } 202 }
202 203
203 #endregion 204 #endregion
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
index 8d4dc56..ff8e16f 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
@@ -341,6 +341,16 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
341 Script.Exec.ExecuteEvent(FunctionName, args); 341 Script.Exec.ExecuteEvent(FunctionName, args);
342 } 342 }
343 343
344 public uint GetLocalID(UUID itemID)
345 {
346 foreach (KeyValuePair<uint, Dictionary<UUID, IScript> > k in Scripts)
347 {
348 if (k.Value.ContainsKey(itemID))
349 return k.Key;
350 }
351 return 0;
352 }
353
344 public int GetStateEventFlags(uint localID, UUID itemID) 354 public int GetStateEventFlags(uint localID, UUID itemID)
345 { 355 {
346 // Console.WriteLine("GetStateEventFlags for <" + localID + "," + itemID + ">"); 356 // Console.WriteLine("GetStateEventFlags for <" + localID + "," + itemID + ">");
@@ -368,22 +378,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
368 378
369 public List<UUID> GetScriptKeys(uint localID) 379 public List<UUID> GetScriptKeys(uint localID)
370 { 380 {
371 if (localID == 0) // Find it
372 {
373 List<UUID> keylist = new List<UUID>();
374
375 foreach (Dictionary<UUID, IScript> d in Scripts.Values)
376 {
377 foreach (UUID id in d.Keys)
378 {
379 if (!keylist.Contains(id))
380 keylist.Add(id);
381 }
382 }
383 }
384
385 if (Scripts.ContainsKey(localID) == false) 381 if (Scripts.ContainsKey(localID) == false)
386 return null; 382 return new List<UUID>();
387 383
388 Dictionary<UUID, IScript> Obj; 384 Dictionary<UUID, IScript> Obj;
389 Scripts.TryGetValue(localID, out Obj); 385 Scripts.TryGetValue(localID, out Obj);
@@ -395,6 +391,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
395 { 391 {
396 lock (scriptLock) 392 lock (scriptLock)
397 { 393 {
394 IScript Script = null;
395
398 if (Scripts.ContainsKey(localID) == false) 396 if (Scripts.ContainsKey(localID) == false)
399 return null; 397 return null;
400 398
@@ -404,7 +402,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
404 return null; 402 return null;
405 403
406 // Get script 404 // Get script
407 IScript Script;
408 Obj.TryGetValue(itemID, out Script); 405 Obj.TryGetValue(itemID, out Script);
409 return Script; 406 return Script;
410 } 407 }