Skip to content

Commit

Permalink
Update ChatSystem.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Oct 17, 2024
1 parent 0f73ebf commit 97042eb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
using Content.Server.Shuttles.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics.Joints;
using Content.Shared.Atmos.Components;

namespace Content.Server.Chat.Systems;

Expand Down Expand Up @@ -506,7 +507,8 @@ private void SendEntityWhisper(
if (session.AttachedEntity is not { Valid: true } listener)
continue;

if (Transform(session.AttachedEntity.Value).GridUid != Transform(source).GridUid
if (!HasComp<SharedMapAtmosphereComponent>(Transform(session.AttachedEntity.Value).MapUid)
&& Transform(session.AttachedEntity.Value).GridUid != Transform(source).GridUid
&& !CheckAttachedGrids(source, session.AttachedEntity.Value))
continue;

Expand Down Expand Up @@ -712,7 +714,10 @@ private void SendInVoiceRange(ChatChannel channel, string name, string message,
var language = languageOverride ?? _language.GetLanguage(source);
foreach (var (session, data) in GetRecipients(source, Transform(source).GridUid == null ? 0.3f : VoiceRange))
{
if (session.AttachedEntity != null
if (session.AttachedEntity is not { Valid: true } playerEntity)
continue;

if (!HasComp<SharedMapAtmosphereComponent>(Transform(session.AttachedEntity.Value).MapUid)
&& Transform(session.AttachedEntity.Value).GridUid != Transform(source).GridUid
&& !CheckAttachedGrids(source, session.AttachedEntity.Value))
continue;
Expand All @@ -721,11 +726,8 @@ private void SendInVoiceRange(ChatChannel channel, string name, string message,
if (entRange == MessageRangeCheckResult.Disallowed)
continue;
var entHideChat = entRange == MessageRangeCheckResult.HideChat;
if (session.AttachedEntity is not { Valid: true } playerEntity)
continue;
EntityUid listener = session.AttachedEntity.Value;


// If the channel does not support languages, or the entity can understand the message, send the original message, otherwise send the obfuscated version
if (channel == ChatChannel.LOOC || channel == ChatChannel.Emotes || _language.CanUnderstand(listener, language.ID))
{
Expand Down

0 comments on commit 97042eb

Please sign in to comment.