diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index b834619..9232db9 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -398,26 +398,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
398 | 398 | ||
399 | public bool DeleteNPC(UUID agentID, Scene scene) | 399 | public bool DeleteNPC(UUID agentID, Scene scene) |
400 | { | 400 | { |
401 | bool doRemove = false; | ||
402 | NPCAvatar av; | ||
401 | lock (m_avatars) | 403 | lock (m_avatars) |
402 | { | 404 | { |
403 | NPCAvatar av; | ||
404 | if (m_avatars.TryGetValue(agentID, out av)) | 405 | if (m_avatars.TryGetValue(agentID, out av)) |
405 | { | 406 | { |
406 | /* | 407 | /* |
407 | m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", | 408 | m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", |
408 | agentID, av.Name); | 409 | agentID, av.Name); |
409 | */ | 410 | */ |
411 | doRemove = true; | ||
412 | } | ||
413 | } | ||
410 | 414 | ||
411 | scene.CloseAgent(agentID, false); | 415 | if (doRemove) |
412 | 416 | { | |
417 | scene.CloseAgent(agentID, false); | ||
418 | lock (m_avatars) | ||
419 | { | ||
413 | m_avatars.Remove(agentID); | 420 | m_avatars.Remove(agentID); |
414 | |||
415 | /* | ||
416 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", | ||
417 | agentID, av.Name); | ||
418 | */ | ||
419 | return true; | ||
420 | } | 421 | } |
422 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", | ||
423 | agentID, av.Name); | ||
424 | return true; | ||
421 | } | 425 | } |
422 | /* | 426 | /* |
423 | m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", | 427 | m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", |
@@ -457,4 +461,4 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
457 | av.OwnerID == callerID || av.AgentId == callerID; | 461 | av.OwnerID == callerID || av.AgentId == callerID; |
458 | } | 462 | } |
459 | } | 463 | } |
460 | } \ No newline at end of file | 464 | } |