Fix movetotarget on mega regions.
parent
dc5711ad62
commit
0962a35d2f
|
@ -1698,8 +1698,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
|
// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
|
||||||
// Name, pos, m_scene.RegionInfo.RegionName);
|
// Name, pos, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
if (pos.X < 0 || pos.X >= Constants.RegionSize
|
Vector2 regionSize;
|
||||||
|| pos.Y < 0 || pos.Y >= Constants.RegionSize
|
IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>();
|
||||||
|
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)
|
|| pos.Z < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1713,7 +1723,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// pos.Z = AbsolutePosition.Z;
|
// 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);
|
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
|
// Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
|
||||||
|
|
Loading…
Reference in New Issue