aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs32
1 files changed, 19 insertions, 13 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index a3cefc9..94349f6 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -30,18 +30,11 @@ using OpenMetaverse;
30using Nini.Config; 30using Nini.Config;
31using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.CoreModules.Avatar.NPC;
33using OpenSim.Framework; 34using OpenSim.Framework;
34 35
35namespace OpenSim.Region.OptionalModules.World.NPC 36namespace OpenSim.Region.OptionalModules.World.NPC
36{ 37{
37 public interface INPCModule
38 {
39 UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom);
40 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
41 void Say(UUID agentID, Scene scene, string text);
42 void DeleteNPC(UUID agentID, Scene scene);
43 }
44
45 public class NPCModule : IRegionModule, INPCModule 38 public class NPCModule : IRegionModule, INPCModule
46 { 39 {
47 // private const bool m_enabled = false; 40 // private const bool m_enabled = false;
@@ -74,19 +67,32 @@ namespace OpenSim.Region.OptionalModules.World.NPC
74 67
75 public void Autopilot(UUID agentID, Scene scene, Vector3 pos) 68 public void Autopilot(UUID agentID, Scene scene, Vector3 pos)
76 { 69 {
77 ScenePresence sp; 70 lock (m_avatars)
78 scene.TryGetAvatar(agentID, out sp); 71 if (m_avatars.ContainsKey(agentID))
79 sp.DoAutoPilot(0,pos,m_avatars[agentID]); 72 {
73 ScenePresence sp;
74 scene.TryGetAvatar(agentID, out sp);
75 sp.DoAutoPilot(0, pos, m_avatars[agentID]);
76 }
80 } 77 }
81 78
82 public void Say(UUID agentID, Scene scene, string text) 79 public void Say(UUID agentID, Scene scene, string text)
83 { 80 {
84 m_avatars[agentID].Say(text); 81 lock (m_avatars)
82 if (m_avatars.ContainsKey(agentID))
83 {
84 m_avatars[agentID].Say(text);
85 }
85 } 86 }
86 87
87 public void DeleteNPC(UUID agentID, Scene scene) 88 public void DeleteNPC(UUID agentID, Scene scene)
88 { 89 {
89 scene.RemoveClient(agentID); 90 lock(m_avatars)
91 if (m_avatars.ContainsKey(agentID))
92 {
93 scene.RemoveClient(agentID);
94 m_avatars.Remove(agentID);
95 }
90 } 96 }
91 97
92 98