- type: entity
  abstract: true
  parent: BaseStructureDynamic
  id: GasCanister
  name: gas canister
  description: A canister that can contain any type of gas. It can be attached to connector ports using a wrench.
  components:
    - type: Animateable
    - type: InteractionOutline
    - type: Transform
      noRot: true
    - type: Sprite
      sprite: Structures/Storage/canister.rsi
      noRot: true
      layers:
        - state: grey
    - type: Appearance
    - type: GenericVisualizer
      visuals:
        enum.AnchorVisuals.Anchored:
          connectedToPort:
            False: { state: can-connector, visible: false }
            True: { state: can-connector, visible: true }
        enum.GasCanisterVisuals.TankInserted:
          tankInserted:
            False: { state: can-open, visible: false }
            True: { state: can-open, visible: true }
        enum.LockVisuals.Locked:
          locked:
            False: { state: unlocked, shader: "unshaded" }
            True: { state: locked, shader: "unshaded" }
        enum.GasCanisterVisuals.PressureState:
          pressureLight:
            0: { state: can-o0, shader: "unshaded" }
            1: { state: can-o1, shader: "unshaded" }
            2: { state: can-o2, shader: "unshaded" }
            3: { state: can-o3, shader: "unshaded" }
    - type: ActivatableUI
      key: enum.GasCanisterUiKey.Key
    - type: UIRequiresLock
      userInterfaceKeys:
      - enum.GasCanisterUiKey.Key
    - type: UserInterface
      interfaces:
        enum.GasCanisterUiKey.Key:
          type: GasCanisterBoundUserInterface
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 600
          behaviors:
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
        - trigger:
            !type:DamageTrigger
            damage: 300
          behaviors:
            - !type:PlaySoundBehavior
              sound:
                collection: MetalBreak
            - !type:SpawnEntitiesBehavior
              spawn:
                GasCanisterBrokenBase:
                  min: 1
                  max: 1
            - !type:DoActsBehavior
              acts: [ "Destruction" ]
            - !type:DumpCanisterBehavior
    - type: Damageable
      damageContainer: Inorganic
      damageModifierSet: Metallic
    - type: Physics
      bodyType: Dynamic
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.25,-0.25,0.25,0.25"
          density: 190
          mask:
          - SmallMobMask
          layer:
          - MachineLayer
    - type: AtmosDevice
      requireAnchored: false
      joinSystem: true
    - type: ContainerContainer
      containers:
        tank_slot: !type:ContainerSlot {}
    - type: NodeContainer
      nodes:
        port:
          !type:PortablePipeNode
          nodeGroupID: Pipe
          rotationsEnabled: false
          volume: 1
    - type: ItemSlots
    - type: GasPortable
    - type: GasCanister
      gasTankSlot:
        name: comp-gas-canister-slot-name-gas-tank
        ejectOnBreak: true
        whitelist:
          components:
            - GasTank
    - type: StaticPrice
      price: 200
    - type: AccessReader
      access: [["Atmospherics"], ["Engineering"], ["Research"]]
    - type: Lock
      locked: false
    - type: GuideHelp
      guides:
      - GasCanisters
    - type: Paintable
      group: Canisters

- type: entity
  parent: GasCanister
  id: StorageCanister
  name: storage canister
  components:
    - type: Sprite
      layers:
        - state: yellow
    - type: GasCanister
      gasMixture:
        volume: 1500
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            StorageCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior

# Filled canisters, contain 1871.71051 moles each

- type: entity
  parent: GasCanister
  id: AirCanister
  name: air canister
  description: A canister that can contain any type of gas. This one is supposed to contain air mixture. It can be attached to connector ports using a wrench.
  components:
  - type: Sprite
    layers:
      - state: grey
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        Oxygen: 581.56 # oxygen 21%
        Nitrogen: 2187.79 # nitrogen 79%
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 600
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          AirCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:DumpCanisterBehavior

- type: entity
  parent: GasCanister
  id: OxygenCanister
  name: oxygen canister
  description: A canister that can contain any type of gas. This one is supposed to contain oxygen. It can be attached to connector ports using a wrench.
  components:
  - type: Sprite
    layers:
      - state: blue
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        Oxygen: 2769.36 # oxygen
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 600
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          OxygenCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:DumpCanisterBehavior

- type: entity
  id: LiquidOxygenCanister
  parent: OxygenCanister
  name: liquid oxygen canister
  description: A canister that can contain any type of gas. This one is supposed to contain liquid oxygen. It can be attached to connector ports using a wrench.
  components:
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        Oxygen: 18710.71051 # oxygen
      temperature: 72
  - type: AccessReader
    access: [["Atmospherics"]]

- type: entity
  parent: GasCanister
  id: NitrogenCanister
  name: nitrogen canister
  description: A canister that can contain any type of gas. This one is supposed to contain nitrogen. It can be attached to connector ports using a wrench.
  components:
    - type: Sprite
      layers:
        - state: red
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          Nitrogen: 2769.36 # nitrogen
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            NitrogenCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior

- type: entity
  id: LiquidNitrogenCanister
  parent: NitrogenCanister
  name: liquid nitrogen canister
  description: A canister that can contain any type of gas. This one is supposed to contain liquid nitrogen. It can be attached to connector ports using a wrench.
  components:
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        Nitrogen: 18710.71051 # nitrogen
      temperature: 72
  - type: AccessReader
    access: [["Atmospherics"]]

