fix HG tp detection

0.9.1.0-post-fixes
UbitUmarov 2019-01-18 18:42:14 +00:00
parent 04f44bcf99
commit fc075c61ed
1 changed files with 54 additions and 62 deletions

View File

@ -534,8 +534,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// region inside a varregion.
GridRegion reg = GetTeleportDestinationRegion(sp.Scene.GridService, sp.Scene.RegionInfo.ScopeID, regionHandle, ref position);
if (reg != null)
if( reg == null)
{
finalDestination = null;
// TP to a place that doesn't exist (anymore)
// Inform the viewer about that
sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to was not found");
// and set the map-tile to '(Offline)'
uint regX, regY;
Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
MapBlockData block = new MapBlockData();
block.X = (ushort)(regX);
block.Y = (ushort)(regY);
block.Access = (byte)SimAccess.Down; // == not there
List<MapBlockData> blocks = new List<MapBlockData>();
blocks.Add(block);
sp.ControllingClient.SendMapBlock(blocks, 0);
return;
}
string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
string reason = String.Empty;
@ -569,31 +590,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// This is it
//
DoTeleportInternal(sp, reg, finalDestination, position, lookAt, teleportFlags);
//
//
//
}
else
{
finalDestination = null;
// TP to a place that doesn't exist (anymore)
// Inform the viewer about that
sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore");
// and set the map-tile to '(Offline)'
uint regX, regY;
Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
MapBlockData block = new MapBlockData();
block.X = (ushort)(regX);
block.Y = (ushort)(regY);
block.Access = (byte)SimAccess.Down; // == not there
List<MapBlockData> blocks = new List<MapBlockData>();
blocks.Add(block);
sp.ControllingClient.SendMapBlock(blocks, 0);
}
}
// The teleport address could be an address in a subregion of a larger varregion.
@ -781,7 +777,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else if (sp.Flying)
teleportFlags |= (uint)TeleportFlags.IsFlying;
sp.IsInLocalTransit = finalDestination.RegionLocY != 0; // HG
sp.IsInLocalTransit = reg.RegionLocY != 0; // HG
sp.IsInTransit = true;
@ -818,7 +814,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
int newSizeX = finalDestination.RegionSizeX;
int newSizeY = finalDestination.RegionSizeY;
bool OutSideViewRange = NeedsNewAgent(sp.RegionViewDistance, oldRegionX, newRegionX, oldRegionY, newRegionY,
bool OutSideViewRange = !sp.IsInLocalTransit || NeedsNewAgent(sp.RegionViewDistance, oldRegionX, newRegionX, oldRegionY, newRegionY,
oldSizeX, oldSizeY, newSizeX, newSizeY);
if (OutSideViewRange)
@ -1046,17 +1042,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
/*
// TODO: This may be 0.6. Check if still needed
// For backwards compatibility
if (version == 0f)
{
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
}
*/
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
if(logout)
@ -1100,7 +1085,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
List<ulong> childRegionsToClose = null;
// HG needs a deeper change
bool localclose = (ctx.OutboundVersion < 0.7f || ((teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0));
bool localclose = (ctx.OutboundVersion < 0.7f || !sp.IsInLocalTransit);
if (localclose)
{
childRegionsToClose = sp.GetChildAgentsToClose(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY);
@ -2122,6 +2107,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
cagents.Add(agent);
}
List<ulong> toclose;
// previousRegionNeighbourHandles now contains regions to forget
if (previousRegionNeighbourHandles.Count > 0)
{
@ -2133,11 +2119,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if(notHG) // does not work on HG
{
List<ulong> toclose = new List<ulong>(previousRegionNeighbourHandles);
sp.CloseChildAgents(toclose);
toclose = new List<ulong>(previousRegionNeighbourHandles);
// sp.CloseChildAgents(toclose);
}
else
toclose = new List<ulong>();
}
else
toclose = new List<ulong>();
/// Update all child agent with everyone's seeds
// foreach (AgentCircuitData a in cagents)
// a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
@ -2148,7 +2137,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.KnownRegions = seeds;
sp.SetNeighbourRegionSizeInfo(neighbours);
if (neighbours.Count > 0)
if (neighbours.Count > 0 || toclose.Count > 0)
{
AgentPosition agentpos = new AgentPosition();
agentpos.AgentID = new UUID(sp.UUID.Guid);
@ -2166,10 +2155,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Util.FireAndForget(delegate
{
Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
Thread.Sleep(500); // the original delay that was at InformClientOfNeighbourAsync start
int count = 0;
IPEndPoint ipe;
if(toclose.Count > 0)
sp.CloseChildAgents(toclose);
foreach (GridRegion neighbour in neighbours)
{
ulong handler = neighbour.RegionHandle;