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];
|
var location = args[0];
|
||||||
if (location == "?")
|
if (location == "?")
|
||||||
{
|
{
|
||||||
var locations = string.Join(", ",
|
var locations = string.Join(", ", GetWarpPointNames(entMan));
|
||||||
entMan.EntityQuery<WarpPointComponent>(true)
|
|
||||||
.Select(p => p.Location)
|
|
||||||
.Where(p => p != null)
|
|
||||||
.OrderBy(p => p)
|
|
||||||
.Distinct());
|
|
||||||
|
|
||||||
shell.WriteLine(locations);
|
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