diff options
author | Melanie | 2013-01-16 15:47:55 +0000 |
---|---|---|
committer | Melanie | 2013-01-16 15:47:55 +0000 |
commit | 818254916cb562422b3a3301b9f35fafd64ee3fe (patch) | |
tree | e8655f6472b305d43a2f23059c375c90e7004a2b /OpenSim/Region/ScriptEngine/Shared | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.zip opensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.tar.gz opensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.tar.bz2 opensim-SC-818254916cb562422b3a3301b9f35fafd64ee3fe.tar.xz |
JustinCC's core re-merge
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
14 files changed, 177 insertions, 77 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs index b5fa6de..d03955b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using System.Collections; | 31 | using System.Collections; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -62,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
62 | internal TaskInventoryItem m_item; | 63 | internal TaskInventoryItem m_item; |
63 | internal bool m_CMFunctionsEnabled = false; | 64 | internal bool m_CMFunctionsEnabled = false; |
64 | 65 | ||
65 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) |
66 | { | 67 | { |
67 | m_ScriptEngine = ScriptEngine; | 68 | m_ScriptEngine = ScriptEngine; |
68 | m_host = host; | 69 | m_host = host; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4ce2afd..e83bbbb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -87,10 +87,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
87 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 87 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
88 | { | 88 | { |
89 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 89 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
90 | |||
90 | protected IScriptEngine m_ScriptEngine; | 91 | protected IScriptEngine m_ScriptEngine; |
91 | protected SceneObjectPart m_host; | 92 | protected SceneObjectPart m_host; |
92 | 93 | ||
93 | /// <summary> | 94 | /// <summary> |
95 | /// Used for script sleeps when we are using co-operative script termination. | ||
96 | /// </summary> | ||
97 | /// <remarks>null if co-operative script termination is not active</remarks> | ||
98 | EventWaitHandle m_coopSleepHandle; | ||
99 | |||
100 | /// <summary> | ||
94 | /// The item that hosts this script | 101 | /// The item that hosts this script |
95 | /// </summary> | 102 | /// </summary> |
96 | protected TaskInventoryItem m_item; | 103 | protected TaskInventoryItem m_item; |
@@ -142,33 +149,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
142 | {"TURNRIGHT", "Turning Right"} | 149 | {"TURNRIGHT", "Turning Right"} |
143 | }; | 150 | }; |
144 | 151 | ||
145 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 152 | public void Initialize( |
153 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
146 | { | 154 | { |
147 | /* | ||
148 | m_ShoutSayTimer = new Timer(1000); | ||
149 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; | ||
150 | m_ShoutSayTimer.AutoReset = true; | ||
151 | m_ShoutSayTimer.Start(); | ||
152 | */ | ||
153 | m_lastSayShoutCheck = DateTime.UtcNow; | 155 | m_lastSayShoutCheck = DateTime.UtcNow; |
154 | 156 | ||
155 | m_ScriptEngine = ScriptEngine; | 157 | m_ScriptEngine = scriptEngine; |
156 | m_host = host; | 158 | m_host = host; |
157 | m_item = item; | 159 | m_item = item; |
158 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 160 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
161 | m_coopSleepHandle = coopSleepHandle; | ||
159 | 162 | ||
160 | LoadLimits(); // read script limits from config. | 163 | LoadConfig(); |
161 | 164 | ||
162 | m_TransferModule = | 165 | m_TransferModule = |
163 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 166 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); |
164 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 167 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); |
165 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); | 168 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); |
166 | 169 | ||
167 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | 170 | AsyncCommands = new AsyncCommandManager(m_ScriptEngine); |
168 | } | 171 | } |
169 | 172 | ||
170 | /* load configuration items that affect script, object and run-time behavior. */ | 173 | /// <summary> |
171 | private void LoadLimits() | 174 | /// Load configuration items that affect script, object and run-time behavior. */ |
175 | /// </summary> | ||
176 | private void LoadConfig() | ||
172 | { | 177 | { |
173 | m_ScriptDelayFactor = | 178 | m_ScriptDelayFactor = |
174 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); | 179 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); |
@@ -182,12 +187,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
182 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); | 187 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); |
183 | if (m_notecardLineReadCharsMax > 65535) | 188 | if (m_notecardLineReadCharsMax > 65535) |
184 | m_notecardLineReadCharsMax = 65535; | 189 | m_notecardLineReadCharsMax = 65535; |
190 | |||
185 | // load limits for particular subsystems. | 191 | // load limits for particular subsystems. |
186 | IConfig SMTPConfig; | 192 | IConfig SMTPConfig; |
187 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { | 193 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { |
188 | // there's an smtp config, so load in the snooze time. | 194 | // there's an smtp config, so load in the snooze time. |
189 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | 195 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); |
190 | } | 196 | } |
197 | |||
191 | // Rezzing an object with a velocity can create recoil. This feature seems to have been | 198 | // Rezzing an object with a velocity can create recoil. This feature seems to have been |
192 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales | 199 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales |
193 | // it by this factor. May be zero to turn off recoil all together. | 200 | // it by this factor. May be zero to turn off recoil all together. |
@@ -212,7 +219,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
212 | delay = (int)((float)delay * m_ScriptDelayFactor); | 219 | delay = (int)((float)delay * m_ScriptDelayFactor); |
213 | if (delay == 0) | 220 | if (delay == 0) |
214 | return; | 221 | return; |
215 | System.Threading.Thread.Sleep(delay); | 222 | |
223 | Sleep(delay); | ||
224 | } | ||
225 | |||
226 | protected virtual void Sleep(int delay) | ||
227 | { | ||
228 | if (m_coopSleepHandle == null) | ||
229 | System.Threading.Thread.Sleep(delay); | ||
230 | else if (m_coopSleepHandle.WaitOne(delay)) | ||
231 | throw new ScriptCoopStopException(); | ||
216 | } | 232 | } |
217 | 233 | ||
218 | public Scene World | 234 | public Scene World |
@@ -3228,7 +3244,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3228 | { | 3244 | { |
3229 | // m_log.Info("llSleep snoozing " + sec + "s."); | 3245 | // m_log.Info("llSleep snoozing " + sec + "s."); |
3230 | m_host.AddScriptLPS(1); | 3246 | m_host.AddScriptLPS(1); |
3231 | Thread.Sleep((int)(sec * 1000)); | 3247 | |
3248 | Sleep((int)(sec * 1000)); | ||
3232 | } | 3249 | } |
3233 | 3250 | ||
3234 | public LSL_Float llGetMass() | 3251 | public LSL_Float llGetMass() |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index ceb4660..a08ccc8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -30,6 +30,7 @@ using System.Reflection; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
33 | using System.Threading; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim; | 36 | using OpenSim; |
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
61 | internal bool m_LSFunctionsEnabled = false; | 62 | internal bool m_LSFunctionsEnabled = false; |
62 | internal IScriptModuleComms m_comms = null; | 63 | internal IScriptModuleComms m_comms = null; |
63 | 64 | ||
64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 65 | public void Initialize( |
66 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
65 | { | 67 | { |
66 | m_ScriptEngine = ScriptEngine; | 68 | m_ScriptEngine = scriptEngine; |
67 | m_host = host; | 69 | m_host = host; |
68 | 70 | ||
69 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 71 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
@@ -92,10 +94,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
92 | get { return m_ScriptEngine.World; } | 94 | get { return m_ScriptEngine.World; } |
93 | } | 95 | } |
94 | 96 | ||
95 | // | 97 | /// <summary> |
96 | //Dumps an error message on the debug console. | 98 | /// Dumps an error message on the debug console. |
97 | // | 99 | /// </summary> |
98 | |||
99 | internal void LSShoutError(string message) | 100 | internal void LSShoutError(string message) |
100 | { | 101 | { |
101 | if (message.Length > 1023) | 102 | if (message.Length > 1023) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 8f34833..981499e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -30,6 +30,7 @@ using System.Reflection; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
33 | using System.Threading; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim; | 36 | using OpenSim; |
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
61 | internal bool m_MODFunctionsEnabled = false; | 62 | internal bool m_MODFunctionsEnabled = false; |
62 | internal IScriptModuleComms m_comms = null; | 63 | internal IScriptModuleComms m_comms = null; |
63 | 64 | ||
64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 65 | public void Initialize( |
66 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
65 | { | 67 | { |
66 | m_ScriptEngine = ScriptEngine; | 68 | m_ScriptEngine = scriptEngine; |
67 | m_host = host; | 69 | m_host = host; |
68 | m_item = item; | 70 | m_item = item; |
69 | 71 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4a46398..49857cf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -143,9 +143,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
143 | 143 | ||
144 | protected IUrlModule m_UrlModule = null; | 144 | protected IUrlModule m_UrlModule = null; |
145 | 145 | ||
146 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 146 | public void Initialize( |
147 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
147 | { | 148 | { |
148 | m_ScriptEngine = ScriptEngine; | 149 | m_ScriptEngine = scriptEngine; |
149 | m_host = host; | 150 | m_host = host; |
150 | m_item = item; | 151 | m_item = item; |
151 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 152 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index 22804f5..e44a106 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs | |||
@@ -82,6 +82,24 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | /// <summary> | ||
86 | /// Used to signal when the script is stopping in co-operation with the script engine | ||
87 | /// (instead of through Thread.Abort()). | ||
88 | /// </summary> | ||
89 | [Serializable] | ||
90 | public class ScriptCoopStopException : Exception | ||
91 | { | ||
92 | public ScriptCoopStopException() | ||
93 | { | ||
94 | } | ||
95 | |||
96 | protected ScriptCoopStopException( | ||
97 | SerializationInfo info, | ||
98 | StreamingContext context) | ||
99 | { | ||
100 | } | ||
101 | } | ||
102 | |||
85 | public class DetectParams | 103 | public class DetectParams |
86 | { | 104 | { |
87 | public const int AGENT = 1; | 105 | public const int AGENT = 1; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index ff4d130..a869a6a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
158 | 158 | ||
159 | public UUID AppDomain { get; set; } | 159 | public UUID AppDomain { get; set; } |
160 | 160 | ||
161 | public SceneObjectPart Part { get; private set; } | ||
162 | |||
161 | public string PrimName { get; private set; } | 163 | public string PrimName { get; private set; } |
162 | 164 | ||
163 | public string ScriptName { get; private set; } | 165 | public string ScriptName { get; private set; } |
@@ -199,54 +201,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
199 | 201 | ||
200 | public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; | 202 | public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; |
201 | 203 | ||
204 | private bool m_coopTermination; | ||
205 | |||
206 | private EventWaitHandle m_coopSleepHandle; | ||
207 | |||
202 | public void ClearQueue() | 208 | public void ClearQueue() |
203 | { | 209 | { |
204 | m_TimerQueued = false; | 210 | m_TimerQueued = false; |
205 | EventQueue.Clear(); | 211 | EventQueue.Clear(); |
206 | } | 212 | } |
207 | 213 | ||
208 | public ScriptInstance(IScriptEngine engine, SceneObjectPart part, | 214 | public ScriptInstance( |
209 | UUID itemID, UUID assetID, string assembly, | 215 | IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item, |
210 | AppDomain dom, string primName, string scriptName, | 216 | int startParam, bool postOnRez, |
211 | int startParam, bool postOnRez, StateSource stateSource, | 217 | int maxScriptQueue) |
212 | int maxScriptQueue) | ||
213 | { | 218 | { |
214 | State = "default"; | 219 | State = "default"; |
215 | EventQueue = new Queue(32); | 220 | EventQueue = new Queue(32); |
216 | 221 | ||
217 | Engine = engine; | 222 | Engine = engine; |
218 | LocalID = part.LocalId; | 223 | Part = part; |
219 | ObjectID = part.UUID; | 224 | ScriptTask = item; |
220 | RootLocalID = part.ParentGroup.LocalId; | 225 | |
221 | RootObjectID = part.ParentGroup.UUID; | 226 | // This is currently only here to allow regression tests to get away without specifying any inventory |
222 | ItemID = itemID; | 227 | // item when they are testing script logic that doesn't require an item. |
223 | AssetID = assetID; | 228 | if (ScriptTask != null) |
224 | PrimName = primName; | 229 | { |
225 | ScriptName = scriptName; | 230 | ScriptName = ScriptTask.Name; |
226 | m_Assembly = assembly; | 231 | ItemID = ScriptTask.ItemID; |
232 | AssetID = ScriptTask.AssetID; | ||
233 | } | ||
234 | |||
235 | PrimName = part.ParentGroup.Name; | ||
227 | StartParam = startParam; | 236 | StartParam = startParam; |
228 | m_MaxScriptQueue = maxScriptQueue; | 237 | m_MaxScriptQueue = maxScriptQueue; |
229 | m_stateSource = stateSource; | ||
230 | m_postOnRez = postOnRez; | 238 | m_postOnRez = postOnRez; |
231 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; | 239 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; |
232 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; | 240 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; |
233 | 241 | ||
234 | if (part != null) | 242 | if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") |
235 | { | 243 | { |
236 | part.TaskInventory.LockItemsForRead(true); | 244 | m_coopTermination = true; |
237 | if (part.TaskInventory.ContainsKey(ItemID)) | 245 | m_coopSleepHandle = new AutoResetEvent(false); |
238 | { | ||
239 | ScriptTask = part.TaskInventory[ItemID]; | ||
240 | } | ||
241 | part.TaskInventory.LockItemsForRead(false); | ||
242 | } | 246 | } |
247 | } | ||
248 | |||
249 | /// <summary> | ||
250 | /// Load the script from an assembly into an AppDomain. | ||
251 | /// </summary> | ||
252 | /// <param name='dom'></param> | ||
253 | /// <param name='assembly'></param> | ||
254 | /// <param name='stateSource'></param> | ||
255 | public void Load(AppDomain dom, string assembly, StateSource stateSource) | ||
256 | { | ||
257 | m_Assembly = assembly; | ||
258 | m_stateSource = stateSource; | ||
243 | 259 | ||
244 | ApiManager am = new ApiManager(); | 260 | ApiManager am = new ApiManager(); |
245 | 261 | ||
246 | foreach (string api in am.GetApis()) | 262 | foreach (string api in am.GetApis()) |
247 | { | 263 | { |
248 | m_Apis[api] = am.CreateApi(api); | 264 | m_Apis[api] = am.CreateApi(api); |
249 | m_Apis[api].Initialize(engine, part, ScriptTask); | 265 | m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); |
250 | } | 266 | } |
251 | 267 | ||
252 | try | 268 | try |
@@ -280,7 +296,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
280 | 296 | ||
281 | // // m_log.Debug("[Script] Script instance created"); | 297 | // // m_log.Debug("[Script] Script instance created"); |
282 | 298 | ||
283 | part.SetScriptEvents(ItemID, | 299 | Part.SetScriptEvents(ItemID, |
284 | (int)m_Script.GetStateEventFlags(State)); | 300 | (int)m_Script.GetStateEventFlags(State)); |
285 | } | 301 | } |
286 | catch (Exception e) | 302 | catch (Exception e) |
@@ -322,7 +338,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
322 | 338 | ||
323 | // m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName); | 339 | // m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName); |
324 | 340 | ||
325 | part.SetScriptEvents(ItemID, | 341 | Part.SetScriptEvents(ItemID, |
326 | (int)m_Script.GetStateEventFlags(State)); | 342 | (int)m_Script.GetStateEventFlags(State)); |
327 | 343 | ||
328 | if (!Running) | 344 | if (!Running) |
@@ -534,9 +550,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
534 | } | 550 | } |
535 | 551 | ||
536 | // Wait for the current event to complete. | 552 | // Wait for the current event to complete. |
537 | if (!m_InSelfDelete && workItem.Wait(new TimeSpan((long)timeout * 100000))) | 553 | if (!m_InSelfDelete) |
538 | { | 554 | { |
539 | return true; | 555 | if (!m_coopTermination) |
556 | { | ||
557 | // If we're not co-operative terminating then try and wait for the event to complete before stopping | ||
558 | if (workItem.Wait(new TimeSpan((long)timeout * 100000))) | ||
559 | return true; | ||
560 | } | ||
561 | else | ||
562 | { | ||
563 | m_log.DebugFormat( | ||
564 | "[SCRIPT INSTANCE]: Co-operatively stopping script {0} {1} in {2} {3}", | ||
565 | ScriptName, ItemID, PrimName, ObjectID); | ||
566 | |||
567 | // This will terminate the event on next handle check by the script. | ||
568 | m_coopSleepHandle.Set(); | ||
569 | |||
570 | // For now, we will wait forever since the event should always cleanly terminate once LSL loop | ||
571 | // checking is implemented. May want to allow a shorter timeout option later. | ||
572 | if (workItem.Wait(TimeSpan.MaxValue)) | ||
573 | { | ||
574 | m_log.DebugFormat( | ||
575 | "[SCRIPT INSTANCE]: Co-operatively stopped script {0} {1} in {2} {3}", | ||
576 | ScriptName, ItemID, PrimName, ObjectID); | ||
577 | |||
578 | return true; | ||
579 | } | ||
580 | } | ||
540 | } | 581 | } |
541 | 582 | ||
542 | lock (EventQueue) | 583 | lock (EventQueue) |
@@ -549,6 +590,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
549 | 590 | ||
550 | // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then | 591 | // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then |
551 | // forcibly abort the work item (this aborts the underlying thread). | 592 | // forcibly abort the work item (this aborts the underlying thread). |
593 | // Co-operative termination should never reach this point. | ||
552 | if (!m_InSelfDelete) | 594 | if (!m_InSelfDelete) |
553 | { | 595 | { |
554 | m_log.DebugFormat( | 596 | m_log.DebugFormat( |
@@ -796,7 +838,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
796 | m_InEvent = false; | 838 | m_InEvent = false; |
797 | m_CurrentEvent = String.Empty; | 839 | m_CurrentEvent = String.Empty; |
798 | 840 | ||
799 | if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException)) | 841 | if ((!(e is TargetInvocationException) |
842 | || (!(e.InnerException is SelfDeleteException) | ||
843 | && !(e.InnerException is ScriptDeleteException) | ||
844 | && !(e.InnerException is ScriptCoopStopException))) | ||
845 | && !(e is ThreadAbortException)) | ||
800 | { | 846 | { |
801 | try | 847 | try |
802 | { | 848 | { |
@@ -846,6 +892,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
846 | if (part != null) | 892 | if (part != null) |
847 | part.Inventory.RemoveInventoryItem(ItemID); | 893 | part.Inventory.RemoveInventoryItem(ItemID); |
848 | } | 894 | } |
895 | else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException)) | ||
896 | { | ||
897 | m_log.DebugFormat( | ||
898 | "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.", | ||
899 | PrimName, ScriptName, data.EventName, State); | ||
900 | } | ||
849 | } | 901 | } |
850 | } | 902 | } |
851 | } | 903 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index cb7291a..6dd6c17 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
93 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); | 94 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); |
94 | 95 | ||
95 | LSL_Api api = new LSL_Api(); | 96 | LSL_Api api = new LSL_Api(); |
96 | api.Initialize(m_engine, so1.RootPart, null); | 97 | api.Initialize(m_engine, so1.RootPart, null, null); |
97 | 98 | ||
98 | // Create a second object | 99 | // Create a second object |
99 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); | 100 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); |
@@ -126,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
126 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); | 127 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); |
127 | m_scene.AddSceneObject(so1); | 128 | m_scene.AddSceneObject(so1); |
128 | LSL_Api api = new LSL_Api(); | 129 | LSL_Api api = new LSL_Api(); |
129 | api.Initialize(m_engine, so1.RootPart, null); | 130 | api.Initialize(m_engine, so1.RootPart, null, null); |
130 | 131 | ||
131 | // Create an object embedded inside the first | 132 | // Create an object embedded inside the first |
132 | UUID itemId = TestHelpers.ParseTail(0x20); | 133 | UUID itemId = TestHelpers.ParseTail(0x20); |
@@ -136,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
136 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); | 137 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); |
137 | m_scene.AddSceneObject(so2); | 138 | m_scene.AddSceneObject(so2); |
138 | LSL_Api api2 = new LSL_Api(); | 139 | LSL_Api api2 = new LSL_Api(); |
139 | api2.Initialize(m_engine, so2.RootPart, null); | 140 | api2.Initialize(m_engine, so2.RootPart, null, null); |
140 | 141 | ||
141 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** | 142 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** |
142 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); | 143 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs index d9b17d7..5b57bbe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
45 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
46 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
@@ -104,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
104 | m_scene.AddSceneObject(grp2); | 105 | m_scene.AddSceneObject(grp2); |
105 | 106 | ||
106 | LSL_Api apiGrp1 = new LSL_Api(); | 107 | LSL_Api apiGrp1 = new LSL_Api(); |
107 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | 108 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); |
108 | 109 | ||
109 | apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); | 110 | apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); |
110 | 111 | ||
@@ -131,7 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
131 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 132 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
132 | 133 | ||
133 | LSL_Api apiGrp1 = new LSL_Api(); | 134 | LSL_Api apiGrp1 = new LSL_Api(); |
134 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | 135 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); |
135 | 136 | ||
136 | apiGrp1.llBreakLink(2); | 137 | apiGrp1.llBreakLink(2); |
137 | 138 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs index 98017d8..60de5cb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenSim.Region.ScriptEngine.Shared.Api; | 36 | using OpenSim.Region.ScriptEngine.Shared.Api; |
37 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
37 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 38 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
@@ -67,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
67 | engine.AddRegion(scene); | 68 | engine.AddRegion(scene); |
68 | 69 | ||
69 | m_lslApi = new LSL_Api(); | 70 | m_lslApi = new LSL_Api(); |
70 | m_lslApi.Initialize(engine, part, null); | 71 | m_lslApi.Initialize(engine, part, null, null); |
71 | } | 72 | } |
72 | 73 | ||
73 | [Test] | 74 | [Test] |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index c41d1e7..e97ae06 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 35 | using OpenSim.Region.ScriptEngine.Shared.Api; |
36 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
36 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 37 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | using System; | 39 | using System; |
@@ -66,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
66 | engine.AddRegion(scene); | 67 | engine.AddRegion(scene); |
67 | 68 | ||
68 | m_lslApi = new LSL_Api(); | 69 | m_lslApi = new LSL_Api(); |
69 | m_lslApi.Initialize(engine, part, null); | 70 | m_lslApi.Initialize(engine, part, null, null); |
70 | } | 71 | } |
71 | 72 | ||
72 | [Test] | 73 | [Test] |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 1381d2b..c88bad5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
93 | m_scene.AddSceneObject(so); | 94 | m_scene.AddSceneObject(so); |
94 | 95 | ||
95 | OSSL_Api osslApi = new OSSL_Api(); | 96 | OSSL_Api osslApi = new OSSL_Api(); |
96 | osslApi.Initialize(m_engine, part, null); | 97 | osslApi.Initialize(m_engine, part, null, null); |
97 | 98 | ||
98 | string notecardName = "appearanceNc"; | 99 | string notecardName = "appearanceNc"; |
99 | 100 | ||
@@ -134,7 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
134 | m_scene.AddSceneObject(so); | 135 | m_scene.AddSceneObject(so); |
135 | 136 | ||
136 | OSSL_Api osslApi = new OSSL_Api(); | 137 | OSSL_Api osslApi = new OSSL_Api(); |
137 | osslApi.Initialize(m_engine, part, null); | 138 | osslApi.Initialize(m_engine, part, null, null); |
138 | 139 | ||
139 | string notecardName = "appearanceNc"; | 140 | string notecardName = "appearanceNc"; |
140 | 141 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs index 5ed1f3d..b2803a1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.CoreModules.Framework.InventoryAccess; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -98,9 +99,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
98 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 99 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
99 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 100 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
100 | 101 | ||
101 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 102 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
102 | OSSL_Api osslApi = new OSSL_Api(); | 103 | OSSL_Api osslApi = new OSSL_Api(); |
103 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 104 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
104 | 105 | ||
105 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); | 106 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); |
106 | 107 | ||
@@ -144,9 +145,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
144 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 145 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
145 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 146 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
146 | 147 | ||
147 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 148 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
148 | OSSL_Api osslApi = new OSSL_Api(); | 149 | OSSL_Api osslApi = new OSSL_Api(); |
149 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 150 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
150 | 151 | ||
151 | // Create an object embedded inside the first | 152 | // Create an object embedded inside the first |
152 | TaskInventoryHelpers.AddNotecard( | 153 | TaskInventoryHelpers.AddNotecard( |
@@ -192,12 +193,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
192 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 193 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
193 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 194 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
194 | 195 | ||
195 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 196 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
196 | OSSL_Api osslApi = new OSSL_Api(); | 197 | OSSL_Api osslApi = new OSSL_Api(); |
197 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 198 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
198 | 199 | ||
199 | // Create an object embedded inside the first | 200 | // Create an object embedded inside the first |
200 | TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | 201 | TaskInventoryHelpers.AddSceneObject( |
202 | m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | ||
201 | 203 | ||
202 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); | 204 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); |
203 | 205 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index d6c82f1..1f8a6e5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Region.ScriptEngine.Shared; | 43 | using OpenSim.Region.ScriptEngine.Shared; |
44 | using OpenSim.Region.ScriptEngine.Shared.Api; | 44 | using OpenSim.Region.ScriptEngine.Shared.Api; |
45 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 46 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
46 | using OpenSim.Services.Interfaces; | 47 | using OpenSim.Services.Interfaces; |
47 | using OpenSim.Tests.Common; | 48 | using OpenSim.Tests.Common; |
@@ -99,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
99 | m_scene.AddSceneObject(so); | 100 | m_scene.AddSceneObject(so); |
100 | 101 | ||
101 | OSSL_Api osslApi = new OSSL_Api(); | 102 | OSSL_Api osslApi = new OSSL_Api(); |
102 | osslApi.Initialize(m_engine, part, null); | 103 | osslApi.Initialize(m_engine, part, null, null); |
103 | 104 | ||
104 | string notecardName = "appearanceNc"; | 105 | string notecardName = "appearanceNc"; |
105 | osslApi.osOwnerSaveAppearance(notecardName); | 106 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -125,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
125 | m_scene.AddSceneObject(so); | 126 | m_scene.AddSceneObject(so); |
126 | 127 | ||
127 | OSSL_Api osslApi = new OSSL_Api(); | 128 | OSSL_Api osslApi = new OSSL_Api(); |
128 | osslApi.Initialize(m_engine, so.RootPart, null); | 129 | osslApi.Initialize(m_engine, so.RootPart, null, null); |
129 | 130 | ||
130 | bool gotExpectedException = false; | 131 | bool gotExpectedException = false; |
131 | try | 132 | try |
@@ -160,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
160 | m_scene.AddSceneObject(so); | 161 | m_scene.AddSceneObject(so); |
161 | 162 | ||
162 | OSSL_Api osslApi = new OSSL_Api(); | 163 | OSSL_Api osslApi = new OSSL_Api(); |
163 | osslApi.Initialize(m_engine, part, null); | 164 | osslApi.Initialize(m_engine, part, null, null); |
164 | 165 | ||
165 | string notecardName = "appearanceNc"; | 166 | string notecardName = "appearanceNc"; |
166 | osslApi.osOwnerSaveAppearance(notecardName); | 167 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -194,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
194 | m_scene.AddSceneObject(so); | 195 | m_scene.AddSceneObject(so); |
195 | 196 | ||
196 | OSSL_Api osslApi = new OSSL_Api(); | 197 | OSSL_Api osslApi = new OSSL_Api(); |
197 | osslApi.Initialize(m_engine, part, null); | 198 | osslApi.Initialize(m_engine, part, null, null); |
198 | 199 | ||
199 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); | 200 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); |
200 | 201 | ||
@@ -232,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
232 | m_scene.AddSceneObject(so); | 233 | m_scene.AddSceneObject(so); |
233 | 234 | ||
234 | OSSL_Api osslApi = new OSSL_Api(); | 235 | OSSL_Api osslApi = new OSSL_Api(); |
235 | osslApi.Initialize(m_engine, part, null); | 236 | osslApi.Initialize(m_engine, part, null, null); |
236 | 237 | ||
237 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); | 238 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); |
238 | 239 | ||
@@ -284,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
284 | m_scene.AddSceneObject(otherSo); | 285 | m_scene.AddSceneObject(otherSo); |
285 | 286 | ||
286 | OSSL_Api osslApi = new OSSL_Api(); | 287 | OSSL_Api osslApi = new OSSL_Api(); |
287 | osslApi.Initialize(m_engine, part, null); | 288 | osslApi.Initialize(m_engine, part, null, null); |
288 | 289 | ||
289 | OSSL_Api otherOsslApi = new OSSL_Api(); | 290 | OSSL_Api otherOsslApi = new OSSL_Api(); |
290 | otherOsslApi.Initialize(m_engine, otherPart, null); | 291 | otherOsslApi.Initialize(m_engine, otherPart, null, null); |
291 | 292 | ||
292 | string notecardName = "appearanceNc"; | 293 | string notecardName = "appearanceNc"; |
293 | osslApi.osOwnerSaveAppearance(notecardName); | 294 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -331,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
331 | m_scene.AddSceneObject(so); | 332 | m_scene.AddSceneObject(so); |
332 | 333 | ||
333 | OSSL_Api osslApi = new OSSL_Api(); | 334 | OSSL_Api osslApi = new OSSL_Api(); |
334 | osslApi.Initialize(m_engine, part, null); | 335 | osslApi.Initialize(m_engine, part, null, null); |
335 | 336 | ||
336 | string notecardName = "appearanceNc"; | 337 | string notecardName = "appearanceNc"; |
337 | osslApi.osOwnerSaveAppearance(notecardName); | 338 | osslApi.osOwnerSaveAppearance(notecardName); |