From 456c89a7a30c5c2ec2e228beb717b9c611106364 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 22 Dec 2011 16:59:51 -0800 Subject: Fixes some problems with objects that attempt to cross a region boundary into a region that does not exist. This is particularly problematic for physical objects where the velocity continues to move them out of the region causing an infinite number of failed region crossings. The patch forces an object that fails a crossing to be non-physical and moves it back into the starting region. --- .../EntityTransfer/EntityTransferModule.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b9d5d32..098e5cb 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1705,6 +1705,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer uint x = 0, y = 0; Utils.LongToUInts(newRegionHandle, out x, out y); GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); + + if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent)) + { + m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); + + // 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.ScheduleGroupForFullUpdate(); + } + + + + + if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) { grp.RootPart.GroupPosition = oldGroupPosition; -- cgit v1.1