From 77089e5d0a1548a4512054da3ddeea6ba2b5e242 Mon Sep 17 00:00:00 2001 From: SkaldetSkaeg Date: Mon, 5 Feb 2024 16:46:34 +0500 Subject: [PATCH 01/11] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=81=D0=BE=D0=BB=D1=8C=20=D0=B2=20yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Structures/Machines/computers.yml | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Resources/Prototypes/SS220/Entities/Structures/Machines/computers.yml b/Resources/Prototypes/SS220/Entities/Structures/Machines/computers.yml index f5e8e3750d8e..bd5743808923 100644 --- a/Resources/Prototypes/SS220/Entities/Structures/Machines/computers.yml +++ b/Resources/Prototypes/SS220/Entities/Structures/Machines/computers.yml @@ -28,4 +28,44 @@ - type: PointLight radius: 1.5 energy: 1.6 - color: "#f71713" \ No newline at end of file + color: "#f71713" + +- type: entity + parent: BaseComputer + id: ComputerCluwneComms + name: communications computer for jokes + description: Used to create memed announces + components: + - type: Sprite + layers: + - map: ["computerLayerBody"] + state: computer + - map: ["computerLayerKeyboard"] + state: generic_keyboard + - map: ["computerLayerScreen"] + state: comm + - map: ["computerLayerKeys"] + state: generic_keys + - type: AccessReader + access: [[ "service" ]] + - type: CommunicationsConsole + title: comms-console-announcement-title-station + sound: # Corvax-Announcements + path: /Audio/Corvax/Announcements/announce.ogg + params: + volume: -4 + - type: ActivatableUI + key: enum.CommunicationsConsoleUiKey.Key + - type: UserInterface + interfaces: + - key: enum.CommunicationsConsoleUiKey.Key + type: CommunicationsConsoleBoundUserInterface + - type: Computer + board: CommsComputerCircuitboard + - type: PointLight + radius: 1.5 + energy: 1.6 + color: "#3c5eb5" + - type: Damageable + damageContainer: Inorganic + damageModifierSet: StrongMetallic From b7b4015812356b8aeb4b389edb0ae7148b500e30 Mon Sep 17 00:00:00 2001 From: SkaldetSkaeg Date: Wed, 7 Feb 2024 14:44:51 +0500 Subject: [PATCH 02/11] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=20=D1=87=D0=B0=D1=81=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=20=D0=B8=D1=85=20=D0=BE=D0=B1=D1=8B=D1=87?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D0=BA=D0=BE=D0=BC=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=81=D0=BE=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...CommunicationsConsoleBoundUserInterface.cs | 116 ++++++++++++++++++ .../UI/CluwneCommunicationsConsoleMenu.xaml | 16 +++ .../CluwneCommunicationsConsoleMenu.xaml.cs | 111 +++++++++++++++++ ...luwne-communications-console-component.ftl | 14 +++ .../Locale/ru-RU/ss220/joke-lerts-level.ftl | 12 ++ .../Structures/Machines/computers.yml | 6 +- 6 files changed, 272 insertions(+), 3 deletions(-) create mode 100644 Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleBoundUserInterface.cs create mode 100644 Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleMenu.xaml create mode 100644 Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleMenu.xaml.cs create mode 100644 Resources/Locale/ru-RU/ss220/cluwne-communications-console-component.ftl create mode 100644 Resources/Locale/ru-RU/ss220/joke-lerts-level.ftl diff --git a/Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleBoundUserInterface.cs b/Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleBoundUserInterface.cs new file mode 100644 index 000000000000..7286c40e4930 --- /dev/null +++ b/Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleBoundUserInterface.cs @@ -0,0 +1,116 @@ +using Content.Shared.CCVar; +using Content.Shared.Chat; +using Content.Shared.Communications; +using Robust.Shared.Configuration; +using Robust.Shared.Timing; + +namespace Content.Client.SS220.Communications.UI +{ + public sealed class CluwneCommunicationsConsoleBoundUserInterface : BoundUserInterface + { + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly IConfigurationManager _cfg = default!; + + [ViewVariables] + private CluwneCommunicationsConsoleMenu? _menu; + + [ViewVariables] + public bool CanAnnounce { get; private set; } + + [ViewVariables] + public bool CanCall { get; private set; } + + [ViewVariables] + public bool CountdownStarted { get; private set; } + + [ViewVariables] + public bool AlertLevelSelectable { get; private set; } + + [ViewVariables] + public string CurrentLevel { get; private set; } = default!; + + [ViewVariables] + private TimeSpan? _expectedCountdownTime; + + public int Countdown => _expectedCountdownTime == null ? 0 : Math.Max((int) _expectedCountdownTime.Value.Subtract(_gameTiming.CurTime).TotalSeconds, 0); + + public CluwneCommunicationsConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _menu = new CluwneCommunicationsConsoleMenu(this); + _menu.OnClose += Close; + _menu.OpenCentered(); + } + + public void AlertLevelSelected(string level) + { + if (AlertLevelSelectable) + { + CurrentLevel = level; + SendMessage(new CommunicationsConsoleSelectAlertLevelMessage(level)); + } + } + + public void EmergencyShuttleButtonPressed() + { + if (CountdownStarted) + RecallShuttle(); + else + CallShuttle(); + } + + public void AnnounceButtonPressed(string message) + { + var maxLength = _cfg.GetCVar(CCVars.ChatMaxAnnouncementLength); + var msg = SharedChatSystem.SanitizeAnnouncement(message, maxLength); + SendMessage(new CommunicationsConsoleAnnounceMessage(msg)); + } + + public void CallShuttle() + { + SendMessage(new CommunicationsConsoleCallEmergencyShuttleMessage()); + } + + public void RecallShuttle() + { + SendMessage(new CommunicationsConsoleRecallEmergencyShuttleMessage()); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (state is not CommunicationsConsoleInterfaceState commsState) + return; + + CanAnnounce = commsState.CanAnnounce; + CanCall = commsState.CanCall; + _expectedCountdownTime = commsState.ExpectedCountdownEnd; + CountdownStarted = commsState.CountdownStarted; + AlertLevelSelectable = commsState.AlertLevels != null && !float.IsNaN(commsState.CurrentAlertDelay) && commsState.CurrentAlertDelay <= 0; + CurrentLevel = commsState.CurrentAlert; + + if (_menu != null) + { + _menu.UpdateCountdown(); + _menu.UpdateAlertLevels(commsState.AlertLevels, CurrentLevel); + _menu.AlertLevelButton.Disabled = !AlertLevelSelectable; + _menu.EmergencyShuttleButton.Disabled = !CanCall; + _menu.AnnounceButton.Disabled = !CanAnnounce; + } + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) return; + + _menu?.Dispose(); + } + } +} diff --git a/Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleMenu.xaml b/Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleMenu.xaml new file mode 100644 index 000000000000..86c0b4e2d533 --- /dev/null +++ b/Content.Client/SS220/CluwneCommunications/UI/CluwneCommunicationsConsoleMenu.xaml @@ -0,0 +1,16 @@ + + + +