aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs45
1 files changed, 0 insertions, 45 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index a2417c4..1b4b5e6 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -54,15 +54,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private static readonly string LogHeader = "[ENTITY TRANSFER MODULE]"; 55 private static readonly string LogHeader = "[ENTITY TRANSFER MODULE]";
56 56
57 public const int DefaultMaxTransferDistance = 4095;
58 public const bool WaitForAgentArrivedAtDestinationDefault = true; 57 public const bool WaitForAgentArrivedAtDestinationDefault = true;
59 58
60 /// <summary> 59 /// <summary>
61 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
62 /// </summary>
63 public int MaxTransferDistance { get; set; }
64
65 /// <summary>
66 /// If true then on a teleport, the source region waits for a callback from the destination region. If 60 /// If true then on a teleport, the source region waits for a callback from the destination region. If
67 /// a callback fails to arrive within a set time then the user is pulled back into the source region. 61 /// a callback fails to arrive within a set time then the user is pulled back into the source region.
68 /// </summary> 62 /// </summary>
@@ -220,12 +214,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
220 214
221 WaitForAgentArrivedAtDestination 215 WaitForAgentArrivedAtDestination
222 = transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault); 216 = transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestinationDefault);
223
224 MaxTransferDistance = transferConfig.GetInt("max_distance", DefaultMaxTransferDistance);
225 }
226 else
227 {
228 MaxTransferDistance = DefaultMaxTransferDistance;
229 } 217 }
230 218
231 m_entityTransferStateMachine = new EntityTransferStateMachine(this); 219 m_entityTransferStateMachine = new EntityTransferStateMachine(this);
@@ -601,28 +589,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
601 return true; 589 return true;
602 } 590 }
603 591
604 /// <summary>
605 /// Determines whether this instance is within the max transfer distance.
606 /// </summary>
607 /// <param name="sourceRegion"></param>
608 /// <param name="destRegion"></param>
609 /// <returns>
610 /// <c>true</c> if this instance is within max transfer distance; otherwise, <c>false</c>.
611 /// </returns>
612 private bool IsWithinMaxTeleportDistance(RegionInfo sourceRegion, GridRegion destRegion)
613 {
614 if(MaxTransferDistance == 0)
615 return true;
616
617// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
618//
619// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
620// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
621
622 // Insanely, RegionLoc on RegionInfo is the 256m map co-ord whilst GridRegion.RegionLoc is the raw meters position.
623 return Math.Abs(sourceRegion.RegionLocX - destRegion.RegionCoordX) <= MaxTransferDistance
624 && Math.Abs(sourceRegion.RegionLocY - destRegion.RegionCoordY) <= MaxTransferDistance;
625 }
626 592
627 /// <summary> 593 /// <summary>
628 /// Wraps DoTeleportInternal() and manages the transfer state. 594 /// Wraps DoTeleportInternal() and manages the transfer state.
@@ -684,17 +650,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
684 650
685 RegionInfo sourceRegion = sp.Scene.RegionInfo; 651 RegionInfo sourceRegion = sp.Scene.RegionInfo;
686 652
687 if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination))
688 {
689 sp.ControllingClient.SendTeleportFailed(
690 string.Format(
691 "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
692 finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY,
693 sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY,
694 MaxTransferDistance));
695
696 return;
697 }
698 653
699 uint newRegionX, newRegionY, oldRegionX, oldRegionY; 654 uint newRegionX, newRegionY, oldRegionX, oldRegionY;
700 Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY); 655 Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY);