diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 342de78..6f36c0b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1698,16 +1698,14 @@ 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 | // Allow move to another sub-region within a megaregion | ||
1701 | Vector2 regionSize; | 1702 | Vector2 regionSize; |
1702 | IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>(); | 1703 | IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>(); |
1703 | if(regionCombinerModule != null) | 1704 | if (regionCombinerModule != null) |
1704 | { | ||
1705 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | 1705 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); |
1706 | } | ||
1707 | else | 1706 | else |
1708 | { | ||
1709 | regionSize = new Vector2(Constants.RegionSize); | 1707 | regionSize = new Vector2(Constants.RegionSize); |
1710 | } | 1708 | |
1711 | if (pos.X < 0 || pos.X >= regionSize.X | 1709 | if (pos.X < 0 || pos.X >= regionSize.X |
1712 | || pos.Y < 0 || pos.Y >= regionSize.Y | 1710 | || pos.Y < 0 || pos.Y >= regionSize.Y |
1713 | || pos.Z < 0) | 1711 | || pos.Z < 0) |
@@ -1723,14 +1721,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1723 | // pos.Z = AbsolutePosition.Z; | 1721 | // pos.Z = AbsolutePosition.Z; |
1724 | // } | 1722 | // } |
1725 | 1723 | ||
1724 | // Get terrain height for sub-region in a megaregion if necessary | ||
1726 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); | 1725 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); |
1727 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); | 1726 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); |
1728 | UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; | 1727 | UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; |
1729 | Scene targetScene = m_scene; | 1728 | Scene targetScene = m_scene; |
1730 | if(!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | 1729 | |
1731 | { | 1730 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) |
1732 | targetScene = m_scene; | 1731 | targetScene = m_scene; |
1733 | } | 1732 | |
1734 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; | 1733 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; |
1735 | pos.Z = Math.Max(terrainHeight, pos.Z); | 1734 | pos.Z = Math.Max(terrainHeight, pos.Z); |
1736 | 1735 | ||