diff options
author | Melanie | 2012-06-28 22:02:20 +0100 |
---|---|---|
committer | Melanie | 2012-06-28 22:02:20 +0100 |
commit | a1a22a2f1034a1feb67b141abf4b138248cdb356 (patch) | |
tree | b1f71abd8e3f9a3106a4140ad35abba94c8468e5 /OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.zip opensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.tar.gz opensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.tar.bz2 opensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.tar.xz |
Revert "Mantis 5977 Corrections to llRegionSayTo"
This reverts commit 679da63da617d031e5e7ae3f2d2a29db1a23ace3.
Conflicts:
OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 6ffc7e6..5649855 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -197,7 +197,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
197 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | 198 | string fromNamePrefix = ""; |
199 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
200 | UUID targetID = c.TargetUUID; | ||
201 | string message = c.Message; | 200 | string message = c.Message; |
202 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
203 | Vector3 fromPos = c.Position; | 202 | Vector3 fromPos = c.Position; |
@@ -236,31 +235,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
236 | message = message.Substring(0, 1000); | 235 | message = message.Substring(0, 1000); |
237 | 236 | ||
238 | // m_log.DebugFormat( | 237 | // m_log.DebugFormat( |
239 | // "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}", | 238 | // "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}", |
240 | // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID); | 239 | // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); |
241 | 240 | ||
242 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); | 241 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); |
243 | 242 | ||
244 | foreach (Scene s in m_scenes) | 243 | foreach (Scene s in m_scenes) |
245 | { | 244 | { |
246 | if (targetID == UUID.Zero) | 245 | // This should use ForEachClient, but clients don't have a position. |
247 | { | 246 | // If camera is moved into client, then camera position can be used |
248 | // This should use ForEachClient, but clients don't have a position. | 247 | s.ForEachRootScenePresence( |
249 | // If camera is moved into client, then camera position can be used | 248 | delegate(ScenePresence presence) |
250 | s.ForEachRootScenePresence( | ||
251 | delegate(ScenePresence presence) | ||
252 | { | ||
253 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false)) | ||
254 | receiverIDs.Add(presence.UUID); | ||
255 | } | ||
256 | ); | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | // This is a send to a specific client eg from llRegionSayTo | ||
261 | // no need to check distance etc, jand send is as say | ||
262 | ScenePresence presence = s.GetScenePresence(targetID); | ||
263 | if (presence != null && !presence.IsChildAgent) | ||
264 | { | 249 | { |
265 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | 250 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
266 | if (Presencecheck != null) | 251 | if (Presencecheck != null) |
@@ -271,14 +256,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
271 | // objects on a parcel with access restrictions | 256 | // objects on a parcel with access restrictions |
272 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) | 257 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) |
273 | { | 258 | { |
274 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType, false)) | 259 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) |
275 | receiverIDs.Add(presence.UUID); | 260 | receiverIDs.Add(presence.UUID); |
276 | } | 261 | } |
277 | } | 262 | } |
278 | } | 263 | } |
279 | } | 264 | ); |
280 | } | 265 | } |
281 | 266 | ||
282 | (scene as Scene).EventManager.TriggerOnChatToClients( | 267 | (scene as Scene).EventManager.TriggerOnChatToClients( |
283 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); | 268 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); |
284 | } | 269 | } |
@@ -358,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
358 | /// precondition</returns> | 343 | /// precondition</returns> |
359 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, | 344 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, |
360 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 345 | UUID fromAgentID, string fromName, ChatTypeEnum type, |
361 | string message, ChatSourceType src, bool ignoreDistance) | 346 | string message, ChatSourceType src) |
362 | { | 347 | { |
363 | // don't send stuff to child agents | 348 | // don't send stuff to child agents |
364 | if (presence.IsChildAgent) return false; | 349 | if (presence.IsChildAgent) return false; |
@@ -369,15 +354,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
369 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | 354 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
370 | 355 | ||
371 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); | 356 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); |
372 | 357 | ||
373 | if (!ignoreDistance) | 358 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || |
359 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
360 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
374 | { | 361 | { |
375 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || | 362 | return false; |
376 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
377 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
378 | { | ||
379 | return false; | ||
380 | } | ||
381 | } | 363 | } |
382 | 364 | ||
383 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView | 365 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView |