diff options
author | Justin Clark-Casey (justincc) | 2011-08-04 03:08:35 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-04 03:08:35 +0100 |
commit | 1918402cb181a39f8c085a409909dccb5c988aa1 (patch) | |
tree | 582087c4709c0a733feac0f3c140a80afd3fb10d | |
parent | if an NPC move to target is above the terrain then make it fly to destination (diff) | |
download | opensim-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 '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 13 |
2 files changed, 16 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 17b55bf..d40132e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1537,8 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1537 | if (update_movementflag | 1537 | if (update_movementflag |
1538 | && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) | 1538 | && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) |
1539 | && (m_parentID == 0) | 1539 | && (m_parentID == 0) |
1540 | && !SitGround | 1540 | && !SitGround) |
1541 | && !MovingToTarget) | ||
1542 | Animator.UpdateMovementAnimations(); | 1541 | Animator.UpdateMovementAnimations(); |
1543 | } | 1542 | } |
1544 | 1543 | ||
@@ -1711,9 +1710,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1711 | if (pos.Z - terrainHeight < 0.2) | 1710 | if (pos.Z - terrainHeight < 0.2) |
1712 | pos.Z = terrainHeight; | 1711 | pos.Z = terrainHeight; |
1713 | 1712 | ||
1714 | // m_log.DebugFormat( | 1713 | m_log.DebugFormat( |
1715 | // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", | 1714 | "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", |
1716 | // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); | 1715 | Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); |
1717 | 1716 | ||
1718 | if (pos.Z > terrainHeight) | 1717 | if (pos.Z > terrainHeight) |
1719 | PhysicsActor.Flying = true; | 1718 | PhysicsActor.Flying = true; |
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(); |