aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs21
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs46
4 files changed, 52 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 3eff96e..f1d69b0 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1443,10 +1443,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1443 // see that it is actually outside the current region), find the new region that the 1443 // see that it is actually outside the current region), find the new region that the
1444 // point is actually in. 1444 // point is actually in.
1445 // Returns the coordinates and information of the new region or 'null' of it doesn't exist. 1445 // Returns the coordinates and information of the new region or 'null' of it doesn't exist.
1446 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos) 1446 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
1447 out string version, out Vector3 newpos, out string failureReason)
1447 { 1448 {
1448 version = String.Empty; 1449 version = String.Empty;
1449 newpos = pos; 1450 newpos = pos;
1451 failureReason = string.Empty;
1450 1452
1451// m_log.DebugFormat( 1453// m_log.DebugFormat(
1452// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name); 1454// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
@@ -1463,12 +1465,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1463 if (neighbourRegion != null) 1465 if (neighbourRegion != null)
1464 { 1466 {
1465 // Compute the entity's position relative to the new region 1467 // Compute the entity's position relative to the new region
1466 newpos = new Vector3( (float)(presenceWorldX - (double)neighbourRegion.RegionLocX), 1468 newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX),
1467 (float)(presenceWorldY - (double)neighbourRegion.RegionLocY), 1469 (float)(presenceWorldY - (double)neighbourRegion.RegionLocY),
1468 pos.Z); 1470 pos.Z);
1469 1471
1470 if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) 1472 if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
1471 { 1473 {
1474 failureReason = "Cannot region cross into banned parcel";
1472 neighbourRegion = null; 1475 neighbourRegion = null;
1473 } 1476 }
1474 else 1477 else
@@ -1478,15 +1481,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1478 } 1481 }
1479 1482
1480 // Check to see if we have access to the target region. 1483 // Check to see if we have access to the target region.
1481 string reason;
1482 if (neighbourRegion != null 1484 if (neighbourRegion != null
1483 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) 1485 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out failureReason))
1484 { 1486 {
1485 // remember banned 1487 // remember banned
1486 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); 1488 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
1487 neighbourRegion = null; 1489 neighbourRegion = null;
1488 } 1490 }
1489 } 1491 }
1492 else
1493 {
1494 // The destination region just doesn't exist
1495 failureReason = "Cannot cross into non-existant region";
1496 }
1490 1497
1491 if (neighbourRegion == null) 1498 if (neighbourRegion == null)
1492 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", 1499 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}",
@@ -1509,11 +1516,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1509 uint y; 1516 uint y;
1510 Vector3 newpos; 1517 Vector3 newpos;
1511 string version; 1518 string version;
1519 string failureReason;
1512 1520
1513 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out version, out newpos); 1521 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition,
1522 out version, out newpos, out failureReason);
1514 if (neighbourRegion == null) 1523 if (neighbourRegion == null)
1515 { 1524 {
1516 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); 1525 agent.ControllingClient.SendAlertMessage(failureReason);
1517 return false; 1526 return false;
1518 } 1527 }
1519 1528
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 709d8fc..5d07a5f 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -92,11 +92,12 @@ namespace OpenSim.Region.Framework.Interfaces
92 92
93 void EnableChildAgent(ScenePresence agent, GridRegion region); 93 void EnableChildAgent(ScenePresence agent, GridRegion region);
94 94
95 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos); 95 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version,
96 out Vector3 newpos, out string reason);
96 97
97 void Cross(SceneObjectGroup sog, Vector3 position, bool silent); 98 void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
98 99
99 ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); 100 ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version);
100 } 101 }
101 102
102 public interface IUserAgentVerificationModule 103 public interface IUserAgentVerificationModule
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0657cbb..73a30f3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -459,6 +459,7 @@ namespace OpenSim.Region.Framework.Scenes
459 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 459 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
460 string version = String.Empty; 460 string version = String.Empty;
461 Vector3 newpos = Vector3.Zero; 461 Vector3 newpos = Vector3.Zero;
462 string failureReason = String.Empty;
462 OpenSim.Services.Interfaces.GridRegion destination = null; 463 OpenSim.Services.Interfaces.GridRegion destination = null;
463 464
464 if (m_rootPart.KeyframeMotion != null) 465 if (m_rootPart.KeyframeMotion != null)
@@ -476,7 +477,7 @@ namespace OpenSim.Region.Framework.Scenes
476 477
477 // We set the avatar position as being the object 478 // We set the avatar position as being the object
478 // position to get the region to send to 479 // position to get the region to send to
479 if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos)) == null) 480 if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos, out failureReason)) == null)
480 { 481 {
481 canCross = false; 482 canCross = false;
482 break; 483 break;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 576b8c2..d4af9fc 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3473,8 +3473,6 @@ namespace OpenSim.Region.Framework.Scenes
3473 Vector3 pos2 = AbsolutePosition; 3473 Vector3 pos2 = AbsolutePosition;
3474 Vector3 origPosition = pos2; 3474 Vector3 origPosition = pos2;
3475 Vector3 vel = Velocity; 3475 Vector3 vel = Velocity;
3476 int neighbor = 0;
3477 int[] fix = new int[2];
3478 3476
3479 // Compute the avatar position in the next physics tick. 3477 // Compute the avatar position in the next physics tick.
3480 // If the avatar will be crossing, we force the crossing to happen now 3478 // If the avatar will be crossing, we force the crossing to happen now
@@ -3507,23 +3505,13 @@ namespace OpenSim.Region.Framework.Scenes
3507 if (m_requestedSitTargetUUID == UUID.Zero) 3505 if (m_requestedSitTargetUUID == UUID.Zero)
3508 { 3506 {
3509 m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader); 3507 m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader);
3510 const float borderFudge = 0.1f; 3508
3511
3512 if (origPosition.X < 0)
3513 origPosition.X = borderFudge;
3514 else if (origPosition.X > (float)m_scene.RegionInfo.RegionSizeX)
3515 origPosition.X = (float)m_scene.RegionInfo.RegionSizeX - borderFudge;
3516 if (origPosition.Y < 0)
3517 origPosition.Y = borderFudge;
3518 else if (origPosition.Y > (float)m_scene.RegionInfo.RegionSizeY)
3519 origPosition.Y = (float)m_scene.RegionInfo.RegionSizeY - borderFudge;
3520 Velocity = Vector3.Zero; 3509 Velocity = Vector3.Zero;
3521 AbsolutePosition = origPosition; 3510 AbsolutePosition = EnforceSanityOnPosition(origPosition);
3522 3511
3523 AddToPhysicalScene(isFlying); 3512 AddToPhysicalScene(isFlying);
3524 } 3513 }
3525 } 3514 }
3526
3527 } 3515 }
3528 } 3516 }
3529 else 3517 else
@@ -3541,6 +3529,36 @@ namespace OpenSim.Region.Framework.Scenes
3541 } 3529 }
3542 } 3530 }
3543 3531
3532 // Given a position, make sure it is within the current region.
3533 // If just outside some border, the returned position will be just inside the border on that side.
3534 private Vector3 EnforceSanityOnPosition(Vector3 origPosition)
3535 {
3536 const float borderFudge = 0.1f;
3537 Vector3 ret = origPosition;
3538
3539 // Sanity checking on the position to make sure it is in the region we couldn't cross from
3540 float extentX = (float)m_scene.RegionInfo.RegionSizeX;
3541 float extentY = (float)m_scene.RegionInfo.RegionSizeY;
3542 IRegionCombinerModule combiner = m_scene.RequestModuleInterface<IRegionCombinerModule>();
3543 if (combiner != null)
3544 {
3545 // If a mega-region, the size could be much bigger
3546 Vector2 megaExtent = combiner.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
3547 extentX = megaExtent.X;
3548 extentY = megaExtent.Y;
3549 }
3550 if (ret.X < 0)
3551 ret.X = borderFudge;
3552 else if (ret.X >= extentX)
3553 ret.X = extentX - borderFudge;
3554 if (ret.Y < 0)
3555 ret.Y = borderFudge;
3556 else if (ret.Y >= extentY)
3557 ret.Y = extentY - borderFudge;
3558
3559 return ret;
3560 }
3561
3544 /// <summary> 3562 /// <summary>
3545 /// Moves the agent outside the region bounds 3563 /// Moves the agent outside the region bounds
3546 /// Tells neighbor region that we're crossing to it 3564 /// Tells neighbor region that we're crossing to it