diff options
author | Justin Clark-Casey (justincc) | 2011-08-10 00:26:38 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-10 00:26:38 +0100 |
commit | 195c1dc9b8b8511980d9a607a242b24a5a91da17 (patch) | |
tree | f1e844250bf92895e39a41f8b6fac7797a09317f /OpenSim/Region/OptionalModules/World | |
parent | When an NPC appearance is loaded, rez the attachments too (diff) | |
download | opensim-SC-195c1dc9b8b8511980d9a607a242b24a5a91da17.zip opensim-SC-195c1dc9b8b8511980d9a607a242b24a5a91da17.tar.gz opensim-SC-195c1dc9b8b8511980d9a607a242b24a5a91da17.tar.bz2 opensim-SC-195c1dc9b8b8511980d9a607a242b24a5a91da17.tar.xz |
implement osNpcStopMoveTo() to cancel any current move target
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 068eec8..87cb322 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -217,7 +217,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
217 | return npcAvatar.AgentId; | 217 | return npcAvatar.AgentId; |
218 | } | 218 | } |
219 | 219 | ||
220 | public void MoveToTarget(UUID agentID, Scene scene, Vector3 pos) | 220 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos) |
221 | { | 221 | { |
222 | lock (m_avatars) | 222 | lock (m_avatars) |
223 | { | 223 | { |
@@ -230,22 +230,49 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
230 | "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); | 230 | "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); |
231 | 231 | ||
232 | sp.MoveToTarget(pos); | 232 | sp.MoveToTarget(pos); |
233 | |||
234 | return true; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | return false; | ||
239 | } | ||
240 | |||
241 | public bool StopMoveToTarget(UUID agentID, Scene scene) | ||
242 | { | ||
243 | lock (m_avatars) | ||
244 | { | ||
245 | if (m_avatars.ContainsKey(agentID)) | ||
246 | { | ||
247 | ScenePresence sp; | ||
248 | scene.TryGetScenePresence(agentID, out sp); | ||
249 | |||
250 | sp.Velocity = Vector3.Zero; | ||
251 | sp.ResetMoveToTarget(); | ||
252 | |||
253 | return true; | ||
233 | } | 254 | } |
234 | } | 255 | } |
256 | |||
257 | return false; | ||
235 | } | 258 | } |
236 | 259 | ||
237 | public void Say(UUID agentID, Scene scene, string text) | 260 | public bool Say(UUID agentID, Scene scene, string text) |
238 | { | 261 | { |
239 | lock (m_avatars) | 262 | lock (m_avatars) |
240 | { | 263 | { |
241 | if (m_avatars.ContainsKey(agentID)) | 264 | if (m_avatars.ContainsKey(agentID)) |
242 | { | 265 | { |
243 | m_avatars[agentID].Say(text); | 266 | m_avatars[agentID].Say(text); |
267 | |||
268 | return true; | ||
244 | } | 269 | } |
245 | } | 270 | } |
271 | |||
272 | return false; | ||
246 | } | 273 | } |
247 | 274 | ||
248 | public void DeleteNPC(UUID agentID, Scene scene) | 275 | public bool DeleteNPC(UUID agentID, Scene scene) |
249 | { | 276 | { |
250 | lock (m_avatars) | 277 | lock (m_avatars) |
251 | { | 278 | { |
@@ -253,8 +280,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
253 | { | 280 | { |
254 | scene.RemoveClient(agentID); | 281 | scene.RemoveClient(agentID); |
255 | m_avatars.Remove(agentID); | 282 | m_avatars.Remove(agentID); |
283 | |||
284 | return true; | ||
256 | } | 285 | } |
257 | } | 286 | } |
287 | |||
288 | return false; | ||
258 | } | 289 | } |
259 | 290 | ||
260 | public void PostInitialise() | 291 | public void PostInitialise() |