Default warp point names (#21017)
This commit is contained in:
@@ -59,9 +59,7 @@ namespace Content.Server.Administration.Commands
|
||||
var currentMap = _entManager.GetComponent<TransformComponent>(playerEntity).MapID;
|
||||
var currentGrid = _entManager.GetComponent<TransformComponent>(playerEntity).GridUid;
|
||||
|
||||
var found = _entManager.EntityQuery<WarpPointComponent>(true)
|
||||
.Where(p => p.Location == location)
|
||||
.Select(p => (_entManager.GetComponent<TransformComponent>(p.Owner).Coordinates, p.Follow))
|
||||
var found = GetWarpPointByName(location)
|
||||
.OrderBy(p => p.Item1, Comparer<EntityCoordinates>.Create((a, b) =>
|
||||
{
|
||||
// Sort so that warp points on the same grid/map are first.
|
||||
@@ -133,11 +131,28 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
private IEnumerable<string> GetWarpPointNames()
|
||||
{
|
||||
return _entManager.EntityQuery<WarpPointComponent>(true)
|
||||
.Select(p => p.Location)
|
||||
.Where(p => p != null)
|
||||
.OrderBy(p => p)
|
||||
.Distinct()!;
|
||||
List<string> points = new(_entManager.Count<WarpPointComponent>());
|
||||
var query = _entManager.AllEntityQueryEnumerator<WarpPointComponent, MetaDataComponent>();
|
||||
while (query.MoveNext(out _, out var warp, out var meta))
|
||||
{
|
||||
points.Add(warp.Location ?? meta.EntityName);
|
||||
}
|
||||
|
||||
points.Sort();
|
||||
return points;
|
||||
}
|
||||
|
||||
private List<(EntityCoordinates, bool)> GetWarpPointByName(string name)
|
||||
{
|
||||
List<(EntityCoordinates, bool)> points = new();
|
||||
var query = _entManager.AllEntityQueryEnumerator<WarpPointComponent, MetaDataComponent, TransformComponent>();
|
||||
while (query.MoveNext(out var uid, out var warp, out var meta, out var xform))
|
||||
{
|
||||
if (name == (warp.Location ?? meta.EntityName))
|
||||
points.Add((xform.Coordinates, warp.Follow));
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
|
||||
Reference in New Issue
Block a user