1
0

SignalSwitchComponent.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Content.Server.DeviceLinking.Systems;
  2. using Content.Shared.DeviceLinking;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  5. namespace Content.Server.DeviceLinking.Components;
  6. /// <summary>
  7. /// Simple switch that will fire ports when toggled on or off. A button is jsut a switch that signals on the
  8. /// same port regardless of its state.
  9. /// </summary>
  10. [RegisterComponent, Access(typeof(SignalSwitchSystem))]
  11. public sealed partial class SignalSwitchComponent : Component
  12. {
  13. /// <summary>
  14. /// The port that gets signaled when the switch turns on.
  15. /// </summary>
  16. [DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
  17. public string OnPort = "On";
  18. /// <summary>
  19. /// The port that gets signaled when the switch turns off.
  20. /// </summary>
  21. [DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
  22. public string OffPort = "Off";
  23. /// <summary>
  24. /// The port that gets signaled with the switch's current status.
  25. /// This is only used if OnPort is different from OffPort, not in the case of a toggle switch.
  26. /// </summary>
  27. [DataField("statusPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
  28. public string StatusPort = "Status";
  29. [DataField("state")]
  30. public bool State;
  31. [DataField("clickSound")]
  32. public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/lightswitch.ogg");
  33. }