diff --git a/Content.Client/Administration/UI/Tabs/ServerTab.xaml b/Content.Client/Administration/UI/Tabs/ServerTab.xaml index fb2431734a..81e8916949 100644 --- a/Content.Client/Administration/UI/Tabs/ServerTab.xaml +++ b/Content.Client/Administration/UI/Tabs/ServerTab.xaml @@ -5,7 +5,8 @@ MinSize="50 50"> - - + + + diff --git a/Content.Server/Chat/Commands/SetOOCCommand.cs b/Content.Server/Chat/Commands/SetOOCCommand.cs new file mode 100644 index 0000000000..f26ce1e1a5 --- /dev/null +++ b/Content.Server/Chat/Commands/SetOOCCommand.cs @@ -0,0 +1,44 @@ +using Content.Server.Administration; +using Content.Shared.Administration; +using Content.Shared.CCVar; +using Robust.Shared.Configuration; +using Robust.Shared.Console; +using Robust.Shared.IoC; +using Robust.Shared.Localization; + +namespace Content.Server.Chat.Commands; + +[AdminCommand(AdminFlags.Server)] +public class SetOOCCommand : IConsoleCommand +{ + public string Command => "setooc"; + public string Description => Loc.GetString("set-ooc-command-description"); + public string Help => Loc.GetString("set-ooc-command-help"); + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + var cfg = IoCManager.Resolve(); + + if (args.Length > 1) + { + shell.WriteError(Loc.GetString("set-ooc-command-too-many-arguments-error")); + return; + } + + var ooc = cfg.GetCVar(CCVars.OocEnabled); + + if (args.Length == 0) + { + ooc = !ooc; + } + + if (args.Length == 1 && !bool.TryParse(args[0], out ooc)) + { + shell.WriteError(Loc.GetString("set-ooc-command-invalid-argument-error")); + return; + } + + cfg.SetCVar(CCVars.OocEnabled, ooc); + + shell.WriteLine(Loc.GetString(ooc ? "set-ooc-command-ooc-enabled" : "set-ooc-command-ooc-disabled")); + } +} diff --git a/Resources/Locale/en-US/administration/commands/set-ooc-command.ftl b/Resources/Locale/en-US/administration/commands/set-ooc-command.ftl new file mode 100644 index 0000000000..62b0747173 --- /dev/null +++ b/Resources/Locale/en-US/administration/commands/set-ooc-command.ftl @@ -0,0 +1,6 @@ +set-ooc-command-description = Allows you to enable or disable OOC. +set-ooc-command-help = Usage: setooc OR setooc [value] +set-ooc-command-too-many-arguments-error = Too many arguments. +set-ooc-command-invalid-argument-error = Invalid argument. +set-ooc-command-ooc-enabled = OOC chat has been enabled. +set-ooc-command-ooc-disabled = OOC chat has been disabled. diff --git a/Resources/Locale/en-US/administration/ui/tabs/server-tab.ftl b/Resources/Locale/en-US/administration/ui/tabs/server-tab.ftl new file mode 100644 index 0000000000..581a2a1c87 --- /dev/null +++ b/Resources/Locale/en-US/administration/ui/tabs/server-tab.ftl @@ -0,0 +1,3 @@ +server-reboot = Reboot +server-shutdown = Shutdown +server-ooc-toggle = Toggle OOC