using Content.Server.Administration;
using Content.Server._NF.Shipyard.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.Utility;
namespace Content.Server._NF.Shipyard.Commands;
///
/// Purchases a shuttle and docks it to a station.
///
[AdminCommand(AdminFlags.Fun)]
public sealed class PurchaseShuttleCommand : IConsoleCommand
{
[Dependency] private readonly IEntitySystemManager _entityManager = default!;
public string Command => "purchaseshuttle";
public string Description => Loc.GetString("shipyard-commands-purchase-desc");
public string Help => $"{Command} ";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (!int.TryParse(args[0], out var stationId))
{
shell.WriteError($"{args[0]} is not a valid integer.");
return;
}
var shuttlePath = args[1];
var system = _entityManager.GetEntitySystem();
var station = new EntityUid(stationId);
system.TryPurchaseShuttle(station, new ResPath(shuttlePath), out _);
}
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
switch (args.Length)
{
case 1:
return CompletionResult.FromHint(Loc.GetString("station-id"));
case 2:
return CompletionResult.FromHint(Loc.GetString("cmd-hint-savemap-path"));
}
return CompletionResult.Empty;
}
}