public bool DeleteNPC(UUID agentID, Scene scene) { lock (m_avatars) { NPCAvatar av; if (m_avatars.TryGetValue(agentID, out av)) { /* m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name); */ scene.CloseAgent(agentID, false); m_avatars.Remove(agentID); /* m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); */ return true; } } /* m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID); */ return false; }
public bool DeleteNPC(UUID agentID, Scene scene) { m_avatarsRwLock.AcquireWriterLock(-1); try { NPCAvatar av; if (m_avatars.TryGetValue(agentID, out av)) { /* m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name); */ scene.CloseAgent(agentID, false); m_avatars.Remove(agentID); /* m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); */ return true; } } finally { m_avatarsRwLock.ReleaseWriterLock(); } /* m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID); */ return false; }