2022-05-13 00:59:03 -07:00
|
|
|
|
using Content.Server.Administration;
|
2021-12-21 21:23:29 +01:00
|
|
|
|
using Content.Server.GameTicking.Presets;
|
2020-12-20 04:48:13 +01:00
|
|
|
|
using Content.Shared.Administration;
|
2021-06-13 14:52:40 +02:00
|
|
|
|
using Content.Shared.CCVar;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.Configuration;
|
2021-02-01 16:49:43 -08:00
|
|
|
|
using Robust.Shared.Console;
|
2020-12-20 04:48:13 +01:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.GameTicking.Commands
|
2020-12-20 04:48:13 +01:00
|
|
|
|
{
|
2021-11-29 14:40:10 -06:00
|
|
|
|
[AdminCommand(AdminFlags.Round)]
|
2025-06-17 05:39:42 -04:00
|
|
|
|
public sealed class GoLobbyCommand : LocalizedEntityCommands
|
2020-12-20 04:48:13 +01:00
|
|
|
|
{
|
2025-06-17 05:39:42 -04:00
|
|
|
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
|
|
|
|
|
[Dependency] private readonly GameTicker _gameTicker = default!;
|
2024-05-12 17:34:52 -07:00
|
|
|
|
|
2025-06-17 05:39:42 -04:00
|
|
|
|
public override string Command => "golobby";
|
|
|
|
|
|
|
|
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-20 04:48:13 +01:00
|
|
|
|
{
|
2021-12-21 21:23:29 +01:00
|
|
|
|
GamePresetPrototype? preset = null;
|
2020-12-20 04:48:13 +01:00
|
|
|
|
var presetName = string.Join(" ", args);
|
|
|
|
|
|
|
|
|
|
|
|
if (args.Length > 0)
|
|
|
|
|
|
{
|
2025-06-17 05:39:42 -04:00
|
|
|
|
if (!_gameTicker.TryFindGamePreset(presetName, out preset))
|
2020-12-20 04:48:13 +01:00
|
|
|
|
{
|
2025-06-17 05:39:42 -04:00
|
|
|
|
shell.WriteLine(Loc.GetString($"cmd-forcepreset-no-preset-found", ("preset", presetName)));
|
2020-12-20 04:48:13 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-17 05:39:42 -04:00
|
|
|
|
_configManager.SetCVar(CCVars.GameLobbyEnabled, true);
|
2020-12-20 04:48:13 +01:00
|
|
|
|
|
2025-06-17 05:39:42 -04:00
|
|
|
|
_gameTicker.RestartRound();
|
2020-12-20 04:48:13 +01:00
|
|
|
|
|
|
|
|
|
|
if (preset != null)
|
2025-06-17 05:39:42 -04:00
|
|
|
|
_gameTicker.SetGamePreset(preset);
|
2020-12-20 04:48:13 +01:00
|
|
|
|
|
2025-06-17 05:39:42 -04:00
|
|
|
|
shell.WriteLine(Loc.GetString(preset == null ? "cmd-golobby-success" : "cmd-golobby-success-with-preset", ("preset", presetName)));
|
2020-12-20 04:48:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|