- type: entity
  parent: GasPipeBase
  abstract: true
  id: GasBinaryBase
  placement:
    mode: SnapgridCenter
  components:
  - type: AtmosDevice
  - type: Tag
    tags:
      - Unstackable
  - type: SubFloorHide
    blockInteractions: false
    blockAmbience: false
  - type: NodeContainer
    nodes:
      inlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North
      outlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
  - type: AtmosPipeLayers
    spriteRsiPaths:
      Primary: Structures/Piping/Atmospherics/pump.rsi
      Secondary: Structures/Piping/Atmospherics/pump_alt1.rsi
      Tertiary: Structures/Piping/Atmospherics/pump_alt2.rsi

- type: entity
  parent: GasBinaryBase
  id: GasPressurePump
  name: gas pump
  description: A pump that moves gas by pressure.
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: ExtensionCableReceiver
  - type: LightningTarget
    priority: 1
  - type: ApcPowerReceiver
    powerLoad: 200
  - type: Rotatable
  - type: Transform
    noRot: false
  - type: SubFloorHide
    visibleLayers:
    - enum.SubfloorLayers.FirstLayer
  - type: Sprite
    sprite: Structures/Piping/Atmospherics/pump.rsi
    layers:
    - sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: pipeStraight
      map: [ "enum.PipeVisualLayers.Pipe" ]
    - state: pumpPressure
      map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
  - type: AtmosPipeLayers
    alternativePrototypes:
      Primary: GasPressurePump
      Secondary: GasPressurePumpAlt1
      Tertiary: GasPressurePumpAlt2
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.PumpVisuals.Enabled:
        enabled:
          True: { state: pumpPressureOn }
          False: { state: pumpPressure }
  - type: PipeColorVisuals
  - type: GasPressurePump
    enabled: false
  - type: ActivatableUI
    key: enum.GasPressurePumpUiKey.Key
  - type: ActivatableUIRequiresAnchor
  - type: UserInterface
    interfaces:
      enum.GasPressurePumpUiKey.Key:
        type: GasPressurePumpBoundUserInterface
  - type: Construction
    graph: GasBinary
    node: pressurepump
  - type: AmbientSound
    enabled: false
    volume: -9
    range: 5
    sound:
      path: /Audio/Ambience/Objects/gas_pump.ogg
  - type: AtmosMonitoringConsoleDevice
    navMapBlip: GasFlowRegulator
  - type: GuideHelp
    guides:
    - Pumps

- type: entity
  parent: GasBinaryBase
  id: GasVolumePump
  name: volumetric gas pump
  description: A pump that moves gas by volume.
  placement:
    mode: AlignAtmosPipeLayers
  components:
    - type: ExtensionCableReceiver
    - type: LightningTarget
      priority: 1
    - type: ApcPowerReceiver
      powerLoad: 200
    - type: Rotatable
    - type: Transform
      noRot: false
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      sprite: Structures/Piping/Atmospherics/pump.rsi
      layers:
        - sprite: Structures/Piping/Atmospherics/pipe.rsi
          state: pipeStraight
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: pumpVolume
          map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
    - type: AtmosPipeLayers
      alternativePrototypes:
        Primary: GasVolumePump
        Secondary: GasVolumePumpAlt1
        Tertiary: GasVolumePumpAlt2
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.GasVolumePumpVisuals.State:
          enabled:
            On: { state: pumpVolumeOn }
            Off: { state: pumpVolume }
            Blocked: { state: pumpVolumeBlocked }
    - type: PipeColorVisuals
    - type: GasVolumePump
      enabled: false
    - type: ActivatableUI
      key: enum.GasVolumePumpUiKey.Key
    - type: ActivatableUIRequiresAnchor
    - type: UserInterface
      interfaces:
        enum.GasVolumePumpUiKey.Key:
          type: GasVolumePumpBoundUserInterface
    - type: Construction
      graph: GasBinary
      node: volumepump
    - type: AmbientSound
      enabled: false
      volume: -9
      range: 5
      sound:
        path: /Audio/Ambience/Objects/gas_pump.ogg
    - type: DeviceNetwork
      deviceNetId: AtmosDevices
      receiveFrequencyId: AtmosMonitor
      transmitFrequencyId: AtmosMonitor
      sendBroadcastAttemptEvent: true
      examinableAddress: true
      prefix: device-address-prefix-volume-pump
    - type: WiredNetworkConnection
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasFlowRegulator
    - type: GuideHelp
      guides:
      - Pumps

- type: entity
  parent: GasBinaryBase
  id: GasPressureRegulator
  name: inlet pressure regulator
  description: A valve that releases gas when the inlet pressure exceeds a certain threshold.
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: Rotatable
  - type: Transform
    noRot: false
  - type: SubFloorHide
    visibleLayers:
    - enum.SubfloorLayers.FirstLayer
  - type: Sprite
    sprite: Structures/Piping/Atmospherics/pump.rsi
    layers:
    - sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: pipeStraight
      map: [ "enum.PipeVisualLayers.Pipe" ]
    - state: pumpPressureRegulator
      map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
  - type: AtmosPipeLayers
    alternativePrototypes:
      Primary: GasPressureRegulator
      Secondary: GasPressureRegulatorAlt1
      Tertiary: GasPressureRegulatorAlt2
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.PressureRegulatorVisuals.State:
        enabled:
          True: { state: pumpPressureRegulatorOn }
          False: { state: pumpPressureRegulator }
  - type: PipeColorVisuals
  - type: GasPressureRegulator
    enabled: false
    threshold: 4500
  - type: Construction
    graph: GasBinary
    node: pressureregulator
  - type: ActivatableUI
    key: enum.GasPressureRegulatorUiKey.Key
    blockSpectators: true
  - type: ActivatableUIRequiresAnchor
  - type: UserInterface
    interfaces:
      enum.GasPressureRegulatorUiKey.Key:
        type: GasPressureRegulatorBoundUserInterface
  - type: AmbientSound
    enabled: false
    volume: -9
    range: 5
    sound:
      path: /Audio/Ambience/Objects/gas_hiss.ogg
  - type: AtmosMonitoringConsoleDevice
    navMapBlip: GasFlowRegulator
  - type: GuideHelp
    guides:
    - PressureRegulator

- type: entity
  parent: GasBinaryBase
  id: GasPassiveGate
  name: passive gate
  description: A one-way air valve that does not require power.
  placement:
    mode: AlignAtmosPipeLayers
  components:
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      sprite: Structures/Piping/Atmospherics/pump.rsi
      layers:
        - sprite: Structures/Piping/Atmospherics/pipe.rsi
          state: pipeStraight
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: pumpPassiveGate
          map: [ "enum.SubfloorLayers.FirstLayer" ]
    - type: AtmosPipeLayers
      alternativePrototypes:
        Primary: GasPassiveGate
        Secondary: GasPassiveGateAlt1
        Tertiary: GasPassiveGateAlt2
    - type: Appearance
    - type: PipeColorVisuals
    - type: GasPassiveGate
    - type: Construction
      graph: GasBinary
      node: passivegate
    - type: AmbientSound
      enabled: true
      volume: -9
      range: 5
      sound:
        path: /Audio/Ambience/Objects/gas_hiss.ogg
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasValve
    - type: GuideHelp
      guides:
      - PassiveGate

- type: entity
  parent: GasBinaryBase
  id: GasValve
  name: manual valve
  description: A pipe with a valve that can be used to disable the flow of gas through it.
  placement:
    mode: AlignAtmosPipeLayers
  components:
    # TODO ATMOS: Give unique sprite.
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      sprite: Structures/Piping/Atmospherics/pump.rsi
      layers:
        - sprite: Structures/Piping/Atmospherics/pipe.rsi
          state: pipeStraight
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: pumpManualValve
          map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
    - type: AtmosPipeLayers
      alternativePrototypes:
        Primary: GasValve
        Secondary: GasValveAlt1
        Tertiary: GasValveAlt2
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.FilterVisuals.Enabled:
          enabled:
            True: { state: pumpManualValveOn }
            False: { state: pumpManualValve }
    - type: PipeColorVisuals
    - type: GasValve
    - 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: valve
    - type: AmbientSound
      enabled: true
      volume: -9
      range: 5
      sound:
        path: /Audio/Ambience/Objects/gas_hiss.ogg
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasValve
    - type: GuideHelp
      guides:
      - ManualValve

- type: entity
  parent: GasBinaryBase
  id: SignalControlledValve
  name: signal valve
  description: A pipe with a valve that can be controlled with signals.
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: StationAiWhitelist
  - type: SubFloorHide
    visibleLayers:
    - enum.SubfloorLayers.FirstLayer
  - type: Sprite
    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: AtmosPipeLayers
    alternativePrototypes:
      Primary: SignalControlledValve
      Secondary: SignalControlledValveAlt1
      Tertiary: SignalControlledValveAlt2
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.FilterVisuals.Enabled:
        enabled:
          True: { state: pumpSignalValveOn }
          False: { state: pumpSignalValve }
  - type: PipeColorVisuals
  - type: GasValve
  - type: SignalControlledValve
  - type: DeviceNetwork
    deviceNetId: Wireless
    receiveFrequencyId: BasicDevice
  - type: WirelessNetworkConnection
    range: 200
  - type: DeviceLinkSink
    ports:
      - 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: true
    volume: -9
    range: 5
    sound:
      path: /Audio/Ambience/Objects/gas_hiss.ogg
  - type: AtmosMonitoringConsoleDevice
    navMapBlip: GasValve
  - type: GuideHelp
    guides:
    - SignalValve

- type: entity
  parent: GasBinaryBase
  id: GasPort
  name: connector port
  description: For connecting portable devices related to atmospherics control.
  placement:
    mode: SnapgridCenter
  components:
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      sprite: Structures/Piping/Atmospherics/gascanisterport.rsi
      layers:
        - sprite: Structures/Piping/Atmospherics/pipe.rsi
          state: pipeUnaryConnectors
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: gasCanisterPort
          map: [ "enum.SubfloorLayers.FirstLayer" ]
    - type: AtmosPipeLayers
      spriteRsiPaths: {}
    - type: Appearance
    - type: PipeColorVisuals
    - type: GasPort
    - type: NodeContainer
      nodes:
        connected:
          !type:PortPipeNode
          nodeGroupID: Pipe
          pipeDirection: South
    - type: Construction
      graph: GasBinary
      node: port
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasVentOpening
    - type: GuideHelp
      guides:
      - GasCanisters

- type: entity
  parent: GasVentPump
  id: GasDualPortVentPump
  name: dual-port air vent
  description: Has a valve and a pump attached to it. There are two ports, one is an input for releasing air, the other is an output when siphoning.
  placement:
    mode: SnapgridCenter
  components:
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      drawdepth: FloorObjects
      sprite: Structures/Piping/Atmospherics/vent.rsi
      layers:
        - sprite: Structures/Piping/Atmospherics/pipe.rsi
          state: pipeBinaryConnectors
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: vent_off
          map: [ "enabled", "enum.SubfloorLayers.FirstLayer" ]
    - type: AtmosPipeLayers
      spriteRsiPaths: {}
    - type: GenericVisualizer
      visuals:
        enum.VentPumpVisuals.State:
          enabled:
            Off: { state: vent_off }
            In: { state: vent_in }
            Out: { state: vent_out }
            Welded: { state: vent_welded }
            Lockout: { state: vent_lockout }
    - type: PipeColorVisuals
    - type: GasVentPump
      inlet: inlet
      outlet: outlet
      canLink: true
    - type: DeviceNetwork
      deviceNetId: Wireless
      receiveFrequencyId: BasicDevice
    - type: WirelessNetworkConnection
      range: 200
    - type: DeviceLinkSink
      ports:
        - Pressurize
        - Depressurize
    - type: Construction
      graph: GasBinary
      node: dualportventpump
    - type: NodeContainer
      nodes:
        inlet:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: North
        outlet:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: South
    - type: AmbientSound
      enabled: true
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasVentOpening
    - type: GuideHelp
      guides:
      - AirVent

- type: entity
  parent: [ BaseMachine, ConstructibleMachine ]
  id: GasRecycler
  name: gas recycler
  description: Recycles carbon dioxide and nitrous oxide. Heater and compressor not included.
  placement:
    mode: SnapgridCenter
  components:
  - type: Sprite
    sprite: Structures/Machines/gasrecycler.rsi
    layers:
    - sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: pipeBinaryConnectors
      map: [ "enum.PipeVisualLayers.Pipe" ]
    - state: running
    - state: unlit
      shader: unshaded
  - type: AtmosPipeLayers
    spriteLayersRsiPaths:
      enum.PipeVisualLayers.Pipe:
        Primary: Structures/Piping/Atmospherics/pipe.rsi
        Secondary: Structures/Piping/Atmospherics/pipe_alt1.rsi
        Tertiary: Structures/Piping/Atmospherics/pipe_alt2.rsi
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.PumpVisuals.Enabled:
        enabled:
          True: { state: running }
          False: { state: unlit }
  - type: PipeColorVisuals
  - type: Rotatable
  - type: GasRecycler
  - type: PipeRestrictOverlap
  - type: NodeContainer
    nodes:
      inlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North
      outlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
  - type: AtmosDevice
  - type: AtmosPipeColor
  - type: AmbientSound
    enabled: true
    volume: -9
    range: 5
    sound:
      path: /Audio/Ambience/Objects/gas_pump.ogg
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
      - !type:ChangeConstructionNodeBehavior
        node: machineFrame
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Machine
    board: GasRecyclerMachineCircuitboard
  - type: AtmosMonitoringConsoleDevice
    navMapBlip: GasValve

- type: entity
  parent: GasBinaryBase
  id: HeatExchanger
  name: radiator
  description: Transfers heat between the pipe and its surroundings.
  placement:
    mode: SnapgridCenter
  components:
  - type: Rotatable
  - type: Transform
    noRot: false
  - type: Sprite
    sprite: Structures/Piping/Atmospherics/heatexchanger.rsi
    layers:
    - sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: pipeStraight
      map: [ "enum.PipeVisualLayers.Pipe" ]
    - state: heStraight
      map: [ "enum.SubfloorLayers.FirstLayer" ]
  - type: AtmosPipeLayers
    spriteRsiPaths: {}
    numberOfPipeLayers: 1
  - type: SubFloorHide
    visibleLayers:
    - enum.SubfloorLayers.FirstLayer
  - type: Appearance
  - type: PipeColorVisuals
  - type: AtmosDevice
  - type: HeatExchanger
  - type: NodeContainer
    nodes:
      inlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North
      outlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
  - type: Construction
    graph: GasBinary
    node: radiator
  - type: AtmosMonitoringConsoleDevice
    navMapBlip: Thermoregulator
  - type: GuideHelp
    guides:
    - Radiators

- type: entity
  parent: HeatExchanger
  id: HeatExchangerBend
  suffix: Bend
  components:
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      layers:
      - sprite: Structures/Piping/Atmospherics/pipe.rsi
        state: pipeBend
        map: [ "enum.PipeVisualLayers.Pipe" ]
      - state: heBend
        map: [ "enum.SubfloorLayers.FirstLayer" ]
    - type: NodeContainer
      nodes:
        inlet:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: South
        outlet:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: West
    - type: Construction
      graph: GasBinary
      node: bendradiator
