diff options
author | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
commit | 159fcbf150b7da0e229b29aa7b94793484543d12 (patch) | |
tree | b8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |
parent | Merge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.zip opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2 opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 65 |
1 files changed, 52 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 174642d..5cbfec6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -32,6 +32,7 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using Mono.Addins; | 33 | using Mono.Addins; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.StructuredData; | ||
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
@@ -103,6 +104,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
103 | 104 | ||
104 | public virtual void RegionLoaded(Scene scene) | 105 | public virtual void RegionLoaded(Scene scene) |
105 | { | 106 | { |
107 | if (!m_enabled) | ||
108 | return; | ||
109 | |||
110 | ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface<ISimulatorFeaturesModule>(); | ||
111 | |||
112 | if (featuresModule != null) | ||
113 | featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest; | ||
114 | |||
106 | } | 115 | } |
107 | 116 | ||
108 | public virtual void RemoveRegion(Scene scene) | 117 | public virtual void RemoveRegion(Scene scene) |
@@ -372,21 +381,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
372 | UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type, | 381 | UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type, |
373 | string message, ChatSourceType src, bool ignoreDistance) | 382 | string message, ChatSourceType src, bool ignoreDistance) |
374 | { | 383 | { |
375 | // don't send chat to child agents | 384 | if (presence.LifecycleState != ScenePresenceState.Running) |
376 | if (presence.IsChildAgent) return false; | 385 | return false; |
377 | |||
378 | Vector3 fromRegionPos = fromPos + regionPos; | ||
379 | Vector3 toRegionPos = presence.AbsolutePosition + | ||
380 | new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize, | ||
381 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | ||
382 | 386 | ||
383 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); | 387 | if (!ignoreDistance) |
384 | |||
385 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || | ||
386 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
387 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
388 | { | 388 | { |
389 | return false; | 389 | Vector3 fromRegionPos = fromPos + regionPos; |
390 | Vector3 toRegionPos = presence.AbsolutePosition + | ||
391 | new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize, | ||
392 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | ||
393 | |||
394 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); | ||
395 | |||
396 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || | ||
397 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
398 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
399 | { | ||
400 | return false; | ||
401 | } | ||
390 | } | 402 | } |
391 | 403 | ||
392 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView | 404 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView |
@@ -426,5 +438,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
426 | Timers.Remove(target); | 438 | Timers.Remove(target); |
427 | Timer.Dispose(); | 439 | Timer.Dispose(); |
428 | } | 440 | } |
441 | #region SimulatorFeaturesRequest | ||
442 | |||
443 | static OSDInteger m_SayRange, m_WhisperRange, m_ShoutRange; | ||
444 | |||
445 | private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) | ||
446 | { | ||
447 | OSD extras = new OSDMap(); | ||
448 | if (features.ContainsKey("OpenSimExtras")) | ||
449 | extras = features["OpenSimExtras"]; | ||
450 | else | ||
451 | features["OpenSimExtras"] = extras; | ||
452 | |||
453 | if (m_SayRange == null) | ||
454 | { | ||
455 | // Do this only once | ||
456 | m_SayRange = new OSDInteger(m_saydistance); | ||
457 | m_WhisperRange = new OSDInteger(m_whisperdistance); | ||
458 | m_ShoutRange = new OSDInteger(m_shoutdistance); | ||
459 | } | ||
460 | |||
461 | ((OSDMap)extras)["say-range"] = m_SayRange; | ||
462 | ((OSDMap)extras)["whisper-range"] = m_WhisperRange; | ||
463 | ((OSDMap)extras)["shout-range"] = m_ShoutRange; | ||
464 | |||
465 | } | ||
466 | |||
467 | #endregion | ||
429 | } | 468 | } |
430 | } | 469 | } |