using Content.Server.Radio.Components; using Content.Shared.Radio; using Content.Shared.Radio.Components; namespace Content.Server.Radio; public sealed class IntrinsicRadioKeySystem : EntitySystem { public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnTransmitterChannelsChanged); SubscribeLocalEvent(OnReceiverChannelsChanged); } private void OnTransmitterChannelsChanged(EntityUid uid, IntrinsicRadioTransmitterComponent component, EncryptionChannelsChangedEvent args) { UpdateChannels(uid, args.Component, ref component.Channels); } private void OnReceiverChannelsChanged(EntityUid uid, ActiveRadioComponent component, EncryptionChannelsChangedEvent args) { UpdateChannels(uid, args.Component, ref component.Channels); } private void UpdateChannels(EntityUid _, EncryptionKeyHolderComponent component, ref HashSet channels) { channels.Clear(); channels.UnionWith(component.Channels); } }