aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorRobert Adams2013-12-27 08:23:37 -0800
committerRobert Adams2013-12-27 08:23:37 -0800
commit01c0bbf1810d60ed5c4a31ede754fb11d843ed6a (patch)
tree5a567453bc0e7b2548a8e38cf1372c6176dcd06b /OpenSim/Region/Framework/Scenes
parentvarregion: many more updates removing the constant RegionSize and replacing (diff)
downloadopensim-SC-01c0bbf1810d60ed5c4a31ede754fb11d843ed6a.zip
opensim-SC-01c0bbf1810d60ed5c4a31ede754fb11d843ed6a.tar.gz
opensim-SC-01c0bbf1810d60ed5c4a31ede754fb11d843ed6a.tar.bz2
opensim-SC-01c0bbf1810d60ed5c4a31ede754fb11d843ed6a.tar.xz
varregion: extract banned region logic into a class for cleanlyness.
Add 'not found' caching in EntityTransferModule.GetRegionContainingWorldLocation so hitting borders and bad teleports do not continuiously hammer on the GridService.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs128
1 files changed, 13 insertions, 115 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4efd9d5..a98baea 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3425,6 +3425,7 @@ namespace OpenSim.Region.Framework.Scenes
3425 if (!IsInTransit) 3425 if (!IsInTransit)
3426 { 3426 {
3427 Vector3 pos2 = AbsolutePosition; 3427 Vector3 pos2 = AbsolutePosition;
3428 Vector3 origPosition = pos2;
3428 Vector3 vel = Velocity; 3429 Vector3 vel = Velocity;
3429 int neighbor = 0; 3430 int neighbor = 0;
3430 int[] fix = new int[2]; 3431 int[] fix = new int[2];
@@ -3459,128 +3460,25 @@ namespace OpenSim.Region.Framework.Scenes
3459 // Tried to make crossing happen but it failed. 3460 // Tried to make crossing happen but it failed.
3460 if (m_requestedSitTargetUUID == UUID.Zero) 3461 if (m_requestedSitTargetUUID == UUID.Zero)
3461 { 3462 {
3462 3463 m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader);
3463 Vector3 pos = AbsolutePosition; 3464 const float borderFudge = 0.1f;
3464 if (AbsolutePosition.X < 0) 3465
3465 pos.X += Velocity.X * 2; 3466 if (origPosition.X < 0)
3466 else if (AbsolutePosition.X > m_scene.RegionInfo.RegionSizeX) 3467 origPosition.X = borderFudge;
3467 pos.X -= Velocity.X * 2; 3468 else if (origPosition.X > (float)m_scene.RegionInfo.RegionSizeX)
3468 if (AbsolutePosition.Y < 0) 3469 origPosition.X = (float)m_scene.RegionInfo.RegionSizeX - borderFudge;
3469 pos.Y += Velocity.Y * 2; 3470 if (origPosition.Y < 0)
3470 else if (AbsolutePosition.Y > m_scene.RegionInfo.RegionSizeY) 3471 origPosition.Y = borderFudge;
3471 pos.Y -= Velocity.Y * 2; 3472 else if (origPosition.Y > (float)m_scene.RegionInfo.RegionSizeY)
3473 origPosition.Y = (float)m_scene.RegionInfo.RegionSizeY - borderFudge;
3472 Velocity = Vector3.Zero; 3474 Velocity = Vector3.Zero;
3473 AbsolutePosition = pos; 3475 AbsolutePosition = origPosition;
3474 3476
3475 AddToPhysicalScene(isFlying); 3477 AddToPhysicalScene(isFlying);
3476 } 3478 }
3477 } 3479 }
3478 3480
3479 } 3481 }
3480
3481 /*
3482 // Checks if where it's headed exists a region
3483 if (m_scene.TestBorderCross(pos2, Cardinals.W))
3484 {
3485 if (m_scene.TestBorderCross(pos2, Cardinals.S))
3486 {
3487 needsTransit = true;
3488 neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
3489 }
3490 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3491 {
3492 needsTransit = true;
3493 neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
3494 }
3495 else
3496 {
3497 needsTransit = true;
3498 neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
3499 }
3500 }
3501 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
3502 {
3503 if (m_scene.TestBorderCross(pos2, Cardinals.S))
3504 {
3505 needsTransit = true;
3506 neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
3507 }
3508 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3509 {
3510 needsTransit = true;
3511 neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
3512 }
3513 else
3514 {
3515 needsTransit = true;
3516 neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
3517 }
3518 }
3519 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
3520 {
3521 needsTransit = true;
3522 neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
3523 }
3524 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3525 {
3526 needsTransit = true;
3527 neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
3528 }
3529
3530 // Makes sure avatar does not end up outside region
3531 if (neighbor <= 0)
3532 {
3533 if (needsTransit)
3534 {
3535 if (m_requestedSitTargetUUID == UUID.Zero)
3536 {
3537 bool isFlying = Flying;
3538 RemoveFromPhysicalScene();
3539
3540 Vector3 pos = AbsolutePosition;
3541 if (AbsolutePosition.X < 0)
3542 pos.X += Velocity.X * 2;
3543 else if (AbsolutePosition.X > m_scene.RegionInfo.RegionSizeX)
3544 pos.X -= Velocity.X * 2;
3545 if (AbsolutePosition.Y < 0)
3546 pos.Y += Velocity.Y * 2;
3547 else if (AbsolutePosition.Y > m_scene.RegionInfo.RegionSizeY)
3548 pos.Y -= Velocity.Y * 2;
3549 Velocity = Vector3.Zero;
3550 AbsolutePosition = pos;
3551
3552// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
3553
3554 AddToPhysicalScene(isFlying);
3555 }
3556 }
3557 }
3558 else if (neighbor > 0)
3559 {
3560 if (!CrossToNewRegion())
3561 {
3562 if (m_requestedSitTargetUUID == UUID.Zero)
3563 {
3564 bool isFlying = Flying;
3565 RemoveFromPhysicalScene();
3566
3567 Vector3 pos = AbsolutePosition;
3568 if (AbsolutePosition.X < 0)
3569 pos.X += Velocity.X * 2;
3570 else if (AbsolutePosition.X > m_scene.RegionInfo.RegionSizeX)
3571 pos.X -= Velocity.X * 2;
3572 if (AbsolutePosition.Y < 0)
3573 pos.Y += Velocity.Y * 2;
3574 else if (AbsolutePosition.Y > m_scene.RegionInfo.RegionSizeY)
3575 pos.Y -= Velocity.Y * 2;
3576 Velocity = Vector3.Zero;
3577 AbsolutePosition = pos;
3578
3579 AddToPhysicalScene(isFlying);
3580 }
3581 }
3582 }
3583 */
3584 } 3482 }
3585 else 3483 else
3586 { 3484 {