2021-12-19 23:25:16 +01:00
|
|
|
using Content.Server.Administration;
|
|
|
|
|
using Content.Shared.Administration;
|
|
|
|
|
using Content.Shared.CCVar;
|
|
|
|
|
using Robust.Shared.Configuration;
|
|
|
|
|
using Robust.Shared.Console;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Chat.Commands;
|
|
|
|
|
|
2024-06-01 04:14:43 -04:00
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
2025-06-18 20:03:28 -04:00
|
|
|
public sealed class SetOOCCommand : LocalizedCommands
|
2021-12-19 23:25:16 +01:00
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
|
|
|
|
|
|
|
|
|
public override string Command => "setooc";
|
2021-12-19 23:25:16 +01:00
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
|
|
|
{
|
2021-12-19 23:25:16 +01:00
|
|
|
if (args.Length > 1)
|
|
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
shell.WriteError(Loc.GetString("shell-need-between-arguments", ("lower", 0), ("upper", 1)));
|
2021-12-19 23:25:16 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
var ooc = _configManager.GetCVar(CCVars.OocEnabled);
|
2021-12-19 23:25:16 +01:00
|
|
|
|
|
|
|
|
if (args.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
ooc = !ooc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (args.Length == 1 && !bool.TryParse(args[0], out ooc))
|
|
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
shell.WriteError(Loc.GetString("shell-invalid-bool"));
|
2021-12-19 23:25:16 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
_configManager.SetCVar(CCVars.OocEnabled, ooc);
|
2021-12-19 23:25:16 +01:00
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
shell.WriteLine(Loc.GetString(ooc ? "cmd-setooc-ooc-enabled" : "cmd-setooc-ooc-disabled"));
|
2021-12-19 23:25:16 +01:00
|
|
|
}
|
|
|
|
|
}
|