From dbe32a1f6d148d16c462b3b7d5a6c507743a5f9a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 9 Feb 2012 00:10:45 +0000 Subject: minor: put in commented out logging statements for future reuse --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/OptionalModules/World/NPC') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 6a48b89..8701431 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -292,13 +292,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC NPCAvatar av; if (m_avatars.TryGetValue(agentID, out av)) { +// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name); scene.RemoveClient(agentID, false); m_avatars.Remove(agentID); +// m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name); return true; } } +// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID); return false; } -- cgit v1.1 From 9c84a8162f700fc2eb35018389c12fcfedc02587 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 9 Feb 2012 01:17:59 +0000 Subject: If NPCModule.CreateNPC() fails to create the required ScenePresence (which should in theory never happen), don't add the NPC to the npc list but return UUID.Zero instead. --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World/NPC') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 8701431..dc6eefc 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -148,22 +148,21 @@ namespace OpenSim.Region.OptionalModules.World.NPC ScenePresence 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); + m_avatars.Add(npcAvatar.AgentId, npcAvatar); + m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); + + return npcAvatar.AgentId; } else { m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); + return UUID.Zero; } - - m_avatars.Add(npcAvatar.AgentId, npcAvatar); } - - m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); - - return npcAvatar.AgentId; } public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) -- cgit v1.1