implement osNpcStopMoveTo() to cancel any current move target
parent
cba54090c7
commit
195c1dc9b8
|
@ -566,8 +566,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <param name="silent"></param>
|
||||
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
|
||||
attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
|
||||
so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
|
||||
so.DetachFromBackup();
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="agentID"></param>
|
||||
/// <param name="appearance"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
|
@ -67,7 +67,16 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="pos"></param>
|
||||
void MoveToTarget(UUID agentID, Scene scene, Vector3 pos);
|
||||
/// <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);
|
||||
|
||||
/// <summary>
|
||||
/// Stop the NPC's current movement.
|
||||
/// </summary>
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool StopMoveToTarget(UUID agentID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Get the NPC to say something.
|
||||
|
@ -75,13 +84,15 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="text"></param>
|
||||
void Say(UUID agentID, Scene scene, string text);
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool Say(UUID agentID, Scene scene, string text);
|
||||
|
||||
/// <summary>
|
||||
/// Delete an NPC.
|
||||
/// </summary>
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
void DeleteNPC(UUID agentID, Scene scene);
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool DeleteNPC(UUID agentID, Scene scene);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
public void Say(UUID agentID, Scene scene, string text)
|
||||
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 bool Say(UUID agentID, Scene scene, string text)
|
||||
{
|
||||
lock (m_avatars)
|
||||
{
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
m_avatars[agentID].Say(text);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteNPC(UUID agentID, Scene scene)
|
||||
return false;
|
||||
}
|
||||
|
||||
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()
|
||||
|
|
|
@ -2213,6 +2213,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
public void osNpcStopMoveTo(LSL_Key npc)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo");
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
module.StopMoveToTarget(new UUID(npc.m_string), World);
|
||||
}
|
||||
|
||||
public void osNpcSay(LSL_Key npc, string message)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcSay");
|
||||
|
|
|
@ -173,6 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_Key osNpcSaveAppearance(string avatar, string notecardName);
|
||||
void osNpcLoadAppearance(string avatar, string notecardNameOrUuid);
|
||||
void osNpcMoveTo(key npc, vector position);
|
||||
void osNpcStopMoveTo(LSL_Key npc);
|
||||
void osNpcSay(key npc, string message);
|
||||
void osNpcRemove(key npc);
|
||||
|
||||
|
|
|
@ -498,6 +498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_OSSL_Functions.osNpcMoveTo(npc, position);
|
||||
}
|
||||
|
||||
public void osNpcStopMoveTo(LSL_Key npc)
|
||||
{
|
||||
m_OSSL_Functions.osNpcStopMoveTo(npc);
|
||||
}
|
||||
|
||||
public void osNpcSay(key npc, string message)
|
||||
{
|
||||
m_OSSL_Functions.osNpcSay(npc, message);
|
||||
|
|
Loading…
Reference in New Issue