ClearBluespaceLockerLinks.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. using Content.Server.Storage.Components;
  2. using Content.Shared.Administration;
  3. using Robust.Shared.Console;
  4. namespace Content.Server.Administration.Commands;
  5. [AdminCommand(AdminFlags.Admin)]
  6. public sealed class ClearBluespaceLockerLinks : IConsoleCommand
  7. {
  8. [Dependency] private readonly IEntityManager _entityManager = default!;
  9. public string Command => "clearbluespacelockerlinks";
  10. public string Description => "Removes the bluespace links of the given uid. Does not remove links this uid is the target of.";
  11. public string Help => "Usage: clearbluespacelockerlinks <storage uid>";
  12. public void Execute(IConsoleShell shell, string argStr, string[] args)
  13. {
  14. if (args.Length != 1)
  15. {
  16. shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
  17. return;
  18. }
  19. if (!NetEntity.TryParse(args[0], out var entityUidNet) || !_entityManager.TryGetEntity(entityUidNet, out var entityUid))
  20. {
  21. shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
  22. return;
  23. }
  24. _entityManager.RemoveComponent<BluespaceLockerComponent>(entityUid.Value);
  25. }
  26. }