- type: entity
  abstract: true
  parent: BaseItem
  id: GasPipeSansLayersIndestructible
  name: gas pipe
  description: Holds gas.
  placement:
    mode: SnapgridCenter
  components:
  - type: Visibility
    layer: 1
  - type: Item
    size: Normal
  - type: Transform
    anchored: true
  - type: SubFloorHide
  - type: CollideOnAnchor
  - type: Anchorable
  - type: Rotatable
    increment: 90
  - type: Sprite
    sprite: Structures/Piping/Atmospherics/pipe.rsi
    drawdepth: ThinPipe
    visible: false
  - type: Appearance
  - type: PipeAppearance
  - type: PipeColorVisuals
  - type: NodeContainer
  - type: PipeRestrictOverlap
  - type: AtmosUnsafeUnanchor
  - type: AtmosPipeColor
  - type: AtmosMonitoringConsoleDevice
  - type: Tag
    tags:
    - Pipe
  - type: Physics
    canCollide: false
    bodyType: static
  - type: StaticPrice
    price: 30

- type: entity
  abstract: true
  parent: [ GasPipeSansLayersIndestructible, StructureHealthContainer ]
  id: GasPipeSansLayers
  components:
  - type: Damageable
    damageModifierSet: SteelMod
  - type: Destructible
    thresholds:
    - trigger: # regular damage trigger (replace with broken pipe)
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
          params:
            volume: -8
      - !type:SpawnEntitiesBehavior
        spawn:
          GasPipeBroken:
            min: 1
            max: 1
        offset: 0

- type: entity
  abstract: true
  id: BaseGasPipeLayers
  components:
  - 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: entity
  abstract: true
  parent: [ GasPipeSansLayers, BaseGasPipeLayers ]
  id: GasPipeBase

#Note: The PipeDirection of the PipeNode should be the south-facing version, because the entity starts at an angle of 0 (south)

- type: entity
  parent: GasPipeBase
  id: !type:CreateVariants
    values: [ GasPipeHalf, GasPipeHalfAlt1, GasPipeHalfAlt2 ]
  suffix: Half
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: NodeContainer
    nodes:
      pipe:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
        volume: 100
  - type: Sprite
    layers:
    - sprite: !type:CreateVariants
        values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
      state: pipeHalf
      map: [ "enum.PipeVisualLayers.Pipe" ]
  - type: Construction
    graph: !type:CreateVariants
      values: [ GasPipe, GasPipeAlt1, GasPipeAlt2 ]
    node: half
  - type: AtmosPipeLayers
    pipeLayer: !type:CreateVariants
      values: [ 0, 1, 2 ]
  - type: Item
    size: Small
    storedSprite:
      sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: storageHalf
  - type: GuideHelp
    guides:
    - Pipes
    - PipeNetworks

- type: entity
  parent: GasPipeBase
  id: !type:CreateVariants
    values: [ GasPipeStraight, GasPipeStraightAlt1, GasPipeStraightAlt2 ]
  suffix: Straight
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: NodeContainer
    nodes:
      pipe:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: Longitudinal
  - type: Sprite
    layers:
    - sprite: !type:CreateVariants
        values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
      state: pipeStraight
      map: [ "enum.PipeVisualLayers.Pipe" ]
  - type: AtmosPipeLayers
    pipeLayer: !type:CreateVariants
      values: [ 0, 1, 2 ]
  - type: Construction
    graph: !type:CreateVariants
      values: [ GasPipe, GasPipeAlt1, GasPipeAlt2 ]
    node: straight
  - type: Item
    storedSprite:
      sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: storageStraight
    shape:
    - 0,0,0,2
  - type: MeleeWeapon
    attackRate: 1
    damage:
      types:
        Blunt: 8
    soundHit:
      collection: MetalThud # this NEEDS to changed to the metal pipe falling sound effect on april first every year
  - type: GuideHelp
    guides:
    - Pipes
    - PipeNetworks

- type: entity
  parent: GasPipeBase
  id: !type:CreateVariants
    values: [ GasPipeBend, GasPipeBendAlt1, GasPipeBendAlt2 ]
  suffix: Bend
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: NodeContainer
    nodes:
      pipe:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: SWBend
  - type: Sprite
    layers:
    - sprite: !type:CreateVariants
        values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
      state: pipeBend
      map: [ "enum.PipeVisualLayers.Pipe" ]
  - type: AtmosPipeLayers
    pipeLayer: !type:CreateVariants
      values: [ 0, 1, 2 ]
  - type: Construction
    graph: !type:CreateVariants
      values: [ GasPipe, GasPipeAlt1, GasPipeAlt2 ]
    node: bend
  - type: Item
    shape:
    - 0,0,1,0
    - 1,1,1,1
    heldPrefix: Bend
    storedSprite:
      sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: storageBend
  - type: MeleeWeapon
    wideAnimationRotation: 180
    attackRate: 1
    damage:
      types:
        Blunt: 6
    soundHit:
      collection: MetalThud
  - type: DamageOtherOnHit
    damage:
      types:
        Blunt: 8 # Woe, pipe be upon ye!
  - type: GuideHelp
    guides:
    - Pipes
    - PipeNetworks

