diff options
author | Robert Adams | 2014-02-15 17:02:53 -0800 |
---|---|---|
committer | Robert Adams | 2014-02-15 17:02:53 -0800 |
commit | 7fc289c039ca3cdbad0f050e17c1b1d13e684c73 (patch) | |
tree | b03784f877703368750cd8d75ddeb148d810101f /OpenSim/Region/Framework/Scenes | |
parent | Rewrite of mega-region code to use new form of border checking. (diff) | |
download | opensim-SC-7fc289c039ca3cdbad0f050e17c1b1d13e684c73.zip opensim-SC-7fc289c039ca3cdbad0f050e17c1b1d13e684c73.tar.gz opensim-SC-7fc289c039ca3cdbad0f050e17c1b1d13e684c73.tar.bz2 opensim-SC-7fc289c039ca3cdbad0f050e17c1b1d13e684c73.tar.xz |
Properly restore position on crossing failure for mega-regions.
Fix odd "cannot cross into banned parcel" viewer error message when crossing
into non-existant region. Proper permission failure messages are now returned.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 46 |
2 files changed, 34 insertions, 15 deletions
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 |