From 3cfd9be98ded52b358166262d0634d9e33484491 Mon Sep 17 00:00:00 2001 From: Kirus59 <145689588+Kirus59@users.noreply.github.com> Date: Tue, 24 Sep 2024 00:26:16 +0300 Subject: [PATCH] Encryption keys Pai fix (#1924) * Encryption keys Pai fix * maybe?... --- Content.Server/Radio/EntitySystems/RadioSystem.cs | 11 ++++++----- .../Prototypes/SS220/Entities/Objects/Fun/pai.yml | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Content.Server/Radio/EntitySystems/RadioSystem.cs b/Content.Server/Radio/EntitySystems/RadioSystem.cs index cbe319ce3cc614..2b3811ca1149cd 100644 --- a/Content.Server/Radio/EntitySystems/RadioSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioSystem.cs @@ -265,13 +265,14 @@ private void OnEncryptionChannelsChangeTransmitter(Entity entity, ref EncryptionChannelsChangedEvent args) { - if (!TryComp(entity.Owner, out var activeRadio)) - return; - - HashSet channels = entity.Comp.Channels; + HashSet channels = new(); channels.UnionWith(args.Component.Channels); + channels.UnionWith(entity.Comp.Channels); - activeRadio.Channels = new(channels); + if (channels.Count > 0) + EnsureComp(entity.Owner).Channels = channels; + else + RemComp(entity.Owner); } //SS220 PAI with encryption keys end } diff --git a/Resources/Prototypes/SS220/Entities/Objects/Fun/pai.yml b/Resources/Prototypes/SS220/Entities/Objects/Fun/pai.yml index ea304a350e3221..abaf5689ddb803 100644 --- a/Resources/Prototypes/SS220/Entities/Objects/Fun/pai.yml +++ b/Resources/Prototypes/SS220/Entities/Objects/Fun/pai.yml @@ -45,6 +45,9 @@ - type: IntrinsicRadioTransmitter channels: - Binary + - type: ActiveRadio + channels: + - Binary - type: DoAfter - type: Actions - type: TypingIndicator