diff options
author | Melanie | 2012-06-28 21:23:42 +0200 |
---|---|---|
committer | Melanie | 2012-06-28 21:23:42 +0200 |
commit | c87f0ac2261d1aa5226957aff63bfc8ac0efaffd (patch) | |
tree | 5a8ac8569730595044c9310a1f5321bff1f5e109 /OpenSim | |
parent | Return NPC instead of AGENT in the detect parameters for touch, collision and (diff) | |
download | opensim-SC-c87f0ac2261d1aa5226957aff63bfc8ac0efaffd.zip opensim-SC-c87f0ac2261d1aa5226957aff63bfc8ac0efaffd.tar.gz opensim-SC-c87f0ac2261d1aa5226957aff63bfc8ac0efaffd.tar.bz2 opensim-SC-c87f0ac2261d1aa5226957aff63bfc8ac0efaffd.tar.xz |
Fix llRegionSayTo the right way
Diffstat (limited to 'OpenSim')
4 files changed, 37 insertions, 11 deletions
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs index 54fa275..7450be2 100644 --- a/OpenSim/Framework/OSChatMessage.cs +++ b/OpenSim/Framework/OSChatMessage.cs | |||
@@ -51,6 +51,7 @@ namespace OpenSim.Framework | |||
51 | protected object m_senderObject; | 51 | protected object m_senderObject; |
52 | protected ChatTypeEnum m_type; | 52 | protected ChatTypeEnum m_type; |
53 | protected UUID m_fromID; | 53 | protected UUID m_fromID; |
54 | protected UUID m_destination = UUID.Zero; | ||
54 | 55 | ||
55 | public OSChatMessage() | 56 | public OSChatMessage() |
56 | { | 57 | { |
@@ -131,6 +132,12 @@ namespace OpenSim.Framework | |||
131 | set { m_fromID = value; } | 132 | set { m_fromID = value; } |
132 | } | 133 | } |
133 | 134 | ||
135 | public UUID Destination | ||
136 | { | ||
137 | get { return m_destination; } | ||
138 | set { m_destination = value; } | ||
139 | } | ||
140 | |||
134 | /// <summary> | 141 | /// <summary> |
135 | /// | 142 | /// |
136 | /// </summary> | 143 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 4d8fb90..357c2af 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -199,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
199 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
200 | string message = c.Message; | 200 | string message = c.Message; |
201 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
202 | UUID destination = c.Destination; | ||
202 | Vector3 fromPos = c.Position; | 203 | Vector3 fromPos = c.Position; |
203 | Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, | 204 | Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, |
204 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | 205 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
@@ -222,6 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
222 | { | 223 | { |
223 | fromNamePrefix = m_adminPrefix; | 224 | fromNamePrefix = m_adminPrefix; |
224 | } | 225 | } |
226 | destination = UUID.Zero; // Avatars cant "SayTo" | ||
225 | break; | 227 | break; |
226 | 228 | ||
227 | case ChatSourceType.Object: | 229 | case ChatSourceType.Object: |
@@ -244,9 +246,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
244 | { | 246 | { |
245 | // This should use ForEachClient, but clients don't have a position. | 247 | // This should use ForEachClient, but clients don't have a position. |
246 | // If camera is moved into client, then camera position can be used | 248 | // If camera is moved into client, then camera position can be used |
249 | // MT: No, it can't, as chat is heard from the avatar position, not | ||
250 | // the camera position. | ||
247 | s.ForEachRootScenePresence( | 251 | s.ForEachRootScenePresence( |
248 | delegate(ScenePresence presence) | 252 | delegate(ScenePresence presence) |
249 | { | 253 | { |
254 | if (destination != UUID.Zero && presence.UUID != destination) | ||
255 | return; | ||
250 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | 256 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
251 | if (Presencecheck != null) | 257 | if (Presencecheck != null) |
252 | { | 258 | { |
@@ -346,8 +352,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
346 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 352 | UUID fromAgentID, string fromName, ChatTypeEnum type, |
347 | string message, ChatSourceType src) | 353 | string message, ChatSourceType src) |
348 | { | 354 | { |
349 | // don't send stuff to child agents | 355 | // don't send llRegionSay to child agents. Send normal chat because you |
350 | if (presence.IsChildAgent) return false; | 356 | // can't talk across sim borders if it's not done |
357 | if (type == ChatTypeEnum.Broadcast && presence.IsChildAgent) return false; | ||
351 | 358 | ||
352 | Vector3 fromRegionPos = fromPos + regionPos; | 359 | Vector3 fromRegionPos = fromPos + regionPos; |
353 | Vector3 toRegionPos = presence.AbsolutePosition + | 360 | Vector3 toRegionPos = presence.AbsolutePosition + |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 176c86d..07bb291 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -90,6 +90,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
90 | // private static readonly ILog m_log = | 90 | // private static readonly ILog m_log = |
91 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 91 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
92 | 92 | ||
93 | private const int DEBUG_CHANNEL = 2147483647; | ||
94 | |||
93 | private ListenerManager m_listenerManager; | 95 | private ListenerManager m_listenerManager; |
94 | private Queue m_pending; | 96 | private Queue m_pending; |
95 | private Queue m_pendingQ; | 97 | private Queue m_pendingQ; |
@@ -311,6 +313,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
311 | public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) | 313 | public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) |
312 | { | 314 | { |
313 | error = null; | 315 | error = null; |
316 | |||
317 | if (channel == DEBUG_CHANNEL) | ||
318 | return true; | ||
319 | |||
314 | // Is id an avatar? | 320 | // Is id an avatar? |
315 | ScenePresence sp = m_scene.GetScenePresence(target); | 321 | ScenePresence sp = m_scene.GetScenePresence(target); |
316 | 322 | ||
@@ -319,7 +325,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
319 | // Send message to avatar | 325 | // Send message to avatar |
320 | if (channel == 0) | 326 | if (channel == 0) |
321 | { | 327 | { |
322 | m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false); | 328 | // Channel 0 goes to viewer ONLY |
329 | m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false, false, target); | ||
330 | return true; | ||
323 | } | 331 | } |
324 | 332 | ||
325 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | 333 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
@@ -351,12 +359,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
351 | return true; | 359 | return true; |
352 | } | 360 | } |
353 | 361 | ||
354 | // Need to toss an error here | 362 | SceneObjectPart part = m_scene.GetSceneObjectPart(target); |
355 | if (channel == 0) | 363 | if (part == null) // Not even an object |
356 | { | 364 | return true; // No error |
357 | error = "Cannot use llRegionSayTo to message objects on channel 0"; | ||
358 | return false; | ||
359 | } | ||
360 | 365 | ||
361 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 366 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) |
362 | { | 367 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 3ef1e29..431b903 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -38,8 +38,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
38 | { | 38 | { |
39 | public partial class Scene | 39 | public partial class Scene |
40 | { | 40 | { |
41 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | 41 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, |
42 | UUID fromID, bool fromAgent, bool broadcast) | 42 | UUID fromID, bool fromAgent, bool broadcast, UUID destination) |
43 | { | 43 | { |
44 | OSChatMessage args = new OSChatMessage(); | 44 | OSChatMessage args = new OSChatMessage(); |
45 | 45 | ||
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
49 | args.Position = fromPos; | 49 | args.Position = fromPos; |
50 | args.SenderUUID = fromID; | 50 | args.SenderUUID = fromID; |
51 | args.Scene = this; | 51 | args.Scene = this; |
52 | args.Destination = destination; | ||
52 | 53 | ||
53 | if (fromAgent) | 54 | if (fromAgent) |
54 | { | 55 | { |
@@ -71,6 +72,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
71 | EventManager.TriggerOnChatFromWorld(this, args); | 72 | EventManager.TriggerOnChatFromWorld(this, args); |
72 | } | 73 | } |
73 | 74 | ||
75 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | ||
76 | UUID fromID, bool fromAgent, bool broadcast) | ||
77 | { | ||
78 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, broadcast, UUID.Zero); | ||
79 | } | ||
80 | |||
74 | /// <summary> | 81 | /// <summary> |
75 | /// | 82 | /// |
76 | /// </summary> | 83 | /// </summary> |