Map vote & forcemap command (#5278)

This commit is contained in:
mirrorcult
2021-11-11 23:25:57 -07:00
committed by GitHub
parent 0b182f2d11
commit 03f766577a
7 changed files with 107 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Server.GameTicking.Commands
{
[AdminCommand(AdminFlags.Server)]
class ForceMapCommand : IConsoleCommand
{
public string Command => "forcemap";
public string Description => "forcemap-command-description";
public string Help => $"forcemap-command-help";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteLine(Loc.GetString("forcemap-command-need-one-argument"));
return;
}
var cfg = IoCManager.Resolve<IConfigurationManager>();
var name = args[0];
cfg.SetCVar(CCVars.GameMap, name);
shell.WriteLine(Loc.GetString("forcemap-command-success", ("map", name)));
}
}
}