From c99e365ce7df8bb77d9a59b779af27c7959668e2 Mon Sep 17 00:00:00 2001 From: Morb <14136326+Morb0@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:56:20 +0300 Subject: [PATCH] Give nukies the ability to declare war for a TC boost (#19291) Co-authored-by: Kevin Zheng --- .../WarDeclaratorBoundUserInterface.cs | 49 ++++ .../NukeOps/WarDeclaratorWindow.xaml | 18 ++ .../NukeOps/WarDeclaratorWindow.xaml.cs | 138 +++++++++++ .../CommunicationsConsoleSystem.cs | 41 +++- .../GameTicking/GameTicker.GameRule.cs | 1 + .../Rules/Components/GameRuleComponent.cs | 10 +- .../Components/NukeOpsShuttleComponent.cs | 9 + .../Rules/Components/NukeopsRuleComponent.cs | 46 +++- .../GameTicking/Rules/NukeopsRuleSystem.cs | 218 +++++++++++++++++- .../NukeOps/WarDeclaratorComponent.cs | 48 ++++ Content.Server/NukeOps/WarDeclaratorSystem.cs | 127 ++++++++++ .../Events/ShuttleConsoleFTLStartEvent.cs | 10 + .../Shuttles/Systems/ShuttleConsoleSystem.cs | 5 +- Content.Shared/NukeOps/WarDeclaratorEvents.cs | 48 ++++ .../communications-console-component.ftl | 1 + .../Locale/en-US/nukeops/war-declarator.ftl | 16 ++ Resources/Locale/en-US/nukeops/war-ops.ftl | 2 + Resources/Locale/en-US/store/currency.ftl | 1 + Resources/Maps/infiltrator.yml | 8 - .../Syndicate_Gadgets/war_declarator.yml | 25 ++ .../Roles/Jobs/Fun/misc_startinggear.yml | 2 + .../declaration_of_war.rsi/declarator.png | Bin 0 -> 921 bytes .../Devices/declaration_of_war.rsi/meta.json | 26 +++ 23 files changed, 831 insertions(+), 18 deletions(-) create mode 100644 Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs create mode 100644 Content.Client/NukeOps/WarDeclaratorWindow.xaml create mode 100644 Content.Client/NukeOps/WarDeclaratorWindow.xaml.cs create mode 100644 Content.Server/GameTicking/Rules/Components/NukeOpsShuttleComponent.cs create mode 100644 Content.Server/NukeOps/WarDeclaratorComponent.cs create mode 100644 Content.Server/NukeOps/WarDeclaratorSystem.cs create mode 100644 Content.Server/Shuttles/Events/ShuttleConsoleFTLStartEvent.cs create mode 100644 Content.Shared/NukeOps/WarDeclaratorEvents.cs create mode 100644 Resources/Locale/en-US/nukeops/war-declarator.ftl create mode 100644 Resources/Locale/en-US/nukeops/war-ops.ftl create mode 100644 Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/war_declarator.yml create mode 100644 Resources/Textures/Objects/Devices/declaration_of_war.rsi/declarator.png create mode 100644 Resources/Textures/Objects/Devices/declaration_of_war.rsi/meta.json diff --git a/Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs b/Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs new file mode 100644 index 0000000000..7394e27043 --- /dev/null +++ b/Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs @@ -0,0 +1,49 @@ +using Content.Shared.NukeOps; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Shared.Timing; + +namespace Content.Client.NukeOps; + +[UsedImplicitly] +public sealed class WarDeclaratorBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private WarDeclaratorWindow? _window; + + public WarDeclaratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) {} + + protected override void Open() + { + base.Open(); + + _window = new WarDeclaratorWindow(); + if (State != null) + UpdateState(State); + + _window.OpenCentered(); + + _window.OnClose += Close; + _window.OnActivated += OnWarDeclaratorActivated; + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + if (_window == null || state is not WarDeclaratorBoundUserInterfaceState cast) + return; + + _window?.UpdateState(cast); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (disposing) _window?.Dispose(); + } + + private void OnWarDeclaratorActivated(string message) + { + SendMessage(new WarDeclaratorActivateMessage(message)); + } +} diff --git a/Content.Client/NukeOps/WarDeclaratorWindow.xaml b/Content.Client/NukeOps/WarDeclaratorWindow.xaml new file mode 100644 index 0000000000..f90ed865a0 --- /dev/null +++ b/Content.Client/NukeOps/WarDeclaratorWindow.xaml @@ -0,0 +1,18 @@ + + + +