- type: entity
  abstract: true
  id: GasCanisterBase
  name: gas canister
  description: A canister that can contain any type of gas. It can be attached to connector ports using a wrench.
  parent: BaseConstructibleDynamic
  components:
  - type: InteractionOutline
  - type: SnapGrid
  - type: Sprite
  - type: Damageable
    resistances: metallicResistances
  - type: Physics
    bodyType: Dynamic
    fixtures:
    - shape:
        !type:PhysShapeAabb
          bounds: "-0.5,-0.25,0.5,0.25"
      mass: 25
      mask:
        - MobImpassable
      layer:
        - Opaque
        - MobImpassable
        - SmallImpassable
        - VaultImpassable
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: GasCanister
  - type: UserInterface
  - type: Appearance

- type: entity
  parent: GasCanisterBase
  id: GasCanister
  components:
  - type: Sprite
    netsync: false
    sprite: Constructible/Atmos/canister.rsi
    state: grey
  - type: Appearance
    visuals:
    - type: GasCanisterVisualizer
      stateConnected: can-connector
      pressureStates:
        - can-o0
        - can-o1
        - can-o2
        - can-o3
  - type: UserInterface
    interfaces:
      - key: enum.GasCanisterUiKey.Key
        type: GasCanisterBoundUserInterface
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound: /Audio/Effects/metalbreak.ogg
      - !type:SpawnEntitiesBehavior
        spawn:
          GasCanisterBrokenBase:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

- type: entity
  parent: GasCanister
  id: StorageCanister
  name: storage canister
  components:
    - type: Sprite
      state: yellow # Classic toxins canister
    - type: GasCanister
      gasMixture:
        volume: 1000
        moles: # List of gasses for easy reference
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 0 # Tritium
          - 0 # Water vapor
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound: /Audio/Effects/metalbreak.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            StorageCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]

# Filled canisters, contain 1871.71051 moles each

- type: entity
  parent: GasCanister
  id: AirCanister
  name: air canister
  components:
  - type: Sprite
    state: grey
  - type: GasCanister
    gasMixture:
      volume: 1000
      moles:
        - 393.0592071 # oxygen 21%
        - 1478.6513029 # nitrogen 79%
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound: /Audio/Effects/metalbreak.ogg
      - !type:SpawnEntitiesBehavior
        spawn:
          AirCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

- type: entity
  parent: GasCanister
  id: OxygenCanister
  name: oxygen canister
  components:
  - type: Sprite
    state: blue
  - type: GasCanister
    gasMixture:
      volume: 1000
      moles:
        - 1871.71051 # oxygen
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound: /Audio/Effects/metalbreak.ogg
      - !type:SpawnEntitiesBehavior
        spawn:
          OxygenCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

- type: entity
  parent: GasCanister
  id: NitrogenCanister
  name: nitrogen canister
  components:
    - type: Sprite
      state: red
    - type: GasCanister
      gasMixture:
        volume: 1000
        moles:
          - 0 # oxygen
          - 1871.71051 # nitrogen
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound: /Audio/Effects/metalbreak.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            NitrogenCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]

- type: entity
  parent: GasCanister
  id: CarbonDioxideCanister
  name: carbon dioxide canister
  components:
    - type: Sprite
      state: black
    - type: GasCanister
      gasMixture:
        volume: 1000
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 1871.71051 # CO2
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound: /Audio/Effects/metalbreak.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            CarbonDioxideCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]

- type: entity
  parent: GasCanister
  id: PlasmaCanister
  name: plasma canister
  components:
    - type: Sprite
      state: orange
    - type: GasCanister
      gasMixture:
        volume: 1000
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # carbon dioxide
          - 1871.71051 # plasma
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound: /Audio/Effects/metalbreak.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            PlasmaCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]

- type: entity
  parent: GasCanister
  id: TritiumCanister
  name: tritium canister
  components:
    - type: Sprite
      state: green
    - type: GasCanister
      gasMixture:
        volume: 1000
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 1871.71051 # Tritium
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound: /Audio/Effects/metalbreak.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            TritiumCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]

- type: entity
  parent: GasCanister
  id: WaterVaporCanister
  name: water vapor canister
  components:
    - type: Sprite
      state: water_vapor
    - type: GasCanister
      gasMixture:
        volume: 1000
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 0 # Tritium
          - 1871.71051 # Water vapor
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 300
        behaviors:
        - !type:PlaySoundBehavior
          sound: /Audio/Effects/metalbreak.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            WaterVaporCanisterBroken:
              min: 1
              max: 1
        - !type:DoActsBehavior
          acts: [ "Destruction" ]

# Broke Entities

- type: entity
  parent: BaseConstructible
  id: GasCanisterBrokenBase
  name: broken gas canister
  description: A broken gas canister. Not useless yet, as it can be salvaged for high quality materials.
  abstract: true
  components:
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 100
        behaviors:
        - !type:PlaySoundBehavior
          sound: /Audio/Effects/metalbreak.ogg
        - !type:SpawnEntitiesBehavior
          spawn:
            SheetPlasteel1:
              min: 1
              max: 2
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - type: Damageable
      resistances: metallicResistances
    - type: InteractionOutline
    - type: Sprite
      sprite: Constructible/Atmos/canister.rsi
      state: grey-1
    - type: Physics
      bodyType: Dynamic
      fixtures:
        - shape:
            !type:PhysShapeAabb
              bounds: "-0.3,-0.4,0.3,0.4"
          mass: 25
          mask:
            - MobImpassable
          layer:
            - Opaque
            - MobImpassable
            - SmallImpassable
            - VaultImpassable

- type: entity
  parent: GasCanisterBrokenBase
  id: StorageCanisterBroken
  name: broken storage canister
  abstract: true
  components:
    - type: Sprite
      state: yellow-1

- type: entity
  parent: GasCanisterBrokenBase
  id: AirCanisterBroken
  name: broken air canister
  abstract: true
  components:
  - type: Sprite
    state: grey-1

- type: entity
  parent: GasCanisterBrokenBase
  id: OxygenCanisterBroken
  name: broken oxygen canister
  abstract: true
  components:
  - type: Sprite
    state: blue-1

- type: entity
  parent: GasCanisterBrokenBase
  id: NitrogenCanisterBroken
  name: broken nitrogen canister
  abstract: true
  components:
    - type: Sprite
      state: red-1

- type: entity
  parent: GasCanisterBrokenBase
  id: CarbonDioxideCanisterBroken
  name: broken carbon dioxide canister
  abstract: true
  components:
    - type: Sprite
      state: black-1

- type: entity
  parent: GasCanisterBrokenBase
  id: PlasmaCanisterBroken
  name: broken plasma canister
  abstract: true
  components:
    - type: Sprite
      state: orange-1

- type: entity
  parent: GasCanisterBrokenBase
  id: TritiumCanisterBroken
  name: broken tritium canister
  abstract: true
  components:
    - type: Sprite
      state: green-1

- type: entity
  parent: GasCanisterBrokenBase
  id: WaterVaporCanisterBroken
  name: broken water vapor canister
  abstract: true
  components:
    - type: Sprite
      state: water_vapor-1
