2023-06-07 23:25:59 -07:00
|
|
|
using Content.Server.ParticleAccelerator.Components;
|
|
|
|
|
using Content.Server.ParticleAccelerator.EntitySystems;
|
|
|
|
|
using Content.Server.Wires;
|
|
|
|
|
using Content.Shared.Singularity.Components;
|
|
|
|
|
using Content.Shared.Wires;
|
2023-10-29 04:21:02 +11:00
|
|
|
using Robust.Shared.Player;
|
2023-06-07 23:25:59 -07:00
|
|
|
|
|
|
|
|
namespace Content.Server.ParticleAccelerator.Wires;
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ParticleAcceleratorPowerWireAction : ComponentWireAction<ParticleAcceleratorControlBoxComponent>
|
2023-06-07 23:25:59 -07:00
|
|
|
{
|
|
|
|
|
public override string Name { get; set; } = "wire-name-pa-power";
|
|
|
|
|
public override Color Color { get; set; } = Color.Yellow;
|
|
|
|
|
public override object StatusKey { get; } = ParticleAcceleratorWireStatus.Power;
|
|
|
|
|
|
|
|
|
|
public override StatusLightState? GetLightState(Wire wire, ParticleAcceleratorControlBoxComponent component)
|
|
|
|
|
{
|
|
|
|
|
if (!component.CanBeEnabled)
|
|
|
|
|
return StatusLightState.Off;
|
|
|
|
|
return component.Enabled ? StatusLightState.On : StatusLightState.BlinkingSlow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Cut(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller)
|
|
|
|
|
{
|
|
|
|
|
var paSystem = EntityManager.System<ParticleAcceleratorSystem>();
|
|
|
|
|
|
|
|
|
|
controller.CanBeEnabled = false;
|
2024-04-26 18:16:24 +10:00
|
|
|
paSystem.SwitchOff(wire.Owner, user, controller);
|
2023-06-07 23:25:59 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Mend(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller)
|
|
|
|
|
{
|
|
|
|
|
controller.CanBeEnabled = true;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Pulse(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller)
|
|
|
|
|
{
|
|
|
|
|
var paSystem = EntityManager.System<ParticleAcceleratorSystem>();
|
|
|
|
|
|
|
|
|
|
if (controller.Enabled)
|
2024-04-26 18:16:24 +10:00
|
|
|
paSystem.SwitchOff(wire.Owner, user, controller);
|
2023-06-07 23:25:59 -07:00
|
|
|
else if (controller.Assembled)
|
2024-04-26 18:16:24 +10:00
|
|
|
paSystem.SwitchOn(wire.Owner, user, controller);
|
2023-06-07 23:25:59 -07:00
|
|
|
}
|
|
|
|
|
}
|