PowerStatCommand.cs 959 B

123456789101112131415161718192021222324252627
  1. using Content.Server.Administration;
  2. using Content.Server.Power.EntitySystems;
  3. using Content.Shared.Administration;
  4. using Robust.Shared.Console;
  5. namespace Content.Server.Power.Commands
  6. {
  7. [AdminCommand(AdminFlags.Debug)]
  8. public sealed class PowerStatCommand : IConsoleCommand
  9. {
  10. [Dependency] private readonly IEntityManager _e = default!;
  11. public string Command => "powerstat";
  12. public string Description => "Shows statistics for pow3r";
  13. public string Help => "Usage: powerstat";
  14. public void Execute(IConsoleShell shell, string argStr, string[] args)
  15. {
  16. var stats = _e.System<PowerNetSystem>().GetStatistics();
  17. shell.WriteLine($"networks: {stats.CountNetworks}");
  18. shell.WriteLine($"loads: {stats.CountLoads}");
  19. shell.WriteLine($"supplies: {stats.CountSupplies}");
  20. shell.WriteLine($"batteries: {stats.CountBatteries}");
  21. }
  22. }
  23. }