aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorRobert Adams2014-01-26 19:32:28 -0800
committerRobert Adams2014-01-26 19:32:28 -0800
commit49af6b53e74123ccebdbd411d456cb8bae528d61 (patch)
treefc636f3cb3b497c2241633d2908d6882f8d5bfa2 /OpenSim/Region/CoreModules/Framework
parentMerge branch 'master' into varregion (diff)
downloadopensim-SC-49af6b53e74123ccebdbd411d456cb8bae528d61.zip
opensim-SC-49af6b53e74123ccebdbd411d456cb8bae528d61.tar.gz
opensim-SC-49af6b53e74123ccebdbd411d456cb8bae528d61.tar.bz2
opensim-SC-49af6b53e74123ccebdbd411d456cb8bae528d61.tar.xz
varregion: enable teleporting to a varregion by clicking on the map and
pressing the 'teleport' button. This commit adds returning region map info for all the subregions of a varregion. This also handles the selection of the extra region and then the displacement of the postion so the teleport is to the correct location.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs31
1 files changed, 28 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 85e8159..a038f73 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -523,9 +523,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
523 ScenePresence sp, ulong regionHandle, Vector3 position, 523 ScenePresence sp, ulong regionHandle, Vector3 position,
524 Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination) 524 Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination)
525 { 525 {
526 uint x = 0, y = 0; 526 // Get destination region taking into account that the address could be an offset
527 Util.RegionHandleToWorldLoc(regionHandle, out x, out y); 527 // region inside a varregion.
528 GridRegion reg = Scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); 528 GridRegion reg = GetTeleportDestinationRegion(sp.Scene.GridService, sp.Scene.RegionInfo.ScopeID, regionHandle, ref position);
529 529
530 if (reg != null) 530 if (reg != null)
531 { 531 {
@@ -588,6 +588,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
588 } 588 }
589 } 589 }
590 590
591 // The teleport address could be an address in a subregion of a larger varregion.
592 // Find the real base region and adjust the teleport location to account for the
593 // larger region.
594 private GridRegion GetTeleportDestinationRegion(IGridService gridService, UUID scope, ulong regionHandle, ref Vector3 position)
595 {
596 uint x = 0, y = 0;
597 Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
598
599 // Compute the world location we're teleporting to
600 double worldX = (double)x + position.X;
601 double worldY = (double)y + position.Y;
602
603 // Find the region that contains the position
604 GridRegion reg = GetRegionContainingWorldLocation(gridService, scope, worldX, worldY);
605
606 if (reg != null)
607 {
608 // modify the position for the offset into the actual region returned
609 position.X += x - reg.RegionLocX;
610 position.Y += y - reg.RegionLocY;
611 }
612
613 return reg;
614 }
615
591 // Nothing to validate here 616 // Nothing to validate here
592 protected virtual bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason) 617 protected virtual bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason)
593 { 618 {