From 5d6c9644faf6aeac38410af9cff97adfef88d7aa Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 10 Aug 2011 01:47:37 +0100
Subject: 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.
---
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 6 +++++-
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++++--
3 files changed, 13 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 763d2dc..06296c9 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -67,8 +67,12 @@ namespace OpenSim.Region.Framework.Interfaces
/// The UUID of the NPC
///
///
+ ///
+ /// 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.
+ ///
/// True if the operation succeeded, false if there was no such agent or the agent was not an NPC
- bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos);
+ bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly);
///
/// Stop the NPC's current movement.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3b6a458..fe96152 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -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
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2db83eb..b8e4e93 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1684,7 +1684,12 @@ namespace OpenSim.Region.Framework.Scenes
/// Move to the given target over time.
///
///
- public void MoveToTarget(Vector3 pos)
+ ///
+ /// 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.
+ ///
+ 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;
--
cgit v1.1