logic gate momentary pulse, switch status port (#17198)

* logic gate momentary is now pulse

* switch status, minor refactor

* filescope namespace

* switch

* fix ci probably

* add auto linking for edge detector and logic gate

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-06-12 22:43:59 +00:00
committed by GitHub
parent 263890ff64
commit 7cbf08ea9e
7 changed files with 109 additions and 49 deletions

View File

@@ -1,32 +1,39 @@
using Content.Server.DeviceLinking.Systems;
using Content.Shared.MachineLinking;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.DeviceLinking.Components
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))]
public sealed class SignalSwitchComponent : Component
{
/// <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.
/// The port that gets signaled when the switch turns on.
/// </summary>
[RegisterComponent]
public sealed class SignalSwitchComponent : Component
{
/// <summary>
/// The port that gets signaled when the switch turns on.
/// </summary>
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string OnPort = "On";
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string OnPort = "On";
/// <summary>
/// The port that gets signaled when the switch turns off.
/// </summary>
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string OffPort = "Off";
/// <summary>
/// The port that gets signaled when the switch turns off.
/// </summary>
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string OffPort = "Off";
[DataField("state")]
public bool State;
/// <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>
[DataField("statusPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string StatusPort = "Status";
[DataField("clickSound")]
public SoundSpecifier ClickSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/lightswitch.ogg");
}
[DataField("state")]
public bool State;
[DataField("clickSound")]
public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/lightswitch.ogg");
}