Add interlocking airlocks (#14177)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
28
Content.Server/MachineLinking/Components/OrGateComponent.cs
Normal file
28
Content.Server/MachineLinking/Components/OrGateComponent.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Shared.MachineLinking;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.MachineLinking.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class OrGateComponent : Component
|
||||
{
|
||||
// Initial state
|
||||
[ViewVariables]
|
||||
public SignalState StateA1 = SignalState.Low;
|
||||
|
||||
[ViewVariables]
|
||||
public SignalState StateB1 = SignalState.Low;
|
||||
|
||||
[ViewVariables]
|
||||
public SignalState LastO1 = SignalState.Low;
|
||||
|
||||
[ViewVariables]
|
||||
public SignalState StateA2 = SignalState.Low;
|
||||
|
||||
[ViewVariables]
|
||||
public SignalState StateB2 = SignalState.Low;
|
||||
|
||||
[ViewVariables]
|
||||
public SignalState LastO2 = SignalState.Low;
|
||||
}
|
||||
@@ -20,5 +20,16 @@ namespace Content.Server.MachineLinking.Components
|
||||
[DataField("requiredQuality", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? RequiredQuality;
|
||||
|
||||
// Utility functions below to deal with linking entities with both Transmit and Receive components.
|
||||
public bool LinkTX()
|
||||
{
|
||||
return SavedTransmitter == null;
|
||||
}
|
||||
|
||||
public bool LinkRX()
|
||||
{
|
||||
return SavedTransmitter != null && SavedReceiver == null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Server.MachineLinking.System;
|
||||
|
||||
namespace Content.Server.MachineLinking.Components
|
||||
@@ -31,6 +32,13 @@ namespace Content.Server.MachineLinking.Components
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float TransmissionRange = 30f;
|
||||
|
||||
/*
|
||||
* Remember last output state to avoid re-raising a SignalChangedEvent if the signal
|
||||
* level hasn't actually changed.
|
||||
*/
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public SignalState LastState = SignalState.Low;
|
||||
|
||||
[DataField("outputs")]
|
||||
[Access(typeof(SignalLinkerSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
|
||||
public Dictionary<string, List<PortIdentifier>> Outputs = new();
|
||||
|
||||
Reference in New Issue
Block a user