aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs33
1 files changed, 22 insertions, 11 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index d0b5a94..f38af46 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -75,19 +75,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC
75 // We are close enough to the target 75 // We are close enough to the target
76 m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); 76 m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name);
77 77
78 presence.Velocity = Vector3.Zero;
79 presence.AbsolutePosition = presence.MoveToPositionTarget;
80 presence.ResetMoveToTarget();
81
78 if (presence.PhysicsActor.Flying) 82 if (presence.PhysicsActor.Flying)
79 { 83 {
80 Vector3 targetPos = presence.MoveToPositionTarget; 84 for (int i = 0; i < 5; i++)
81 float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; 85 presence.PhysicsActor.IsColliding = true;
82 if (targetPos.Z - terrainHeight < 0.2) 86
83 { 87// Vector3 targetPos = presence.MoveToPositionTarget;
88 if (m_avatars[presence.UUID].LandAtTarget)
84 presence.PhysicsActor.Flying = false; 89 presence.PhysicsActor.Flying = false;
85 }
86 }
87 90
88 presence.Velocity = Vector3.Zero; 91// float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
89 presence.AbsolutePosition = presence.MoveToPositionTarget; 92// if (targetPos.Z - terrainHeight < 0.2)
90 presence.ResetMoveToTarget(); 93// {
94// presence.PhysicsActor.Flying = false;
95// }
96 }
91 97
92 // FIXME: This doesn't work 98 // FIXME: This doesn't work
93 if (presence.PhysicsActor.Flying) 99 if (presence.PhysicsActor.Flying)
@@ -217,7 +223,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
217 return npcAvatar.AgentId; 223 return npcAvatar.AgentId;
218 } 224 }
219 225
220 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly) 226 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget)
221 { 227 {
222 lock (m_avatars) 228 lock (m_avatars)
223 { 229 {
@@ -227,8 +233,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
227 scene.TryGetScenePresence(agentID, out sp); 233 scene.TryGetScenePresence(agentID, out sp);
228 234
229 m_log.DebugFormat( 235 m_log.DebugFormat(
230 "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); 236 "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
237 sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget);
231 238
239 m_avatars[agentID].LandAtTarget = landAtTarget;
232 sp.MoveToTarget(pos, noFly); 240 sp.MoveToTarget(pos, noFly);
233 241
234 return true; 242 return true;
@@ -263,6 +271,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
263 { 271 {
264 if (m_avatars.ContainsKey(agentID)) 272 if (m_avatars.ContainsKey(agentID))
265 { 273 {
274 ScenePresence sp;
275 scene.TryGetScenePresence(agentID, out sp);
276
266 m_avatars[agentID].Say(text); 277 m_avatars[agentID].Say(text);
267 278
268 return true; 279 return true;