- 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: _NF/Structures/Storage/canister.rsi # Frontier
      noRot: true
      layers:
        - state: air # Frontier
    - 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: ActivatableUIRequiresLock
    - 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 #this is so they can go under plastic flaps
          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: 125 # Frontier: 200<125
    - type: AccessReader
#      access: [["Atmospherics"], ["Engineering"], ["Research"], ["Captain"]] # Frontier
    - type: Construction # Frontier
      graph: NFStorageCanister # Frontier
      node: storagecanister # Frontier
    - type: Lock
      locked: true # Frontier: false<true
    - type: GuideHelp
      guides:
      - GasCanisters
    - type: Paintable
      group: Canisters

- type: entity
  parent: GasCanister
  id: StorageCanister
  name: storage canister
  components:
    - type: Sprite
      layers:
        - state: storage # Frontier
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles: # List of gasses for easy reference
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 0 # Tritium
          - 0 # Water vapor
          - 0 # Ammonia
          - 0 # N2O
          - 0 # 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:
            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: air # Frontier
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
      - 581.56 # oxygen 21%
      - 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: oxygen # Frontier
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
      - 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: Sprite
    layers:
      - state: oxygen_liquid # Frontier
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        - 18710.71051 # oxygen
      temperature: 72
#  - type: AccessReader # Frontier
#    access: [["Atmospherics"]] # Frontier
  - type: Destructible # Frontier
    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:
          LiquidOxygenCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:DumpCanisterBehavior

- 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: nitrogen # Frontier
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          - 0 # oxygen
          - 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: Sprite
    layers:
      - state: nitrogen_liquid # Frontier
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        - 0 # oxygen
        - 18710.71051 # nitrogen
      temperature: 72
#  - type: AccessReader # Frontier
#    access: [["Atmospherics"]] # Frontier
  - 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:
          LiquidNitrogenCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:DumpCanisterBehavior

- 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: carbon # Frontier
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 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 # Frontier
#      locked: true # Frontier

- 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: Sprite
    layers:
      - state: carbon_liquid # Frontier
  - type: GasCanister
    gasMixture:
      volume: 1500
      moles:
        - 0 # oxygen
        - 0 # nitrogen
        - 18710.71051 # CO2
      temperature: 72
#  - type: AccessReader # Frontier
#    access: [["Atmospherics"]] # Frontier
  - 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:
          LiquidCarbonDioxideCanisterBroken:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:DumpCanisterBehavior

- 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: plasma # Frontier
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # carbon dioxide
          - 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 # Frontier
#      locked: true # Frontier
    - type: PirateBountyItem # Frontier
      id: PlasmaCanister # Frontier

- 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: tritium # Frontier
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 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:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 0 # Tritium
          - 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: ammonia # Frontier
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 0 # Tritium
          - 0 #  Water vapor
          - 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: nitrous_oxide # Frontier
    - type: GasCanister
      gasMixture:
        volume: 1500
        moles:
          - 0 # oxygen
          - 0 # nitrogen
          - 0 # CO2
          - 0 # Plasma
          - 0 # Tritium
          - 0 #  Water vapor
          - 0 # Ammonia
          - 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:
      - 0 # oxygen
      - 0 # nitrogen
      - 0 # CO2
      - 0 # Plasma
      - 0 # Tritium
      - 0 # Water vapor
      - 0 # Ammonia
      - 0 # N2O
      - 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: _NF/Structures/Storage/canister.rsi # Frontier
      state: air-1 # Frontier
    - 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: 60 # Frontier: 125<60 - TODO: material value rework

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

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

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

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

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

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

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

- 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: ammonia-1

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

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