diff options
author | UbitUmarov | 2019-01-18 18:42:14 +0000 |
---|---|---|
committer | UbitUmarov | 2019-01-18 18:42:14 +0000 |
commit | fc075c61edbe3dee3a01c3ab8f5d2d361003a460 (patch) | |
tree | 3a74dd1ad11a650da704216f7b9db6ea0858b434 /OpenSim/Region/CoreModules/Framework/EntityTransfer | |
parent | mantis 8442 more changes to alpha blending (mono does not like last) (diff) | |
download | opensim-SC-fc075c61edbe3dee3a01c3ab8f5d2d361003a460.zip opensim-SC-fc075c61edbe3dee3a01c3ab8f5d2d361003a460.tar.gz opensim-SC-fc075c61edbe3dee3a01c3ab8f5d2d361003a460.tar.bz2 opensim-SC-fc075c61edbe3dee3a01c3ab8f5d2d361003a460.tar.xz |
fix HG tp detection
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 116 |
1 files changed, 54 insertions, 62 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 2f2034f..53061a4 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -534,52 +534,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
534 | // region inside a varregion. | 534 | // region inside a varregion. |
535 | GridRegion reg = GetTeleportDestinationRegion(sp.Scene.GridService, sp.Scene.RegionInfo.ScopeID, regionHandle, ref position); | 535 | GridRegion reg = GetTeleportDestinationRegion(sp.Scene.GridService, sp.Scene.RegionInfo.ScopeID, regionHandle, ref position); |
536 | 536 | ||
537 | if (reg != null) | 537 | if( reg == null) |
538 | { | ||
539 | string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId); | ||
540 | |||
541 | string reason = String.Empty; | ||
542 | finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out reason); | ||
543 | |||
544 | if (finalDestination == null) | ||
545 | { | ||
546 | m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}", | ||
547 | LogHeader, sp.Name, sp.UUID, reason); | ||
548 | |||
549 | sp.ControllingClient.SendTeleportFailed(reason); | ||
550 | return; | ||
551 | } | ||
552 | |||
553 | // Check that these are not the same coordinates | ||
554 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | ||
555 | finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY) | ||
556 | { | ||
557 | // Can't do. Viewer crashes | ||
558 | sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again."); | ||
559 | return; | ||
560 | } | ||
561 | |||
562 | if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason)) | ||
563 | { | ||
564 | sp.ControllingClient.SendTeleportFailed(reason); | ||
565 | return; | ||
566 | } | ||
567 | |||
568 | // | ||
569 | // This is it | ||
570 | // | ||
571 | DoTeleportInternal(sp, reg, finalDestination, position, lookAt, teleportFlags); | ||
572 | // | ||
573 | // | ||
574 | // | ||
575 | } | ||
576 | else | ||
577 | { | 538 | { |
578 | finalDestination = null; | 539 | finalDestination = null; |
579 | 540 | ||
580 | // TP to a place that doesn't exist (anymore) | 541 | // TP to a place that doesn't exist (anymore) |
581 | // Inform the viewer about that | 542 | // Inform the viewer about that |
582 | sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | 543 | sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to was not found"); |
583 | 544 | ||
584 | // and set the map-tile to '(Offline)' | 545 | // and set the map-tile to '(Offline)' |
585 | uint regX, regY; | 546 | uint regX, regY; |
@@ -593,7 +554,42 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
593 | List<MapBlockData> blocks = new List<MapBlockData>(); | 554 | List<MapBlockData> blocks = new List<MapBlockData>(); |
594 | blocks.Add(block); | 555 | blocks.Add(block); |
595 | sp.ControllingClient.SendMapBlock(blocks, 0); | 556 | sp.ControllingClient.SendMapBlock(blocks, 0); |
557 | return; | ||
558 | } | ||
559 | |||
560 | string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId); | ||
561 | |||
562 | string reason = String.Empty; | ||
563 | finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out reason); | ||
564 | |||
565 | if (finalDestination == null) | ||
566 | { | ||
567 | m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}", | ||
568 | LogHeader, sp.Name, sp.UUID, reason); | ||
569 | |||
570 | sp.ControllingClient.SendTeleportFailed(reason); | ||
571 | return; | ||
596 | } | 572 | } |
573 | |||
574 | // Check that these are not the same coordinates | ||
575 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | ||
576 | finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY) | ||
577 | { | ||
578 | // Can't do. Viewer crashes | ||
579 | sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again."); | ||
580 | return; | ||
581 | } | ||
582 | |||
583 | if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason)) | ||
584 | { | ||
585 | sp.ControllingClient.SendTeleportFailed(reason); | ||
586 | return; | ||
587 | } | ||
588 | |||
589 | // | ||
590 | // This is it | ||
591 | // | ||
592 | DoTeleportInternal(sp, reg, finalDestination, position, lookAt, teleportFlags); | ||
597 | } | 593 | } |
598 | 594 | ||
599 | // The teleport address could be an address in a subregion of a larger varregion. | 595 | // The teleport address could be an address in a subregion of a larger varregion. |
@@ -781,7 +777,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
781 | else if (sp.Flying) | 777 | else if (sp.Flying) |
782 | teleportFlags |= (uint)TeleportFlags.IsFlying; | 778 | teleportFlags |= (uint)TeleportFlags.IsFlying; |
783 | 779 | ||
784 | sp.IsInLocalTransit = finalDestination.RegionLocY != 0; // HG | 780 | sp.IsInLocalTransit = reg.RegionLocY != 0; // HG |
785 | sp.IsInTransit = true; | 781 | sp.IsInTransit = true; |
786 | 782 | ||
787 | 783 | ||
@@ -818,7 +814,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
818 | int newSizeX = finalDestination.RegionSizeX; | 814 | int newSizeX = finalDestination.RegionSizeX; |
819 | int newSizeY = finalDestination.RegionSizeY; | 815 | int newSizeY = finalDestination.RegionSizeY; |
820 | 816 | ||
821 | bool OutSideViewRange = NeedsNewAgent(sp.RegionViewDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, | 817 | bool OutSideViewRange = !sp.IsInLocalTransit || NeedsNewAgent(sp.RegionViewDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, |
822 | oldSizeX, oldSizeY, newSizeX, newSizeY); | 818 | oldSizeX, oldSizeY, newSizeX, newSizeY); |
823 | 819 | ||
824 | if (OutSideViewRange) | 820 | if (OutSideViewRange) |
@@ -1046,17 +1042,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1046 | return; | 1042 | return; |
1047 | } | 1043 | } |
1048 | 1044 | ||
1049 | /* | ||
1050 | // TODO: This may be 0.6. Check if still needed | ||
1051 | // For backwards compatibility | ||
1052 | if (version == 0f) | ||
1053 | { | ||
1054 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
1055 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | ||
1056 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
1057 | } | ||
1058 | */ | ||
1059 | |||
1060 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 1045 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
1061 | 1046 | ||
1062 | if(logout) | 1047 | if(logout) |
@@ -1100,7 +1085,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1100 | 1085 | ||
1101 | List<ulong> childRegionsToClose = null; | 1086 | List<ulong> childRegionsToClose = null; |
1102 | // HG needs a deeper change | 1087 | // HG needs a deeper change |
1103 | bool localclose = (ctx.OutboundVersion < 0.7f || ((teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)); | 1088 | bool localclose = (ctx.OutboundVersion < 0.7f || !sp.IsInLocalTransit); |
1104 | if (localclose) | 1089 | if (localclose) |
1105 | { | 1090 | { |
1106 | childRegionsToClose = sp.GetChildAgentsToClose(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); | 1091 | childRegionsToClose = sp.GetChildAgentsToClose(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); |
@@ -2122,6 +2107,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2122 | cagents.Add(agent); | 2107 | cagents.Add(agent); |
2123 | } | 2108 | } |
2124 | 2109 | ||
2110 | List<ulong> toclose; | ||
2125 | // previousRegionNeighbourHandles now contains regions to forget | 2111 | // previousRegionNeighbourHandles now contains regions to forget |
2126 | if (previousRegionNeighbourHandles.Count > 0) | 2112 | if (previousRegionNeighbourHandles.Count > 0) |
2127 | { | 2113 | { |
@@ -2133,14 +2119,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2133 | 2119 | ||
2134 | if(notHG) // does not work on HG | 2120 | if(notHG) // does not work on HG |
2135 | { | 2121 | { |
2136 | List<ulong> toclose = new List<ulong>(previousRegionNeighbourHandles); | 2122 | toclose = new List<ulong>(previousRegionNeighbourHandles); |
2137 | sp.CloseChildAgents(toclose); | 2123 | // sp.CloseChildAgents(toclose); |
2138 | } | 2124 | } |
2125 | else | ||
2126 | toclose = new List<ulong>(); | ||
2139 | } | 2127 | } |
2140 | 2128 | else | |
2129 | toclose = new List<ulong>(); | ||
2141 | /// Update all child agent with everyone's seeds | 2130 | /// Update all child agent with everyone's seeds |
2142 | // foreach (AgentCircuitData a in cagents) | 2131 | // foreach (AgentCircuitData a in cagents) |
2143 | // a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); | 2132 | // a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); |
2144 | 2133 | ||
2145 | if (capsModule != null) | 2134 | if (capsModule != null) |
2146 | capsModule.SetChildrenSeed(sp.UUID, seeds); | 2135 | capsModule.SetChildrenSeed(sp.UUID, seeds); |
@@ -2148,7 +2137,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2148 | sp.KnownRegions = seeds; | 2137 | sp.KnownRegions = seeds; |
2149 | sp.SetNeighbourRegionSizeInfo(neighbours); | 2138 | sp.SetNeighbourRegionSizeInfo(neighbours); |
2150 | 2139 | ||
2151 | if (neighbours.Count > 0) | 2140 | if (neighbours.Count > 0 || toclose.Count > 0) |
2152 | { | 2141 | { |
2153 | AgentPosition agentpos = new AgentPosition(); | 2142 | AgentPosition agentpos = new AgentPosition(); |
2154 | agentpos.AgentID = new UUID(sp.UUID.Guid); | 2143 | agentpos.AgentID = new UUID(sp.UUID.Guid); |
@@ -2166,10 +2155,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2166 | 2155 | ||
2167 | Util.FireAndForget(delegate | 2156 | Util.FireAndForget(delegate |
2168 | { | 2157 | { |
2169 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start | 2158 | Thread.Sleep(500); // the original delay that was at InformClientOfNeighbourAsync start |
2170 | int count = 0; | 2159 | int count = 0; |
2171 | IPEndPoint ipe; | 2160 | IPEndPoint ipe; |
2172 | 2161 | ||
2162 | if(toclose.Count > 0) | ||
2163 | sp.CloseChildAgents(toclose); | ||
2164 | |||
2173 | foreach (GridRegion neighbour in neighbours) | 2165 | foreach (GridRegion neighbour in neighbours) |
2174 | { | 2166 | { |
2175 | ulong handler = neighbour.RegionHandle; | 2167 | ulong handler = neighbour.RegionHandle; |