2020-12-17 07:20:57 +00:00
|
|
|
using Content.Server.Administration;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.ParticleAccelerator.Components;
|
|
|
|
|
using Content.Server.Singularity.Components;
|
2021-07-24 13:42:05 +02:00
|
|
|
using Content.Server.Singularity.EntitySystems;
|
2020-12-17 07:20:57 +00:00
|
|
|
using Content.Shared.Administration;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Singularity.Components;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-12-17 07:20:57 +00:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Singularity
|
2020-12-17 07:20:57 +00:00
|
|
|
{
|
|
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class StartSingularityEngineCommand : IConsoleCommand
|
2020-12-17 07:20:57 +00:00
|
|
|
{
|
|
|
|
|
public string Command => "startsingularityengine";
|
|
|
|
|
public string Description => "Automatically turns on the particle accelerator and containment field emitters.";
|
|
|
|
|
public string Help => $"{Command}";
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-17 07:20:57 +00:00
|
|
|
{
|
|
|
|
|
if (args.Length != 0)
|
|
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
shell.WriteLine($"Invalid amount of arguments: {args.Length}.\n{Help}");
|
2020-12-17 07:20:57 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
2022-12-19 18:47:15 -08:00
|
|
|
var entitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
2023-05-28 08:44:28 +02:00
|
|
|
|
|
|
|
|
// Turn on emitters
|
|
|
|
|
var emitterQuery = entityManager.EntityQueryEnumerator<EmitterComponent>();
|
|
|
|
|
var emitterSystem = entitySystemManager.GetEntitySystem<EmitterSystem>();
|
|
|
|
|
while (emitterQuery.MoveNext(out var uid, out var emitterComponent))
|
2020-12-17 07:20:57 +00:00
|
|
|
{
|
2023-05-28 08:44:28 +02:00
|
|
|
//FIXME: This turns on ALL emitters, including APEs. It should only turn on the containment field emitters.
|
|
|
|
|
emitterSystem.SwitchOn(uid, emitterComponent);
|
2020-12-17 07:20:57 +00:00
|
|
|
}
|
2023-05-28 08:44:28 +02:00
|
|
|
|
|
|
|
|
// Turn on radiation collectors
|
|
|
|
|
var radiationCollectorQuery = entityManager.EntityQueryEnumerator<RadiationCollectorComponent>();
|
|
|
|
|
var radiationCollectorSystem = entitySystemManager.GetEntitySystem<RadiationCollectorSystem>();
|
|
|
|
|
while (radiationCollectorQuery.MoveNext(out var uid, out var radiationCollectorComponent))
|
2021-05-28 10:44:13 +01:00
|
|
|
{
|
2023-05-28 08:44:28 +02:00
|
|
|
radiationCollectorSystem.SetCollectorEnabled(uid, enabled: true, user: null, radiationCollectorComponent);
|
2021-05-28 10:44:13 +01:00
|
|
|
}
|
2023-05-28 08:44:28 +02:00
|
|
|
|
|
|
|
|
// Setup PA
|
2021-09-28 13:35:29 +02:00
|
|
|
foreach (var comp in entityManager.EntityQuery<ParticleAcceleratorControlBoxComponent>())
|
2020-12-17 07:20:57 +00:00
|
|
|
{
|
2021-06-27 05:40:03 +02:00
|
|
|
comp.RescanParts();
|
|
|
|
|
comp.SetStrength(ParticleAcceleratorPowerState.Level0);
|
|
|
|
|
comp.SwitchOn();
|
2020-12-17 07:20:57 +00:00
|
|
|
}
|
2021-02-01 16:49:43 -08:00
|
|
|
shell.WriteLine("Done!");
|
2020-12-17 07:20:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|