diff --git a/Content.Server/Anomaly/AnomalySystem.Commands.cs b/Content.Server/Anomaly/AnomalySystem.Commands.cs new file mode 100644 index 0000000000..91056976a5 --- /dev/null +++ b/Content.Server/Anomaly/AnomalySystem.Commands.cs @@ -0,0 +1,59 @@ +using Content.Server.Administration; +using Content.Shared.Administration; +using Content.Shared.Anomaly.Components; +using Robust.Shared.Console; + +namespace Content.Server.Anomaly; + +public sealed partial class AnomalySystem +{ + [Dependency] private readonly IConsoleHost _consoleHost = default!; + + public void InitializeCommands() + { + _consoleHost.RegisterCommand("pulseanomaly", Loc.GetString("anomaly-command-pulse"), "pulseanomaly ", + PulseAnomalyCommand, + GetAnomalyCompletion); + + _consoleHost.RegisterCommand("supercriticalanomaly", Loc.GetString("anomaly-command-supercritical"), "supercriticalanomaly ", + SupercriticalAnomalyCommand, + GetAnomalyCompletion); + } + + [AdminCommand(AdminFlags.Fun)] + private void PulseAnomalyCommand(IConsoleShell shell, string argstr, string[] args) + { + if (args.Length != 1) + shell.WriteError("Argument length must be 1"); + + if (!EntityUid.TryParse(args[0], out var uid)) + return; + + if (!TryComp(uid, out var anomaly)) + return; + + DoAnomalyPulse(uid, anomaly); + } + + [AdminCommand(AdminFlags.Fun)] + private void SupercriticalAnomalyCommand(IConsoleShell shell, string argstr, string[] args) + { + if (args.Length != 1) + shell.WriteError("Argument length must be 1"); + + if (!EntityUid.TryParse(args[0], out var uid)) + return; + + if (!HasComp(uid)) + return; + + StartSupercriticalEvent(uid); + } + + private CompletionResult GetAnomalyCompletion(IConsoleShell shell, string[] args) + { + return args.Length != 1 + ? CompletionResult.Empty + : CompletionResult.FromHintOptions(CompletionHelper.Components(args[0]), ""); + } +} diff --git a/Content.Server/Anomaly/AnomalySystem.cs b/Content.Server/Anomaly/AnomalySystem.cs index 7b1ed087d3..781fe6014c 100644 --- a/Content.Server/Anomaly/AnomalySystem.cs +++ b/Content.Server/Anomaly/AnomalySystem.cs @@ -1,4 +1,4 @@ -using Content.Server.Anomaly.Components; +using Content.Server.Anomaly.Components; using Content.Server.Atmos.EntitySystems; using Content.Server.Audio; using Content.Server.Explosion.EntitySystems; @@ -44,6 +44,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem InitializeGenerator(); InitializeScanner(); InitializeVessel(); + InitializeCommands(); } private void OnMapInit(EntityUid uid, AnomalyComponent component, MapInitEvent args) diff --git a/Resources/Locale/en-US/anomaly/anomaly.ftl b/Resources/Locale/en-US/anomaly/anomaly.ftl index f93b5bb97e..cff944ae22 100644 --- a/Resources/Locale/en-US/anomaly/anomaly.ftl +++ b/Resources/Locale/en-US/anomaly/anomaly.ftl @@ -37,6 +37,8 @@ anomaly-generator-charges = {$charges -> } anomaly-generator-announcement = An anomaly has been generated! +anomaly-command-pulse = Pulses a target anomaly +anomaly-command-supercritical = Makes a target anomaly go supercritical # Flavor text on the footer anomaly-generator-flavor-left = Anomaly may spawn inside the operator.