- type: entity
  parent: GasCanister
  id: CarbonDioxideCanister
  name: carbon dioxide canister
  description: A canister that can contain any type of gas. This one is supposed to contain carbon dioxide. It can be attached to connector ports using a wrench.
  components:
    - type: Sprite
      layers:
        - state: black
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          CarbonDioxide: 2769.36 # CO2
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            CarbonDioxideCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior
    - type: Lock
      locked: true

- type: entity
  id: LiquidCarbonDioxideCanister
  parent: CarbonDioxideCanister
  name: liquid carbon dioxide canister
  description: A canister that can contain any type of gas. This one is supposed to contain liquid carbon dioxide. It can be attached to connector ports using a wrench.
  components:
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        CarbonDioxide: 18710.71051 # CO2
      temperature: 72
  - type: AccessReader
    access: [["Atmospherics"]]

- type: entity
  parent: GasCanister
  id: PlasmaCanister
  name: plasma canister
  description: A canister that can contain any type of gas. This one is supposed to contain plasma. It can be attached to connector ports using a wrench.
  components:
    - type: Sprite
      layers:
        - state: orange
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          Plasma: 2769.36 # plasma
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            PlasmaCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior
    - type: Lock
      locked: true

- type: entity
  parent: GasCanister
  id: TritiumCanister
  name: tritium canister
  description: A canister that can contain any type of gas. This one is supposed to contain tritium. It can be attached to connector ports using a wrench.
  components:
    - type: Sprite
      layers:
        - state: green
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          Tritium: 2769.36 # Tritium
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            TritiumCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior
    - type: Lock
      locked: true

- type: entity
  parent: GasCanister
  id: WaterVaporCanister
  name: water vapor canister
  description: A canister that can contain any type of gas. This one is supposed to contain water vapor. It can be attached to connector ports using a wrench.
  components:
    - type: Sprite
      layers:
        - state: water_vapor
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          WaterVapor: 2769.36 # Water vapor
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            WaterVaporCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior

- type: entity
  parent: GasCanister
  id: AmmoniaCanister
  name: ammonia canister
  description: A canister that can contain any type of gas. This one is supposed to contain ammonia. It can be attached to connector ports using a wrench.
  components:
    - type: Sprite
      layers:
        - state: greenys
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          Ammonia: 2769.36 # Ammonia
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            AmmoniaCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior
    - type: Lock
      locked: true

- type: entity
  parent: GasCanister
  id: NitrousOxideCanister
  name: nitrous oxide canister
  description: A canister that can contain any type of gas. This one is supposed to contain nitrous oxide. It can be attached to connector ports using a wrench.
  components:
    - type: Sprite
      layers:
        - state: redws
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          NitrousOxide: 2769.36 # N2O
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 600
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            NitrousOxideCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
        - !type:DumpCanisterBehavior
    - type: Lock
      locked: true

- type: entity
  parent: GasCanister
  id: FrezonCanister
  name: frezon canister
  description: A canister that can contain any type of gas. This one is supposed to contain frezon. It can be attached to connector ports using a wrench.
  components:
  - type: Sprite
    layers:
    - state: frezon
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        Frezon: 2769.36 # Frezon
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 600
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          FrezonCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:DumpCanisterBehavior
  - type: Lock
    locked: true

# Broke Entities

- type: entity
  parent: BaseStructureDynamic
  id: GasCanisterBrokenBase
  name: broken gas canister
  description: A broken gas canister. Not useless yet, as it can be salvaged for high quality materials.
  components:
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 200
        behaviors:
          - !type:DoActsBehavior
            acts: [ "Destruction" ]
      - trigger:
          !type:DamageTrigger
          damage: 100
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            SheetPlasteel1:
              min: 1
              max: 2
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - type: Damageable
      damageContainer: Inorganic
      damageModifierSet: Metallic
    - type: InteractionOutline
    - type: Sprite
      sprite: Structures/Storage/canister.rsi
      state: grey-1
    - type: Physics
      bodyType: Dynamic
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.4,-0.3,0.4,0.3"
          density: 190
          mask:
          - MachineMask
          layer:
          - MachineLayer
    - type: PhysicalComposition
      materialComposition:
        Steel: 500
    - type: StaticPrice
      price: 125

- type: entity
  parent: GasCanisterBrokenBase
  id: StorageCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: yellow-1

- type: entity
  parent: GasCanisterBrokenBase
  id: AirCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    state: grey-1

- type: entity
  parent: GasCanisterBrokenBase
  id: OxygenCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    state: blue-1

- type: entity
  parent: GasCanisterBrokenBase
  id: NitrogenCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: red-1

- type: entity
  parent: GasCanisterBrokenBase
  id: CarbonDioxideCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: black-1

- type: entity
  parent: GasCanisterBrokenBase
  id: PlasmaCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: orange-1

- type: entity
  parent: GasCanisterBrokenBase
  id: TritiumCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: green-1

- type: entity
  parent: GasCanisterBrokenBase
  id: WaterVaporCanisterBroken
  name: broken water vapor canister
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: water_vapor-1

- type: entity
  parent: GasCanisterBrokenBase
  id: AmmoniaCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: greenys-1

- type: entity
  parent: GasCanisterBrokenBase
  id: NitrousOxideCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
    - type: Sprite
      state: redws-1

- type: entity
  parent: GasCanisterBrokenBase
  id: FrezonCanisterBroken
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    state: frezon-1
