Add completions for ForceMap and ForcePreset
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
using Content.Server.Administration;
|
using System.Linq;
|
||||||
|
using Content.Server.Administration;
|
||||||
using Content.Server.Maps;
|
using Content.Server.Maps;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.GameTicking.Commands
|
namespace Content.Server.GameTicking.Commands
|
||||||
{
|
{
|
||||||
@@ -9,8 +11,8 @@ namespace Content.Server.GameTicking.Commands
|
|||||||
sealed class ForceMapCommand : IConsoleCommand
|
sealed class ForceMapCommand : IConsoleCommand
|
||||||
{
|
{
|
||||||
public string Command => "forcemap";
|
public string Command => "forcemap";
|
||||||
public string Description => "forcemap-command-description";
|
public string Description => Loc.GetString("forcemap-command-description");
|
||||||
public string Help => $"forcemap-command-help";
|
public string Help => Loc.GetString("forcemap-command-help");
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
@@ -26,5 +28,20 @@ namespace Content.Server.GameTicking.Commands
|
|||||||
gameMap.ForceSelectMap(name);
|
gameMap.ForceSelectMap(name);
|
||||||
shell.WriteLine(Loc.GetString("forcemap-command-success", ("map", name)));
|
shell.WriteLine(Loc.GetString("forcemap-command-success", ("map", name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length == 1)
|
||||||
|
{
|
||||||
|
var options = IoCManager.Resolve<IPrototypeManager>()
|
||||||
|
.EnumeratePrototypes<GameMapPrototype>()
|
||||||
|
.Select(p => new CompletionOption(p.ID, p.MapName))
|
||||||
|
.OrderBy(p => p.Value);
|
||||||
|
|
||||||
|
return CompletionResult.FromHintOptions(options, Loc.GetString("forcemap-command-arg-map"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return CompletionResult.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using Content.Server.Administration;
|
using System.Linq;
|
||||||
|
using Content.Server.Administration;
|
||||||
|
using Content.Server.GameTicking.Presets;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.GameTicking.Commands
|
namespace Content.Server.GameTicking.Commands
|
||||||
{
|
{
|
||||||
@@ -37,5 +40,20 @@ namespace Content.Server.GameTicking.Commands
|
|||||||
shell.WriteLine($"Forced the game to start with preset {name}.");
|
shell.WriteLine($"Forced the game to start with preset {name}.");
|
||||||
ticker.UpdateInfoText();
|
ticker.UpdateInfoText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length == 1)
|
||||||
|
{
|
||||||
|
var options = IoCManager.Resolve<IPrototypeManager>()
|
||||||
|
.EnumeratePrototypes<GamePresetPrototype>()
|
||||||
|
.OrderBy(p => p.ID)
|
||||||
|
.Select(p => p.ID);
|
||||||
|
|
||||||
|
return CompletionResult.FromHintOptions(options, "<preset>");
|
||||||
|
}
|
||||||
|
|
||||||
|
return CompletionResult.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
## Forcemap command loc.
|
## Forcemap command loc.
|
||||||
|
|
||||||
forcemap-command-description = Forces the game to start with a given map next round.
|
forcemap-command-description = Forces the game to start with a given map next round.
|
||||||
forcemap-command-help = forcemap <map_path>
|
forcemap-command-help = forcemap <map ID>
|
||||||
forcemap-command-need-one-argument = forcemap takes one argument, the path to the map file.
|
forcemap-command-need-one-argument = forcemap takes one argument, the path to the map file.
|
||||||
forcemap-command-success = Forced the game to start with map { $map } next round.
|
forcemap-command-success = Forced the game to start with map { $map } next round.
|
||||||
|
forcemap-command-arg-map = <map ID>
|
||||||
|
|||||||
Reference in New Issue
Block a user