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 25a53b4..7f07d73 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1844,8 +1844,16 @@ namespace OpenSim.Region.Framework.Scenes
1844// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1844// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
1845// Name, pos, m_scene.RegionInfo.RegionName); 1845// Name, pos, m_scene.RegionInfo.RegionName);
1846 1846
1847 if (pos.X < 0 || pos.X >= Constants.RegionSize 1847 // Allow move to another sub-region within a megaregion
1848 || pos.Y < 0 || pos.Y >= Constants.RegionSize 1848 Vector2 regionSize;
1849 IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>();
1850 if (regionCombinerModule != null)
1851 regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
1852 else
1853 regionSize = new Vector2(Constants.RegionSize);
1854
1855 if (pos.X < 0 || pos.X >= regionSize.X
1856 || pos.Y < 0 || pos.Y >= regionSize.Y
1849 || pos.Z < 0) 1857 || pos.Z < 0)
1850 return; 1858 return;
1851 1859
@@ -1859,7 +1867,16 @@ namespace OpenSim.Region.Framework.Scenes
1859// pos.Z = AbsolutePosition.Z; 1867// pos.Z = AbsolutePosition.Z;
1860// } 1868// }
1861 1869
1862 float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 1870 // Get terrain height for sub-region in a megaregion if necessary
1871 int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X);
1872 int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y);
1873 UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID;
1874 Scene targetScene = m_scene;
1875
1876 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene))
1877 targetScene = m_scene;
1878
1879 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)];
1863 pos.Z = Math.Max(terrainHeight, pos.Z); 1880 pos.Z = Math.Max(terrainHeight, pos.Z);
1864 1881
1865 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is 1882 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is