aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-04 03:08:35 +0100
committerJustin Clark-Casey (justincc)2011-08-04 03:08:35 +0100
commit1918402cb181a39f8c085a409909dccb5c988aa1 (patch)
tree582087c4709c0a733feac0f3c140a80afd3fb10d /OpenSim/Region/OptionalModules
parentif an NPC move to target is above the terrain then make it fly to destination (diff)
downloadopensim-SC_OLD-1918402cb181a39f8c085a409909dccb5c988aa1.zip
opensim-SC_OLD-1918402cb181a39f8c085a409909dccb5c988aa1.tar.gz
opensim-SC_OLD-1918402cb181a39f8c085a409909dccb5c988aa1.tar.bz2
opensim-SC_OLD-1918402cb181a39f8c085a409909dccb5c988aa1.tar.xz
if an NPC target is set to a ground location, then automatically land them when they get there.
This doesn't help where the target is a prim surface. In these situations, it might be better to provide manual overrides so the script can control whethre an avatar flys there/lands, etc.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 30e81fc..4f21d9d 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -72,8 +72,19 @@ namespace OpenSim.Region.OptionalModules.World.NPC
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 <= ScenePresence.SIGNIFICANT_MOVEMENT) 73 if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT)
74 { 74 {
75 m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name);
76 // 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);
77
78 if (presence.PhysicsActor.Flying)
79 {
80 Vector3 targetPos = presence.MoveToPositionTarget;
81 float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
82 if (targetPos.Z - terrainHeight < 0.2)
83 {
84 presence.PhysicsActor.Flying = false;
85 }
86 }
87
77 presence.Velocity = Vector3.Zero; 88 presence.Velocity = Vector3.Zero;
78 presence.AbsolutePosition = presence.MoveToPositionTarget; 89 presence.AbsolutePosition = presence.MoveToPositionTarget;
79 presence.ResetMoveToTarget(); 90 presence.ResetMoveToTarget();