From 0962a35d2ff8e2d0a8cf87bfce542276dfb2c0f5 Mon Sep 17 00:00:00 2001 From: Iain Oliver Date: Wed, 14 Nov 2012 15:02:35 +0000 Subject: Fix movetotarget on mega regions. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 96bca3e..342de78 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1698,8 +1698,18 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", // Name, pos, m_scene.RegionInfo.RegionName); - if (pos.X < 0 || pos.X >= Constants.RegionSize - || pos.Y < 0 || pos.Y >= Constants.RegionSize + Vector2 regionSize; + IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface(); + if(regionCombinerModule != null) + { + regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); + } + else + { + regionSize = new Vector2(Constants.RegionSize); + } + if (pos.X < 0 || pos.X >= regionSize.X + || pos.Y < 0 || pos.Y >= regionSize.Y || pos.Z < 0) return; @@ -1713,7 +1723,15 @@ namespace OpenSim.Region.Framework.Scenes // pos.Z = AbsolutePosition.Z; // } - float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; + int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); + int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); + UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; + Scene targetScene = m_scene; + if(!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) + { + targetScene = m_scene; + } + float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; pos.Z = Math.Max(terrainHeight, pos.Z); // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is -- cgit v1.1