IListener and IRadio purge (#11980)

This commit is contained in:
Leon Friedrich
2022-11-15 17:09:27 +13:00
committed by GitHub
parent bc525425da
commit 0b5a58001c
48 changed files with 946 additions and 643 deletions

View File

@@ -1,6 +1,3 @@
using Content.Server.Radio.Components;
using Content.Shared.Interaction;
using Content.Shared.Radio;
using Content.Shared.Whitelist;
namespace Content.Server.SurveillanceCamera;
@@ -10,9 +7,9 @@ namespace Content.Server.SurveillanceCamera;
/// environment. All surveillance camera monitors have speakers for this.
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(IListen))]
public sealed class SurveillanceCameraMicrophoneComponent : Component, IListen
public sealed class SurveillanceCameraMicrophoneComponent : Component
{
[DataField("enabled")]
public bool Enabled { get; set; } = true;
/// <summary>
@@ -21,27 +18,9 @@ public sealed class SurveillanceCameraMicrophoneComponent : Component, IListen
/// Used to avoid things like feedback loops, or radio spam.
/// </summary>
[DataField("blacklist")]
public EntityWhitelist BlacklistedComponents { get; } = new();
public EntityWhitelist Blacklist { get; } = new();
// TODO: Once IListen is removed, **REMOVE THIS**
private SurveillanceCameraMicrophoneSystem? _microphoneSystem;
protected override void Initialize()
{
base.Initialize();
_microphoneSystem = EntitySystem.Get<SurveillanceCameraMicrophoneSystem>();
}
public int ListenRange { get; } = 10;
public bool CanListen(string message, EntityUid source, RadioChannelPrototype? channelPrototype)
{
return _microphoneSystem != null
&& _microphoneSystem.CanListen(Owner, source, this);
}
public void Listen(string message, EntityUid speaker, RadioChannelPrototype? channel)
{
_microphoneSystem?.RelayEntityMessage(Owner, speaker, message);
}
[ViewVariables(VVAccess.ReadWrite)]
[DataField("range")]
public int Range { get; } = 10;
}