From dbba104eab0df6b04916fa9c67797c972b5bec2c Mon Sep 17 00:00:00 2001 From: Morb <14136326+Morb0@users.noreply.github.com> Date: Sun, 11 Dec 2022 21:06:11 +0300 Subject: [PATCH] Fax Machine (#11704) --- Content.Client/Fax/UI/FaxBoundUi.cs | 58 +++ Content.Client/Fax/UI/FaxWindow.xaml | 32 ++ Content.Client/Fax/UI/FaxWindow.xaml.cs | 81 ++++ Content.Server/Fax/FaxConstants.cs | 28 ++ Content.Server/Fax/FaxMachineComponent.cs | 142 ++++++ Content.Server/Fax/FaxSystem.cs | 442 ++++++++++++++++++ Content.Server/Nuke/NukeCodePaperSystem.cs | 75 +-- Content.Shared/Fax/FaxVisuals.cs | 17 + Content.Shared/Fax/SharedFax.cs | 53 +++ .../Audio/Machines/high_tech_confirm.ogg | Bin 0 -> 14304 bytes Resources/Audio/Machines/license.txt | 10 +- Resources/Audio/Machines/printer.ogg | Bin 0 -> 42893 bytes Resources/Audio/Machines/scanning.ogg | Bin 0 -> 17894 bytes Resources/Audio/Machines/tray_eject.ogg | Bin 0 -> 16839 bytes .../Locale/en-US/devices/device-network.ftl | 1 + Resources/Locale/en-US/fax/fax.ftl | 20 + .../Locale/en-US/nuke/nuke-component.ftl | 5 + Resources/Locale/en-US/verbs/verb-system.ftl | 1 + .../Device/devicenet_frequencies.yml | 5 + .../Entities/Objects/Misc/paper.yml | 3 - .../Structures/Machines/fax_machine.yml | 106 +++++ .../Machines/fax_machine.rsi/icon.png | Bin 0 -> 350 bytes .../Machines/fax_machine.rsi/idle.png | Bin 0 -> 909 bytes .../Machines/fax_machine.rsi/inserting.png | Bin 0 -> 1593 bytes .../Machines/fax_machine.rsi/meta.json | 89 ++++ .../Machines/fax_machine.rsi/printing.png | Bin 0 -> 1773 bytes 26 files changed, 1133 insertions(+), 35 deletions(-) create mode 100644 Content.Client/Fax/UI/FaxBoundUi.cs create mode 100644 Content.Client/Fax/UI/FaxWindow.xaml create mode 100644 Content.Client/Fax/UI/FaxWindow.xaml.cs create mode 100644 Content.Server/Fax/FaxConstants.cs create mode 100644 Content.Server/Fax/FaxMachineComponent.cs create mode 100644 Content.Server/Fax/FaxSystem.cs create mode 100644 Content.Shared/Fax/FaxVisuals.cs create mode 100644 Content.Shared/Fax/SharedFax.cs create mode 100644 Resources/Audio/Machines/high_tech_confirm.ogg create mode 100644 Resources/Audio/Machines/printer.ogg create mode 100644 Resources/Audio/Machines/scanning.ogg create mode 100644 Resources/Audio/Machines/tray_eject.ogg create mode 100644 Resources/Locale/en-US/fax/fax.ftl create mode 100644 Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/icon.png create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/idle.png create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/inserting.png create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/meta.json create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/printing.png diff --git a/Content.Client/Fax/UI/FaxBoundUi.cs b/Content.Client/Fax/UI/FaxBoundUi.cs new file mode 100644 index 0000000000..f6d31e78db --- /dev/null +++ b/Content.Client/Fax/UI/FaxBoundUi.cs @@ -0,0 +1,58 @@ +using Content.Shared.Fax; +using Robust.Client.GameObjects; + +namespace Content.Client.Fax.UI; + +public sealed class FaxBoundUi : BoundUserInterface +{ + private FaxWindow? _window; + + public FaxBoundUi(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _window = new FaxWindow(); + _window.OpenCentered(); + + _window.OnClose += Close; + _window.SendButtonPressed += OnSendButtonPressed; + _window.RefreshButtonPressed += OnRefreshButtonPressed; + _window.PeerSelected += OnPeerSelected; + } + + private void OnSendButtonPressed() + { + SendMessage(new FaxSendMessage()); + } + + private void OnRefreshButtonPressed() + { + SendMessage(new FaxRefreshMessage()); + } + + private void OnPeerSelected(string address) + { + SendMessage(new FaxDestinationMessage(address)); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (_window == null || state is not FaxUiState cast) + return; + + _window.UpdateState(cast); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (disposing) + _window?.Dispose(); + } +} diff --git a/Content.Client/Fax/UI/FaxWindow.xaml b/Content.Client/Fax/UI/FaxWindow.xaml new file mode 100644 index 0000000000..c83e617aa7 --- /dev/null +++ b/Content.Client/Fax/UI/FaxWindow.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + +