--- /dev/null
+using Content.Server.Atmos.Piping.Binary.EntitySystems;
+using Content.Shared.MachineLinking;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
+
+namespace Content.Server.Atmos.Piping.Binary.Components;
+
+[RegisterComponent, Access(typeof(SignalControlledValveSystem))]
+public sealed class SignalControlledValveComponent : Component
+{
+ [DataField("openPort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
+ public string OpenPort = "Open";
+
+ [DataField("closePort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
+ public string ClosePort = "Close";
+
+ [DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
+ public string TogglePort = "Toggle";
+}
--- /dev/null
+using Content.Server.Atmos.Piping.Binary.Components;
+using Content.Server.MachineLinking.Events;
+using Content.Server.MachineLinking.System;
+
+namespace Content.Server.Atmos.Piping.Binary.EntitySystems;
+
+public sealed class SignalControlledValveSystem : EntitySystem
+{
+ [Dependency] private readonly SignalLinkerSystem _signal = default!;
+ [Dependency] private readonly GasValveSystem _valve = default!;
+
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ SubscribeLocalEvent<SignalControlledValveComponent, ComponentInit>(OnInit);
+ SubscribeLocalEvent<SignalControlledValveComponent, SignalReceivedEvent>(OnSignalReceived);
+ }
+
+ private void OnInit(EntityUid uid, SignalControlledValveComponent comp, ComponentInit args)
+ {
+ _signal.EnsureReceiverPorts(uid, comp.OpenPort, comp.ClosePort, comp.TogglePort);
+ }
+
+ private void OnSignalReceived(EntityUid uid, SignalControlledValveComponent comp, SignalReceivedEvent args)
+ {
+ if (!TryComp<GasValveComponent>(uid, out var valve))
+ return;
+
+ if (args.Port == comp.OpenPort)
+ {
+ _valve.Set(uid, valve, true);
+ }
+ else if (args.Port == comp.ClosePort)
+ {
+ _valve.Set(uid, valve, false);
+ }
+ else if (args.Port == comp.TogglePort)
+ {
+ _valve.Toggle(uid, valve);
+ }
+ }
+}
sound:
path: /Audio/Ambience/Objects/gas_hiss.ogg
+- type: entity
+ parent: GasBinaryBase
+ id: SignalControlledValve
+ name: signal valve
+ description: A pipe with a valve that can be controlled with signals.
+ placement:
+ mode: SnapgridCenter
+ components:
+ - type: Sprite
+ netsync: false
+ sprite: Structures/Piping/Atmospherics/pump.rsi
+ layers:
+ - sprite: Structures/Piping/Atmospherics/pipe.rsi
+ state: pipeStraight
+ map: [ "enum.PipeVisualLayers.Pipe" ]
+ - state: pumpSignalValve
+ map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
+ - type: Appearance
+ - type: GenericVisualizer
+ visuals:
+ enum.FilterVisuals.Enabled:
+ enabled:
+ True: { state: pumpSignalValveOn }
+ False: { state: pumpSignalValve }
+ - type: PipeColorVisuals
+ - type: GasValve
+ - type: SignalControlledValve
+ - type: SignalReceiver
+ inputs:
+ Open: []
+ Close: []
+ Toggle: []
+ - type: NodeContainer
+ nodes:
+ inlet:
+ !type:PipeNode
+ nodeGroupID: Pipe
+ pipeDirection: North
+ volume: 100
+ outlet:
+ !type:PipeNode
+ nodeGroupID: Pipe
+ pipeDirection: South
+ volume: 100
+ - type: Construction
+ graph: GasBinary
+ node: signalvalve
+ - type: AmbientSound
+ enabled: false
+ volume: -9
+ range: 5
+ sound:
+ path: /Audio/Ambience/Objects/gas_hiss.ogg
+
- type: entity
parent: GasBinaryBase
id: GasPort
amount: 2
doAfter: 1
+ - to: signalvalve
+ steps:
+ - material: Steel
+ amount: 2
+ doAfter: 1
+
- to: port
steps:
- material: Steel
- tool: Welding
doAfter: 1
+ - node: signalvalve
+ entity: SignalControlledValve
+ edges:
+ - to: start
+ conditions:
+ - !type:EntityAnchored
+ anchored: false
+ completed:
+ - !type:SpawnPrototype
+ prototype: SheetSteel1
+ amount: 2
+ - !type:DeleteEntity
+ steps:
+ - tool: Welding
+ doAfter: 1
+
- node: port
entity: GasPort
edges:
conditions:
- !type:TileNotBlocked {}
+- type: construction
+ id: SignalControlledValve
+ name: signal valve
+ description: Valve controlled by signal inputs.
+ graph: GasBinary
+ startNode: start
+ targetNode: signalvalve
+ category: construction-category-utilities
+ placementMode: SnapgridCenter
+ canBuildInImpassable: false
+ icon:
+ sprite: Structures/Piping/Atmospherics/pump.rsi
+ state: pumpSignalValve
+ layers:
+ - sprite: Structures/Piping/Atmospherics/pipe.rsi
+ state: pipeStraight
+ - sprite: Structures/Piping/Atmospherics/pump.rsi
+ state: pumpSignalValve
+ conditions:
+ - !type:TileNotBlocked {}
+
- type: construction
id: GasPort
name: connector port
canRotate: true
canBuildInImpassable: true
conditions:
- - !type:WallmountCondition {}
\ No newline at end of file
+ - !type:WallmountCondition {}
"y":32
},
"license":"CC-BY-SA-3.0",
- "copyright":"Taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da",
+ "copyright":"Taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da. Signal valve is a digital valve modified by deltanedas.",
"states":[
{
"name":"pumpDigitalValve",
"name":"pumpManualValveOn",
"directions":4
},
+ {
+ "name":"pumpSignalValve",
+ "directions":4
+ },
+ {
+ "name":"pumpSignalValveOn",
+ "directions":4
+ },
{
"name":"pumpPassiveGate",
"directions":4