-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
593988d
commit f1f28dc
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <uid>", | ||
PulseAnomalyCommand, | ||
GetAnomalyCompletion); | ||
|
||
_consoleHost.RegisterCommand("supercriticalanomaly", Loc.GetString("anomaly-command-supercritical"), "supercriticalanomaly <uid>", | ||
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<AnomalyComponent>(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<AnomalyComponent>(uid)) | ||
return; | ||
|
||
StartSupercriticalEvent(uid); | ||
} | ||
|
||
private CompletionResult GetAnomalyCompletion(IConsoleShell shell, string[] args) | ||
{ | ||
return args.Length != 1 | ||
? CompletionResult.Empty | ||
: CompletionResult.FromHintOptions(CompletionHelper.Components<AnomalyComponent>(args[0]), "<uid>"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters