global radio toggle for observers (#22137)
This commit is contained in:
@@ -15,6 +15,13 @@ public sealed partial class ActiveRadioComponent : Component
|
|||||||
[DataField("channels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<RadioChannelPrototype>))]
|
[DataField("channels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<RadioChannelPrototype>))]
|
||||||
public HashSet<string> Channels = new();
|
public HashSet<string> Channels = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A toggle for globally receiving all radio channels.
|
||||||
|
/// Overrides <see cref="Channels"/>
|
||||||
|
/// </summary>
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool ReceiveAllChannels;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If this radio can hear all messages on all maps
|
/// If this radio can hear all messages on all maps
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -103,8 +103,12 @@ public sealed class RadioSystem : EntitySystem
|
|||||||
var radioQuery = EntityQueryEnumerator<ActiveRadioComponent, TransformComponent>();
|
var radioQuery = EntityQueryEnumerator<ActiveRadioComponent, TransformComponent>();
|
||||||
while (canSend && radioQuery.MoveNext(out var receiver, out var radio, out var transform))
|
while (canSend && radioQuery.MoveNext(out var receiver, out var radio, out var transform))
|
||||||
{
|
{
|
||||||
if (!radio.Channels.Contains(channel.ID) || (TryComp<IntercomComponent>(receiver, out var intercom) && !intercom.SupportedChannels.Contains(channel.ID)))
|
if (!radio.ReceiveAllChannels)
|
||||||
continue;
|
{
|
||||||
|
if (!radio.Channels.Contains(channel.ID) || (TryComp<IntercomComponent>(receiver, out var intercom) &&
|
||||||
|
!intercom.SupportedChannels.Contains(channel.ID)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!channel.LongRange && transform.MapID != sourceMapId && !radio.GlobalReceive)
|
if (!channel.LongRange && transform.MapID != sourceMapId && !radio.GlobalReceive)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -39,19 +39,7 @@
|
|||||||
- type: MovementIgnoreGravity
|
- type: MovementIgnoreGravity
|
||||||
- type: IntrinsicRadioReceiver
|
- type: IntrinsicRadioReceiver
|
||||||
- type: ActiveRadio
|
- type: ActiveRadio
|
||||||
channels:
|
receiveAllChannels: true
|
||||||
- Binary
|
|
||||||
- Common
|
|
||||||
- Command
|
|
||||||
- CentCom
|
|
||||||
- Engineering
|
|
||||||
- Medical
|
|
||||||
- Science
|
|
||||||
- Security
|
|
||||||
- Service
|
|
||||||
- Supply
|
|
||||||
- Syndicate
|
|
||||||
- Freelance
|
|
||||||
globalReceive: true
|
globalReceive: true
|
||||||
- type: Physics
|
- type: Physics
|
||||||
bodyType: KinematicController
|
bodyType: KinematicController
|
||||||
|
|||||||
Reference in New Issue
Block a user