diff options
author | BlueWall | 2011-08-20 12:36:35 -0400 |
---|---|---|
committer | BlueWall | 2011-08-20 12:36:35 -0400 |
commit | 5e231acdce7a006a4d88a205044d9862f7d4dda8 (patch) | |
tree | 7ce528d13ddabcdcd19b9fb3b55232661d5db34d /OpenSim | |
parent | Add llRegionSayTo (diff) | |
download | opensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.zip opensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.tar.gz opensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.tar.bz2 opensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.tar.xz |
Add avatar and attachments to llRegionSay
llRegionSay will now message avatars on chan 0
and will message attachments on the avatar that
listen on channels other than 0.
This behavior is consistant with the LL
implementation as tested on regions in Agni
with one exception: this implementation does
not include issue:
https://jira.secondlife.com/browse/SCR-66?
Diffstat (limited to 'OpenSim')
3 files changed, 71 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 6917b14..22352f5 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -282,9 +282,71 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | // wComm.DeliverMessageTo(target, channelID, m_host.Name, m_host.UUID, text); | 285 | /// <summary> |
286 | public void DeliverMessageTo(UUID target, int channel, string name, UUID id, string msg) | 286 | /// Delivers the message to. |
287 | { | 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.Attachments; | ||
318 | // Nothing left to do | ||
319 | if (attachments == null) | ||
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 | // Need to check each attachment | ||
329 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | ||
330 | { | ||
331 | if (li.GetHostID().Equals(id)) | ||
332 | continue; | ||
333 | |||
334 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) | ||
335 | continue; | ||
336 | |||
337 | if ( targets.Contains(li.GetHostID())) | ||
338 | QueueMessage(new ListenerInfo(li, name, id, msg)); | ||
339 | } | ||
340 | return true; | ||
341 | } | ||
342 | |||
343 | // Need to toss an error here | ||
344 | if (channel == 0) | ||
345 | { | ||
346 | error = "Cannot use llRegionSayTo to message objects on channel 0"; | ||
347 | return false; | ||
348 | } | ||
349 | |||
288 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 350 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) |
289 | { | 351 | { |
290 | // Dont process if this message is from yourself! | 352 | // Dont process if this message is from yourself! |
@@ -298,9 +360,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
298 | if ( li.GetHostID().Equals(target)) | 360 | if ( li.GetHostID().Equals(target)) |
299 | { | 361 | { |
300 | QueueMessage(new ListenerInfo(li, name, id, msg)); | 362 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
301 | return; | 363 | break; |
302 | } | 364 | } |
303 | } | 365 | } |
366 | return true; | ||
304 | } | 367 | } |
305 | 368 | ||
306 | protected void QueueMessage(ListenerInfo li) | 369 | protected void QueueMessage(ListenerInfo li) |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 8f200ae..dafbf30 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs | |||
@@ -98,7 +98,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
98 | /// <param name='msg'> | 98 | /// <param name='msg'> |
99 | /// Message. | 99 | /// Message. |
100 | /// </param> | 100 | /// </param> |
101 | void DeliverMessageTo(UUID target, int channel, string name, UUID id, string msg); | 101 | bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error); |
102 | 102 | ||
103 | /// <summary> | 103 | /// <summary> |
104 | /// Are there any listen events ready to be dispatched? | 104 | /// Are there any listen events ready to be dispatched? |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 25d7ad9..db45354 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -845,11 +845,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
845 | 845 | ||
846 | public void llRegionSayTo(string target, int channel, string msg) | 846 | public void llRegionSayTo(string target, int channel, string msg) |
847 | { | 847 | { |
848 | if (channel == 0) | 848 | string error = String.Empty; |
849 | { | ||
850 | LSLError("Cannot use llRegionSay() on channel 0"); | ||
851 | return; | ||
852 | } | ||
853 | 849 | ||
854 | if (msg.Length > 1023) | 850 | if (msg.Length > 1023) |
855 | msg = msg.Substring(0, 1023); | 851 | msg = msg.Substring(0, 1023); |
@@ -861,7 +857,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
861 | 857 | ||
862 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 858 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
863 | if (wComm != null) | 859 | if (wComm != null) |
864 | wComm.DeliverMessageTo(TargetID, channel, m_host.Name, m_host.UUID, msg); | 860 | if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) |
861 | LSLError(error); | ||
865 | } | 862 | } |
866 | 863 | ||
867 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) | 864 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) |