EdgeDetectorComponent.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using Content.Server.DeviceLinking.Systems;
  2. using Content.Shared.DeviceLinking;
  3. using Robust.Shared.Prototypes;
  4. namespace Content.Server.DeviceLinking.Components;
  5. /// <summary>
  6. /// An edge detector that pulses high or low output ports when the input port gets a rising or falling edge respectively.
  7. /// </summary>
  8. [RegisterComponent, Access(typeof(EdgeDetectorSystem))]
  9. public sealed partial class EdgeDetectorComponent : Component
  10. {
  11. /// <summary>
  12. /// Name of the input port.
  13. /// </summary>
  14. [DataField, ViewVariables(VVAccess.ReadWrite)]
  15. public ProtoId<SinkPortPrototype> InputPort = "Input";
  16. /// <summary>
  17. /// Name of the rising edge output port.
  18. /// </summary>
  19. [DataField, ViewVariables(VVAccess.ReadWrite)]
  20. public ProtoId<SourcePortPrototype> OutputHighPort = "OutputHigh";
  21. /// <summary>
  22. /// Name of the falling edge output port.
  23. /// </summary>
  24. [DataField, ViewVariables(VVAccess.ReadWrite)]
  25. public ProtoId<SourcePortPrototype> OutputLowPort = "OutputLow";
  26. // Initial state
  27. [DataField]
  28. public SignalState State = SignalState.Low;
  29. }