@@ -251,56 +251,45 @@ public sealed class CrewManifestSystem : EntitySystem
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public sealed class CrewManifestCommand : IConsoleCommand
|
||||
public sealed class CrewManifestCommand : LocalizedEntityCommands
|
||||
{
|
||||
public string Command => "crewmanifest";
|
||||
public string Description => "Opens the crew manifest for the given station.";
|
||||
public string Help => $"Usage: {Command} <entity uid>";
|
||||
[Dependency] private readonly CrewManifestSystem _manifestSystem = default!;
|
||||
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
public override string Command => "crewmanifest";
|
||||
|
||||
public CrewManifestCommand()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.WriteLine($"Invalid argument count.\n{Help}");
|
||||
shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NetEntity.TryParse(args[0], out var uidNet) || !_entityManager.TryGetEntity(uidNet, out var uid))
|
||||
if (!NetEntity.TryParse(args[0], out var uidNet) || !EntityManager.TryGetEntity(uidNet, out var uid))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid entity UID.");
|
||||
shell.WriteLine(Loc.GetString($"shell-argument-station-id-invalid", ("index", args[0])));
|
||||
return;
|
||||
}
|
||||
|
||||
if (shell.Player == null || shell.Player is not { } session)
|
||||
if (shell.Player is not { } session)
|
||||
{
|
||||
shell.WriteLine("You must run this from a client.");
|
||||
shell.WriteLine(Loc.GetString($"shell-cannot-run-command-from-server"));
|
||||
return;
|
||||
}
|
||||
|
||||
var crewManifestSystem = _entityManager.System<CrewManifestSystem>();
|
||||
|
||||
crewManifestSystem.OpenEui(uid.Value, session);
|
||||
_manifestSystem.OpenEui(uid.Value, session);
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
return CompletionResult.Empty;
|
||||
}
|
||||
|
||||
var stations = new List<CompletionOption>();
|
||||
var query = _entityManager.EntityQueryEnumerator<StationDataComponent>();
|
||||
var query = EntityManager.EntityQueryEnumerator<StationDataComponent>();
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
var meta = _entityManager.GetComponent<MetaDataComponent>(uid);
|
||||
var meta = EntityManager.GetComponent<MetaDataComponent>(uid);
|
||||
stations.Add(new CompletionOption(uid.ToString(), meta.EntityName));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
cmd-crewmanifest-desc = Opens the crew manifest for the given station.
|
||||
cmd-crewmanifest-help = Usage: crewmanifest <entityUid>
|
||||
Reference in New Issue
Block a user