Ghost hearing action (#19722)

This commit is contained in:
Kara
2023-09-24 13:34:08 -07:00
committed by GitHub
parent 5e405380ef
commit fb175a520d
11 changed files with 97 additions and 28 deletions

View File

@@ -739,7 +739,7 @@ public sealed partial class ChatSystem : SharedChatSystem
// TODO proper speech occlusion
var recipients = new Dictionary<ICommonSession, ICChatRecipientData>();
var ghosts = GetEntityQuery<GhostComponent>();
var ghostHearing = GetEntityQuery<GhostHearingComponent>();
var xforms = GetEntityQuery<TransformComponent>();
var transformSource = xforms.GetComponent(source);
@@ -756,9 +756,9 @@ public sealed partial class ChatSystem : SharedChatSystem
if (transformEntity.MapID != sourceMapId)
continue;
var observer = ghosts.HasComponent(playerEntity);
var observer = ghostHearing.HasComponent(playerEntity);
// even if they are an observer, in some situations we still need the range
// even if they are a ghost hearer, in some situations we still need the range
if (sourceCoords.TryDistance(EntityManager, transformEntity.Coordinates, out var distance) && distance < voiceGetRange)
{
recipients.Add(player, new ICChatRecipientData(distance, observer));