document & 80-character width terminal formatting
Signed-off-by: Diva Canto <diva@metaverseink.com>integration
parent
23605cf93d
commit
f560d581bb
|
@ -32,14 +32,16 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than
|
/// Temporary interface. More methods to come at some point to make NPCs
|
||||||
/// controlling purely through module level interface calls (e.g. sit/stand).
|
/// more object oriented rather than controlling purely through module
|
||||||
|
/// level interface calls (e.g. sit/stand).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface INPC
|
public interface INPC
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user)
|
/// Should this NPC be sensed by LSL sensors as an 'agent'
|
||||||
/// rather than an OpenSim specific NPC extension?
|
/// (interpreted here to mean a normal user) rather than an OpenSim
|
||||||
|
/// specific NPC extension?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool SenseAsAgent { get; }
|
bool SenseAsAgent { get; }
|
||||||
}
|
}
|
||||||
|
@ -53,35 +55,42 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="lastname"></param>
|
/// <param name="lastname"></param>
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
/// <param name="senseAsAgent">
|
/// <param name="senseAsAgent">
|
||||||
/// Make the NPC show up as an agent on LSL sensors. The default is that they
|
/// Make the NPC show up as an agent on LSL sensors. The default is
|
||||||
/// show up as the NPC type instead, but this is currently an OpenSim-only extension.
|
/// that they show up as the NPC type instead, but this is currently
|
||||||
|
/// an OpenSim-only extension.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="appearance">The avatar appearance to use for the new NPC.</param>
|
/// <param name="appearance">
|
||||||
/// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
|
/// The avatar appearance to use for the new NPC.
|
||||||
UUID CreateNPC(
|
/// </param>
|
||||||
string firstname,
|
/// <returns>
|
||||||
string lastname,
|
/// The UUID of the ScenePresence created. UUID.Zero if there was a
|
||||||
Vector3 position,
|
/// failure.
|
||||||
UUID owner,
|
/// </returns>
|
||||||
bool senseAsAgent,
|
UUID CreateNPC(string firstname, string lastname, Vector3 position,
|
||||||
Scene scene,
|
UUID owner, bool senseAsAgent, Scene scene,
|
||||||
AvatarAppearance appearance);
|
AvatarAppearance appearance);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the agent is an NPC.
|
/// Check if the agent is an NPC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns>
|
/// <returns>
|
||||||
|
/// True if the agent is an NPC in the given scene. False otherwise.
|
||||||
|
/// </returns>
|
||||||
bool IsNPC(UUID agentID, Scene scene);
|
bool IsNPC(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface
|
/// Get the NPC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is not currently complete - manipulation of NPCs still occurs
|
||||||
|
/// through the region interface.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns>The NPC. null if it does not exist.</returns>
|
/// <returns>The NPC. null if it does not exist.</returns>
|
||||||
INPC GetNPC(UUID agentID, Scene scene);
|
INPC GetNPC(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -89,7 +98,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="npcID"></param>
|
/// <param name="npcID"></param>
|
||||||
/// <param name="callerID"></param>
|
/// <param name="callerID"></param>
|
||||||
/// <returns>true if they do, false if they don't or if there's no NPC with the given ID.</returns>
|
/// <returns>
|
||||||
|
/// true if they do, false if they don't or if there's no NPC with the
|
||||||
|
/// given ID.
|
||||||
|
/// </returns>
|
||||||
bool CheckPermissions(UUID npcID, UUID callerID);
|
bool CheckPermissions(UUID npcID, UUID callerID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -98,8 +110,12 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="appearance"></param>
|
/// <param name="appearance"></param>
|
||||||
/// <param name="scene"></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>
|
/// <returns>
|
||||||
bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene);
|
/// 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>
|
/// <summary>
|
||||||
/// Move an NPC to a target over time.
|
/// Move an NPC to a target over time.
|
||||||
|
@ -108,23 +124,29 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
/// <param name="noFly">
|
/// <param name="noFly">
|
||||||
/// If true, then the avatar will attempt to walk to the location even if it's up in the air.
|
/// If true, then the avatar will attempt to walk to the location even
|
||||||
/// This is to allow walking on prims.
|
/// if it's up in the air. This is to allow walking on prims.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="landAtTarget">
|
/// <param name="landAtTarget">
|
||||||
/// If true and the avatar is flying when it reaches the target, land.
|
/// If true and the avatar is flying when it reaches the target, land.
|
||||||
/// </param> name="running">
|
/// </param> name="running">
|
||||||
/// If true, NPC moves with running speed.
|
/// If true, NPC moves with running speed.
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
///
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running);
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
|
bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly,
|
||||||
|
bool landAtTarget, bool running);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop the NPC's current movement.
|
/// Stop the NPC's current movement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <param name="scene"></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>
|
/// <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);
|
bool StopMoveToTarget(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -133,7 +155,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <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);
|
bool Say(UUID agentID, Scene scene, string text);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -143,7 +168,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="channel"></param>
|
/// <param name="channel"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <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, int channel);
|
bool Say(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -153,7 +181,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="channel"></param>
|
/// <param name="channel"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool Shout(UUID agentID, Scene scene, string text, int channel);
|
bool Shout(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -163,7 +194,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="channel"></param>
|
/// <param name="channel"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool Whisper(UUID agentID, Scene scene, string text, int channel);
|
bool Whisper(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -188,7 +222,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="partID"></param>
|
/// <param name="partID"></param>
|
||||||
/// <returns>true if the touch is actually attempted, false if not</returns>
|
/// <returns>
|
||||||
|
/// true if the touch is actually attempted, false if not.
|
||||||
|
/// </returns>
|
||||||
bool Touch(UUID agentID, UUID partID);
|
bool Touch(UUID agentID, UUID partID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -196,14 +232,20 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <param name="scene"></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>
|
/// <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);
|
bool DeleteNPC(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the owner of a NPC
|
/// Get the owner of a NPC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// UUID of owner if the NPC exists, UUID.Zero if there was no such
|
||||||
|
/// agent, the agent is unowned or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
UUID GetOwner(UUID agentID);
|
UUID GetOwner(UUID agentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,16 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Timer=System.Timers.Timer;
|
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.World.NPC
|
namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
@ -44,9 +46,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||||
public class NPCModule : INPCModule, ISharedRegionModule
|
public class NPCModule : INPCModule, ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
|
private Dictionary<UUID, NPCAvatar> m_avatars =
|
||||||
|
new Dictionary<UUID, NPCAvatar>();
|
||||||
|
|
||||||
public bool Enabled { get; private set; }
|
public bool Enabled { get; private set; }
|
||||||
|
|
||||||
|
@ -89,8 +93,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
public bool IsNPC(UUID agentId, Scene scene)
|
public bool IsNPC(UUID agentId, Scene scene)
|
||||||
{
|
{
|
||||||
// FIXME: This implementation could not just use the ScenePresence.PresenceType (and callers could inspect
|
// FIXME: This implementation could not just use the
|
||||||
// that directly).
|
// ScenePresence.PresenceType (and callers could inspect that
|
||||||
|
// directly).
|
||||||
ScenePresence sp = scene.GetScenePresence(agentId);
|
ScenePresence sp = scene.GetScenePresence(agentId);
|
||||||
if (sp == null || sp.IsChildAgent)
|
if (sp == null || sp.IsChildAgent)
|
||||||
return false;
|
return false;
|
||||||
|
@ -99,7 +104,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return m_avatars.ContainsKey(agentId);
|
return m_avatars.ContainsKey(agentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
|
public bool SetNPCAppearance(UUID agentId,
|
||||||
|
AvatarAppearance appearance, Scene scene)
|
||||||
{
|
{
|
||||||
ScenePresence npc = scene.GetScenePresence(agentId);
|
ScenePresence npc = scene.GetScenePresence(agentId);
|
||||||
if (npc == null || npc.IsChildAgent)
|
if (npc == null || npc.IsChildAgent)
|
||||||
|
@ -112,34 +118,35 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
// Delete existing npc attachments
|
// Delete existing npc attachments
|
||||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
|
scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
|
||||||
|
|
||||||
// XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
|
// XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet
|
||||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
// since it doesn't transfer attachments
|
||||||
|
AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
|
||||||
|
true);
|
||||||
npc.Appearance = npcAppearance;
|
npc.Appearance = npcAppearance;
|
||||||
|
|
||||||
// Rez needed npc attachments
|
// Rez needed npc attachments
|
||||||
scene.AttachmentsModule.RezAttachments(npc);
|
scene.AttachmentsModule.RezAttachments(npc);
|
||||||
|
|
||||||
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
|
IAvatarFactoryModule module =
|
||||||
|
scene.RequestModuleInterface<IAvatarFactoryModule>();
|
||||||
module.SendAppearance(npc.UUID);
|
module.SendAppearance(npc.UUID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID CreateNPC(
|
public UUID CreateNPC(string firstname, string lastname,
|
||||||
string firstname,
|
Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
|
||||||
string lastname,
|
AvatarAppearance appearance)
|
||||||
Vector3 position,
|
|
||||||
UUID owner,
|
|
||||||
bool senseAsAgent,
|
|
||||||
Scene scene,
|
|
||||||
AvatarAppearance appearance)
|
|
||||||
{
|
{
|
||||||
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, owner, senseAsAgent, scene);
|
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position,
|
||||||
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
|
owner, senseAsAgent, scene);
|
||||||
|
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0,
|
||||||
|
int.MaxValue);
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
|
"[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
|
||||||
firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName);
|
firstname, lastname, npcAvatar.AgentId, owner,
|
||||||
|
senseAsAgent, position, scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
AgentCircuitData acd = new AgentCircuitData();
|
AgentCircuitData acd = new AgentCircuitData();
|
||||||
acd.AgentID = npcAvatar.AgentId;
|
acd.AgentID = npcAvatar.AgentId;
|
||||||
|
@ -147,42 +154,55 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
acd.lastname = lastname;
|
acd.lastname = lastname;
|
||||||
acd.ServiceURLs = new Dictionary<string, object>();
|
acd.ServiceURLs = new Dictionary<string, object>();
|
||||||
|
|
||||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
|
||||||
|
true);
|
||||||
acd.Appearance = npcAppearance;
|
acd.Appearance = npcAppearance;
|
||||||
|
|
||||||
// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++)
|
/*
|
||||||
// {
|
for (int i = 0;
|
||||||
// m_log.DebugFormat(
|
i < acd.Appearance.Texture.FaceTextures.Length; i++)
|
||||||
// "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
|
{
|
||||||
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
m_log.DebugFormat(
|
||||||
// }
|
"[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
|
||||||
|
acd.AgentID, i,
|
||||||
|
acd.Appearance.Texture.FaceTextures[i]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
{
|
{
|
||||||
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
|
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode,
|
||||||
|
acd);
|
||||||
scene.AddNewClient(npcAvatar, PresenceType.Npc);
|
scene.AddNewClient(npcAvatar, PresenceType.Npc);
|
||||||
|
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
|
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
/*
|
||||||
// "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
|
m_log.DebugFormat(
|
||||||
|
"[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}",
|
||||||
|
sp.Name, sp.UUID);
|
||||||
|
*/
|
||||||
|
|
||||||
sp.CompleteMovement(npcAvatar, false);
|
sp.CompleteMovement(npcAvatar, false);
|
||||||
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
|
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
|
||||||
m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name);
|
m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}",
|
||||||
|
npcAvatar.AgentId, sp.Name);
|
||||||
|
|
||||||
return npcAvatar.AgentId;
|
return npcAvatar.AgentId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
|
m_log.WarnFormat(
|
||||||
|
"[NPC MODULE]: Could not find scene presence for NPC {0} {1}",
|
||||||
|
sp.Name, sp.UUID);
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running)
|
public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos,
|
||||||
|
bool noFly, bool landAtTarget, bool running)
|
||||||
{
|
{
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
{
|
{
|
||||||
|
@ -192,12 +212,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
if (scene.TryGetScenePresence(agentID, out sp))
|
if (scene.TryGetScenePresence(agentID, out sp))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
|
"[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
|
||||||
sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget);
|
sp.Name, pos, scene.RegionInfo.RegionName,
|
||||||
|
noFly, landAtTarget);
|
||||||
|
|
||||||
sp.MoveToTarget(pos, noFly, landAtTarget);
|
sp.MoveToTarget(pos, noFly, landAtTarget);
|
||||||
sp.SetAlwaysRun = running;
|
sp.SetAlwaysRun = running;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,9 +291,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
if (scene.TryGetScenePresence(agentID, out sp))
|
if (scene.TryGetScenePresence(agentID, out sp))
|
||||||
{
|
{
|
||||||
sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
|
sp.HandleAgentRequestSit(m_avatars[agentID], agentID,
|
||||||
// sp.HandleAgentSit(m_avatars[agentID], agentID);
|
partID, Vector3.Zero);
|
||||||
|
//sp.HandleAgentSit(m_avatars[agentID], agentID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +303,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Whisper(UUID agentID, Scene scene, string text, int channel)
|
public bool Whisper(UUID agentID, Scene scene, string text,
|
||||||
|
int channel)
|
||||||
{
|
{
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
{
|
{
|
||||||
|
@ -356,16 +379,23 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
NPCAvatar av;
|
NPCAvatar av;
|
||||||
if (m_avatars.TryGetValue(agentID, out av))
|
if (m_avatars.TryGetValue(agentID, out av))
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name);
|
/*
|
||||||
|
m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
|
||||||
|
agentID, av.Name);
|
||||||
|
*/
|
||||||
scene.RemoveClient(agentID, false);
|
scene.RemoveClient(agentID, false);
|
||||||
m_avatars.Remove(agentID);
|
m_avatars.Remove(agentID);
|
||||||
|
/*
|
||||||
m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name);
|
m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
|
||||||
|
agentID, av.Name);
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID);
|
m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
|
||||||
|
agentID);
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +419,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
/// <returns>true if they do, false if they don't.</returns>
|
/// <returns>true if they do, false if they don't.</returns>
|
||||||
private bool CheckPermissions(NPCAvatar av, UUID callerID)
|
private bool CheckPermissions(NPCAvatar av, UUID callerID)
|
||||||
{
|
{
|
||||||
return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID;
|
return callerID == UUID.Zero || av.OwnerID == UUID.Zero ||
|
||||||
|
av.OwnerID == callerID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue