early code to allow scripts to force npcs not to fly when moving to target

this is to allow walking on prims.  it will be up to the script writer to be sure that there is a continuous path.
currently implemented in osNpcMoveToTarget(), but none of this is final.
This commit is contained in:
Justin Clark-Casey (justincc)
2011-08-10 01:47:37 +01:00
parent 4cb8d6379d
commit 5d6c9644fa
15 changed files with 45 additions and 18 deletions

View File

@@ -67,8 +67,12 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="agentID">The UUID of the NPC</param>
/// <param name="scene"></param>
/// <param name="pos"></param>
/// <param name="noFly">
/// If true, then the avatar will attempt to walk to the location even if it's up in the air.
/// This is to allow walking on prims.
/// </param>
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos);
bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly);
/// <summary>
/// Stop the NPC's current movement.

View File

@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null)
{
avatar.MoveToTarget(target);
avatar.MoveToTarget(target, false);
}
}
else

View File

@@ -1684,7 +1684,12 @@ namespace OpenSim.Region.Framework.Scenes
/// Move to the given target over time.
/// </summary>
/// <param name="pos"></param>
public void MoveToTarget(Vector3 pos)
/// <param name="noFly">
/// If true, then don't allow the avatar to fly to the target, even if it's up in the air.
/// This is to allow movement to targets that are known to be on an elevated platform with a continuous path
/// from start to finish.
/// </param>
public void MoveToTarget(Vector3 pos, bool noFly)
{
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
@@ -1718,7 +1723,7 @@ namespace OpenSim.Region.Framework.Scenes
"[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
if (pos.Z > terrainHeight)
if (!noFly && pos.Z > terrainHeight)
PhysicsActor.Flying = true;
MovingToTarget = true;