aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs23
1 files changed, 20 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 96bca3e..6f36c0b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1698,8 +1698,16 @@ namespace OpenSim.Region.Framework.Scenes
1698// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1698// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
1699// Name, pos, m_scene.RegionInfo.RegionName); 1699// Name, pos, m_scene.RegionInfo.RegionName);
1700 1700
1701 if (pos.X < 0 || pos.X >= Constants.RegionSize 1701 // Allow move to another sub-region within a megaregion
1702 || pos.Y < 0 || pos.Y >= Constants.RegionSize 1702 Vector2 regionSize;
1703 IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>();
1704 if (regionCombinerModule != null)
1705 regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
1706 else
1707 regionSize = new Vector2(Constants.RegionSize);
1708
1709 if (pos.X < 0 || pos.X >= regionSize.X
1710 || pos.Y < 0 || pos.Y >= regionSize.Y
1703 || pos.Z < 0) 1711 || pos.Z < 0)
1704 return; 1712 return;
1705 1713
@@ -1713,7 +1721,16 @@ namespace OpenSim.Region.Framework.Scenes
1713// pos.Z = AbsolutePosition.Z; 1721// pos.Z = AbsolutePosition.Z;
1714// } 1722// }
1715 1723
1716 float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 1724 // Get terrain height for sub-region in a megaregion if necessary
1725 int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X);
1726 int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y);
1727 UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID;
1728 Scene targetScene = m_scene;
1729
1730 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene))
1731 targetScene = m_scene;
1732
1733 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)];
1717 pos.Z = Math.Max(terrainHeight, pos.Z); 1734 pos.Z = Math.Max(terrainHeight, pos.Z);
1718 1735
1719 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is 1736 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is