forked from wylab/wylab-station-14
6fc13a5875
* 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
36 lines
1.0 KiB
C#
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;
|
|
}
|