* #1607 partial progress * #1607 partial progress * #1607 almost done * #1607 PR suggestions * #1607 PR suggestions * #1607 PR suggestions * #1607 PR tweak * #1607 PR tweak * #1607 removed unused namespaces * #1607 PR tweak * Fix jank Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
#nullable enable
|
|
using Content.Server.Administration;
|
|
using Content.Server.Battery.Components;
|
|
using Content.Shared.Administration;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Server.Battery
|
|
{
|
|
[AdminCommand(AdminFlags.Admin)]
|
|
public class DrainAllBatteriesCommand : IConsoleCommand
|
|
{
|
|
public string Command => "drainallbatteries";
|
|
public string Description => "Drains *all* batteries. Useful to make sure that an engine provides enough power to sustain the station.";
|
|
public string Help => $"{Command}";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length != 0)
|
|
{
|
|
shell.WriteLine($"Invalid amount of arguments: {args.Length}.\n{Help}");
|
|
return;
|
|
}
|
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
|
foreach (var batteryComp in entityManager.ComponentManager.EntityQuery<BatteryComponent>())
|
|
{
|
|
batteryComp.CurrentCharge = 0;
|
|
}
|
|
|
|
shell.WriteLine("Done!");
|
|
}
|
|
}
|
|
}
|