Add completions for ForceMap and ForcePreset

This commit is contained in:
Pieter-Jan Briers
2022-05-25 00:26:57 +02:00
parent c6796ce73b
commit a557dd26ec
3 changed files with 41 additions and 5 deletions

View File

@@ -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 Robust.Shared.Console;
using Robust.Shared.Prototypes;
namespace Content.Server.GameTicking.Commands
{
@@ -37,5 +40,20 @@ namespace Content.Server.GameTicking.Commands
shell.WriteLine($"Forced the game to start with preset {name}.");
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;
}
}
}