2023-06-12 22:43:59 +00:00
|
|
|
using Content.Server.DeviceLinking.Systems;
|
2023-07-24 14:07:35 +12:00
|
|
|
using Content.Shared.DeviceLinking;
|
2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2022-05-12 20:46:20 +12:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
2020-08-29 03:33:42 -07:00
|
|
|
|
2023-06-12 22:43:59 +00:00
|
|
|
namespace Content.Server.DeviceLinking.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Simple switch that will fire ports when toggled on or off. A button is jsut a switch that signals on the
|
|
|
|
|
/// same port regardless of its state.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent, Access(typeof(SignalSwitchSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class SignalSwitchComponent : Component
|
2020-08-29 03:33:42 -07:00
|
|
|
{
|
2022-05-12 20:46:20 +12:00
|
|
|
/// <summary>
|
2023-06-12 22:43:59 +00:00
|
|
|
/// The port that gets signaled when the switch turns on.
|
|
|
|
|
/// </summary>
|
2023-07-24 14:07:35 +12:00
|
|
|
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
|
2023-06-12 22:43:59 +00:00
|
|
|
public string OnPort = "On";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The port that gets signaled when the switch turns off.
|
2022-05-12 20:46:20 +12:00
|
|
|
/// </summary>
|
2023-07-24 14:07:35 +12:00
|
|
|
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
|
2023-06-12 22:43:59 +00:00
|
|
|
public string OffPort = "Off";
|
2022-05-12 20:46:20 +12:00
|
|
|
|
2023-06-12 22:43:59 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// The port that gets signaled with the switch's current status.
|
|
|
|
|
/// This is only used if OnPort is different from OffPort, not in the case of a toggle switch.
|
|
|
|
|
/// </summary>
|
2023-07-24 14:07:35 +12:00
|
|
|
[DataField("statusPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
|
2023-06-12 22:43:59 +00:00
|
|
|
public string StatusPort = "Status";
|
2022-05-12 20:46:20 +12:00
|
|
|
|
2023-06-12 22:43:59 +00:00
|
|
|
[DataField("state")]
|
|
|
|
|
public bool State;
|
2022-06-22 03:51:42 +03:00
|
|
|
|
2023-06-12 22:43:59 +00:00
|
|
|
[DataField("clickSound")]
|
|
|
|
|
public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/lightswitch.ogg");
|
2020-08-29 03:33:42 -07:00
|
|
|
}
|