mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-14 04:41:14 +03:00
* add new cvar * add command to change the cvar * send chat alert when the cvar is changed * add new button to server tab to toggle that cvar * block deadchat * make it partial * empty commit * add completion * use the helper * new line in the end * remove white line * fix for sending server announcmente while the server is still loading * just use ? * remove changes to chat manager * make messages dull /j --------- Co-authored-by: Beck Thompson <beck-thompson-kde@outlook.com>
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
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;
|
|
|
|
[AdminCommand(AdminFlags.Server)]
|
|
public sealed partial class SetDeadChatCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private IConfigurationManager _configManager = default!;
|
|
|
|
public override string Command => "setdeadchat";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length > 1)
|
|
{
|
|
shell.WriteError(Loc.GetString("shell-need-between-arguments", ("lower", 0), ("upper", 1)));
|
|
return;
|
|
}
|
|
|
|
var deadchat = _configManager.GetCVar(CCVars.DeadChatEnabled);
|
|
|
|
if (args.Length == 0)
|
|
{
|
|
deadchat = !deadchat;
|
|
}
|
|
|
|
if (args.Length == 1 && !bool.TryParse(args[0], out deadchat))
|
|
{
|
|
shell.WriteError(Loc.GetString("shell-invalid-bool"));
|
|
return;
|
|
}
|
|
|
|
_configManager.SetCVar(CCVars.DeadChatEnabled, deadchat);
|
|
|
|
shell.WriteLine(Loc.GetString(deadchat ? "cmd-setdeadchat-looc-enabled" : "cmd-setdeadchat-looc-disabled"));
|
|
}
|
|
|
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
|
{
|
|
return args.Length == 1 ? CompletionResult.FromOptions(CompletionHelper.Booleans) : CompletionResult.Empty;
|
|
}
|
|
}
|