- type: entity
  parent: GasPipeBase
  id: !type:CreateVariants
    values: [ GasPipeTJunction, GasPipeTJunctionAlt1, GasPipeTJunctionAlt2 ]
  suffix: TJunction
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: NodeContainer
    nodes:
      pipe:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: TSouth
  - type: Sprite
    layers:
    - sprite: !type:CreateVariants
        values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
      state: pipeTJunction
      map: [ "enum.PipeVisualLayers.Pipe" ]
  - type: AtmosPipeLayers
    pipeLayer: !type:CreateVariants
      values: [ 0, 1, 2 ]
  - type: Construction
    graph: !type:CreateVariants
      values: [ GasPipe, GasPipeAlt1, GasPipeAlt2 ]
    node: tjunction
  - type: Item
    heldPrefix: TJunction
    storedSprite:
      sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: storageTJunction
  - type: MeleeWeapon
    wideAnimationRotation: 90
    attackRate: 0.75
    damage:
      types:
        Blunt: 10
    soundHit:
      collection: MetalThud
  - type: GuideHelp
    guides:
    - Pipes
    - PipeNetworks

- type: entity
  parent: GasPipeBase
  id: !type:CreateVariants
    values: [ GasPipeFourway, GasPipeFourwayAlt1, GasPipeFourwayAlt2 ]
  suffix: Fourway
  categories: !type:CreateVariants
    sequences: [ [ ], [ HideSpawnMenu ], [ HideSpawnMenu ] ]
  placement:
    mode: AlignAtmosPipeLayers
  components:
  - type: Transform
    noRot: true
  - type: NodeContainer
    nodes:
      pipe:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: Fourway
  - type: Sprite
    layers:
    - sprite: !type:CreateVariants
        values: [ Structures/Piping/Atmospherics/pipe.rsi, Structures/Piping/Atmospherics/pipe_alt1.rsi, Structures/Piping/Atmospherics/pipe_alt2.rsi ]
      state: pipeFourway
      map: [ "enum.PipeVisualLayers.Pipe" ]
  - type: AtmosPipeLayers
    pipeLayer: !type:CreateVariants
      values: [ 0, 1, 2 ]
  - type: Construction
    graph: !type:CreateVariants
      values: [ GasPipe, GasPipeAlt1, GasPipeAlt2 ]
    node: fourway
  - type: Item
    heldPrefix: Fourway
    storedSprite:
      sprite: Structures/Piping/Atmospherics/pipe.rsi
      state: storageFourway
  - type: MeleeWeapon
    wideAnimationRotation: 90
    attackRate: 0.75
    damage:
      types:
        Blunt: 10
    soundHit:
      collection: MetalThud
  - type: GuideHelp
    guides:
    - Pipes
    - PipeNetworks

- type: entity
  id: GasPipeBroken
  parent: [ GasPipeSansLayersIndestructible, BaseGasPipeLayers, StructureHealthFurniture ]
  name: broken pipe
  description: It used to hold gas.
  components:
  - type: Sprite
    layers:
    - state: pipeBroken
      map: [ "enum.PipeVisualLayers.Pipe" ]
  - type: Construction
    graph: GasPipeSpecial
    node: broken
  - type: Item
    size: Small
  - type: Damageable
    damageModifierSet: SteelMod
  - type: GuideHelp
    guides:
    - Pipes
    - PipeNetworks

- type: entity
  parent: GasPipeBase
  id: GasPipeManifold
  name: gas pipe manifold
  description: Allows gas pipes of different configurations to be connected together.
  placement:
    mode: SnapgridCenter
  components:
  - type: Sprite
    layers:
    - sprite: Structures/Piping/Atmospherics/manifold.rsi
      state: pipeManifold
      map: [ "enum.PipeVisualLayers.Pipe" ]
  - type: PipeAppearance
    sprite:
    - { sprite: Structures/Piping/Atmospherics/manifold.rsi, state: pipeConnector }
    - { sprite: Structures/Piping/Atmospherics/manifold.rsi, state: pipeConnector_alt1 }
    - { sprite: Structures/Piping/Atmospherics/manifold.rsi, state: pipeConnector_alt2 }
  - type: AtmosPipeLayers
    pipeLayersLocked: true
  - type: Construction
    graph: GasPipeSpecial
    node: manifold
  - type: Item
    size: Small
    shape:
    - 0,0,1,0
    storedSprite:
      sprite: Structures/Piping/Atmospherics/manifold.rsi
      state: storageManifold
  - type: NodeContainer
    nodes:
      south0:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
        pipeLayer: 0
        volume: 50
      south1:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
        pipeLayer: 1
        volume: 50
      south2:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: South
        pipeLayer: 2
        volume: 50
      north0:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North
        pipeLayer: 0
        volume: 50
      north1:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North
        pipeLayer: 1
        volume: 50
      north2:
        !type:PipeNode
        nodeGroupID: Pipe
        pipeDirection: North
        pipeLayer: 2
        volume: 50
  - type: GasPipeManifold
  - type: AtmosMonitoringConsoleDevice
    navMapBlip: GasPipeManifold
    showAbsentConnections: false
  - type: AtmosDevice
  - type: Tag
    tags:
    - Unstackable
