diff options
author | Tom | 2011-09-04 07:06:36 -0700 |
---|---|---|
committer | Tom | 2011-09-04 07:06:36 -0700 |
commit | 66dec3b8742eff04fbbcc6e3249fe4ba87986500 (patch) | |
tree | 76cc708a821d35fac5cdbbce2de304b47064e732 /OpenSim/Region/CoreModules/Scripting | |
parent | Guard another nullref (diff) | |
parent | Fixed BulletSim config files for Linux *.so libraries. (diff) | |
download | opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.zip opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.gz opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.bz2 opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.xz |
Resolve merge commits, stage 1
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index d647e71..b20a875 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -282,6 +282,93 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | /// <summary> | ||
286 | /// Delivers the message to a scene entity. | ||
287 | /// </summary> | ||
288 | /// <param name='target'> | ||
289 | /// Target. | ||
290 | /// </param> | ||
291 | /// <param name='channel'> | ||
292 | /// Channel. | ||
293 | /// </param> | ||
294 | /// <param name='name'> | ||
295 | /// Name. | ||
296 | /// </param> | ||
297 | /// <param name='id'> | ||
298 | /// Identifier. | ||
299 | /// </param> | ||
300 | /// <param name='msg'> | ||
301 | /// Message. | ||
302 | /// </param> | ||
303 | public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) | ||
304 | { | ||
305 | error = null; | ||
306 | // Is id an avatar? | ||
307 | ScenePresence sp = m_scene.GetScenePresence(target); | ||
308 | |||
309 | if (sp != null) | ||
310 | { | ||
311 | // Send message to avatar | ||
312 | if (channel == 0) | ||
313 | { | ||
314 | m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false); | ||
315 | } | ||
316 | |||
317 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | ||
318 | |||
319 | if (attachments.Count == 0) | ||
320 | return true; | ||
321 | |||
322 | // Get uuid of attachments | ||
323 | List<UUID> targets = new List<UUID>(); | ||
324 | foreach (SceneObjectGroup sog in attachments) | ||
325 | { | ||
326 | targets.Add(sog.UUID); | ||
327 | } | ||
328 | |||
329 | // Need to check each attachment | ||
330 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | ||
331 | { | ||
332 | if (li.GetHostID().Equals(id)) | ||
333 | continue; | ||
334 | |||
335 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) | ||
336 | continue; | ||
337 | |||
338 | if (targets.Contains(li.GetHostID())) | ||
339 | QueueMessage(new ListenerInfo(li, name, id, msg)); | ||
340 | } | ||
341 | |||
342 | return true; | ||
343 | } | ||
344 | |||
345 | // Need to toss an error here | ||
346 | if (channel == 0) | ||
347 | { | ||
348 | error = "Cannot use llRegionSayTo to message objects on channel 0"; | ||
349 | return false; | ||
350 | } | ||
351 | |||
352 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | ||
353 | { | ||
354 | // Dont process if this message is from yourself! | ||
355 | if (li.GetHostID().Equals(id)) | ||
356 | continue; | ||
357 | |||
358 | SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); | ||
359 | if (sPart == null) | ||
360 | continue; | ||
361 | |||
362 | if ( li.GetHostID().Equals(target)) | ||
363 | { | ||
364 | QueueMessage(new ListenerInfo(li, name, id, msg)); | ||
365 | break; | ||
366 | } | ||
367 | } | ||
368 | |||
369 | return true; | ||
370 | } | ||
371 | |||
285 | protected void QueueMessage(ListenerInfo li) | 372 | protected void QueueMessage(ListenerInfo li) |
286 | { | 373 | { |
287 | lock (m_pending.SyncRoot) | 374 | lock (m_pending.SyncRoot) |