diff options
author | Adam Frisby | 2009-08-21 11:14:55 +1000 |
---|---|---|
committer | Adam Frisby | 2009-08-21 11:14:55 +1000 |
commit | 01f394d2037be62a3d74e2d28ab9e5644f86a9a2 (patch) | |
tree | 53ff6b50c49f766f71befff01c4aafccf9661ec2 /OpenSim/Region/OptionalModules | |
parent | * Implements a bunch of stuff in NPCModule (diff) | |
download | opensim-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.cs | 32 |
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; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Region.Framework.Interfaces; | 31 | using OpenSim.Region.Framework.Interfaces; |
32 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.CoreModules.Avatar.NPC; | ||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | 35 | ||
35 | namespace OpenSim.Region.OptionalModules.World.NPC | 36 | namespace 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 | ||