Files
wylab-station-14/Content.Shared/DeviceLinking/Components/RandomGateComponent.cs
T
Borsh 6fc13a5875 Adding a random gate (#41627)
* Added random gate

* minor edit

* cleaning up my shit after trying to do something faster

* new lines

* some changes

* joke

* UI

* Long Division

* Dont use ctrl + x in 3 am

* I hope these are the final touches

* One thing, I don't know why

* noname commit

* no way, 1kk of code lines edit

* sudo rm -rf ... and something there...

* update

* sometimes its sad
2025-12-14 19:15:22 +00:00

36 lines
1.0 KiB
C#

using Robust.Shared.Prototypes;
using Robust.Shared.GameStates;
namespace Content.Shared.DeviceLinking.Components;
/// <summary>
/// A component for a random gate, which outputs a signal with a given probability.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class RandomGateComponent : Component
{
/// <summary>
/// The input port for receiving signals.
/// </summary>
[DataField]
public ProtoId<SinkPortPrototype> InputPort = "RandomGateInput";
/// <summary>
/// The output port for sending signals.
/// </summary>
[DataField]
public ProtoId<SourcePortPrototype> OutputPort = "Output";
/// <summary>
/// The last output state of the gate.
/// </summary>
[DataField, AutoNetworkedField]
public bool LastOutput;
/// <summary>
/// The probability (0.0 to 1.0) that the gate will output a signal.
/// </summary>
[DataField, AutoNetworkedField]
public float SuccessProbability = 0.5f;
}