Global ghost hearing (#3954)
* Add global hearing for ghosts * Fix speech bubbles breaking when out of PVS
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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<GhostComponent>()
|
||||
|| 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)
|
||||
|
||||
Reference in New Issue
Block a user