Completions for the warp command (#8470)
This commit is contained in:
committed by
GitHub
parent
bba30d867b
commit
4f9f9e5942
@@ -38,12 +38,7 @@ namespace Content.Server.Administration.Commands
|
||||
var location = args[0];
|
||||
if (location == "?")
|
||||
{
|
||||
var locations = string.Join(", ",
|
||||
entMan.EntityQuery<WarpPointComponent>(true)
|
||||
.Select(p => p.Location)
|
||||
.Where(p => p != null)
|
||||
.OrderBy(p => p)
|
||||
.Distinct());
|
||||
var locations = string.Join(", ", GetWarpPointNames(entMan));
|
||||
|
||||
shell.WriteLine(locations);
|
||||
}
|
||||
@@ -121,5 +116,27 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetWarpPointNames(IEntityManager entMan)
|
||||
{
|
||||
return entMan.EntityQuery<WarpPointComponent>(true)
|
||||
.Select(p => p.Location)
|
||||
.Where(p => p != null)
|
||||
.OrderBy(p => p)
|
||||
.Distinct()!;
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
var ent = IoCManager.Resolve<IEntityManager>();
|
||||
var options = new[] { "?" }.Concat(GetWarpPointNames(ent));
|
||||
|
||||
return CompletionResult.FromHintOptions(options, "<warp point | ?>");
|
||||
}
|
||||
|
||||
return CompletionResult.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user