From 2d273107f4a01fa6ba044fbae524268cf7ea37ae Mon Sep 17 00:00:00 2001 From: Julian Giebel Date: Mon, 22 May 2023 15:20:53 +0200 Subject: [PATCH] Implement automatic mode switching for the network configurator and multitool (#16603) --- .../Systems/NetworkConfiguratorSystem.cs | 47 ++++++++++++++++-- .../NetworkConfiguratorComponent.cs | 2 +- Resources/Audio/Machines/attributions.yml | 5 ++ Resources/Audio/Machines/quickbeep.ogg | Bin 0 -> 5403 bytes .../components/cloning-console-component.ftl | 4 +- Resources/Locale/en-US/paper/book-atmos.ftl | 2 +- 6 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 Resources/Audio/Machines/quickbeep.ogg diff --git a/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs b/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs index 4c5bd236b5..5aae1c2722 100644 --- a/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs @@ -204,6 +204,9 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem _uiSystem.TryCloseAll(uid, NetworkConfiguratorUiKey.Configure); } + /// + /// Toggles between linking and listing mode + /// private void SwitchMode(EntityUid? userUid, EntityUid configuratorUid, NetworkConfiguratorComponent configurator) { if (Delay(configurator)) @@ -217,15 +220,32 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem if (!configurator.LinkModeActive) configurator.ActiveDeviceLink = null; - var locString = configurator.LinkModeActive ? "network-configurator-mode-link" : "network-configurator-mode-list"; - _popupSystem.PopupEntity(Loc.GetString("network-configurator-switched-mode", ("mode", Loc.GetString(locString))), - configuratorUid, userUid.Value); + UpdateModeAppearance(userUid.Value, configuratorUid, configurator); + } + /// + /// Sets the mode to linking or list depending on the link mode parameter + /// > + private void SetMode(EntityUid configuratorUid, NetworkConfiguratorComponent configurator, EntityUid userUid, bool linkMode) + { + configurator.LinkModeActive = linkMode; + + if (!linkMode) + configurator.ActiveDeviceLink = null; + + UpdateModeAppearance(userUid, configuratorUid, configurator); + } + + /// + /// Updates the configurators appearance and plays a sound indicating that the mode switched + /// + private void UpdateModeAppearance(EntityUid userUid, EntityUid configuratorUid, NetworkConfiguratorComponent configurator) + { Dirty(configurator); _appearanceSystem.SetData(configuratorUid, NetworkConfiguratorVisuals.Mode, configurator.LinkModeActive); var pitch = configurator.LinkModeActive ? 1 : 0.8f; - _audioSystem.PlayPvs(configurator.SoundSwitchMode, userUid.Value, AudioParams.Default.WithVolume(1.5f).WithPitchScale(pitch)); + _audioSystem.PlayPvs(configurator.SoundSwitchMode, userUid, AudioParams.Default.WithVolume(1.5f).WithPitchScale(pitch)); } /// @@ -262,6 +282,8 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem if (!canReach || !target.HasValue) return; + DetermineMode(uid, configurator, target, user); + if (configurator.LinkModeActive) { TryLinkDevice(uid, configurator, target, user); @@ -277,6 +299,23 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem OpenDeviceListUi(target, user, configurator); } + private void DetermineMode(EntityUid configuratorUid, NetworkConfiguratorComponent configurator, EntityUid? target, EntityUid userUid) + { + var hasLinking = HasComp(target) || HasComp(target); + + if (hasLinking && HasComp(target) || hasLinking == configurator.LinkModeActive) + return; + + if (hasLinking) + { + SetMode(configuratorUid, configurator, userUid, true); + return; + } + + if (HasComp(target)) + SetMode(configuratorUid, configurator, userUid, false); + } + #endregion #region Verbs diff --git a/Content.Shared/DeviceNetwork/Components/NetworkConfiguratorComponent.cs b/Content.Shared/DeviceNetwork/Components/NetworkConfiguratorComponent.cs index 128c328f28..b0b675ac0b 100644 --- a/Content.Shared/DeviceNetwork/Components/NetworkConfiguratorComponent.cs +++ b/Content.Shared/DeviceNetwork/Components/NetworkConfiguratorComponent.cs @@ -56,7 +56,7 @@ public sealed class NetworkConfiguratorComponent : Component public SoundSpecifier SoundNoAccess = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg"); [DataField("soundSwitchMode")] - public SoundSpecifier SoundSwitchMode = new SoundPathSpecifier("/Audio/Machines/beep.ogg"); + public SoundSpecifier SoundSwitchMode = new SoundPathSpecifier("/Audio/Machines/quickbeep.ogg"); } [Serializable, NetSerializable] diff --git a/Resources/Audio/Machines/attributions.yml b/Resources/Audio/Machines/attributions.yml index 0550a64f7c..a3aeabef8f 100644 --- a/Resources/Audio/Machines/attributions.yml +++ b/Resources/Audio/Machines/attributions.yml @@ -27,3 +27,8 @@ license: "CC-BY-4.0" copyright: "Created by AUDACITIER (freesound), converted to MONO and .ogg and edited by EmoGarbage404 (github)." source: "https://freesound.org/people/AUDACITIER/sounds/629196/" + +- files: ["quickbeep.ogg"] + license: "CC0-1.0" + copyright: "Created by BasedUser#2215 on discord" + source: "https://discord.com/channels/310555209753690112/536955542913024015/1066824680188690452" diff --git a/Resources/Audio/Machines/quickbeep.ogg b/Resources/Audio/Machines/quickbeep.ogg new file mode 100644 index 0000000000000000000000000000000000000000..90bc061b58a5e09d7cf4ce55e0dae1e9bcda779e GIT binary patch literal 5403 zcmahN4Oo*^_ih3kh&Tyx5b8T+%8(U9D2HNfD7b+FuZS|SXafZ15Aq^qYE2jjIuUUq z@?)SI$fq+=hf-;j@*@F(KVWH!St8|M)~8mM-?{G#<=6K-efN2}yZ4-P&$;LC-gAju zzI-8KqoEd8)SiTgBUm@=Srb@Ut25N86b7*79Kt^c^-p4mPqHHM%0C-k$%5Glo31Bg z<~;lF_QnW?lRpqFNlj0ADKcX@u_9F+OYMPR%AGMAE?T9@M|M-BK!tTI~N2F z9@t+P_`TQhZuv;@@$#aNcWA<=N)3BL~IhmzIc+T zc)y}1Iqh(2c|*#K!RIUYFW+ye93VoN&o)~PHFQ-!C=eQH6E>N zJm-?0trTypG-vpSQU0yeEcn7Q=bSS}bp9MMde{lr?Fa=+Jet>doC9l+ z;tLr8i>aVKYJMM>0$b#t+a@|*KoLP@a!HzwJH6;l+AKO?%dh5!I5L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b1C9J_F|MBZiFtwk|fHukrqy!o!fRfgB>kKk@OlEOcz~ z0Vb>f(0%F)J9g6>V-qkIny!8J+sp_Ni)X?kKi>oCM!#$O)SZ}Pqgmg%X>|2z_ny;t z_jXiE>g;dUj!wLrzjaBZD=qz#N8ilZ?rRV=jX@iJO^#$WxjSd)d&_t>DCNtDho5*B zj(#|%WFWHtqa86*GbPTSszws5l4BqI`s&2ucP*iQ#2OnbN%K!iX literal 0 HcmV?d00001 diff --git a/Resources/Locale/en-US/medical/components/cloning-console-component.ftl b/Resources/Locale/en-US/medical/components/cloning-console-component.ftl index aecafad5e5..ceb1cdaf85 100644 --- a/Resources/Locale/en-US/medical/components/cloning-console-component.ftl +++ b/Resources/Locale/en-US/medical/components/cloning-console-component.ftl @@ -7,8 +7,8 @@ cloning-console-window-no-patient-data-text = No patient data. cloning-console-window-id-blank = ID: cloning-console-window-scanner-details-label = Genetic Scanner Status cloning-console-window-pod-details-label = Cloning Pod Status -cloning-console-window-no-scanner-detected-label = Link a genetic scanner with a multitool. -cloning-console-window-no-clone-pod-detected-label = Link a cloning pod with a multitool. +cloning-console-window-no-scanner-detected-label = Link a genetic scanner with a multitool or network configurator. +cloning-console-window-no-clone-pod-detected-label = Link a cloning pod with a multitool or network configurator. cloning-console-window-scanner-far-label = Genetic Scanner Too Far Away cloning-console-window-clone-pod-far-label = Cloning Pod Too Far Away cloning-console-eject-body-button = Eject Body diff --git a/Resources/Locale/en-US/paper/book-atmos.ftl b/Resources/Locale/en-US/paper/book-atmos.ftl index 7e7755f9ca..abbb67bc6f 100644 --- a/Resources/Locale/en-US/paper/book-atmos.ftl +++ b/Resources/Locale/en-US/paper/book-atmos.ftl @@ -36,7 +36,7 @@ book-text-atmos-alarms = Air alarms are located throughout stations to allow man - Fill: Disables scrubbers and sets vents to their maximum pressure - Panic: Disables vents and sets scrubbers to siphon - A multitool can be used to link devices to air alarms. + A multitool or network configurator can be used to link devices to air alarms. book-text-atmos-vents = Below is a quick reference guide to several atmospheric devices: