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;
|
2023-06-07 23:25:59 -07:00
|
|
|
using Content.Server.ParticleAccelerator.EntitySystems;
|
2021-06-09 22:19:39 +02:00
|
|
|
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
|
2023-06-07 23:25:59 -07:00
|
|
|
var paSystem = entitySystemManager.GetEntitySystem<ParticleAcceleratorSystem>();
|
|
|
|
|
var paQuery = entityManager.EntityQueryEnumerator<ParticleAcceleratorControlBoxComponent>();
|
|
|
|
|
while (paQuery.MoveNext(out var paId, out var paControl))
|
2020-12-17 07:20:57 +00:00
|
|
|
{
|
2023-06-07 23:25:59 -07:00
|
|
|
paSystem.RescanParts(paId, controller: paControl);
|
|
|
|
|
if (!paControl.Assembled)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
paSystem.SetStrength(paId, ParticleAcceleratorPowerState.Level0, comp: paControl);
|
|
|
|
|
paSystem.SwitchOn(paId, comp: paControl);
|
2020-12-17 07:20:57 +00:00
|
|
|
}
|
2023-06-07 23:25:59 -07:00
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
shell.WriteLine("Done!");
|
2020-12-17 07:20:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|