diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index dd94240..fdc3485 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -70,12 +70,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
70 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); | 70 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); |
71 | 71 | ||
72 | // Check the error term of the current position in relation to the target position | 72 | // Check the error term of the current position in relation to the target position |
73 | if (distanceToTarget <= 1) | 73 | if (distanceToTarget <= 2) |
74 | { | 74 | { |
75 | // m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0} {1}", presence.Name, presence.UUID); | 75 | // m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0} {1}", presence.Name, presence.UUID); |
76 | // We are close enough to the target for now | 76 | // We are close enough to the target for now |
77 | presence.ResetMoveToTarget(); | ||
78 | presence.Velocity = Vector3.Zero; | 77 | presence.Velocity = Vector3.Zero; |
78 | presence.AbsolutePosition = presence.MoveToPositionTarget; | ||
79 | presence.ResetMoveToTarget(); | ||
79 | 80 | ||
80 | // FIXME: This doesn't work | 81 | // FIXME: This doesn't work |
81 | if (presence.PhysicsActor.Flying) | 82 | if (presence.PhysicsActor.Flying) |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 545819f..c9dddba 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -130,6 +130,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
130 | 130 | ||
131 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 131 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
132 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); | 132 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); |
133 | Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); | ||
133 | 134 | ||
134 | // Try a second movement | 135 | // Try a second movement |
135 | startPos = npc.AbsolutePosition; | 136 | startPos = npc.AbsolutePosition; |
@@ -149,6 +150,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
149 | 150 | ||
150 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 151 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
151 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); | 152 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); |
153 | Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); | ||
152 | } | 154 | } |
153 | } | 155 | } |
154 | } \ No newline at end of file | 156 | } \ No newline at end of file |