diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index ebf5e84..a32ab2a 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 | }); |
@@ -178,7 +170,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
178 | return npcAvatar.AgentId; | 170 | return npcAvatar.AgentId; |
179 | } | 171 | } |
180 | 172 | ||
181 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) | 173 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) |
182 | { | 174 | { |
183 | lock (m_avatars) | 175 | lock (m_avatars) |
184 | { | 176 | { |
@@ -192,6 +184,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
192 | sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); | 184 | sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); |
193 | 185 | ||
194 | sp.MoveToTarget(pos, noFly, landAtTarget); | 186 | sp.MoveToTarget(pos, noFly, landAtTarget); |
187 | sp.SetAlwaysRun = running; | ||
195 | 188 | ||
196 | return true; | 189 | return true; |
197 | } | 190 | } |
@@ -221,6 +214,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
221 | 214 | ||
222 | public bool Say(UUID agentID, Scene scene, string text) | 215 | public bool Say(UUID agentID, Scene scene, string text) |
223 | { | 216 | { |
217 | return Say(agentID, scene, text, 0); | ||
218 | } | ||
219 | |||
220 | public bool Say(UUID agentID, Scene scene, string text, int channel) | ||
221 | { | ||
224 | lock (m_avatars) | 222 | lock (m_avatars) |
225 | { | 223 | { |
226 | if (m_avatars.ContainsKey(agentID)) | 224 | if (m_avatars.ContainsKey(agentID)) |
@@ -228,7 +226,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
228 | ScenePresence sp; | 226 | ScenePresence sp; |
229 | scene.TryGetScenePresence(agentID, out sp); | 227 | scene.TryGetScenePresence(agentID, out sp); |
230 | 228 | ||
231 | m_avatars[agentID].Say(text); | 229 | m_avatars[agentID].Say(channel, text); |
230 | |||
231 | return true; | ||
232 | } | ||
233 | } | ||
234 | |||
235 | return false; | ||
236 | } | ||
237 | |||
238 | public bool Shout(UUID agentID, Scene scene, string text, int channel) | ||
239 | { | ||
240 | lock (m_avatars) | ||
241 | { | ||
242 | if (m_avatars.ContainsKey(agentID)) | ||
243 | { | ||
244 | ScenePresence sp; | ||
245 | scene.TryGetScenePresence(agentID, out sp); | ||
246 | |||
247 | m_avatars[agentID].Shout(channel, text); | ||
232 | 248 | ||
233 | return true; | 249 | return true; |
234 | } | 250 | } |
@@ -255,6 +271,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
255 | return false; | 271 | return false; |
256 | } | 272 | } |
257 | 273 | ||
274 | public bool Whisper(UUID agentID, Scene scene, string text, int channel) | ||
275 | { | ||
276 | lock (m_avatars) | ||
277 | { | ||
278 | if (m_avatars.ContainsKey(agentID)) | ||
279 | { | ||
280 | ScenePresence sp; | ||
281 | scene.TryGetScenePresence(agentID, out sp); | ||
282 | |||
283 | m_avatars[agentID].Whisper(channel, text); | ||
284 | |||
285 | return true; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | return false; | ||
290 | } | ||
291 | |||
258 | public bool Stand(UUID agentID, Scene scene) | 292 | public bool Stand(UUID agentID, Scene scene) |
259 | { | 293 | { |
260 | lock (m_avatars) | 294 | lock (m_avatars) |
@@ -308,7 +342,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
308 | scene.RemoveClient(agentID, false); | 342 | scene.RemoveClient(agentID, false); |
309 | m_avatars.Remove(agentID); | 343 | m_avatars.Remove(agentID); |
310 | 344 | ||
311 | // m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name); | 345 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); |
312 | return true; | 346 | return true; |
313 | } | 347 | } |
314 | } | 348 | } |