1
0

ShuttleCommands.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Content.Server.RoundEnd;
  2. using Content.Shared.Administration;
  3. using Content.Shared.Localizations;
  4. using Robust.Shared.Console;
  5. namespace Content.Server.Administration.Commands
  6. {
  7. [AdminCommand(AdminFlags.Round)]
  8. public sealed class CallShuttleCommand : IConsoleCommand
  9. {
  10. [Dependency] private readonly IEntityManager _e = default!;
  11. public string Command => "callshuttle";
  12. public string Description => Loc.GetString("call-shuttle-command-description");
  13. public string Help => Loc.GetString("call-shuttle-command-help-text", ("command",Command));
  14. public void Execute(IConsoleShell shell, string argStr, string[] args)
  15. {
  16. var loc = IoCManager.Resolve<ILocalizationManager>();
  17. // ReSharper disable once ConvertIfStatementToSwitchStatement
  18. if (args.Length == 1 && TimeSpan.TryParseExact(args[0], ContentLocalizationManager.TimeSpanMinutesFormats, loc.DefaultCulture, out var timeSpan))
  19. {
  20. _e.System<RoundEndSystem>().RequestRoundEnd(timeSpan, shell.Player?.AttachedEntity, false);
  21. }
  22. else if (args.Length == 1)
  23. {
  24. shell.WriteLine(Loc.GetString("shell-timespan-minutes-must-be-correct"));
  25. }
  26. else
  27. {
  28. _e.System<RoundEndSystem>().RequestRoundEnd(shell.Player?.AttachedEntity, false);
  29. }
  30. }
  31. }
  32. [AdminCommand(AdminFlags.Round)]
  33. public sealed class RecallShuttleCommand : IConsoleCommand
  34. {
  35. [Dependency] private readonly IEntityManager _e = default!;
  36. public string Command => "recallshuttle";
  37. public string Description => Loc.GetString("recall-shuttle-command-description");
  38. public string Help => Loc.GetString("recall-shuttle-command-help-text", ("command",Command));
  39. public void Execute(IConsoleShell shell, string argStr, string[] args)
  40. {
  41. _e.System<RoundEndSystem>().CancelRoundEndCountdown(shell.Player?.AttachedEntity, false);
  42. }
  43. }
  44. }