aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs18
-rwxr-xr-xOpenSim/Region/ScriptEngine/XEngine/XEngine.cs25
21 files changed, 97 insertions, 69 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
index 30e99b0..b9970bf 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
@@ -46,6 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
46 /// <param name='item'>/param> 46 /// <param name='item'>/param>
47 /// <param name='coopSleepHandle'>/param> 47 /// <param name='coopSleepHandle'>/param>
48 void Initialize( 48 void Initialize(
49 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle); 49 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item);
50 } 50 }
51} \ No newline at end of file 51}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index b8fdd01..6355669 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -110,5 +110,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
110 ParameterInfo[] ScriptBaseClassParameters { get; } 110 ParameterInfo[] ScriptBaseClassParameters { get; }
111 111
112 IScriptApi GetApi(UUID itemID, string name); 112 IScriptApi GetApi(UUID itemID, string name);
113
114 void SleepScript(UUID itemID, int delay);
113 } 115 }
114} 116}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 16641f7..e4297c4 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Threading; 31using System.Threading;
32using System.Diagnostics;
32using OpenMetaverse; 33using OpenMetaverse;
33using log4net; 34using log4net;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -163,6 +164,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
163 void ClearQueue(); 164 void ClearQueue();
164 int StartParam { get; set; } 165 int StartParam { get; set; }
165 166
167 WaitHandle CoopWaitHandle { get; }
168 Stopwatch ExecutionTimer { get; }
169
166 void RemoveState(); 170 void RemoveState();
167 171
168 void Init(); 172 void Init();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 946680c..f364032 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -101,8 +101,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
101 /// Used for script sleeps when we are using co-operative script termination. 101 /// Used for script sleeps when we are using co-operative script termination.
102 /// </summary> 102 /// </summary>
103 /// <remarks>null if co-operative script termination is not active</remarks> 103 /// <remarks>null if co-operative script termination is not active</remarks>
104 WaitHandle m_coopSleepHandle;
105
106 /// <summary> 104 /// <summary>
107 /// The item that hosts this script 105 /// The item that hosts this script
108 /// </summary> 106 /// </summary>
@@ -262,12 +260,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
262 }; 260 };
263 261
264 public void Initialize( 262 public void Initialize(
265 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 263 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
266 { 264 {
267 m_ScriptEngine = scriptEngine; 265 m_ScriptEngine = scriptEngine;
268 m_host = host; 266 m_host = host;
269 m_item = item; 267 m_item = item;
270 m_coopSleepHandle = coopSleepHandle;
271 268
272 LoadConfig(); 269 LoadConfig();
273 270
@@ -406,21 +403,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
406 403
407 protected virtual void Sleep(int delay) 404 protected virtual void Sleep(int delay)
408 { 405 {
409 if (m_coopSleepHandle == null) 406 m_ScriptEngine.SleepScript(m_item.ItemID, delay);
410 System.Threading.Thread.Sleep(delay);
411 else
412 CheckForCoopTermination(delay);
413 } 407 }
414 408
415 /// <summary> 409 /// <summary>
416 /// Check for co-operative termination. 410 /// Check for co-operative termination.
417 /// </summary> 411 /// </summary>
418 /// <param name='delay'>If called with 0, then just the check is performed with no wait.</param> 412 /// <param name='delay'>If called with 0, then just the check is performed with no wait.</param>
419 protected virtual void CheckForCoopTermination(int delay)
420 {
421 if (m_coopSleepHandle.WaitOne(delay))
422 throw new ScriptCoopStopException();
423 }
424 413
425 public Scene World 414 public Scene World
426 { 415 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 3406aea..e5e43f8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
63 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
64 64
65 public void Initialize( 65 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
67 { 67 {
68 m_ScriptEngine = scriptEngine; 68 m_ScriptEngine = scriptEngine;
69 m_host = host; 69 m_host = host;
@@ -833,4 +833,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
833 return success; 833 return success;
834 } 834 }
835 } 835 }
836} \ No newline at end of file 836}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 92dd813..9929dac 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
66 internal IScriptModuleComms m_comms = null; 66 internal IScriptModuleComms m_comms = null;
67 67
68 public void Initialize( 68 public void Initialize(
69 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 69 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
70 { 70 {
71 m_ScriptEngine = scriptEngine; 71 m_ScriptEngine = scriptEngine;
72 m_host = host; 72 m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 123f8ca..c1f1ed5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
145 protected IUrlModule m_UrlModule = null; 145 protected IUrlModule m_UrlModule = null;
146 146
147 public void Initialize( 147 public void Initialize(
148 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 148 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
149 { 149 {
150 m_ScriptEngine = scriptEngine; 150 m_ScriptEngine = scriptEngine;
151 m_host = host; 151 m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 8a744c3..fa6e6fc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -100,6 +100,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
100 100
101 public int DebugLevel { get; set; } 101 public int DebugLevel { get; set; }
102 102
103 public WaitHandle CoopWaitHandle { get; private set; }
104 public Stopwatch ExecutionTimer { get; private set; }
105
103 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } 106 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; }
104 107
105 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); 108 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
@@ -234,6 +237,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
234 { 237 {
235 State = "default"; 238 State = "default";
236 EventQueue = new Queue(32); 239 EventQueue = new Queue(32);
240 ExecutionTimer = new Stopwatch();
237 241
238 Engine = engine; 242 Engine = engine;
239 Part = part; 243 Part = part;
@@ -286,12 +290,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
286 m_stateSource = stateSource; 290 m_stateSource = stateSource;
287 m_coopTermination = coopTermination; 291 m_coopTermination = coopTermination;
288 292
293 if (m_coopTermination)
294 CoopWaitHandle = coopSleepHandle;
295 else
296 CoopWaitHandle = null;
297
289 ApiManager am = new ApiManager(); 298 ApiManager am = new ApiManager();
290 299
291 foreach (string api in am.GetApis()) 300 foreach (string api in am.GetApis())
292 { 301 {
293 m_Apis[api] = am.CreateApi(api); 302 m_Apis[api] = am.CreateApi(api);
294 m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); 303 m_Apis[api].Initialize(Engine, Part, ScriptTask);
295 } 304 }
296 305
297 try 306 try
@@ -766,8 +775,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
766 if (Suspended) 775 if (Suspended)
767 return 0; 776 return 0;
768 777
769 Stopwatch timer = new Stopwatch(); 778 ExecutionTimer.Restart();
770 timer.Start();
771 779
772 try 780 try
773 { 781 {
@@ -775,9 +783,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
775 } 783 }
776 finally 784 finally
777 { 785 {
778 timer.Stop(); 786 ExecutionTimer.Stop();
779 ExecutionTime.AddSample(timer); 787 ExecutionTime.AddSample(ExecutionTimer);
780 Part.ParentGroup.Scene.AddScriptExecutionTime(timer.ElapsedTicks); 788 Part.ParentGroup.Scene.AddScriptExecutionTime(ExecutionTimer.ElapsedTicks);
781 } 789 }
782 } 790 }
783 } 791 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
index 8170e9b..af1da7c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
95 part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f); 95 part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f);
96 96
97 LSL_Api apiGrp1 = new LSL_Api(); 97 LSL_Api apiGrp1 = new LSL_Api();
98 apiGrp1.Initialize(m_engine, part, null, null); 98 apiGrp1.Initialize(m_engine, part, null);
99 99
100 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); 100 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
101 101
@@ -155,4 +155,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
155 } 155 }
156 } 156 }
157 } 157 }
158} \ No newline at end of file 158}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index e35de9c..9a5ebce 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
105 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 105 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
106 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 106 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
107 m_lslApi = new LSL_Api(); 107 m_lslApi = new LSL_Api();
108 m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem, null); 108 m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem);
109 } 109 }
110 110
111 [TearDown] 111 [TearDown]
@@ -245,4 +245,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
245 } 245 }
246 } 246 }
247 } 247 }
248} \ No newline at end of file 248}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 3ff4c6b..9b7cab2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
94 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId); 94 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId);
95 95
96 LSL_Api api = new LSL_Api(); 96 LSL_Api api = new LSL_Api();
97 api.Initialize(m_engine, so1.RootPart, null, null); 97 api.Initialize(m_engine, so1.RootPart, null);
98 98
99 // Create a second object 99 // Create a second object
100 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); 100 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
127 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 127 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
128 m_scene.AddSceneObject(so1); 128 m_scene.AddSceneObject(so1);
129 LSL_Api api = new LSL_Api(); 129 LSL_Api api = new LSL_Api();
130 api.Initialize(m_engine, so1.RootPart, null, null); 130 api.Initialize(m_engine, so1.RootPart, null);
131 131
132 // Create an object embedded inside the first 132 // Create an object embedded inside the first
133 UUID itemId = TestHelpers.ParseTail(0x20); 133 UUID itemId = TestHelpers.ParseTail(0x20);
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); 137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
138 m_scene.AddSceneObject(so2); 138 m_scene.AddSceneObject(so2);
139 LSL_Api api2 = new LSL_Api(); 139 LSL_Api api2 = new LSL_Api();
140 api2.Initialize(m_engine, so2.RootPart, null, null); 140 api2.Initialize(m_engine, so2.RootPart, null);
141 141
142 // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** 142 // *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
143 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); 143 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
@@ -184,7 +184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
184 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 184 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
185 m_scene.AddSceneObject(so1); 185 m_scene.AddSceneObject(so1);
186 LSL_Api api = new LSL_Api(); 186 LSL_Api api = new LSL_Api();
187 api.Initialize(m_engine, so1.RootPart, null, null); 187 api.Initialize(m_engine, so1.RootPart, null);
188 188
189 // Create an object embedded inside the first 189 // Create an object embedded inside the first
190 UUID itemId = TestHelpers.ParseTail(0x20); 190 UUID itemId = TestHelpers.ParseTail(0x20);
@@ -218,7 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
218 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 218 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
219 m_scene.AddSceneObject(so1); 219 m_scene.AddSceneObject(so1);
220 LSL_Api api = new LSL_Api(); 220 LSL_Api api = new LSL_Api();
221 api.Initialize(m_engine, so1.RootPart, null, null); 221 api.Initialize(m_engine, so1.RootPart, null);
222 222
223 // Create an object embedded inside the first 223 // Create an object embedded inside the first
224 UUID itemId = TestHelpers.ParseTail(0x20); 224 UUID itemId = TestHelpers.ParseTail(0x20);
@@ -250,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
250 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, "sourceSo", user1Id); 250 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, "sourceSo", user1Id);
251 m_scene.AddSceneObject(sourceSo); 251 m_scene.AddSceneObject(sourceSo);
252 LSL_Api api = new LSL_Api(); 252 LSL_Api api = new LSL_Api();
253 api.Initialize(m_engine, sourceSo.RootPart, null, null); 253 api.Initialize(m_engine, sourceSo.RootPart, null);
254 TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World"); 254 TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World");
255 255
256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id); 256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
@@ -285,4 +285,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
285 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script")); 285 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
286 } 286 }
287 } 287 }
288} \ No newline at end of file 288}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
index b6f5e09..14b1890 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
104 m_scene.AddSceneObject(grp2); 104 m_scene.AddSceneObject(grp2);
105 105
106 LSL_Api apiGrp1 = new LSL_Api(); 106 LSL_Api apiGrp1 = new LSL_Api();
107 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 107 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
108 108
109 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); 109 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE);
110 110
@@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
132 132
133 LSL_Api apiGrp1 = new LSL_Api(); 133 LSL_Api apiGrp1 = new LSL_Api();
134 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 134 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
135 135
136 apiGrp1.llBreakLink(2); 136 apiGrp1.llBreakLink(2);
137 137
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
160 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 160 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
161 161
162 LSL_Api apiGrp1 = new LSL_Api(); 162 LSL_Api apiGrp1 = new LSL_Api();
163 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 163 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
164 164
165 apiGrp1.llBreakAllLinks(); 165 apiGrp1.llBreakAllLinks();
166 166
@@ -183,4 +183,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
183 } 183 }
184 } 184 }
185 } 185 }
186} \ No newline at end of file 186}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
index 0b1ae60..34a29e6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
67 engine.AddRegion(scene); 67 engine.AddRegion(scene);
68 68
69 m_lslApi = new LSL_Api(); 69 m_lslApi = new LSL_Api();
70 m_lslApi.Initialize(engine, part, null, null); 70 m_lslApi.Initialize(engine, part, null);
71 } 71 }
72 72
73 [Test] 73 [Test]
@@ -133,4 +133,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
133 } 133 }
134 } 134 }
135 } 135 }
136 } \ No newline at end of file 136 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
index 2ac12cb..9ab3115 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
66 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 66 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
67 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 67 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
68 m_lslApi = new LSL_Api(); 68 m_lslApi = new LSL_Api();
69 m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem, null); 69 m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem);
70 } 70 }
71 71
72 [Test] 72 [Test]
@@ -266,4 +266,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
266// } 266// }
267// } 267// }
268 } 268 }
269} \ No newline at end of file 269}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
index caf2b05..d957bf2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
89 m_scene.AddSceneObject(grp1); 89 m_scene.AddSceneObject(grp1);
90 90
91 LSL_Api apiGrp1 = new LSL_Api(); 91 LSL_Api apiGrp1 = new LSL_Api();
92 apiGrp1.Initialize(m_engine, grp1.RootPart, null, null); 92 apiGrp1.Initialize(m_engine, grp1.RootPart, null);
93 93
94 // Check simple 1 prim case 94 // Check simple 1 prim case
95 { 95 {
@@ -167,7 +167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
167 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); 167 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
168 168
169 LSL_Api apiGrp1 = new LSL_Api(); 169 LSL_Api apiGrp1 = new LSL_Api();
170 apiGrp1.Initialize(m_engine, part1, null, null); 170 apiGrp1.Initialize(m_engine, part1, null);
171 171
172 // Note that prim hollow check is passed with the other prim params in order to allow the 172 // Note that prim hollow check is passed with the other prim params in order to allow the
173 // specification of a different check value from the prim param. A cylinder, prism, sphere, 173 // specification of a different check value from the prim param. A cylinder, prism, sphere,
@@ -395,4 +395,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
395 } 395 }
396 396
397 } 397 }
398} \ No newline at end of file 398}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 1b7aa63..d929da8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
65 engine.AddRegion(scene); 65 engine.AddRegion(scene);
66 66
67 m_lslApi = new LSL_Api(); 67 m_lslApi = new LSL_Api();
68 m_lslApi.Initialize(engine, part, null, null); 68 m_lslApi.Initialize(engine, part, null);
69 } 69 }
70 70
71 [Test] 71 [Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
index 40082b5..a8964bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part); 71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part);
72 72
73 LSL_Api apiGrp1 = new LSL_Api(); 73 LSL_Api apiGrp1 = new LSL_Api();
74 apiGrp1.Initialize(m_engine, part, scriptItem, null); 74 apiGrp1.Initialize(m_engine, part, scriptItem);
75 75
76 // Initially long timeout to test cache 76 // Initially long timeout to test cache
77 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 20000; 77 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 20000;
@@ -154,4 +154,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
154 } 154 }
155 } 155 }
156 } 156 }
157} \ No newline at end of file 157}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
index 4c31969..2f9a564 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
93 m_scene.AddSceneObject(so); 93 m_scene.AddSceneObject(so);
94 94
95 OSSL_Api osslApi = new OSSL_Api(); 95 OSSL_Api osslApi = new OSSL_Api();
96 osslApi.Initialize(m_engine, part, null, null); 96 osslApi.Initialize(m_engine, part, null);
97 97
98 string notecardName = "appearanceNc"; 98 string notecardName = "appearanceNc";
99 99
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
134 m_scene.AddSceneObject(so); 134 m_scene.AddSceneObject(so);
135 135
136 OSSL_Api osslApi = new OSSL_Api(); 136 OSSL_Api osslApi = new OSSL_Api();
137 osslApi.Initialize(m_engine, part, null, null); 137 osslApi.Initialize(m_engine, part, null);
138 138
139 string notecardName = "appearanceNc"; 139 string notecardName = "appearanceNc";
140 140
@@ -158,4 +158,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
158 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); 158 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight));
159 } 159 }
160 } 160 }
161} \ No newline at end of file 161}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
index 2fe558a..b6b3f12 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
@@ -98,9 +98,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); 99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
100 100
101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
102 OSSL_Api osslApi = new OSSL_Api(); 102 OSSL_Api osslApi = new OSSL_Api();
103 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 103 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
104 104
105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); 105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
106 106
@@ -144,9 +144,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); 145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
146 146
147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
148 OSSL_Api osslApi = new OSSL_Api(); 148 OSSL_Api osslApi = new OSSL_Api();
149 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 149 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
150 150
151 // Create an object embedded inside the first 151 // Create an object embedded inside the first
152 TaskInventoryHelpers.AddNotecard( 152 TaskInventoryHelpers.AddNotecard(
@@ -192,9 +192,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); 193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
194 194
195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
196 OSSL_Api osslApi = new OSSL_Api(); 196 OSSL_Api osslApi = new OSSL_Api();
197 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 197 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
198 198
199 // Create an object embedded inside the first 199 // Create an object embedded inside the first
200 TaskInventoryHelpers.AddSceneObject( 200 TaskInventoryHelpers.AddSceneObject(
@@ -229,4 +229,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
229 Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint)); 229 Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint));
230 } 230 }
231 } 231 }
232} \ No newline at end of file 232}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index 398ccbe..99bff83 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
99 m_scene.AddSceneObject(so); 99 m_scene.AddSceneObject(so);
100 100
101 OSSL_Api osslApi = new OSSL_Api(); 101 OSSL_Api osslApi = new OSSL_Api();
102 osslApi.Initialize(m_engine, part, null, null); 102 osslApi.Initialize(m_engine, part, null);
103 103
104 string notecardName = "appearanceNc"; 104 string notecardName = "appearanceNc";
105 osslApi.osOwnerSaveAppearance(notecardName); 105 osslApi.osOwnerSaveAppearance(notecardName);
@@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
125 m_scene.AddSceneObject(so); 125 m_scene.AddSceneObject(so);
126 126
127 OSSL_Api osslApi = new OSSL_Api(); 127 OSSL_Api osslApi = new OSSL_Api();
128 osslApi.Initialize(m_engine, so.RootPart, null, null); 128 osslApi.Initialize(m_engine, so.RootPart, null);
129 129
130 bool gotExpectedException = false; 130 bool gotExpectedException = false;
131 try 131 try
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
160 m_scene.AddSceneObject(so); 160 m_scene.AddSceneObject(so);
161 161
162 OSSL_Api osslApi = new OSSL_Api(); 162 OSSL_Api osslApi = new OSSL_Api();
163 osslApi.Initialize(m_engine, part, null, null); 163 osslApi.Initialize(m_engine, part, null);
164 164
165 string notecardName = "appearanceNc"; 165 string notecardName = "appearanceNc";
166 osslApi.osOwnerSaveAppearance(notecardName); 166 osslApi.osOwnerSaveAppearance(notecardName);
@@ -195,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
195 m_scene.AddSceneObject(so); 195 m_scene.AddSceneObject(so);
196 196
197 OSSL_Api osslApi = new OSSL_Api(); 197 OSSL_Api osslApi = new OSSL_Api();
198 osslApi.Initialize(m_engine, part, null, null); 198 osslApi.Initialize(m_engine, part, null);
199 199
200 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 200 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
201 201
@@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
233 m_scene.AddSceneObject(so); 233 m_scene.AddSceneObject(so);
234 234
235 OSSL_Api osslApi = new OSSL_Api(); 235 OSSL_Api osslApi = new OSSL_Api();
236 osslApi.Initialize(m_engine, part, null, null); 236 osslApi.Initialize(m_engine, part, null);
237 237
238 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 238 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
239 239
@@ -285,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
285 m_scene.AddSceneObject(otherSo); 285 m_scene.AddSceneObject(otherSo);
286 286
287 OSSL_Api osslApi = new OSSL_Api(); 287 OSSL_Api osslApi = new OSSL_Api();
288 osslApi.Initialize(m_engine, part, null, null); 288 osslApi.Initialize(m_engine, part, null);
289 289
290 OSSL_Api otherOsslApi = new OSSL_Api(); 290 OSSL_Api otherOsslApi = new OSSL_Api();
291 otherOsslApi.Initialize(m_engine, otherPart, null, null); 291 otherOsslApi.Initialize(m_engine, otherPart, null);
292 292
293 string notecardName = "appearanceNc"; 293 string notecardName = "appearanceNc";
294 osslApi.osOwnerSaveAppearance(notecardName); 294 osslApi.osOwnerSaveAppearance(notecardName);
@@ -332,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
332 m_scene.AddSceneObject(so); 332 m_scene.AddSceneObject(so);
333 333
334 OSSL_Api osslApi = new OSSL_Api(); 334 OSSL_Api osslApi = new OSSL_Api();
335 osslApi.Initialize(m_engine, part, null, null); 335 osslApi.Initialize(m_engine, part, null);
336 336
337 string notecardName = "appearanceNc"; 337 string notecardName = "appearanceNc";
338 osslApi.osOwnerSaveAppearance(notecardName); 338 osslApi.osOwnerSaveAppearance(notecardName);
@@ -348,4 +348,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
348 Assert.That(npc, Is.Null); 348 Assert.That(npc, Is.Null);
349 } 349 }
350 } 350 }
351} \ No newline at end of file 351}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 62bf803..78d4ee9 100755
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -2435,5 +2435,30 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2435 running = instance.Running; 2435 running = instance.Running;
2436 return true; 2436 return true;
2437 } 2437 }
2438
2439 public void SleepScript(UUID itemID, int delay)
2440 {
2441 IScriptInstance instance = GetInstance(itemID);
2442 if (instance == null)
2443 return;
2444
2445 instance.ExecutionTimer.Stop();
2446 try
2447 {
2448 if (instance.CoopWaitHandle != null)
2449 {
2450 if (instance.CoopWaitHandle.WaitOne(delay))
2451 throw new ScriptCoopStopException();
2452 }
2453 else
2454 {
2455 Thread.Sleep(delay);
2456 }
2457 }
2458 finally
2459 {
2460 instance.ExecutionTimer.Start();
2461 }
2462 }
2438 } 2463 }
2439} 2464}