2023-08-15 14:47:55 +03:00
|
|
|
using Content.Server.Administration;
|
|
|
|
|
using Content.Server.Chat.Managers;
|
|
|
|
|
using Content.Shared.Administration;
|
|
|
|
|
using Robust.Shared.Console;
|
|
|
|
|
|
2024-01-28 18:18:54 +07:00
|
|
|
namespace Content.Server._White.ERTRecruitment.Commands;
|
2023-08-15 14:47:55 +03:00
|
|
|
|
|
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
|
|
|
|
public sealed class BlockERT : IConsoleCommand
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly IEntityManager _entities = default!;
|
|
|
|
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
|
|
|
|
|
|
|
|
|
public string Command => "blockert";
|
|
|
|
|
public string Description => "block or unblock call ERT";
|
|
|
|
|
public string Help => "blockert <true/false>";
|
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
|
|
|
{
|
2023-08-17 23:41:13 +03:00
|
|
|
var ertsys = _entities.System<ERTRecruitmentRule>();
|
|
|
|
|
var isDisabled = !ertsys.IsDisabled;
|
2023-08-15 14:47:55 +03:00
|
|
|
|
|
|
|
|
if (args.Length > 0)
|
|
|
|
|
{
|
2023-08-17 23:41:13 +03:00
|
|
|
isDisabled = args[0] == "true";
|
2023-08-15 14:47:55 +03:00
|
|
|
}
|
|
|
|
|
|
2023-08-17 23:41:13 +03:00
|
|
|
ertsys.IsDisabled = isDisabled;
|
|
|
|
|
var message = isDisabled ? "ERT is blocked!" : "ERT is no longer blocked!";
|
2023-08-15 14:47:55 +03:00
|
|
|
shell.WriteLine(message);
|
|
|
|
|
_chatManager.SendAdminAnnouncement(message);
|
|
|
|
|
}
|
|
|
|
|
}
|