From 6600282fe99fc1a3c7ff7b80f8aedbac8fe69015 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Oct 2014 10:08:13 +0000 Subject: another try to prevent double crossing --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 98 ++++++++++------------ 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9f2a689..b9b5621 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -530,77 +530,71 @@ namespace OpenSim.Region.Framework.Scenes { Vector3 val = value; - if (Scene != null && !inTransit) + if (!IsAttachmentCheckFull() && !Scene.LoadingPrims && + ( Scene.TestBorderCross(val, Cardinals.E) || + Scene.TestBorderCross(val, Cardinals.W) || + Scene.TestBorderCross(val, Cardinals.N) || + Scene.TestBorderCross(val, Cardinals.S)) + ) { - if ( - // (Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) - // || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) - // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) - // || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) - // Experimental change for better border crossings. - // The commented out original lines above would, it seems, trigger - // a border crossing a little early or late depending on which - // direction the object was moving. - (Scene.TestBorderCross(val, Cardinals.E) - || Scene.TestBorderCross(val, Cardinals.W) - || Scene.TestBorderCross(val, Cardinals.N) - || Scene.TestBorderCross(val, Cardinals.S)) - && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) + lock (m_parts) { - inTransit = true; - SOGCrossDelegate d = CrossAsync; - d.BeginInvoke(this, val, CrossAsyncCompleted, d); + if (!inTransit) + { + inTransit = true; + SOGCrossDelegate d = CrossAsync; + d.BeginInvoke(this, val, CrossAsyncCompleted, d); + } return; } + } - - if (RootPart.GetStatusSandbox()) + if (RootPart.GetStatusSandbox()) + { + if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) { - if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) - { - RootPart.ScriptSetPhysicsStatus(false); + RootPart.ScriptSetPhysicsStatus(false); - if (Scene != null) - Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), - ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); + if (Scene != null) + Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), + ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); - return; - } + return; } + } - bool triggerScriptEvent = m_rootPart.GroupPosition != val; - if (m_dupeInProgress || IsDeleted) - triggerScriptEvent = false; + bool triggerScriptEvent = m_rootPart.GroupPosition != val; + if (m_dupeInProgress || IsDeleted) + triggerScriptEvent = false; - m_rootPart.GroupPosition = val; + m_rootPart.GroupPosition = val; - // Restuff the new GroupPosition into each child SOP of the linkset. - // this is needed because physics may not have linksets but just loose SOPs in world + // Restuff the new GroupPosition into each child SOP of the linkset. + // this is needed because physics may not have linksets but just loose SOPs in world - SceneObjectPart[] parts = m_parts.GetArray(); + SceneObjectPart[] parts = m_parts.GetArray(); - foreach (SceneObjectPart part in parts) - { - if (part != m_rootPart) - part.GroupPosition = val; - } + foreach (SceneObjectPart part in parts) + { + if (part != m_rootPart) + part.GroupPosition = val; + } - foreach (ScenePresence av in m_linkedAvatars) - { - av.sitSOGmoved(); - } + foreach (ScenePresence av in m_linkedAvatars) + { + av.sitSOGmoved(); + } - // now that position is changed tell it to scripts - if (triggerScriptEvent) + // now that position is changed tell it to scripts + if (triggerScriptEvent) + { + foreach (SceneObjectPart part in parts) { - foreach (SceneObjectPart part in parts) - { - part.TriggerScriptChangedEvent(Changed.POSITION); - } + part.TriggerScriptChangedEvent(Changed.POSITION); } - - Scene.EventManager.TriggerParcelPrimCountTainted(); } + + Scene.EventManager.TriggerParcelPrimCountTainted(); } } -- cgit v1.1