- type: entity
  parent: GasPipeBase
  abstract: true
  id: GasTrinaryBase
  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
        filter:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: West
        outlet:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: South

- type: entity
  parent: GasTrinaryBase
  id: !type:CreateVariants
    values: [ GasFilter, GasFilterAlt1, GasFilterAlt2 ]
  name: gas filter
  description: Very useful for filtering gases.
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      sprite: Structures/Piping/Atmospherics/gasfilter.rsi
      layers:
        - sprite: !type:CreateVariants
            values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
          state: pipeTrinaryConnectors
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: gasFilter
          map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
    - type: AtmosPipeLayers
      pipeLayer: !type:CreateVariants
        values: [ 0, 1, 2 ]
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.FilterVisuals.Enabled:
          enabled:
            True: { state: gasFilterOn }
            False: { state: gasFilter }
    - type: PipeColorVisuals
    - type: ActivatableUI
      key: enum.GasFilterUiKey.Key
    - type: ActivatableUIRequiresAnchor
    - type: UserInterface
      interfaces:
        enum.GasFilterUiKey.Key:
          type: GasFilterBoundUserInterface
    - type: GasFilter
      enabled: false
      transferRate: 1000
      maxTransferRate: 1000
    - type: Flippable
      mirrorEntity: GasFilterFlipped
    - type: Construction
      graph: !type:CreateVariants
        values: [ GasTrinary, GasTrinaryAlt1, GasTrinaryAlt2 ]
      node: filter
    - type: AmbientSound
      enabled: false
      volume: -9
      range: 5
      sound:
        path: /Audio/Ambience/Objects/gas_hiss.ogg
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasFlowRegulator
    - type: GuideHelp
      guides:
      - MixingAndFiltering

- type: entity
  parent: GasFilter
  id: !type:CreateVariants
    values: [ GasFilterFlipped, GasFilterFlippedAlt1, GasFilterFlippedAlt2 ]
  name: gas filter
  suffix: Flipped
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: SubFloorHide
    visibleLayers:
    - enum.SubfloorLayers.FirstLayer
  - type: Sprite
    sprite: Structures/Piping/Atmospherics/gasfilter.rsi
    layers:
    - sprite: !type:CreateVariants
        values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
      state: pipeTrinaryConnectors
      map: [ "enum.PipeVisualLayers.Pipe" ]
    - state: gasFilterF
      map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
  - type: AtmosPipeLayers
    pipeLayer: !type:CreateVariants
      values: [ 0, 1, 2 ]
  - type: Flippable
    mirrorEntity: GasFilter
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.FilterVisuals.Enabled:
        enabled:
          True: { state: gasFilterFOn }
          False: { state: gasFilterF }
  - type: Construction
    node: filterflipped
  - type: PipeColorVisuals
  - type: NodeContainer
    nodes:
      inlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
      filter:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: West
      outlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North

- type: entity
  parent: GasTrinaryBase
  id: !type:CreateVariants
    values: [ GasMixer, GasMixerAlt1, GasMixerAlt2 ]
  name: gas mixer
  description: Very useful for mixing gases.
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
    - type: SubFloorHide
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: Sprite
      sprite: Structures/Piping/Atmospherics/gasmixer.rsi
      layers:
        - sprite: !type:CreateVariants
            values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
          state: pipeTrinaryConnectors
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: gasMixer
          map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
    - type: AtmosPipeLayers
      pipeLayer: !type:CreateVariants
        values: [ 0, 1, 2 ]
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.FilterVisuals.Enabled:
          enabled:
            True: { state: gasMixerOn }
            False: { state: gasMixer }
    - type: PipeColorVisuals
    - type: ActivatableUI
      key: enum.GasMixerUiKey.Key
    - type: ActivatableUIRequiresAnchor
    - type: UserInterface
      interfaces:
        enum.GasMixerUiKey.Key:
          type: GasMixerBoundUserInterface
    - type: GasMixer
      enabled: false
      inletOne: inlet
      inletTwo: filter
    - type: Flippable
      mirrorEntity: GasMixerFlipped
    - type: Construction
      graph: !type:CreateVariants
        values: [ GasTrinary, GasTrinaryAlt1, GasTrinaryAlt2 ]
      node: mixer
    - type: AmbientSound
      enabled: false
      volume: -9
      range: 5
      sound:
        path: /Audio/Ambience/Objects/gas_hiss.ogg
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasFlowRegulator
    - type: GuideHelp
      guides:
      - MixingAndFiltering

- type: entity
  parent: GasMixer
  id: !type:CreateVariants
    values: [ GasMixerFlipped, GasMixerFlippedAlt1, GasMixerFlippedAlt2 ]
  name: gas mixer
  suffix: Flipped
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: Sprite
    sprite: Structures/Piping/Atmospherics/gasmixer.rsi
    layers:
    - sprite: !type:CreateVariants
        values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
      state: pipeTrinaryConnectors
      map: [ "enum.PipeVisualLayers.Pipe" ]
    - state: gasMixerF
      map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
  - type: AtmosPipeLayers
    pipeLayer: !type:CreateVariants
      values: [ 0, 1, 2 ]
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.FilterVisuals.Enabled:
        enabled:
          True: { state: gasMixerFOn }
          False: { state: gasMixerF }
  - type: PipeColorVisuals
  - type: Flippable
    mirrorEntity: GasMixer
  - type: NodeContainer
    nodes:
      inlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
      filter:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: West
      outlet:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North
  - type: Construction
    node: mixerflipped

- type: entity
  parent: GasPipeBase
  id: !type:CreateVariants
    values: [ PressureControlledValve, PressureControlledValveAlt1, PressureControlledValveAlt2 ]
  name: pneumatic valve
  description: A bidirectional valve controlled by pressure. Opens if the output pipe is lower than the pressure of the control pipe by 101.325 kPa.
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
    - type: AtmosDevice
    - type: Tag
      tags:
        - Unstackable
    - type: SubFloorHide
      blockInteractions: false
      blockAmbience: false
      visibleLayers:
      - enum.SubfloorLayers.FirstLayer
    - type: NodeContainer
      nodes:
        inlet:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: North
        control:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: West
        outlet:
          !type:PipeNode
          nodeGroupID: Pipe
          pipeDirection: South
    - type: Sprite
      sprite: Structures/Piping/Atmospherics/pneumaticvalve.rsi
      layers:
        - sprite: !type:CreateVariants
            values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
          state: pipeTrinaryConnectors
          map: [ "enum.PipeVisualLayers.Pipe" ]
        - state: off
          map: [ "enum.SubfloorLayers.FirstLayer", "enabled" ]
    - type: AtmosPipeLayers
      pipeLayer: !type:CreateVariants
        values: [ 0, 1, 2 ]
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.FilterVisuals.Enabled:
          enabled:
            True: { state: on }
            False: { state: off }
    - type: PipeColorVisuals
    - type: PressureControlledValve
    - type: AmbientSound
      enabled: false
      volume: -9
      range: 5
      sound:
        path: /Audio/Ambience/Objects/gas_hiss.ogg
    - type: Construction
      graph: !type:CreateVariants
        values: [ GasTrinary, GasTrinaryAlt1, GasTrinaryAlt2 ]
      node: pneumaticvalve
    - type: AtmosMonitoringConsoleDevice
      navMapBlip: GasFlowRegulator
    - type: GuideHelp
      guides:
      - PneumaticValve
      - Pumps
      - Valves
