Station command improvements (#17431)
* Fix renamestation command not working * Console completions for station commands
This commit is contained in:
committed by
GitHub
parent
ec71f1bc8e
commit
50c278b022
22
Content.Server/Commands/ContentCompletionHelper.cs
Normal file
22
Content.Server/Commands/ContentCompletionHelper.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Content.Server.Station.Components;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Helper functions for programming console command completions.
|
||||
/// </summary>
|
||||
public static class ContentCompletionHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Return all stations, with their ID as value and name as hint.
|
||||
/// </summary>
|
||||
public static IEnumerable<CompletionOption> StationIds(IEntityManager entityManager)
|
||||
{
|
||||
var query = entityManager.EntityQueryEnumerator<StationDataComponent, MetaDataComponent>();
|
||||
while (query.MoveNext(out var uid, out _, out var metaData))
|
||||
{
|
||||
yield return new CompletionOption(uid.ToString(), metaData.EntityName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user