diff --git a/Content.Client/Chat/SpeechBubble.cs b/Content.Client/Chat/SpeechBubble.cs index b2639281d5..56dbc5da7f 100644 --- a/Content.Client/Chat/SpeechBubble.cs +++ b/Content.Client/Chat/SpeechBubble.cs @@ -1,4 +1,4 @@ -using System; +using System; using Content.Client.Interfaces.Chat; using Robust.Client.Graphics; using Robust.Client.UserInterface; @@ -110,6 +110,9 @@ namespace Content.Client.Chat _verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds); } + if (!_senderEntity.Transform.Coordinates.IsValid(_senderEntity.EntityManager)) + return; + var worldPos = _senderEntity.Transform.WorldPosition; worldPos += (0, EntityVerticalOffset); diff --git a/Content.Server/Chat/ChatManager.cs b/Content.Server/Chat/ChatManager.cs index 918b218c3c..9febc1ee2d 100644 --- a/Content.Server/Chat/ChatManager.cs +++ b/Content.Server/Chat/ChatManager.cs @@ -144,8 +144,12 @@ namespace Content.Server.Chat message = message.Trim(); - var pos = source.Transform.Coordinates; - var clients = _playerManager.GetPlayersInRange(pos, VoiceRange).Select(p => p.ConnectedClient); + var mapPos = source.Transform.MapPosition; + + var clients = _playerManager.GetPlayersBy((x) => x.AttachedEntity != null + && (x.AttachedEntity.HasComponent() + || mapPos.InRange(x.AttachedEntity.Transform.MapPosition, VoiceRange))) + .Select(p => p.ConnectedClient).ToList(); if (message.StartsWith(';')) { @@ -184,7 +188,7 @@ namespace Content.Server.Chat msg.Message = message; msg.MessageWrap = Loc.GetString("{0} says, \"{{0}}\"", source.Name); msg.SenderEntity = source.Uid; - _netManager.ServerSendToMany(msg, clients.ToList()); + _netManager.ServerSendToMany(msg, clients); } public void EntityMe(IEntity source, string action)