From 6dbfbc52c05ce81c574d8e5498e87fa2bfbcb029 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Tue, 11 Jul 2023 19:58:18 -0400 Subject: [PATCH] Good Intercoms (#17950) * crystal anomaly * Good intercoms * fixes * fix construction fail * Revert "crystal anomaly" This reverts commit 0d9e3f62ff82c79e72f882b9c7f4ca1b9c6e6dd8. * migration --- .../Radio/Ui/IntercomBoundUserInterface.cs | 58 +++++++ Content.Client/Radio/Ui/IntercomMenu.xaml | 31 ++++ Content.Client/Radio/Ui/IntercomMenu.xaml.cs | 55 +++++++ .../Components/RadioMicrophoneComponent.cs | 10 +- .../Radio/Components/RadioSpeakerComponent.cs | 7 + .../Radio/EntitySystems/RadioDeviceSystem.cs | 151 +++++++++++------- .../Radio/EntitySystems/RadioSystem.cs | 2 +- .../Radio/Components/IntercomComponent.cs | 23 +++ Content.Shared/Radio/RadioVisuals.cs | 6 +- Content.Shared/Radio/SharedIntercom.cs | 59 +++++++ .../en-US/radio/components/intercom.ftl | 5 + .../Xenoarchaeology/item_artifacts.yml | 2 + .../Xenoarchaeology/structure_artifacts.yml | 2 + .../Structures/Wallmounts/intercom.yml | 71 ++++---- .../Prototypes/Procedural/dungeon_configs.yml | 4 +- .../Graphs/utilities/intercom.yml | 2 +- .../XenoArch/Effects/utility_effects.yml | 8 + .../Wallmounts/intercom.rsi/meta.json | 4 + .../Wallmounts/intercom.rsi/speaker.png | Bin 0 -> 157 bytes .../Wallmounts/intercom.rsi/unshaded.png | Bin 369 -> 328 bytes Resources/migration.yml | 5 +- 21 files changed, 407 insertions(+), 98 deletions(-) create mode 100644 Content.Client/Radio/Ui/IntercomBoundUserInterface.cs create mode 100644 Content.Client/Radio/Ui/IntercomMenu.xaml create mode 100644 Content.Client/Radio/Ui/IntercomMenu.xaml.cs create mode 100644 Content.Shared/Radio/Components/IntercomComponent.cs create mode 100644 Content.Shared/Radio/SharedIntercom.cs create mode 100644 Resources/Locale/en-US/radio/components/intercom.ftl create mode 100644 Resources/Textures/Structures/Wallmounts/intercom.rsi/speaker.png diff --git a/Content.Client/Radio/Ui/IntercomBoundUserInterface.cs b/Content.Client/Radio/Ui/IntercomBoundUserInterface.cs new file mode 100644 index 0000000000..abbb1d58ec --- /dev/null +++ b/Content.Client/Radio/Ui/IntercomBoundUserInterface.cs @@ -0,0 +1,58 @@ +using Content.Shared.Radio; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.Radio.Ui; + +[UsedImplicitly] +public sealed class IntercomBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private IntercomMenu? _menu; + + public IntercomBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + + } + + protected override void Open() + { + base.Open(); + + _menu = new(); + + _menu.OnMicPressed += enabled => + { + SendMessage(new ToggleIntercomMicMessage(enabled)); + }; + _menu.OnSpeakerPressed += enabled => + { + SendMessage(new ToggleIntercomSpeakerMessage(enabled)); + }; + _menu.OnChannelSelected += channel => + { + SendMessage(new SelectIntercomChannelMessage(channel)); + }; + + _menu.OnClose += Close; + _menu.OpenCentered(); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; + _menu?.Close(); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (state is not IntercomBoundUIState msg) + return; + + _menu?.Update(msg); + } +} diff --git a/Content.Client/Radio/Ui/IntercomMenu.xaml b/Content.Client/Radio/Ui/IntercomMenu.xaml new file mode 100644 index 0000000000..aed4fc754e --- /dev/null +++ b/Content.Client/Radio/Ui/IntercomMenu.xaml @@ -0,0 +1,31 @@ + + + + + + + + +