Files
tbd-station-14/Content.Server/Commands/GameTicking/ToggleDisallowLateJoinCommand.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

38 lines
1.2 KiB
C#

using Content.Server.Administration;
using Content.Server.Interfaces.GameTicking;
using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.IoC;
namespace Content.Server.Commands.GameTicking
{
[AdminCommand(AdminFlags.Server)]
class ToggleDisallowLateJoinCommand : IConsoleCommand
{
public string Command => "toggledisallowlatejoin";
public string Description => "Allows or disallows latejoining during mid-game.";
public string Help => $"Usage: {Command} <disallow>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteLine("Need exactly one argument.");
return;
}
var ticker = IoCManager.Resolve<IGameTicker>();
if (bool.TryParse(args[0], out var result))
{
ticker.ToggleDisallowLateJoin(bool.Parse(args[0]));
shell.WriteLine(result ? "Late joining has been disabled." : "Late joining has been enabled.");
}
else
{
shell.WriteLine("Invalid argument.");
}
}
}
}