Power stat and nuke codes commands get some LEC love. (#38585)

* commit

* requested changes.
This commit is contained in:
Kyle Tyo
2025-06-29 21:41:55 -04:00
committed by GitHub
parent cd2ce56aef
commit 34825464dc
4 changed files with 57 additions and 59 deletions

View File

@@ -3,25 +3,22 @@ using Content.Server.Power.EntitySystems;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Power.Commands
namespace Content.Server.Power.Commands;
[AdminCommand(AdminFlags.Debug)]
public sealed class PowerStatCommand : LocalizedEntityCommands
{
[AdminCommand(AdminFlags.Debug)]
public sealed class PowerStatCommand : IConsoleCommand
[Dependency] private readonly PowerNetSystem _powerNet = default!;
public override string Command => "powerstat";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "powerstat";
public string Description => "Shows statistics for pow3r";
public string Help => "Usage: powerstat";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var stats = _e.System<PowerNetSystem>().GetStatistics();
shell.WriteLine($"networks: {stats.CountNetworks}");
shell.WriteLine($"loads: {stats.CountLoads}");
shell.WriteLine($"supplies: {stats.CountSupplies}");
shell.WriteLine($"batteries: {stats.CountBatteries}");
}
var stats = _powerNet.GetStatistics();
shell.WriteLine(Loc.GetString("cmd-powerstat-output",
("networks", stats.CountNetworks),
("loads", stats.CountLoads),
("supplies", stats.CountSupplies),
("batteries", stats.CountBatteries)));
}
}