ParticleAcceleratorStrengthWireAction.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Server.ParticleAccelerator.Components;
  2. using Content.Server.ParticleAccelerator.EntitySystems;
  3. using Content.Server.Wires;
  4. using Content.Shared.Singularity.Components;
  5. using Content.Shared.Wires;
  6. using Robust.Shared.Player;
  7. namespace Content.Server.ParticleAccelerator.Wires;
  8. public sealed partial class ParticleAcceleratorStrengthWireAction : ComponentWireAction<ParticleAcceleratorControlBoxComponent>
  9. {
  10. public override string Name { get; set; } = "wire-name-pa-strength";
  11. public override Color Color { get; set; } = Color.Blue;
  12. public override object StatusKey { get; } = ParticleAcceleratorWireStatus.Strength;
  13. public override StatusLightState? GetLightState(Wire wire, ParticleAcceleratorControlBoxComponent component)
  14. {
  15. return component.StrengthLocked ? StatusLightState.BlinkingSlow : StatusLightState.On;
  16. }
  17. public override bool Cut(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller)
  18. {
  19. controller.StrengthLocked = true;
  20. var paSystem = EntityManager.System<ParticleAcceleratorSystem>();
  21. paSystem.UpdateUI(wire.Owner, controller);
  22. return true;
  23. }
  24. public override bool Mend(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller)
  25. {
  26. controller.StrengthLocked = false;
  27. var paSystem = EntityManager.System<ParticleAcceleratorSystem>();
  28. paSystem.UpdateUI(wire.Owner, controller);
  29. return true;
  30. }
  31. public override void Pulse(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller)
  32. {
  33. var paSystem = EntityManager.System<ParticleAcceleratorSystem>();
  34. paSystem.SetStrength(wire.Owner, (ParticleAcceleratorPowerState) ((int) controller.SelectedStrength + 1), user, controller);
  35. }
  36. }