aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs554
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs36
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs261
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs3
7 files changed, 484 insertions, 379 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d235bac..ec771e3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; //for [DebuggerNonUserCode]
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
32using System.Text; 33using System.Text;
33using System.Threading; 34using System.Threading;
@@ -151,6 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
151 get { return m_ScriptEngine.World; } 152 get { return m_ScriptEngine.World; }
152 } 153 }
153 154
155 [DebuggerNonUserCode]
154 public void state(string newState) 156 public void state(string newState)
155 { 157 {
156 m_ScriptEngine.SetState(m_itemID, newState); 158 m_ScriptEngine.SetState(m_itemID, newState);
@@ -160,6 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
160 /// Reset the named script. The script must be present 162 /// Reset the named script. The script must be present
161 /// in the same prim. 163 /// in the same prim.
162 /// </summary> 164 /// </summary>
165 [DebuggerNonUserCode]
163 public void llResetScript() 166 public void llResetScript()
164 { 167 {
165 m_host.AddScriptLPS(1); 168 m_host.AddScriptLPS(1);
@@ -272,40 +275,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
272 protected UUID InventorySelf() 275 protected UUID InventorySelf()
273 { 276 {
274 UUID invItemID = new UUID(); 277 UUID invItemID = new UUID();
275 278 bool unlock = false;
276 lock (m_host.TaskInventory) 279 if (!m_host.TaskInventory.IsReadLockedByMe())
280 {
281 m_host.TaskInventory.LockItemsForRead(true);
282 unlock = true;
283 }
284 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
277 { 285 {
278 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 286 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
279 { 287 {
280 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) 288 invItemID = inv.Key;
281 { 289 break;
282 invItemID = inv.Key;
283 break;
284 }
285 } 290 }
286 } 291 }
287 292 if (unlock)
293 {
294 m_host.TaskInventory.LockItemsForRead(false);
295 }
288 return invItemID; 296 return invItemID;
289 } 297 }
290 298
291 protected UUID InventoryKey(string name, int type) 299 protected UUID InventoryKey(string name, int type)
292 { 300 {
293 m_host.AddScriptLPS(1); 301 m_host.AddScriptLPS(1);
294 302 m_host.TaskInventory.LockItemsForRead(true);
295 lock (m_host.TaskInventory) 303
304 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
296 { 305 {
297 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 306 if (inv.Value.Name == name)
298 { 307 {
299 if (inv.Value.Name == name) 308 m_host.TaskInventory.LockItemsForRead(false);
309
310 if (inv.Value.Type != type)
300 { 311 {
301 if (inv.Value.Type != type) 312 return UUID.Zero;
302 return UUID.Zero;
303
304 return inv.Value.AssetID;
305 } 313 }
314
315 return inv.Value.AssetID;
306 } 316 }
307 } 317 }
308 318
319 m_host.TaskInventory.LockItemsForRead(false);
309 return UUID.Zero; 320 return UUID.Zero;
310 } 321 }
311 322
@@ -313,17 +324,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
313 { 324 {
314 m_host.AddScriptLPS(1); 325 m_host.AddScriptLPS(1);
315 326
316 lock (m_host.TaskInventory) 327
328 m_host.TaskInventory.LockItemsForRead(true);
329
330 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
317 { 331 {
318 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 332 if (inv.Value.Name == name)
319 { 333 {
320 if (inv.Value.Name == name) 334 m_host.TaskInventory.LockItemsForRead(false);
321 { 335 return inv.Value.AssetID;
322 return inv.Value.AssetID;
323 }
324 } 336 }
325 } 337 }
326 338
339 m_host.TaskInventory.LockItemsForRead(false);
340
341
327 return UUID.Zero; 342 return UUID.Zero;
328 } 343 }
329 344
@@ -2555,12 +2570,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2555 2570
2556 m_host.AddScriptLPS(1); 2571 m_host.AddScriptLPS(1);
2557 2572
2573 m_host.TaskInventory.LockItemsForRead(true);
2558 TaskInventoryItem item = m_host.TaskInventory[invItemID]; 2574 TaskInventoryItem item = m_host.TaskInventory[invItemID];
2559 2575 m_host.TaskInventory.LockItemsForRead(false);
2560 lock (m_host.TaskInventory)
2561 {
2562 item = m_host.TaskInventory[invItemID];
2563 }
2564 2576
2565 if (item.PermsGranter == UUID.Zero) 2577 if (item.PermsGranter == UUID.Zero)
2566 return 0; 2578 return 0;
@@ -2635,6 +2647,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2635 if (dist > m_ScriptDistanceFactor * 10.0f) 2647 if (dist > m_ScriptDistanceFactor * 10.0f)
2636 return; 2648 return;
2637 2649
2650 //Clone is thread-safe
2638 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 2651 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
2639 2652
2640 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) 2653 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
@@ -2720,11 +2733,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2720 // Orient the object to the angle calculated 2733 // Orient the object to the angle calculated
2721 llSetRot(rot); 2734 llSetRot(rot);
2722 } 2735 }
2736
2737 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
2738 {
2739 m_host.AddScriptLPS(1);
2740// NotImplemented("llRotLookAt");
2741 m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping);
2742
2743 }
2744
2723 2745
2724 public void llStopLookAt() 2746 public void llStopLookAt()
2725 { 2747 {
2726 m_host.AddScriptLPS(1); 2748 m_host.AddScriptLPS(1);
2727 NotImplemented("llStopLookAt"); 2749// NotImplemented("llStopLookAt");
2750 m_host.StopLookAt();
2728 } 2751 }
2729 2752
2730 public void llSetTimerEvent(double sec) 2753 public void llSetTimerEvent(double sec)
@@ -2758,13 +2781,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2758 { 2781 {
2759 TaskInventoryItem item; 2782 TaskInventoryItem item;
2760 2783
2761 lock (m_host.TaskInventory) 2784 m_host.TaskInventory.LockItemsForRead(true);
2785 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2762 { 2786 {
2763 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2787 m_host.TaskInventory.LockItemsForRead(false);
2764 return; 2788 return;
2765 else 2789 }
2766 item = m_host.TaskInventory[InventorySelf()]; 2790 else
2791 {
2792 item = m_host.TaskInventory[InventorySelf()];
2767 } 2793 }
2794 m_host.TaskInventory.LockItemsForRead(false);
2768 2795
2769 if (item.PermsGranter != UUID.Zero) 2796 if (item.PermsGranter != UUID.Zero)
2770 { 2797 {
@@ -2786,13 +2813,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2786 { 2813 {
2787 TaskInventoryItem item; 2814 TaskInventoryItem item;
2788 2815
2816 m_host.TaskInventory.LockItemsForRead(true);
2789 lock (m_host.TaskInventory) 2817 lock (m_host.TaskInventory)
2790 { 2818 {
2819
2791 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2820 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2821 {
2822 m_host.TaskInventory.LockItemsForRead(false);
2792 return; 2823 return;
2824 }
2793 else 2825 else
2826 {
2794 item = m_host.TaskInventory[InventorySelf()]; 2827 item = m_host.TaskInventory[InventorySelf()];
2828 }
2795 } 2829 }
2830 m_host.TaskInventory.LockItemsForRead(false);
2796 2831
2797 m_host.AddScriptLPS(1); 2832 m_host.AddScriptLPS(1);
2798 2833
@@ -2829,13 +2864,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2829 2864
2830 TaskInventoryItem item; 2865 TaskInventoryItem item;
2831 2866
2832 lock (m_host.TaskInventory) 2867 m_host.TaskInventory.LockItemsForRead(true);
2868
2869 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2833 { 2870 {
2834 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2871 m_host.TaskInventory.LockItemsForRead(false);
2835 return; 2872 return;
2836 else
2837 item = m_host.TaskInventory[InventorySelf()];
2838 } 2873 }
2874 else
2875 {
2876 item = m_host.TaskInventory[InventorySelf()];
2877 }
2878
2879 m_host.TaskInventory.LockItemsForRead(false);
2839 2880
2840 if (item.PermsGranter != m_host.OwnerID) 2881 if (item.PermsGranter != m_host.OwnerID)
2841 return; 2882 return;
@@ -2861,13 +2902,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2861 2902
2862 TaskInventoryItem item; 2903 TaskInventoryItem item;
2863 2904
2864 lock (m_host.TaskInventory) 2905 m_host.TaskInventory.LockItemsForRead(true);
2906
2907 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2865 { 2908 {
2866 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2909 m_host.TaskInventory.LockItemsForRead(false);
2867 return; 2910 return;
2868 else
2869 item = m_host.TaskInventory[InventorySelf()];
2870 } 2911 }
2912 else
2913 {
2914 item = m_host.TaskInventory[InventorySelf()];
2915 }
2916 m_host.TaskInventory.LockItemsForRead(false);
2917
2871 2918
2872 if (item.PermsGranter != m_host.OwnerID) 2919 if (item.PermsGranter != m_host.OwnerID)
2873 return; 2920 return;
@@ -3068,12 +3115,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3068 m_host.AddScriptLPS(1); 3115 m_host.AddScriptLPS(1);
3069 } 3116 }
3070 3117
3071 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
3072 {
3073 m_host.AddScriptLPS(1);
3074 NotImplemented("llRotLookAt");
3075 }
3076
3077 public LSL_Integer llStringLength(string str) 3118 public LSL_Integer llStringLength(string str)
3078 { 3119 {
3079 m_host.AddScriptLPS(1); 3120 m_host.AddScriptLPS(1);
@@ -3097,14 +3138,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3097 3138
3098 TaskInventoryItem item; 3139 TaskInventoryItem item;
3099 3140
3100 lock (m_host.TaskInventory) 3141 m_host.TaskInventory.LockItemsForRead(true);
3142 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
3101 { 3143 {
3102 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 3144 m_host.TaskInventory.LockItemsForRead(false);
3103 return; 3145 return;
3104 else
3105 item = m_host.TaskInventory[InventorySelf()];
3106 } 3146 }
3107 3147 else
3148 {
3149 item = m_host.TaskInventory[InventorySelf()];
3150 }
3151 m_host.TaskInventory.LockItemsForRead(false);
3108 if (item.PermsGranter == UUID.Zero) 3152 if (item.PermsGranter == UUID.Zero)
3109 return; 3153 return;
3110 3154
@@ -3134,13 +3178,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3134 3178
3135 TaskInventoryItem item; 3179 TaskInventoryItem item;
3136 3180
3137 lock (m_host.TaskInventory) 3181 m_host.TaskInventory.LockItemsForRead(true);
3182 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
3138 { 3183 {
3139 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 3184 m_host.TaskInventory.LockItemsForRead(false);
3140 return; 3185 return;
3141 else 3186 }
3142 item = m_host.TaskInventory[InventorySelf()]; 3187 else
3188 {
3189 item = m_host.TaskInventory[InventorySelf()];
3143 } 3190 }
3191 m_host.TaskInventory.LockItemsForRead(false);
3192
3144 3193
3145 if (item.PermsGranter == UUID.Zero) 3194 if (item.PermsGranter == UUID.Zero)
3146 return; 3195 return;
@@ -3213,10 +3262,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3213 3262
3214 TaskInventoryItem item; 3263 TaskInventoryItem item;
3215 3264
3216 lock (m_host.TaskInventory) 3265
3266 m_host.TaskInventory.LockItemsForRead(true);
3267 if (!m_host.TaskInventory.ContainsKey(invItemID))
3268 {
3269 m_host.TaskInventory.LockItemsForRead(false);
3270 return;
3271 }
3272 else
3217 { 3273 {
3218 item = m_host.TaskInventory[invItemID]; 3274 item = m_host.TaskInventory[invItemID];
3219 } 3275 }
3276 m_host.TaskInventory.LockItemsForRead(false);
3220 3277
3221 if (agentID == UUID.Zero || perm == 0) // Releasing permissions 3278 if (agentID == UUID.Zero || perm == 0) // Releasing permissions
3222 { 3279 {
@@ -3248,11 +3305,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3248 3305
3249 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 3306 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
3250 { 3307 {
3251 lock (m_host.TaskInventory) 3308 m_host.TaskInventory.LockItemsForWrite(true);
3252 { 3309 m_host.TaskInventory[invItemID].PermsGranter = agentID;
3253 m_host.TaskInventory[invItemID].PermsGranter = agentID; 3310 m_host.TaskInventory[invItemID].PermsMask = perm;
3254 m_host.TaskInventory[invItemID].PermsMask = perm; 3311 m_host.TaskInventory.LockItemsForWrite(false);
3255 }
3256 3312
3257 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 3313 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
3258 "run_time_permissions", new Object[] { 3314 "run_time_permissions", new Object[] {
@@ -3272,11 +3328,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3272 3328
3273 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 3329 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
3274 { 3330 {
3275 lock (m_host.TaskInventory) 3331 m_host.TaskInventory.LockItemsForWrite(true);
3276 { 3332 m_host.TaskInventory[invItemID].PermsGranter = agentID;
3277 m_host.TaskInventory[invItemID].PermsGranter = agentID; 3333 m_host.TaskInventory[invItemID].PermsMask = perm;
3278 m_host.TaskInventory[invItemID].PermsMask = perm; 3334 m_host.TaskInventory.LockItemsForWrite(false);
3279 }
3280 3335
3281 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 3336 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
3282 "run_time_permissions", new Object[] { 3337 "run_time_permissions", new Object[] {
@@ -3297,11 +3352,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3297 3352
3298 if (!m_waitingForScriptAnswer) 3353 if (!m_waitingForScriptAnswer)
3299 { 3354 {
3300 lock (m_host.TaskInventory) 3355 m_host.TaskInventory.LockItemsForWrite(true);
3301 { 3356 m_host.TaskInventory[invItemID].PermsGranter = agentID;
3302 m_host.TaskInventory[invItemID].PermsGranter = agentID; 3357 m_host.TaskInventory[invItemID].PermsMask = 0;
3303 m_host.TaskInventory[invItemID].PermsMask = 0; 3358 m_host.TaskInventory.LockItemsForWrite(false);
3304 }
3305 3359
3306 presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; 3360 presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
3307 m_waitingForScriptAnswer=true; 3361 m_waitingForScriptAnswer=true;
@@ -3336,10 +3390,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3336 if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) 3390 if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
3337 llReleaseControls(); 3391 llReleaseControls();
3338 3392
3339 lock (m_host.TaskInventory) 3393
3340 { 3394 m_host.TaskInventory.LockItemsForWrite(true);
3341 m_host.TaskInventory[invItemID].PermsMask = answer; 3395 m_host.TaskInventory[invItemID].PermsMask = answer;
3342 } 3396 m_host.TaskInventory.LockItemsForWrite(false);
3397
3343 3398
3344 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 3399 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
3345 "run_time_permissions", new Object[] { 3400 "run_time_permissions", new Object[] {
@@ -3351,16 +3406,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3351 { 3406 {
3352 m_host.AddScriptLPS(1); 3407 m_host.AddScriptLPS(1);
3353 3408
3354 lock (m_host.TaskInventory) 3409 m_host.TaskInventory.LockItemsForRead(true);
3410
3411 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3355 { 3412 {
3356 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 3413 if (item.Type == 10 && item.ItemID == m_itemID)
3357 { 3414 {
3358 if (item.Type == 10 && item.ItemID == m_itemID) 3415 m_host.TaskInventory.LockItemsForRead(false);
3359 { 3416 return item.PermsGranter.ToString();
3360 return item.PermsGranter.ToString();
3361 }
3362 } 3417 }
3363 } 3418 }
3419 m_host.TaskInventory.LockItemsForRead(false);
3364 3420
3365 return UUID.Zero.ToString(); 3421 return UUID.Zero.ToString();
3366 } 3422 }
@@ -3369,19 +3425,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3369 { 3425 {
3370 m_host.AddScriptLPS(1); 3426 m_host.AddScriptLPS(1);
3371 3427
3372 lock (m_host.TaskInventory) 3428 m_host.TaskInventory.LockItemsForRead(true);
3429
3430 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3373 { 3431 {
3374 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 3432 if (item.Type == 10 && item.ItemID == m_itemID)
3375 { 3433 {
3376 if (item.Type == 10 && item.ItemID == m_itemID) 3434 int perms = item.PermsMask;
3377 { 3435 if (m_automaticLinkPermission)
3378 int perms = item.PermsMask; 3436 perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
3379 if (m_automaticLinkPermission) 3437 m_host.TaskInventory.LockItemsForRead(false);
3380 perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 3438 return perms;
3381 return perms;
3382 }
3383 } 3439 }
3384 } 3440 }
3441 m_host.TaskInventory.LockItemsForRead(false);
3385 3442
3386 return 0; 3443 return 0;
3387 } 3444 }
@@ -3414,11 +3471,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3414 UUID invItemID = InventorySelf(); 3471 UUID invItemID = InventorySelf();
3415 3472
3416 TaskInventoryItem item; 3473 TaskInventoryItem item;
3417 lock (m_host.TaskInventory) 3474 m_host.TaskInventory.LockItemsForRead(true);
3418 { 3475 item = m_host.TaskInventory[invItemID];
3419 item = m_host.TaskInventory[invItemID]; 3476 m_host.TaskInventory.LockItemsForRead(false);
3420 } 3477
3421
3422 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3478 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3423 && !m_automaticLinkPermission) 3479 && !m_automaticLinkPermission)
3424 { 3480 {
@@ -3471,16 +3527,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3471 m_host.AddScriptLPS(1); 3527 m_host.AddScriptLPS(1);
3472 UUID invItemID = InventorySelf(); 3528 UUID invItemID = InventorySelf();
3473 3529
3474 lock (m_host.TaskInventory) 3530 m_host.TaskInventory.LockItemsForRead(true);
3475 {
3476 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3531 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3477 && !m_automaticLinkPermission) 3532 && !m_automaticLinkPermission)
3478 { 3533 {
3479 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3534 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
3535 m_host.TaskInventory.LockItemsForRead(false);
3480 return; 3536 return;
3481 } 3537 }
3482 } 3538 m_host.TaskInventory.LockItemsForRead(false);
3483 3539
3484 if (linknum < ScriptBaseClass.LINK_THIS) 3540 if (linknum < ScriptBaseClass.LINK_THIS)
3485 return; 3541 return;
3486 3542
@@ -3649,17 +3705,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3649 m_host.AddScriptLPS(1); 3705 m_host.AddScriptLPS(1);
3650 int count = 0; 3706 int count = 0;
3651 3707
3652 lock (m_host.TaskInventory) 3708 m_host.TaskInventory.LockItemsForRead(true);
3709 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
3653 { 3710 {
3654 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3711 if (inv.Value.Type == type || type == -1)
3655 { 3712 {
3656 if (inv.Value.Type == type || type == -1) 3713 count = count + 1;
3657 {
3658 count = count + 1;
3659 }
3660 } 3714 }
3661 } 3715 }
3662 3716
3717 m_host.TaskInventory.LockItemsForRead(false);
3663 return count; 3718 return count;
3664 } 3719 }
3665 3720
@@ -3668,16 +3723,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3668 m_host.AddScriptLPS(1); 3723 m_host.AddScriptLPS(1);
3669 ArrayList keys = new ArrayList(); 3724 ArrayList keys = new ArrayList();
3670 3725
3671 lock (m_host.TaskInventory) 3726 m_host.TaskInventory.LockItemsForRead(true);
3727 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
3672 { 3728 {
3673 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3729 if (inv.Value.Type == type || type == -1)
3674 { 3730 {
3675 if (inv.Value.Type == type || type == -1) 3731 keys.Add(inv.Value.Name);
3676 {
3677 keys.Add(inv.Value.Name);
3678 }
3679 } 3732 }
3680 } 3733 }
3734 m_host.TaskInventory.LockItemsForRead(false);
3681 3735
3682 if (keys.Count == 0) 3736 if (keys.Count == 0)
3683 { 3737 {
@@ -3714,20 +3768,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3714 } 3768 }
3715 3769
3716 // move the first object found with this inventory name 3770 // move the first object found with this inventory name
3717 lock (m_host.TaskInventory) 3771 m_host.TaskInventory.LockItemsForRead(true);
3772 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
3718 { 3773 {
3719 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3774 if (inv.Value.Name == inventory)
3720 { 3775 {
3721 if (inv.Value.Name == inventory) 3776 found = true;
3722 { 3777 objId = inv.Key;
3723 found = true; 3778 assetType = inv.Value.Type;
3724 objId = inv.Key; 3779 objName = inv.Value.Name;
3725 assetType = inv.Value.Type; 3780 break;
3726 objName = inv.Value.Name;
3727 break;
3728 }
3729 } 3781 }
3730 } 3782 }
3783 m_host.TaskInventory.LockItemsForRead(false);
3731 3784
3732 if (!found) 3785 if (!found)
3733 { 3786 {
@@ -3772,24 +3825,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3772 ScriptSleep(3000); 3825 ScriptSleep(3000);
3773 } 3826 }
3774 3827
3828 [DebuggerNonUserCode]
3775 public void llRemoveInventory(string name) 3829 public void llRemoveInventory(string name)
3776 { 3830 {
3777 m_host.AddScriptLPS(1); 3831 m_host.AddScriptLPS(1);
3778 3832
3779 lock (m_host.TaskInventory) 3833 m_host.TaskInventory.LockItemsForRead(true);
3834 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3780 { 3835 {
3781 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 3836 if (item.Name == name)
3782 { 3837 {
3783 if (item.Name == name) 3838 if (item.ItemID == m_itemID)
3784 { 3839 throw new ScriptDeleteException();
3785 if (item.ItemID == m_itemID) 3840 else
3786 throw new ScriptDeleteException(); 3841 m_host.Inventory.RemoveInventoryItem(item.ItemID);
3787 else 3842
3788 m_host.Inventory.RemoveInventoryItem(item.ItemID); 3843 m_host.TaskInventory.LockItemsForRead(false);
3789 return; 3844 return;
3790 }
3791 } 3845 }
3792 } 3846 }
3847 m_host.TaskInventory.LockItemsForRead(false);
3793 } 3848 }
3794 3849
3795 public void llSetText(string text, LSL_Vector color, double alpha) 3850 public void llSetText(string text, LSL_Vector color, double alpha)
@@ -3878,6 +3933,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3878 { 3933 {
3879 m_host.AddScriptLPS(1); 3934 m_host.AddScriptLPS(1);
3880 3935
3936 //Clone is thread safe
3881 TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 3937 TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
3882 3938
3883 foreach (TaskInventoryItem item in itemDictionary.Values) 3939 foreach (TaskInventoryItem item in itemDictionary.Values)
@@ -3968,17 +4024,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3968 UUID soundId = UUID.Zero; 4024 UUID soundId = UUID.Zero;
3969 if (!UUID.TryParse(impact_sound, out soundId)) 4025 if (!UUID.TryParse(impact_sound, out soundId))
3970 { 4026 {
3971 lock (m_host.TaskInventory) 4027 m_host.TaskInventory.LockItemsForRead(true);
4028 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3972 { 4029 {
3973 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 4030 if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
3974 { 4031 {
3975 if (item.Type == (int)AssetType.Sound && item.Name == impact_sound) 4032 soundId = item.AssetID;
3976 { 4033 break;
3977 soundId = item.AssetID;
3978 break;
3979 }
3980 } 4034 }
3981 } 4035 }
4036 m_host.TaskInventory.LockItemsForRead(false);
3982 } 4037 }
3983 m_host.CollisionSound = soundId; 4038 m_host.CollisionSound = soundId;
3984 m_host.CollisionSoundVolume = (float)impact_volume; 4039 m_host.CollisionSoundVolume = (float)impact_volume;
@@ -4024,6 +4079,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4024 UUID partItemID; 4079 UUID partItemID;
4025 foreach (SceneObjectPart part in parts) 4080 foreach (SceneObjectPart part in parts)
4026 { 4081 {
4082 //Clone is thread safe
4027 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); 4083 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
4028 4084
4029 foreach (TaskInventoryItem item in itemsDictionary.Values) 4085 foreach (TaskInventoryItem item in itemsDictionary.Values)
@@ -4231,17 +4287,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4231 4287
4232 m_host.AddScriptLPS(1); 4288 m_host.AddScriptLPS(1);
4233 4289
4234 lock (m_host.TaskInventory) 4290 m_host.TaskInventory.LockItemsForRead(true);
4291 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
4235 { 4292 {
4236 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 4293 if (item.Type == 10 && item.ItemID == m_itemID)
4237 { 4294 {
4238 if (item.Type == 10 && item.ItemID == m_itemID) 4295 result = item.Name!=null?item.Name:String.Empty;
4239 { 4296 break;
4240 result = item.Name!=null?item.Name:String.Empty;
4241 break;
4242 }
4243 } 4297 }
4244 } 4298 }
4299 m_host.TaskInventory.LockItemsForRead(false);
4245 4300
4246 return result; 4301 return result;
4247 } 4302 }
@@ -4499,23 +4554,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4499 { 4554 {
4500 m_host.AddScriptLPS(1); 4555 m_host.AddScriptLPS(1);
4501 4556
4502 lock (m_host.TaskInventory) 4557 m_host.TaskInventory.LockItemsForRead(true);
4558 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
4503 { 4559 {
4504 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 4560 if (inv.Value.Name == name)
4505 { 4561 {
4506 if (inv.Value.Name == name) 4562 if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
4507 { 4563 {
4508 if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) 4564 m_host.TaskInventory.LockItemsForRead(false);
4509 { 4565 return inv.Value.AssetID.ToString();
4510 return inv.Value.AssetID.ToString(); 4566 }
4511 } 4567 else
4512 else 4568 {
4513 { 4569 m_host.TaskInventory.LockItemsForRead(false);
4514 return UUID.Zero.ToString(); 4570 return UUID.Zero.ToString();
4515 }
4516 } 4571 }
4517 } 4572 }
4518 } 4573 }
4574 m_host.TaskInventory.LockItemsForRead(false);
4519 4575
4520 return UUID.Zero.ToString(); 4576 return UUID.Zero.ToString();
4521 } 4577 }
@@ -6011,14 +6067,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6011 6067
6012 protected UUID GetTaskInventoryItem(string name) 6068 protected UUID GetTaskInventoryItem(string name)
6013 { 6069 {
6014 lock (m_host.TaskInventory) 6070 m_host.TaskInventory.LockItemsForRead(true);
6071 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
6015 { 6072 {
6016 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 6073 if (inv.Value.Name == name)
6017 { 6074 {
6018 if (inv.Value.Name == name) 6075 m_host.TaskInventory.LockItemsForRead(false);
6019 return inv.Key; 6076 return inv.Key;
6020 } 6077 }
6021 } 6078 }
6079 m_host.TaskInventory.LockItemsForRead(false);
6022 6080
6023 return UUID.Zero; 6081 return UUID.Zero;
6024 } 6082 }
@@ -6329,22 +6387,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6329 } 6387 }
6330 6388
6331 // copy the first script found with this inventory name 6389 // copy the first script found with this inventory name
6332 lock (m_host.TaskInventory) 6390 m_host.TaskInventory.LockItemsForRead(true);
6391 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
6333 { 6392 {
6334 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 6393 if (inv.Value.Name == name)
6335 { 6394 {
6336 if (inv.Value.Name == name) 6395 // make sure the object is a script
6396 if (10 == inv.Value.Type)
6337 { 6397 {
6338 // make sure the object is a script 6398 found = true;
6339 if (10 == inv.Value.Type) 6399 srcId = inv.Key;
6340 { 6400 break;
6341 found = true;
6342 srcId = inv.Key;
6343 break;
6344 }
6345 } 6401 }
6346 } 6402 }
6347 } 6403 }
6404 m_host.TaskInventory.LockItemsForRead(false);
6348 6405
6349 if (!found) 6406 if (!found)
6350 { 6407 {
@@ -8147,28 +8204,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8147 { 8204 {
8148 m_host.AddScriptLPS(1); 8205 m_host.AddScriptLPS(1);
8149 8206
8150 lock (m_host.TaskInventory) 8207 m_host.TaskInventory.LockItemsForRead(true);
8208 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8151 { 8209 {
8152 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 8210 if (inv.Value.Name == item)
8153 { 8211 {
8154 if (inv.Value.Name == item) 8212 m_host.TaskInventory.LockItemsForRead(false);
8213 switch (mask)
8155 { 8214 {
8156 switch (mask) 8215 case 0:
8157 { 8216 return (int)inv.Value.BasePermissions;
8158 case 0: 8217 case 1:
8159 return (int)inv.Value.BasePermissions; 8218 return (int)inv.Value.CurrentPermissions;
8160 case 1: 8219 case 2:
8161 return (int)inv.Value.CurrentPermissions; 8220 return (int)inv.Value.GroupPermissions;
8162 case 2: 8221 case 3:
8163 return (int)inv.Value.GroupPermissions; 8222 return (int)inv.Value.EveryonePermissions;
8164 case 3: 8223 case 4:
8165 return (int)inv.Value.EveryonePermissions; 8224 return (int)inv.Value.NextPermissions;
8166 case 4:
8167 return (int)inv.Value.NextPermissions;
8168 }
8169 } 8225 }
8170 } 8226 }
8171 } 8227 }
8228 m_host.TaskInventory.LockItemsForRead(false);
8172 8229
8173 return -1; 8230 return -1;
8174 } 8231 }
@@ -8183,16 +8240,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8183 { 8240 {
8184 m_host.AddScriptLPS(1); 8241 m_host.AddScriptLPS(1);
8185 8242
8186 lock (m_host.TaskInventory) 8243 m_host.TaskInventory.LockItemsForRead(true);
8244 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8187 { 8245 {
8188 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 8246 if (inv.Value.Name == item)
8189 { 8247 {
8190 if (inv.Value.Name == item) 8248 m_host.TaskInventory.LockItemsForRead(false);
8191 { 8249 return inv.Value.CreatorID.ToString();
8192 return inv.Value.CreatorID.ToString();
8193 }
8194 } 8250 }
8195 } 8251 }
8252 m_host.TaskInventory.LockItemsForRead(false);
8196 8253
8197 llSay(0, "No item name '" + item + "'"); 8254 llSay(0, "No item name '" + item + "'");
8198 8255
@@ -8716,16 +8773,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8716 { 8773 {
8717 m_host.AddScriptLPS(1); 8774 m_host.AddScriptLPS(1);
8718 8775
8719 lock (m_host.TaskInventory) 8776 m_host.TaskInventory.LockItemsForRead(true);
8777 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8720 { 8778 {
8721 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 8779 if (inv.Value.Name == name)
8722 { 8780 {
8723 if (inv.Value.Name == name) 8781 m_host.TaskInventory.LockItemsForRead(false);
8724 { 8782 return inv.Value.Type;
8725 return inv.Value.Type;
8726 }
8727 } 8783 }
8728 } 8784 }
8785 m_host.TaskInventory.LockItemsForRead(false);
8729 8786
8730 return -1; 8787 return -1;
8731 } 8788 }
@@ -8756,17 +8813,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8756 if (invItemID == UUID.Zero) 8813 if (invItemID == UUID.Zero)
8757 return new LSL_Vector(); 8814 return new LSL_Vector();
8758 8815
8759 lock (m_host.TaskInventory) 8816 m_host.TaskInventory.LockItemsForRead(true);
8817 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
8760 { 8818 {
8761 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) 8819 m_host.TaskInventory.LockItemsForRead(false);
8762 return new LSL_Vector(); 8820 return new LSL_Vector();
8821 }
8763 8822
8764 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 8823 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
8765 { 8824 {
8766 ShoutError("No permissions to track the camera"); 8825 ShoutError("No permissions to track the camera");
8767 return new LSL_Vector(); 8826 m_host.TaskInventory.LockItemsForRead(false);
8768 } 8827 return new LSL_Vector();
8769 } 8828 }
8829 m_host.TaskInventory.LockItemsForRead(false);
8770 8830
8771 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 8831 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
8772 if (presence != null) 8832 if (presence != null)
@@ -8784,17 +8844,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8784 if (invItemID == UUID.Zero) 8844 if (invItemID == UUID.Zero)
8785 return new LSL_Rotation(); 8845 return new LSL_Rotation();
8786 8846
8787 lock (m_host.TaskInventory) 8847 m_host.TaskInventory.LockItemsForRead(true);
8848 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
8788 { 8849 {
8789 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) 8850 m_host.TaskInventory.LockItemsForRead(false);
8790 return new LSL_Rotation(); 8851 return new LSL_Rotation();
8791
8792 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
8793 {
8794 ShoutError("No permissions to track the camera");
8795 return new LSL_Rotation();
8796 }
8797 } 8852 }
8853 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
8854 {
8855 ShoutError("No permissions to track the camera");
8856 m_host.TaskInventory.LockItemsForRead(false);
8857 return new LSL_Rotation();
8858 }
8859 m_host.TaskInventory.LockItemsForRead(false);
8798 8860
8799 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 8861 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
8800 if (presence != null) 8862 if (presence != null)
@@ -8944,14 +9006,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8944 if (objectID == UUID.Zero) return; 9006 if (objectID == UUID.Zero) return;
8945 9007
8946 UUID agentID; 9008 UUID agentID;
8947 lock (m_host.TaskInventory) 9009 m_host.TaskInventory.LockItemsForRead(true);
8948 { 9010 // we need the permission first, to know which avatar we want to set the camera for
8949 // we need the permission first, to know which avatar we want to set the camera for 9011 agentID = m_host.TaskInventory[invItemID].PermsGranter;
8950 agentID = m_host.TaskInventory[invItemID].PermsGranter;
8951 9012
8952 if (agentID == UUID.Zero) return; 9013 if (agentID == UUID.Zero)
8953 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; 9014 {
9015 m_host.TaskInventory.LockItemsForRead(false);
9016 return;
8954 } 9017 }
9018 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
9019 {
9020 m_host.TaskInventory.LockItemsForRead(false);
9021 return;
9022 }
9023 m_host.TaskInventory.LockItemsForRead(false);
8955 9024
8956 ScenePresence presence = World.GetScenePresence(agentID); 9025 ScenePresence presence = World.GetScenePresence(agentID);
8957 9026
@@ -9001,12 +9070,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9001 9070
9002 // we need the permission first, to know which avatar we want to clear the camera for 9071 // we need the permission first, to know which avatar we want to clear the camera for
9003 UUID agentID; 9072 UUID agentID;
9004 lock (m_host.TaskInventory) 9073 m_host.TaskInventory.LockItemsForRead(true);
9074 agentID = m_host.TaskInventory[invItemID].PermsGranter;
9075 if (agentID == UUID.Zero)
9076 {
9077 m_host.TaskInventory.LockItemsForRead(false);
9078 return;
9079 }
9080 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
9005 { 9081 {
9006 agentID = m_host.TaskInventory[invItemID].PermsGranter; 9082 m_host.TaskInventory.LockItemsForRead(false);
9007 if (agentID == UUID.Zero) return; 9083 return;
9008 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
9009 } 9084 }
9085 m_host.TaskInventory.LockItemsForRead(false);
9010 9086
9011 ScenePresence presence = World.GetScenePresence(agentID); 9087 ScenePresence presence = World.GetScenePresence(agentID);
9012 9088
@@ -9463,15 +9539,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9463 9539
9464 internal UUID ScriptByName(string name) 9540 internal UUID ScriptByName(string name)
9465 { 9541 {
9466 lock (m_host.TaskInventory) 9542 m_host.TaskInventory.LockItemsForRead(true);
9543
9544 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
9467 { 9545 {
9468 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 9546 if (item.Type == 10 && item.Name == name)
9469 { 9547 {
9470 if (item.Type == 10 && item.Name == name) 9548 m_host.TaskInventory.LockItemsForRead(false);
9471 return item.ItemID; 9549 return item.ItemID;
9472 } 9550 }
9473 } 9551 }
9474 9552
9553 m_host.TaskInventory.LockItemsForRead(false);
9554
9475 return UUID.Zero; 9555 return UUID.Zero;
9476 } 9556 }
9477 9557
@@ -9512,6 +9592,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9512 { 9592 {
9513 m_host.AddScriptLPS(1); 9593 m_host.AddScriptLPS(1);
9514 9594
9595 //Clone is thread safe
9515 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 9596 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
9516 9597
9517 UUID assetID = UUID.Zero; 9598 UUID assetID = UUID.Zero;
@@ -9574,6 +9655,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9574 { 9655 {
9575 m_host.AddScriptLPS(1); 9656 m_host.AddScriptLPS(1);
9576 9657
9658 //Clone is thread safe
9577 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 9659 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
9578 9660
9579 UUID assetID = UUID.Zero; 9661 UUID assetID = UUID.Zero;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 5501679..7f739b1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -728,18 +728,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
728 if (target != null) 728 if (target != null)
729 { 729 {
730 UUID animID=UUID.Zero; 730 UUID animID=UUID.Zero;
731 lock (m_host.TaskInventory) 731 m_host.TaskInventory.LockItemsForRead(true);
732 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
732 { 733 {
733 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 734 if (inv.Value.Name == animation)
734 { 735 {
735 if (inv.Value.Name == animation) 736 if (inv.Value.Type == (int)AssetType.Animation)
736 { 737 animID = inv.Value.AssetID;
737 if (inv.Value.Type == (int)AssetType.Animation) 738 continue;
738 animID = inv.Value.AssetID;
739 continue;
740 }
741 } 739 }
742 } 740 }
741 m_host.TaskInventory.LockItemsForRead(false);
743 if (animID == UUID.Zero) 742 if (animID == UUID.Zero)
744 target.Animator.AddAnimation(animation, m_host.UUID); 743 target.Animator.AddAnimation(animation, m_host.UUID);
745 else 744 else
@@ -761,18 +760,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
761 if (target != null) 760 if (target != null)
762 { 761 {
763 UUID animID=UUID.Zero; 762 UUID animID=UUID.Zero;
764 lock (m_host.TaskInventory) 763 m_host.TaskInventory.LockItemsForRead(true);
764 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
765 { 765 {
766 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 766 if (inv.Value.Name == animation)
767 { 767 {
768 if (inv.Value.Name == animation) 768 if (inv.Value.Type == (int)AssetType.Animation)
769 { 769 animID = inv.Value.AssetID;
770 if (inv.Value.Type == (int)AssetType.Animation) 770 continue;
771 animID = inv.Value.AssetID;
772 continue;
773 }
774 } 771 }
775 } 772 }
773 m_host.TaskInventory.LockItemsForRead(false);
776 774
777 if (animID == UUID.Zero) 775 if (animID == UUID.Zero)
778 target.Animator.RemoveAnimation(animation); 776 target.Animator.RemoveAnimation(animation);
@@ -1541,6 +1539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1541 1539
1542 if (!UUID.TryParse(name, out assetID)) 1540 if (!UUID.TryParse(name, out assetID))
1543 { 1541 {
1542 m_host.TaskInventory.LockItemsForRead(true);
1544 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 1543 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1545 { 1544 {
1546 if (item.Type == 7 && item.Name == name) 1545 if (item.Type == 7 && item.Name == name)
@@ -1548,6 +1547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1548 assetID = item.AssetID; 1547 assetID = item.AssetID;
1549 } 1548 }
1550 } 1549 }
1550 m_host.TaskInventory.LockItemsForRead(false);
1551 } 1551 }
1552 1552
1553 if (assetID == UUID.Zero) 1553 if (assetID == UUID.Zero)
@@ -1594,6 +1594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1594 1594
1595 if (!UUID.TryParse(name, out assetID)) 1595 if (!UUID.TryParse(name, out assetID))
1596 { 1596 {
1597 m_host.TaskInventory.LockItemsForRead(true);
1597 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 1598 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1598 { 1599 {
1599 if (item.Type == 7 && item.Name == name) 1600 if (item.Type == 7 && item.Name == name)
@@ -1601,6 +1602,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1601 assetID = item.AssetID; 1602 assetID = item.AssetID;
1602 } 1603 }
1603 } 1604 }
1605 m_host.TaskInventory.LockItemsForRead(false);
1604 } 1606 }
1605 1607
1606 if (assetID == UUID.Zero) 1608 if (assetID == UUID.Zero)
@@ -1651,6 +1653,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1651 1653
1652 if (!UUID.TryParse(name, out assetID)) 1654 if (!UUID.TryParse(name, out assetID))
1653 { 1655 {
1656 m_host.TaskInventory.LockItemsForRead(true);
1654 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 1657 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1655 { 1658 {
1656 if (item.Type == 7 && item.Name == name) 1659 if (item.Type == 7 && item.Name == name)
@@ -1658,6 +1661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1658 assetID = item.AssetID; 1661 assetID = item.AssetID;
1659 } 1662 }
1660 } 1663 }
1664 m_host.TaskInventory.LockItemsForRead(false);
1661 } 1665 }
1662 1666
1663 if (assetID == UUID.Zero) 1667 if (assetID == UUID.Zero)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
index 7f67599..15e0408 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; //for [DebuggerNonUserCode]
30using System.Reflection; 31using System.Reflection;
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
32using OpenSim.Region.ScriptEngine.Shared; 33using OpenSim.Region.ScriptEngine.Shared;
@@ -131,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
131 return (eventFlags); 132 return (eventFlags);
132 } 133 }
133 134
135 [DebuggerNonUserCode]
134 public void ExecuteEvent(string state, string FunctionName, object[] args) 136 public void ExecuteEvent(string state, string FunctionName, object[] args)
135 { 137 {
136 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. 138 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
index 121159c..a44abb0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
@@ -33,6 +33,7 @@ using System.Threading;
33using System.Reflection; 33using System.Reflection;
34using System.Collections; 34using System.Collections;
35using System.Collections.Generic; 35using System.Collections.Generic;
36using System.Diagnostics; //for [DebuggerNonUserCode]
36using OpenSim.Region.ScriptEngine.Interfaces; 37using OpenSim.Region.ScriptEngine.Interfaces;
37using OpenSim.Region.ScriptEngine.Shared; 38using OpenSim.Region.ScriptEngine.Shared;
38using OpenSim.Region.ScriptEngine.Shared.Api.Runtime; 39using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
@@ -90,6 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
90 return (int)m_Executor.GetStateEventFlags(state); 91 return (int)m_Executor.GetStateEventFlags(state);
91 } 92 }
92 93
94 [DebuggerNonUserCode]
93 public void ExecuteEvent(string state, string FunctionName, object[] args) 95 public void ExecuteEvent(string state, string FunctionName, object[] args)
94 { 96 {
95 m_Executor.ExecuteEvent(state, FunctionName, args); 97 m_Executor.ExecuteEvent(state, FunctionName, args);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 5c5d57e..8333a27 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Diagnostics; //for [DebuggerNonUserCode]
30using System.Runtime.Remoting; 31using System.Runtime.Remoting;
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
32using System.Threading; 33using System.Threading;
@@ -237,13 +238,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
237 238
238 if (part != null) 239 if (part != null)
239 { 240 {
240 lock (part.TaskInventory) 241 part.TaskInventory.LockItemsForRead(true);
242 if (part.TaskInventory.ContainsKey(m_ItemID))
241 { 243 {
242 if (part.TaskInventory.ContainsKey(m_ItemID)) 244 m_thisScriptTask = part.TaskInventory[m_ItemID];
243 {
244 m_thisScriptTask = part.TaskInventory[m_ItemID];
245 }
246 } 245 }
246 part.TaskInventory.LockItemsForRead(false);
247 } 247 }
248 248
249 ApiManager am = new ApiManager(); 249 ApiManager am = new ApiManager();
@@ -428,14 +428,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
428 { 428 {
429 int permsMask; 429 int permsMask;
430 UUID permsGranter; 430 UUID permsGranter;
431 lock (part.TaskInventory) 431 part.TaskInventory.LockItemsForRead(true);
432 if (!part.TaskInventory.ContainsKey(m_ItemID))
432 { 433 {
433 if (!part.TaskInventory.ContainsKey(m_ItemID)) 434 part.TaskInventory.LockItemsForRead(false);
434 return; 435 return;
435
436 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
437 permsMask = part.TaskInventory[m_ItemID].PermsMask;
438 } 436 }
437 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
438 permsMask = part.TaskInventory[m_ItemID].PermsMask;
439 part.TaskInventory.LockItemsForRead(false);
439 440
440 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) 441 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
441 { 442 {
@@ -544,6 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
544 return true; 545 return true;
545 } 546 }
546 547
548 [DebuggerNonUserCode] //Prevents the debugger from farting in this function
547 public void SetState(string state) 549 public void SetState(string state)
548 { 550 {
549 if (state == State) 551 if (state == State)
@@ -555,7 +557,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
555 new DetectParams[0])); 557 new DetectParams[0]));
556 PostEvent(new EventParams("state_entry", new Object[0], 558 PostEvent(new EventParams("state_entry", new Object[0],
557 new DetectParams[0])); 559 new DetectParams[0]));
558 560
559 throw new EventAbortException(); 561 throw new EventAbortException();
560 } 562 }
561 563
@@ -638,154 +640,158 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
638 /// <returns></returns> 640 /// <returns></returns>
639 public object EventProcessor() 641 public object EventProcessor()
640 { 642 {
643
644 EventParams data = null;
645
646 lock (m_EventQueue)
647 {
641 lock (m_Script) 648 lock (m_Script)
642 { 649 {
643 EventParams data = null; 650 data = (EventParams) m_EventQueue.Dequeue();
644 651 if (data == null) // Shouldn't happen
645 lock (m_EventQueue)
646 { 652 {
647 data = (EventParams) m_EventQueue.Dequeue(); 653 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
648 if (data == null) // Shouldn't happen
649 { 654 {
650 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) 655 m_CurrentResult = m_Engine.QueueEventHandler(this);
651 {
652 m_CurrentResult = m_Engine.QueueEventHandler(this);
653 }
654 else
655 {
656 m_CurrentResult = null;
657 }
658 return 0;
659 } 656 }
660 657 else
661 if (data.EventName == "timer")
662 m_TimerQueued = false;
663 if (data.EventName == "control")
664 { 658 {
665 if (m_ControlEventsInQueue > 0) 659 m_CurrentResult = null;
666 m_ControlEventsInQueue--;
667 } 660 }
668 if (data.EventName == "collision") 661 return 0;
669 m_CollisionInQueue = false;
670 } 662 }
671
672 //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
673 663
674 m_DetectParams = data.DetectParams; 664 if (data.EventName == "timer")
675 665 m_TimerQueued = false;
676 if (data.EventName == "state") // Hardcoded state change 666 if (data.EventName == "control")
677 { 667 {
678 // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}", 668 if (m_ControlEventsInQueue > 0)
679 // m_PrimName, m_ScriptName, data.Params[0].ToString()); 669 m_ControlEventsInQueue--;
680 m_State=data.Params[0].ToString(); 670 }
681 AsyncCommandManager.RemoveScript(m_Engine, 671 if (data.EventName == "collision")
682 m_LocalID, m_ItemID); 672 m_CollisionInQueue = false;
673 }
674 }
675 lock(m_Script)
676 {
677
678 //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
683 679
684 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 680 m_DetectParams = data.DetectParams;
685 m_LocalID); 681
686 if (part != null) 682 if (data.EventName == "state") // Hardcoded state change
687 { 683 {
688 part.SetScriptEvents(m_ItemID, 684// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
689 (int)m_Script.GetStateEventFlags(State)); 685// m_PrimName, m_ScriptName, data.Params[0].ToString());
690 } 686 m_State=data.Params[0].ToString();
687 AsyncCommandManager.RemoveScript(m_Engine,
688 m_LocalID, m_ItemID);
689
690 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
691 m_LocalID);
692 if (part != null)
693 {
694 part.SetScriptEvents(m_ItemID,
695 (int)m_Script.GetStateEventFlags(State));
691 } 696 }
692 else 697 }
698 else
699 {
700 if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
701 data.EventName == "control") // Don't freeze avies!
693 { 702 {
694 if (m_Engine.World.PipeEventsForScript(m_LocalID) || 703 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
695 data.EventName == "control") // Don't freeze avies! 704 m_LocalID);
696 { 705 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
697 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 706 // m_PrimName, m_ScriptName, data.EventName, m_State);
698 m_LocalID);
699 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
700 // m_PrimName, m_ScriptName, data.EventName, m_State);
701 707
702 try 708 try
703 { 709 {
704 m_CurrentEvent = data.EventName; 710 m_CurrentEvent = data.EventName;
705 m_EventStart = DateTime.Now; 711 m_EventStart = DateTime.Now;
706 m_InEvent = true; 712 m_InEvent = true;
707 713
708 m_Script.ExecuteEvent(State, data.EventName, data.Params); 714 m_Script.ExecuteEvent(State, data.EventName, data.Params);
709 715
710 m_InEvent = false; 716 m_InEvent = false;
711 m_CurrentEvent = String.Empty; 717 m_CurrentEvent = String.Empty;
712 718
713 if (m_SaveState) 719 if (m_SaveState)
714 { 720 {
715 // This will be the very first event we deliver 721 // This will be the very first event we deliver
716 // (state_entry) in default state 722 // (state_entry) in default state
717 // 723 //
718 724
719 SaveState(m_Assembly); 725 SaveState(m_Assembly);
720 726
721 m_SaveState = false; 727 m_SaveState = false;
722 }
723 } 728 }
724 catch (Exception e) 729 }
725 { 730 catch (Exception e)
726 // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); 731 {
727 m_InEvent = false; 732 // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
728 m_CurrentEvent = String.Empty; 733 m_InEvent = false;
734 m_CurrentEvent = String.Empty;
729 735
730 if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException)) 736 if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
731 { 737 {
732 try 738 try
733 {
734 // DISPLAY ERROR INWORLD
735 string text = FormatException(e);
736
737 if (text.Length > 1000)
738 text = text.Substring(0, 1000);
739 m_Engine.World.SimChat(Utils.StringToBytes(text),
740 ChatTypeEnum.DebugChannel, 2147483647,
741 part.AbsolutePosition,
742 part.Name, part.UUID, false);
743 }
744 catch (Exception)
745 {
746 }
747 // catch (Exception e2) // LEGIT: User Scripting
748 // {
749 // m_log.Error("[SCRIPT]: "+
750 // "Error displaying error in-world: " +
751 // e2.ToString());
752 // m_log.Error("[SCRIPT]: " +
753 // "Errormessage: Error compiling script:\r\n" +
754 // e.ToString());
755 // }
756 }
757 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
758 { 739 {
759 m_InSelfDelete = true; 740 // DISPLAY ERROR INWORLD
760 if (part != null && part.ParentGroup != null) 741 string text = FormatException(e);
761 m_Engine.World.DeleteSceneObject(part.ParentGroup, false); 742
743 if (text.Length > 1000)
744 text = text.Substring(0, 1000);
745 m_Engine.World.SimChat(Utils.StringToBytes(text),
746 ChatTypeEnum.DebugChannel, 2147483647,
747 part.AbsolutePosition,
748 part.Name, part.UUID, false);
762 } 749 }
763 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) 750 catch (Exception)
764 { 751 {
765 m_InSelfDelete = true;
766 if (part != null && part.ParentGroup != null)
767 part.Inventory.RemoveInventoryItem(m_ItemID);
768 } 752 }
753 // catch (Exception e2) // LEGIT: User Scripting
754 // {
755 // m_log.Error("[SCRIPT]: "+
756 // "Error displaying error in-world: " +
757 // e2.ToString());
758 // m_log.Error("[SCRIPT]: " +
759 // "Errormessage: Error compiling script:\r\n" +
760 // e.ToString());
761 // }
762 }
763 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
764 {
765 m_InSelfDelete = true;
766 if (part != null && part.ParentGroup != null)
767 m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
768 }
769 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
770 {
771 m_InSelfDelete = true;
772 if (part != null && part.ParentGroup != null)
773 part.Inventory.RemoveInventoryItem(m_ItemID);
769 } 774 }
770 } 775 }
771 } 776 }
777 }
772 778
773 lock (m_EventQueue) 779 lock (m_EventQueue)
780 {
781 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
774 { 782 {
775 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) 783 m_CurrentResult = m_Engine.QueueEventHandler(this);
776 { 784 }
777 m_CurrentResult = m_Engine.QueueEventHandler(this); 785 else
778 } 786 {
779 else 787 m_CurrentResult = null;
780 {
781 m_CurrentResult = null;
782 }
783 } 788 }
789 }
784 790
785 m_DetectParams = null; 791 m_DetectParams = null;
786 792
787 return 0; 793 return 0;
788 } 794 }
789 } 795 }
790 796
791 public int EventTime() 797 public int EventTime()
@@ -824,6 +830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
824 new Object[0], new DetectParams[0])); 830 new Object[0], new DetectParams[0]));
825 } 831 }
826 832
833 [DebuggerNonUserCode] //Stops the VS debugger from farting in this function
827 public void ApiResetScript() 834 public void ApiResetScript()
828 { 835 {
829 // bool running = Running; 836 // bool running = Running;
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 3f38bb6..1fc31c5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -429,6 +429,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
429 } 429 }
430 } 430 }
431 431
432 public int Size
433 {
434 get { return 0; }
435 }
436
432 public object[] Data 437 public object[] Data
433 { 438 {
434 get { 439 get {
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 9030a5c..d997ea3 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -30,6 +30,7 @@ using System.IO;
30using System.Threading; 30using System.Threading;
31using System.Collections; 31using System.Collections;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using System.Diagnostics; //for [DebuggerNonUserCode]
33using System.Security; 34using System.Security;
34using System.Security.Policy; 35using System.Security.Policy;
35using System.Reflection; 36using System.Reflection;
@@ -1119,6 +1120,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1119 return false; 1120 return false;
1120 } 1121 }
1121 1122
1123 [DebuggerNonUserCode]
1122 public void ApiResetScript(UUID itemID) 1124 public void ApiResetScript(UUID itemID)
1123 { 1125 {
1124 IScriptInstance instance = GetInstance(itemID); 1126 IScriptInstance instance = GetInstance(itemID);
@@ -1170,6 +1172,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1170 return UUID.Zero; 1172 return UUID.Zero;
1171 } 1173 }
1172 1174
1175 [DebuggerNonUserCode]
1173 public void SetState(UUID itemID, string newState) 1176 public void SetState(UUID itemID, string newState)
1174 { 1177 {
1175 IScriptInstance instance = GetInstance(itemID); 1178 IScriptInstance instance = GetInstance(itemID);