diff options
author | BlueWall | 2013-01-15 10:08:27 -0500 |
---|---|---|
committer | BlueWall | 2013-01-15 10:08:27 -0500 |
commit | f54b398540698e6e09022fe77b6405624b532f5c (patch) | |
tree | 74581e7176d06dd8e2bff43720a3033ccfe6df0e /OpenSim/Region/ScriptEngine | |
parent | Add Json-Rpc 2.0 To Registered Handlers (diff) | |
parent | BulletSim: tweeks to improve hover. (diff) | |
download | opensim-SC-f54b398540698e6e09022fe77b6405624b532f5c.zip opensim-SC-f54b398540698e6e09022fe77b6405624b532f5c.tar.gz opensim-SC-f54b398540698e6e09022fe77b6405624b532f5c.tar.bz2 opensim-SC-f54b398540698e6e09022fe77b6405624b532f5c.tar.xz |
Merge branch 'master' of /home/opensim/var/repo/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 109 insertions, 83 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 33c02ef..958a448 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -245,11 +245,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
245 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | 245 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); |
246 | } | 246 | } |
247 | 247 | ||
248 | // Returns of the function is allowed. Throws a script exception if not allowed. | ||
248 | public void CheckThreatLevel(ThreatLevel level, string function) | 249 | public void CheckThreatLevel(ThreatLevel level, string function) |
249 | { | 250 | { |
250 | if (!m_OSFunctionsEnabled) | 251 | if (!m_OSFunctionsEnabled) |
251 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws | 252 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws |
252 | 253 | ||
254 | string reasonWhyNot = CheckThreatLevelTest(level, function); | ||
255 | if (!String.IsNullOrEmpty(reasonWhyNot)) | ||
256 | { | ||
257 | OSSLError(reasonWhyNot); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | // Check to see if function is allowed. Returns an empty string if function permitted | ||
262 | // or a string explaining why this function can't be used. | ||
263 | private string CheckThreatLevelTest(ThreatLevel level, string function) | ||
264 | { | ||
253 | if (!m_FunctionPerms.ContainsKey(function)) | 265 | if (!m_FunctionPerms.ContainsKey(function)) |
254 | { | 266 | { |
255 | FunctionPerms perms = new FunctionPerms(); | 267 | FunctionPerms perms = new FunctionPerms(); |
@@ -329,10 +341,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
329 | { | 341 | { |
330 | // Allow / disallow by threat level | 342 | // Allow / disallow by threat level |
331 | if (level > m_MaxThreatLevel) | 343 | if (level > m_MaxThreatLevel) |
332 | OSSLError( | 344 | return |
333 | String.Format( | 345 | String.Format( |
334 | "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", | 346 | "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", |
335 | function, m_MaxThreatLevel, level)); | 347 | function, m_MaxThreatLevel, level); |
336 | } | 348 | } |
337 | else | 349 | else |
338 | { | 350 | { |
@@ -342,7 +354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
342 | if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) | 354 | if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) |
343 | { | 355 | { |
344 | // prim owner is in the list of allowed owners | 356 | // prim owner is in the list of allowed owners |
345 | return; | 357 | return String.Empty; |
346 | } | 358 | } |
347 | 359 | ||
348 | UUID ownerID = m_item.OwnerID; | 360 | UUID ownerID = m_item.OwnerID; |
@@ -354,7 +366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
354 | 366 | ||
355 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) | 367 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) |
356 | { | 368 | { |
357 | return; | 369 | return String.Empty; |
358 | } | 370 | } |
359 | } | 371 | } |
360 | 372 | ||
@@ -365,7 +377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
365 | 377 | ||
366 | if (land.LandData.OwnerID == ownerID) | 378 | if (land.LandData.OwnerID == ownerID) |
367 | { | 379 | { |
368 | return; | 380 | return String.Empty; |
369 | } | 381 | } |
370 | } | 382 | } |
371 | 383 | ||
@@ -375,7 +387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
375 | //Only Estate Managers may use the function | 387 | //Only Estate Managers may use the function |
376 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | 388 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) |
377 | { | 389 | { |
378 | return; | 390 | return String.Empty; |
379 | } | 391 | } |
380 | } | 392 | } |
381 | 393 | ||
@@ -384,25 +396,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
384 | { | 396 | { |
385 | if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) | 397 | if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) |
386 | { | 398 | { |
387 | return; | 399 | return String.Empty; |
388 | } | 400 | } |
389 | } | 401 | } |
390 | 402 | ||
391 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) | 403 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) |
392 | OSSLError( | 404 | return( |
393 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", | 405 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", |
394 | function)); | 406 | function)); |
395 | 407 | ||
396 | if (m_item.CreatorID != ownerID) | 408 | if (m_item.CreatorID != ownerID) |
397 | { | 409 | { |
398 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) | 410 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) |
399 | OSSLError( | 411 | return String.Format("{0} permission denied. Script permissions error.", function); |
400 | String.Format("{0} permission denied. Script permissions error.", | ||
401 | function)); | ||
402 | 412 | ||
403 | } | 413 | } |
404 | } | 414 | } |
405 | } | 415 | } |
416 | return String.Empty; | ||
406 | } | 417 | } |
407 | 418 | ||
408 | internal void OSSLDeprecated(string function, string replacement) | 419 | internal void OSSLDeprecated(string function, string replacement) |
@@ -1558,6 +1569,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1558 | } | 1569 | } |
1559 | } | 1570 | } |
1560 | 1571 | ||
1572 | public string osGetPhysicsEngineType() | ||
1573 | { | ||
1574 | // High because it can be used to target attacks to known weaknesses | ||
1575 | // This would allow a new class of griefer scripts that don't even | ||
1576 | // require their user to know what they are doing (see script | ||
1577 | // kiddie) | ||
1578 | // Because it would be nice if scripts didn't blow up if the information | ||
1579 | // about the physics engine, this function returns an empty string if | ||
1580 | // the user does not have permission to see it. This as opposed to | ||
1581 | // throwing an exception. | ||
1582 | m_host.AddScriptLPS(1); | ||
1583 | string ret = String.Empty; | ||
1584 | if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType"))) | ||
1585 | { | ||
1586 | if (m_ScriptEngine.World.PhysicsScene != null) | ||
1587 | { | ||
1588 | ret = m_ScriptEngine.World.PhysicsScene.EngineType; | ||
1589 | // An old physics engine might have an uninitialized engine type | ||
1590 | if (ret == null) | ||
1591 | ret = "unknown"; | ||
1592 | } | ||
1593 | } | ||
1594 | |||
1595 | return ret; | ||
1596 | } | ||
1597 | |||
1561 | public string osGetSimulatorVersion() | 1598 | public string osGetSimulatorVersion() |
1562 | { | 1599 | { |
1563 | // High because it can be used to target attacks to known weaknesses | 1600 | // High because it can be used to target attacks to known weaknesses |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index cdd9ea8..51d0581 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -259,6 +259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
259 | 259 | ||
260 | string osGetScriptEngineName(); | 260 | string osGetScriptEngineName(); |
261 | string osGetSimulatorVersion(); | 261 | string osGetSimulatorVersion(); |
262 | string osGetPhysicsEngineType(); | ||
262 | Object osParseJSONNew(string JSON); | 263 | Object osParseJSONNew(string JSON); |
263 | Hashtable osParseJSON(string JSON); | 264 | Hashtable osParseJSON(string JSON); |
264 | 265 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index afa9ae0..c9902e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -420,6 +420,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
420 | return m_OSSL_Functions.osGetScriptEngineName(); | 420 | return m_OSSL_Functions.osGetScriptEngineName(); |
421 | } | 421 | } |
422 | 422 | ||
423 | public string osGetPhysicsEngineType() | ||
424 | { | ||
425 | return m_OSSL_Functions.osGetPhysicsEngineType(); | ||
426 | } | ||
427 | |||
423 | public string osGetSimulatorVersion() | 428 | public string osGetSimulatorVersion() |
424 | { | 429 | { |
425 | return m_OSSL_Functions.osGetSimulatorVersion(); | 430 | return m_OSSL_Functions.osGetSimulatorVersion(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 01a5e34..f172216 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -157,19 +157,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
157 | 157 | ||
158 | public UUID AppDomain { get; set; } | 158 | public UUID AppDomain { get; set; } |
159 | 159 | ||
160 | /// <summary> | ||
161 | /// Scene part in which this script instance is contained. | ||
162 | /// </summary> | ||
163 | public SceneObjectPart Part { get; private set; } | ||
164 | |||
160 | public string PrimName { get; private set; } | 165 | public string PrimName { get; private set; } |
161 | 166 | ||
162 | public string ScriptName { get; private set; } | 167 | public string ScriptName { get; private set; } |
163 | 168 | ||
164 | public UUID ItemID { get; private set; } | 169 | public UUID ItemID { get; private set; } |
165 | 170 | ||
166 | public UUID ObjectID { get; private set; } | 171 | public UUID ObjectID { get { return Part.UUID; } } |
167 | 172 | ||
168 | public uint LocalID { get; private set; } | 173 | public uint LocalID { get { return Part.LocalId; } } |
169 | 174 | ||
170 | public UUID RootObjectID { get; private set; } | 175 | public UUID RootObjectID { get { return Part.ParentGroup.UUID; } } |
171 | 176 | ||
172 | public uint RootLocalID { get; private set; } | 177 | public uint RootLocalID { get { return Part.ParentGroup.LocalId; } } |
173 | 178 | ||
174 | public UUID AssetID { get; private set; } | 179 | public UUID AssetID { get; private set; } |
175 | 180 | ||
@@ -214,10 +219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
214 | EventQueue = new Queue(32); | 219 | EventQueue = new Queue(32); |
215 | 220 | ||
216 | Engine = engine; | 221 | Engine = engine; |
217 | LocalID = part.LocalId; | 222 | Part = part; |
218 | ObjectID = part.UUID; | ||
219 | RootLocalID = part.ParentGroup.LocalId; | ||
220 | RootObjectID = part.ParentGroup.UUID; | ||
221 | ItemID = itemID; | 223 | ItemID = itemID; |
222 | AssetID = assetID; | 224 | AssetID = assetID; |
223 | PrimName = primName; | 225 | PrimName = primName; |
@@ -227,17 +229,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
227 | m_MaxScriptQueue = maxScriptQueue; | 229 | m_MaxScriptQueue = maxScriptQueue; |
228 | m_stateSource = stateSource; | 230 | m_stateSource = stateSource; |
229 | m_postOnRez = postOnRez; | 231 | m_postOnRez = postOnRez; |
230 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; | 232 | m_AttachedAvatar = Part.ParentGroup.AttachedAvatar; |
231 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; | 233 | m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID; |
232 | 234 | ||
233 | if (part != null) | 235 | lock (Part.TaskInventory) |
234 | { | 236 | { |
235 | lock (part.TaskInventory) | 237 | if (Part.TaskInventory.ContainsKey(ItemID)) |
236 | { | 238 | { |
237 | if (part.TaskInventory.ContainsKey(ItemID)) | 239 | ScriptTask = Part.TaskInventory[ItemID]; |
238 | { | ||
239 | ScriptTask = part.TaskInventory[ItemID]; | ||
240 | } | ||
241 | } | 240 | } |
242 | } | 241 | } |
243 | 242 | ||
@@ -322,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
322 | 321 | ||
323 | // m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName); | 322 | // m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName); |
324 | 323 | ||
325 | part.SetScriptEvents(ItemID, | 324 | Part.SetScriptEvents(ItemID, |
326 | (int)m_Script.GetStateEventFlags(State)); | 325 | (int)m_Script.GetStateEventFlags(State)); |
327 | 326 | ||
328 | if (!Running) | 327 | if (!Running) |
@@ -418,33 +417,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
418 | PostEvent(new EventParams("attach", | 417 | PostEvent(new EventParams("attach", |
419 | new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0])); | 418 | new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0])); |
420 | } | 419 | } |
421 | |||
422 | } | 420 | } |
423 | } | 421 | } |
424 | 422 | ||
425 | private void ReleaseControls() | 423 | private void ReleaseControls() |
426 | { | 424 | { |
427 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | 425 | int permsMask; |
428 | 426 | UUID permsGranter; | |
429 | if (part != null) | 427 | lock (Part.TaskInventory) |
430 | { | 428 | { |
431 | int permsMask; | 429 | if (!Part.TaskInventory.ContainsKey(ItemID)) |
432 | UUID permsGranter; | 430 | return; |
433 | lock (part.TaskInventory) | ||
434 | { | ||
435 | if (!part.TaskInventory.ContainsKey(ItemID)) | ||
436 | return; | ||
437 | 431 | ||
438 | permsGranter = part.TaskInventory[ItemID].PermsGranter; | 432 | permsGranter = Part.TaskInventory[ItemID].PermsGranter; |
439 | permsMask = part.TaskInventory[ItemID].PermsMask; | 433 | permsMask = Part.TaskInventory[ItemID].PermsMask; |
440 | } | 434 | } |
441 | 435 | ||
442 | if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 436 | if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
443 | { | 437 | { |
444 | ScenePresence presence = Engine.World.GetScenePresence(permsGranter); | 438 | ScenePresence presence = Engine.World.GetScenePresence(permsGranter); |
445 | if (presence != null) | 439 | if (presence != null) |
446 | presence.UnRegisterControlEventsToScript(LocalID, ItemID); | 440 | presence.UnRegisterControlEventsToScript(LocalID, ItemID); |
447 | } | ||
448 | } | 441 | } |
449 | } | 442 | } |
450 | 443 | ||
@@ -706,19 +699,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
706 | m_CollisionInQueue = false; | 699 | m_CollisionInQueue = false; |
707 | } | 700 | } |
708 | 701 | ||
709 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | ||
710 | |||
711 | if (DebugLevel >= 2) | 702 | if (DebugLevel >= 2) |
712 | m_log.DebugFormat( | 703 | m_log.DebugFormat( |
713 | "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", | 704 | "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", |
714 | data.EventName, | 705 | data.EventName, |
715 | ScriptName, | 706 | ScriptName, |
716 | part.Name, | 707 | Part.Name, |
717 | part.LocalId, | 708 | Part.LocalId, |
718 | part.ParentGroup.Name, | 709 | Part.ParentGroup.Name, |
719 | part.ParentGroup.UUID, | 710 | Part.ParentGroup.UUID, |
720 | part.AbsolutePosition, | 711 | Part.AbsolutePosition, |
721 | part.ParentGroup.Scene.Name); | 712 | Part.ParentGroup.Scene.Name); |
722 | 713 | ||
723 | m_DetectParams = data.DetectParams; | 714 | m_DetectParams = data.DetectParams; |
724 | 715 | ||
@@ -731,21 +722,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
731 | "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", | 722 | "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", |
732 | State, | 723 | State, |
733 | ScriptName, | 724 | ScriptName, |
734 | part.Name, | 725 | Part.Name, |
735 | part.LocalId, | 726 | Part.LocalId, |
736 | part.ParentGroup.Name, | 727 | Part.ParentGroup.Name, |
737 | part.ParentGroup.UUID, | 728 | Part.ParentGroup.UUID, |
738 | part.AbsolutePosition, | 729 | Part.AbsolutePosition, |
739 | part.ParentGroup.Scene.Name); | 730 | Part.ParentGroup.Scene.Name); |
740 | 731 | ||
741 | AsyncCommandManager.RemoveScript(Engine, | 732 | AsyncCommandManager.RemoveScript(Engine, |
742 | LocalID, ItemID); | 733 | LocalID, ItemID); |
743 | 734 | ||
744 | if (part != null) | 735 | Part.SetScriptEvents(ItemID, (int)m_Script.GetStateEventFlags(State)); |
745 | { | ||
746 | part.SetScriptEvents(ItemID, | ||
747 | (int)m_Script.GetStateEventFlags(State)); | ||
748 | } | ||
749 | } | 736 | } |
750 | else | 737 | else |
751 | { | 738 | { |
@@ -804,17 +791,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
804 | text = text.Substring(0, 1000); | 791 | text = text.Substring(0, 1000); |
805 | Engine.World.SimChat(Utils.StringToBytes(text), | 792 | Engine.World.SimChat(Utils.StringToBytes(text), |
806 | ChatTypeEnum.DebugChannel, 2147483647, | 793 | ChatTypeEnum.DebugChannel, 2147483647, |
807 | part.AbsolutePosition, | 794 | Part.AbsolutePosition, |
808 | part.Name, part.UUID, false); | 795 | Part.Name, Part.UUID, false); |
809 | 796 | ||
810 | 797 | ||
811 | m_log.DebugFormat( | 798 | m_log.DebugFormat( |
812 | "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}", | 799 | "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}", |
813 | ScriptName, | 800 | ScriptName, |
814 | PrimName, | 801 | PrimName, |
815 | part.UUID, | 802 | Part.UUID, |
816 | part.AbsolutePosition, | 803 | Part.AbsolutePosition, |
817 | part.ParentGroup.Scene.Name, | 804 | Part.ParentGroup.Scene.Name, |
818 | text.Replace("\n", "\\n"), | 805 | text.Replace("\n", "\\n"), |
819 | e.InnerException); | 806 | e.InnerException); |
820 | } | 807 | } |
@@ -834,14 +821,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
834 | else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) | 821 | else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) |
835 | { | 822 | { |
836 | m_InSelfDelete = true; | 823 | m_InSelfDelete = true; |
837 | if (part != null) | 824 | Engine.World.DeleteSceneObject(Part.ParentGroup, false); |
838 | Engine.World.DeleteSceneObject(part.ParentGroup, false); | ||
839 | } | 825 | } |
840 | else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) | 826 | else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) |
841 | { | 827 | { |
842 | m_InSelfDelete = true; | 828 | m_InSelfDelete = true; |
843 | if (part != null) | 829 | Part.Inventory.RemoveInventoryItem(ItemID); |
844 | part.Inventory.RemoveInventoryItem(ItemID); | ||
845 | } | 830 | } |
846 | } | 831 | } |
847 | } | 832 | } |
@@ -888,15 +873,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
888 | ReleaseControls(); | 873 | ReleaseControls(); |
889 | 874 | ||
890 | Stop(timeout); | 875 | Stop(timeout); |
891 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | 876 | Part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; |
892 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; | 877 | Part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; |
893 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; | ||
894 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); | 878 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); |
895 | EventQueue.Clear(); | 879 | EventQueue.Clear(); |
896 | m_Script.ResetVars(); | 880 | m_Script.ResetVars(); |
897 | State = "default"; | 881 | State = "default"; |
898 | 882 | ||
899 | part.SetScriptEvents(ItemID, | 883 | Part.SetScriptEvents(ItemID, |
900 | (int)m_Script.GetStateEventFlags(State)); | 884 | (int)m_Script.GetStateEventFlags(State)); |
901 | if (running) | 885 | if (running) |
902 | Start(); | 886 | Start(); |
@@ -913,16 +897,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
913 | ReleaseControls(); | 897 | ReleaseControls(); |
914 | 898 | ||
915 | m_Script.ResetVars(); | 899 | m_Script.ResetVars(); |
916 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | 900 | Part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; |
917 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; | 901 | Part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; |
918 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; | ||
919 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); | 902 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); |
920 | 903 | ||
921 | EventQueue.Clear(); | 904 | EventQueue.Clear(); |
922 | m_Script.ResetVars(); | 905 | m_Script.ResetVars(); |
923 | State = "default"; | 906 | State = "default"; |
924 | 907 | ||
925 | part.SetScriptEvents(ItemID, | 908 | Part.SetScriptEvents(ItemID, |
926 | (int)m_Script.GetStateEventFlags(State)); | 909 | (int)m_Script.GetStateEventFlags(State)); |
927 | 910 | ||
928 | if (m_CurrentEvent != "state_entry") | 911 | if (m_CurrentEvent != "state_entry") |