From 090c3b948e50004e539f9e85df635eb2c74a0eff Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 19 May 2022 08:25:45 +1000 Subject: [PATCH] Setgamepreset tweaks (#8260) --- .../GameTicking/Commands/SetGamePresetCommand.cs | 15 +++++++++++---- .../game-ticking/set-game-preset-command.ftl | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 Resources/Locale/en-US/game-ticking/set-game-preset-command.ftl diff --git a/Content.Server/GameTicking/Commands/SetGamePresetCommand.cs b/Content.Server/GameTicking/Commands/SetGamePresetCommand.cs index 67a2ea94b9..f13ae6e3f3 100644 --- a/Content.Server/GameTicking/Commands/SetGamePresetCommand.cs +++ b/Content.Server/GameTicking/Commands/SetGamePresetCommand.cs @@ -8,20 +8,27 @@ namespace Content.Server.GameTicking.Commands sealed class SetGamePresetCommand : IConsoleCommand { public string Command => "setgamepreset"; - public string Description => ""; - public string Help => ""; + public string Description => Loc.GetString("set-game-preset-command-description", ("command", Command)); + public string Help => Loc.GetString("set-game-preset-command-help-text", ("command", Command)); public void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { - shell.WriteLine("Need exactly one argument."); + shell.WriteError(Loc.GetString("shell-wrong-arguments-number-need-specific", ("properAmount", 1), ("currentAmount", args.Length))); return; } var ticker = EntitySystem.Get(); - ticker.SetGamePreset(args[0]); + if (!ticker.TryFindGamePreset(args[0], out var preset)) + { + shell.WriteError(Loc.GetString("set-game-preset-preset-error", ("preset", args[0]))); + return; + } + + ticker.SetGamePreset(preset); + shell.WriteLine(Loc.GetString("set-game-preset-preset-set", ("preset", preset.ID))); } } } diff --git a/Resources/Locale/en-US/game-ticking/set-game-preset-command.ftl b/Resources/Locale/en-US/game-ticking/set-game-preset-command.ftl new file mode 100644 index 0000000000..c6c93f2927 --- /dev/null +++ b/Resources/Locale/en-US/game-ticking/set-game-preset-command.ftl @@ -0,0 +1,2 @@ +set-game-preset-preset-error = Unable to find game preset "{$preset}" +set-game-preset-preset-set = Set game preset to "{$preset}"