Adds Handheld Radio/Listener system (#1457)

* re-do of old PR that got fuckied upp

* simplify foreach as suggested

* pass distance to PassSpeechData for a check, remove GetListenRange()

* adds RadioQuery instead of subscribing/unsubscribing

* change SpreadMessage to accept owner rather than component

* change RadioQuery to EntityQuery

* remove declared EntityQuery (oops, didn't know what shadowcommander meant)

* refactor ListeningSystem & refactor added chat logic into listen sys

* IGNORE the oopsie STOP LOOKING
This commit is contained in:
Bright0
2020-07-28 16:13:39 -06:00
committed by GitHub
parent b5667230c1
commit 86a6ac4a2b
8 changed files with 256 additions and 0 deletions

View File

@@ -10,6 +10,15 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using Content.Server.GameObjects.Components;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.EntitySystems;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Robust.Shared.Interfaces.Map;
namespace Content.Server.Chat
{
@@ -21,6 +30,7 @@ namespace Content.Server.Chat
private const int VoiceRange = 7; // how far voice goes in world units
#pragma warning disable 649
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly IServerNetManager _netManager;
[Dependency] private readonly IPlayerManager _playerManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
@@ -67,6 +77,9 @@ namespace Content.Server.Chat
msg.MessageWrap = $"{source.Name} says, \"{{0}}\"";
msg.SenderEntity = source.Uid;
_netManager.ServerSendToMany(msg, clients.ToList());
var listeners = _entitySystemManager.GetEntitySystem<ListeningSystem>();
listeners.PingListeners(source, pos, message);
}
public void EntityMe(IEntity source, string action)