From 195c1dc9b8b8511980d9a607a242b24a5a91da17 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 00:26:38 +0100 Subject: implement osNpcStopMoveTo() to cancel any current move target --- .../Region/OptionalModules/World/NPC/NPCModule.cs | 37 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/OptionalModules') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 068eec8..87cb322 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -217,7 +217,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC return npcAvatar.AgentId; } - public void MoveToTarget(UUID agentID, Scene scene, Vector3 pos) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos) { lock (m_avatars) { @@ -230,22 +230,49 @@ namespace OpenSim.Region.OptionalModules.World.NPC "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); sp.MoveToTarget(pos); + + return true; + } + } + + return false; + } + + public bool StopMoveToTarget(UUID agentID, Scene scene) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + + sp.Velocity = Vector3.Zero; + sp.ResetMoveToTarget(); + + return true; } } + + return false; } - public void Say(UUID agentID, Scene scene, string text) + public bool Say(UUID agentID, Scene scene, string text) { lock (m_avatars) { if (m_avatars.ContainsKey(agentID)) { m_avatars[agentID].Say(text); + + return true; } } + + return false; } - public void DeleteNPC(UUID agentID, Scene scene) + public bool DeleteNPC(UUID agentID, Scene scene) { lock (m_avatars) { @@ -253,8 +280,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC { scene.RemoveClient(agentID); m_avatars.Remove(agentID); + + return true; } } + + return false; } public void PostInitialise() -- cgit v1.1