diff options
author | Dan Lake | 2011-09-21 16:24:48 -0700 |
---|---|---|
committer | Dan Lake | 2011-09-21 16:24:48 -0700 |
commit | 28a482a7ee2cebab1aa720477af175d7e26d702e (patch) | |
tree | 863fb4b43a571da4d1d963b5a1383538e6391ec8 /OpenSim/Region/Framework | |
parent | Commented out new debug statements in ScenePresence (diff) | |
parent | Reinstate option to land an npc when it reaches a target. (diff) | |
download | opensim-SC-28a482a7ee2cebab1aa720477af175d7e26d702e.zip opensim-SC-28a482a7ee2cebab1aa720477af175d7e26d702e.tar.gz opensim-SC-28a482a7ee2cebab1aa720477af175d7e26d702e.tar.bz2 opensim-SC-28a482a7ee2cebab1aa720477af175d7e26d702e.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
4 files changed, 16 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 000a6ed..eadec09 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5178,10 +5178,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
5178 | for (int i = 0; i < 5; i++) | 5178 | for (int i = 0; i < 5; i++) |
5179 | presence.PhysicsActor.IsColliding = true; | 5179 | presence.PhysicsActor.IsColliding = true; |
5180 | 5180 | ||
5181 | // Vector3 targetPos = presence.MoveToPositionTarget; | 5181 | if (presence.LandAtTarget) |
5182 | // if (m_avatars[presence.UUID].LandAtTarget) | 5182 | presence.PhysicsActor.Flying = false; |
5183 | // presence.PhysicsActor.Flying = false; | ||
5184 | 5183 | ||
5184 | // Vector3 targetPos = presence.MoveToPositionTarget; | ||
5185 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; | 5185 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; |
5186 | // if (targetPos.Z - terrainHeight < 0.2) | 5186 | // if (targetPos.Z - terrainHeight < 0.2) |
5187 | // { | 5187 | // { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e7f2491..980b01f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1599,7 +1599,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1599 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 1599 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1600 | if (avatar != null) | 1600 | if (avatar != null) |
1601 | { | 1601 | { |
1602 | avatar.MoveToTarget(target, false); | 1602 | avatar.MoveToTarget(target, false, false); |
1603 | } | 1603 | } |
1604 | } | 1604 | } |
1605 | else | 1605 | else |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b1c2eea..5b02c3b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -220,6 +220,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
220 | public bool MovingToTarget { get; private set; } | 220 | public bool MovingToTarget { get; private set; } |
221 | public Vector3 MoveToPositionTarget { get; private set; } | 221 | public Vector3 MoveToPositionTarget { get; private set; } |
222 | 222 | ||
223 | /// <summary> | ||
224 | /// Controls whether an avatar automatically moving to a target will land when it gets there (if flying). | ||
225 | /// </summary> | ||
226 | public bool LandAtTarget { get; private set; } | ||
227 | |||
223 | private bool m_followCamAuto; | 228 | private bool m_followCamAuto; |
224 | 229 | ||
225 | private int m_movementUpdateCount; | 230 | private int m_movementUpdateCount; |
@@ -1681,7 +1686,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1681 | /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path | 1686 | /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path |
1682 | /// from start to finish. | 1687 | /// from start to finish. |
1683 | /// </param> | 1688 | /// </param> |
1684 | public void MoveToTarget(Vector3 pos, bool noFly) | 1689 | /// <param name="landAtTarget"> |
1690 | /// If true and the avatar starts flying during the move then land at the target. | ||
1691 | /// </param> | ||
1692 | public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) | ||
1685 | { | 1693 | { |
1686 | m_log.DebugFormat( | 1694 | m_log.DebugFormat( |
1687 | "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", | 1695 | "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", |
@@ -1720,6 +1728,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1720 | else if (pos.Z > terrainHeight) | 1728 | else if (pos.Z > terrainHeight) |
1721 | PhysicsActor.Flying = true; | 1729 | PhysicsActor.Flying = true; |
1722 | 1730 | ||
1731 | LandAtTarget = landAtTarget; | ||
1723 | MovingToTarget = true; | 1732 | MovingToTarget = true; |
1724 | MoveToPositionTarget = pos; | 1733 | MoveToPositionTarget = pos; |
1725 | 1734 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index 5a85d7f..64c36ff 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | |||
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
85 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); | 85 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); |
86 | 86 | ||
87 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); | 87 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); |
88 | sp.MoveToTarget(targetPos, false); | 88 | sp.MoveToTarget(targetPos, false, false); |
89 | 89 | ||
90 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); | 90 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); |
91 | Assert.That( | 91 | Assert.That( |
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
110 | // Try a second movement | 110 | // Try a second movement |
111 | startPos = sp.AbsolutePosition; | 111 | startPos = sp.AbsolutePosition; |
112 | targetPos = startPos + new Vector3(10, 0, 0); | 112 | targetPos = startPos + new Vector3(10, 0, 0); |
113 | sp.MoveToTarget(targetPos, false); | 113 | sp.MoveToTarget(targetPos, false, false); |
114 | 114 | ||
115 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); | 115 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); |
116 | Assert.That( | 116 | Assert.That( |