aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorAdam Frisby2009-08-21 11:14:55 +1000
committerAdam Frisby2009-08-21 11:14:55 +1000
commit01f394d2037be62a3d74e2d28ab9e5644f86a9a2 (patch)
tree53ff6b50c49f766f71befff01c4aafccf9661ec2 /OpenSim/Region/OptionalModules
parent* Implements a bunch of stuff in NPCModule (diff)
downloadopensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.zip
opensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.tar.gz
opensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.tar.bz2
opensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.tar.xz
* Fleshes more of NPCModule out.
* Implements some OSSL commands: key osNpcCreate(string user, string name, vector position, key cloneFrom); void osNpcMoveTo(key npc, vector position); void osNpcSay(key npc, string message); void osNpcRemove(key npc); * Untested. Requires ThreatLevel.High.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-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