diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index ebf5e84..9c77b59 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -155,18 +155,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
155 | ScenePresence sp; | 155 | ScenePresence sp; |
156 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 156 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
157 | { | 157 | { |
158 | m_log.DebugFormat( | ||
159 | "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); | ||
160 | |||
161 | sp.CompleteMovement(npcAvatar, false); | 158 | sp.CompleteMovement(npcAvatar, false); |
162 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | 159 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); |
160 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | ||
163 | } | 161 | } |
164 | else | ||
165 | { | ||
166 | m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); | ||
167 | npcAvatar.AgentId = UUID.Zero; | ||
168 | } | ||
169 | |||
170 | } | 162 | } |
171 | ev.Set(); | 163 | ev.Set(); |
172 | }); | 164 | }); |
@@ -221,6 +213,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
221 | 213 | ||
222 | public bool Say(UUID agentID, Scene scene, string text) | 214 | public bool Say(UUID agentID, Scene scene, string text) |
223 | { | 215 | { |
216 | return Say(agentID, scene, text, 0); | ||
217 | } | ||
218 | |||
219 | public bool Say(UUID agentID, Scene scene, string text, int channel) | ||
220 | { | ||
224 | lock (m_avatars) | 221 | lock (m_avatars) |
225 | { | 222 | { |
226 | if (m_avatars.ContainsKey(agentID)) | 223 | if (m_avatars.ContainsKey(agentID)) |
@@ -228,7 +225,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
228 | ScenePresence sp; | 225 | ScenePresence sp; |
229 | scene.TryGetScenePresence(agentID, out sp); | 226 | scene.TryGetScenePresence(agentID, out sp); |
230 | 227 | ||
231 | m_avatars[agentID].Say(text); | 228 | m_avatars[agentID].Say(channel, text); |
229 | |||
230 | return true; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | return false; | ||
235 | } | ||
236 | |||
237 | public bool Shout(UUID agentID, Scene scene, string text, int channel) | ||
238 | { | ||
239 | lock (m_avatars) | ||
240 | { | ||
241 | if (m_avatars.ContainsKey(agentID)) | ||
242 | { | ||
243 | ScenePresence sp; | ||
244 | scene.TryGetScenePresence(agentID, out sp); | ||
245 | |||
246 | m_avatars[agentID].Shout(channel, text); | ||
232 | 247 | ||
233 | return true; | 248 | return true; |
234 | } | 249 | } |
@@ -255,6 +270,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
255 | return false; | 270 | return false; |
256 | } | 271 | } |
257 | 272 | ||
273 | public bool Whisper(UUID agentID, Scene scene, string text, int channel) | ||
274 | { | ||
275 | lock (m_avatars) | ||
276 | { | ||
277 | if (m_avatars.ContainsKey(agentID)) | ||
278 | { | ||
279 | ScenePresence sp; | ||
280 | scene.TryGetScenePresence(agentID, out sp); | ||
281 | |||
282 | m_avatars[agentID].Whisper(channel, text); | ||
283 | |||
284 | return true; | ||
285 | } | ||
286 | } | ||
287 | |||
288 | return false; | ||
289 | } | ||
290 | |||
258 | public bool Stand(UUID agentID, Scene scene) | 291 | public bool Stand(UUID agentID, Scene scene) |
259 | { | 292 | { |
260 | lock (m_avatars) | 293 | lock (m_avatars) |
@@ -308,7 +341,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
308 | scene.RemoveClient(agentID, false); | 341 | scene.RemoveClient(agentID, false); |
309 | m_avatars.Remove(agentID); | 342 | m_avatars.Remove(agentID); |
310 | 343 | ||
311 | // m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name); | 344 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); |
312 | return true; | 345 | return true; |
313 | } | 346 | } |
314 | } | 347 | } |