From e3213065173e1408a138eb0bce0c9e936073b19b Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 14 Feb 2012 00:02:53 +0100 Subject: Prevent object loss and positioning outside the region with failed object sim crossings --- .../Framework/EntityTransfer/EntityTransferModule.cs | 10 +++++----- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++++ .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 +++++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f1399af..4b1c0bc 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1731,17 +1731,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); + // Need to turn off the physics flags, otherwise the object will continue to attempt to + // move out of the region creating an infinite loop of failed attempts to cross + grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false); + // We are going to move the object back to the old position so long as the old position // is in the region oldGroupPosition.X = Util.Clamp(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1); oldGroupPosition.Y = Util.Clamp(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1); oldGroupPosition.Z = Util.Clamp(oldGroupPosition.Z,1.0f,4096.0f); - grp.RootPart.GroupPosition = oldGroupPosition; - - // Need to turn off the physics flags, otherwise the object will continue to attempt to - // move out of the region creating an infinite loop of failed attempts to cross - grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false); + grp.AbsolutePosition = oldGroupPosition; grp.ScheduleGroupForFullUpdate(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 683aafc..877fe96 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -466,6 +466,10 @@ namespace OpenSim.Region.Framework.Scenes && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) { m_scene.CrossPrimGroupIntoNewRegion(val, this, true); + + if (IsDeleted) + return; + val = AbsolutePosition; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b0b1b16..1529140 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2188,7 +2188,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part.ParentGroup.RootPart == part) { SceneObjectGroup parent = part.ParentGroup; - parent.UpdateGroupPosition(new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z)); + Util.FireAndForget(delegate(object x) { + parent.UpdateGroupPosition(new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z)); + }); } else { @@ -7973,7 +7975,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part.ParentGroup.RootPart == part) { SceneObjectGroup parent = part.ParentGroup; - parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); + Util.FireAndForget(delegate(object x) { + parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); + }); } else { @@ -7990,7 +7994,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part.ParentGroup.RootPart == part) { SceneObjectGroup parent = part.ParentGroup; - parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); + Util.FireAndForget(delegate(object x) { + parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); + }); } else { -- cgit v1.1