aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-04-29 20:05:08 +0100
committerJustin Clark-Casey (justincc)2014-04-29 20:05:08 +0100
commitd4eee213a912a37ddd64117f96fb8f7959d7c2ec (patch)
tree8a02207bdd8f6827c129914f720afb1a3f44a491 /OpenSim/Region/Framework
parentAdd regression test for NPC movement on a variable region. (diff)
downloadopensim-SC-d4eee213a912a37ddd64117f96fb8f7959d7c2ec.zip
opensim-SC-d4eee213a912a37ddd64117f96fb8f7959d7c2ec.tar.gz
opensim-SC-d4eee213a912a37ddd64117f96fb8f7959d7c2ec.tar.bz2
opensim-SC-d4eee213a912a37ddd64117f96fb8f7959d7c2ec.tar.xz
Restore terrain height and flying adjustments that were eliminated from non-megaregion paths in ScenePresence.MoveToTarget() by recent patch bc969a6b
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs56
1 files changed, 28 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 772b613..73fe1b7 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2460,6 +2460,8 @@ namespace OpenSim.Region.Framework.Scenes
2460 || pos.Z < 0) 2460 || pos.Z < 0)
2461 return; 2461 return;
2462 2462
2463 Scene targetScene = m_scene;
2464
2463// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); 2465// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
2464// pos += heightAdjust; 2466// pos += heightAdjust;
2465// 2467//
@@ -2474,34 +2476,32 @@ namespace OpenSim.Region.Framework.Scenes
2474 2476
2475 //COMMENT: If its only nessesary in a megaregion, why do it on normal region's too? 2477 //COMMENT: If its only nessesary in a megaregion, why do it on normal region's too?
2476 2478
2477 if (regionCombinerModule != null) 2479 if (regionCombinerModule != null)
2478 { 2480 {
2479 int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); 2481 int x = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
2480 int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); 2482 int y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
2481 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); 2483 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
2482 // If X and Y is NaN, target_region will be null 2484
2483 if (target_region == null) 2485 // If X and Y is NaN, target_region will be null
2484 return; 2486 if (target_region == null)
2485 UUID target_regionID = target_region.RegionID; 2487 return;
2486 Scene targetScene = m_scene; 2488
2487 2489 SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene);
2488 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) 2490 }
2489 targetScene = m_scene; 2491
2490 2492 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)];
2491 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; 2493 pos.Z = Math.Max(terrainHeight, pos.Z);
2492 pos.Z = Math.Max(terrainHeight, pos.Z); 2494
2493 2495 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
2494 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is 2496 // always slightly higher than the actual terrain height.
2495 // always slightly higher than the actual terrain height. 2497 // FIXME: This constrains NPC movements as well, so should be somewhere else.
2496 // FIXME: This constrains NPC movements as well, so should be somewhere else. 2498 if (pos.Z - terrainHeight < 0.2)
2497 if (pos.Z - terrainHeight < 0.2) 2499 pos.Z = terrainHeight;
2498 pos.Z = terrainHeight; 2500
2499 2501 if (noFly)
2500 if (noFly) 2502 Flying = false;
2501 Flying = false; 2503 else if (pos.Z > terrainHeight)
2502 else if (pos.Z > terrainHeight) 2504 Flying = true;
2503 Flying = true;
2504 }
2505 2505
2506// m_log.DebugFormat( 2506// m_log.DebugFormat(
2507// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 2507// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",