- type: entity
  abstract: true
  parent: [ BaseStructureDynamic, BasePaperLabelableVisualized ]
  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
    - state: paper
      visible: false
      map: [ "enum.PaperLabelVisuals.Layer" ]
    - state: integrity-unshaded-0
      map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
      shader: unshaded
      visible: false
    - state: mask-grey
      map: [ "enum.MaxPressureVisualLayers.Base" ]
      visible: false
  - 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" }
      enum.PaperLabelVisuals.HasLabel:
        enum.PaperLabelVisuals.Layer:
          True: { visible: true }
          False: { visible: false }
      enum.StorageVisuals.Open:
        enum.PaperLabelVisuals.Layer:
          True: { visible: false }
      enum.PaperLabelVisuals.LabelType:
        enum.PaperLabelVisuals.Layer:
          Paper: { state: paper }
          Bounty: { state: bounty }
          CaptainsPaper: { state: captains_paper }
          Invoice: { state: invoice }
  - type: ActivatableUI
    key: enum.GasCanisterUiKey.Key
  - type: UIRequiresLock
    userInterfaceKeys:
    - enum.GasCanisterUiKey.Key
  - type: UserInterface
    interfaces:
      enum.GasCanisterUiKey.Key:
        type: GasCanisterBoundUserInterface
  - type: Destructible
    thresholds:
    - trigger: &DamageTrigger300
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:DumpCanisterBehavior
  - type: Damageable
    damageModifierSet: Metallic
  - type: Injurable
    damageContainer: Inorganic
  - 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 {}
      paper_label: !type:ContainerSlot
  - type: NodeContainer
    nodes:
      port:
        !type:PortablePipeNode
        nodeGroupID: Pipe
        rotationsEnabled: false
        volume: 1
  - type: GasPortable
  - type: MaxPressureVisuals
    integrityMask: mask-grey
  - type: GasCanister
    maxIntegrity: 15 # 5 times stronger than a gas tank
    integrity: 15
    maxReleasePressure: 1013.25
    safetyPressure: 10132.5 # High enough that liquid tanks don't burst immediately, with an extra 33% wiggle room to work with
    overpressure: 20265 # Purposefully high because cans react really fucking fast, may need to redo this value if reactions change!
    gasTankSlot:
      name: comp-gas-canister-slot-name-gas-tank
      ejectOnBreak: true
      whitelist:
        components:
          - GasTank
  - type: Explosive
    explosionType: Minibomb # Mostly a pressure wave explosive so primarily blunt damage
    maxIntensity: 100
    tileBreakScale: 0.2 # Keeps the can from spacing all the hot gas it has now vented :). If this proves to be too much it can be removed.
  - 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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-yellow
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-yellow
    - type: GasCanister
      air:
        volume: 1500
        temperature: 293.15
    - type: Destructible
      thresholds:
      - 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
    sprite: Structures/Storage/canister.rsi
    layers:
    - state: grey
    - state: paper
      visible: false
      map: [ "enum.PaperLabelVisuals.Layer" ]
    - state: integrity-unshaded-0
      map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
      shader: unshaded
      visible: false
    - state: mask-grey
      map: [ "enum.MaxPressureVisualLayers.Base" ]
      visible: false
  - type: MaxPressureVisuals
    integrityMask: mask-grey
  - type: GasCanister
    air:
      volume: 1500
      moles:
        Oxygen: 581.56 # oxygen 21%
        Nitrogen: 2187.79 # nitrogen 79%
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger300
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          AirCanisterBroken:
            min: 1
            max: 1

- 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
    - state: paper
      visible: false
      map: [ "enum.PaperLabelVisuals.Layer" ]
    - state: integrity-unshaded-0
      map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
      shader: unshaded
      visible: false
    - state: mask-blue
      map: [ "enum.MaxPressureVisualLayers.Base" ]
      visible: false
  - type: MaxPressureVisuals
    integrityMask: mask-blue
  - type: GasCanister
    air:
      volume: 1500
      moles:
        Oxygen: 2769.36 # oxygen
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger300
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          OxygenCanisterBroken:
            min: 1
            max: 1

- 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
    air:
      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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-red
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-red
    - type: GasCanister
      air:
        volume: 1500
        moles:
          Nitrogen: 2769.36 # nitrogen
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger: *DamageTrigger300
        behaviors:
        - !type:SpawnEntitiesBehavior
          spawn:
            NitrogenCanisterBroken:
              min: 1
              max: 1

- 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
    air:
      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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-black
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-black
    - type: GasCanister
      air:
        volume: 1500
        moles:
          CarbonDioxide: 2769.36 # CO2
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger: *DamageTrigger300
        behaviors:
        - !type:SpawnEntitiesBehavior
          spawn:
            CarbonDioxideCanisterBroken:
              min: 1
              max: 1
    - 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
    air:
      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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-orange
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-orange
    - type: GasCanister
      air:
        volume: 1500
        moles:
          Plasma: 2769.36 # plasma
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger: *DamageTrigger300
        behaviors:
        - !type:SpawnEntitiesBehavior
          spawn:
            PlasmaCanisterBroken:
              min: 1
              max: 1
    - 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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-green
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-green
    - type: GasCanister
      air:
        volume: 1500
        moles:
          Tritium: 2769.36 # Tritium
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger: *DamageTrigger300
        behaviors:
        - !type:SpawnEntitiesBehavior
          spawn:
            TritiumCanisterBroken:
              min: 1
              max: 1
    - 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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-water_vapor
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-water_vapor
    - type: GasCanister
      air:
        volume: 1500
        moles:
          WaterVapor: 2769.36 # Water vapor
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger: *DamageTrigger300
        behaviors:
        - !type:SpawnEntitiesBehavior
          spawn:
            WaterVaporCanisterBroken:
              min: 1
              max: 1

- 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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-greenys
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-greenys
    - type: GasCanister
      air:
        volume: 1500
        moles:
          Ammonia: 2769.36 # Ammonia
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger: *DamageTrigger300
        behaviors:
        - !type:SpawnEntitiesBehavior
          spawn:
            AmmoniaCanisterBroken:
              min: 1
              max: 1
    - 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
      - state: paper
        visible: false
        map: [ "enum.PaperLabelVisuals.Layer" ]
      - state: integrity-unshaded-0
        map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
        shader: unshaded
        visible: false
      - state: mask-redws
        map: [ "enum.MaxPressureVisualLayers.Base" ]
        visible: false
    - type: MaxPressureVisuals
      integrityMask: mask-redws
    - type: GasCanister
      air:
        volume: 1500
        moles:
          NitrousOxide: 2769.36 # N2O
        temperature: 293.15
    - type: Destructible
      thresholds:
      - trigger: *DamageTrigger300
        behaviors:
        - !type:SpawnEntitiesBehavior
          spawn:
            NitrousOxideCanisterBroken:
              min: 1
              max: 1
    - 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
    - state: paper
      visible: false
      map: [ "enum.PaperLabelVisuals.Layer" ]
    - state: integrity-unshaded-0
      map: [ "enum.MaxPressureVisualLayers.BaseUnshaded" ]
      shader: unshaded
      visible: false
    - state: mask-frezon
      map: [ "enum.MaxPressureVisualLayers.Base" ]
      visible: false
  - type: MaxPressureVisuals
    integrityMask: mask-frezon
  - type: GasCanister
    air:
      volume: 1500
      moles:
        Frezon: 2769.36 # Frezon
      temperature: 293.15
  - type: Destructible
    thresholds:
    - trigger: *DamageTrigger300
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          FrezonCanisterBroken:
            min: 1
            max: 1
  - type: Lock
    locked: true


- type: entity
  parent: GasCanister
  id: MaxCapCanister # As of writing canisters currently have about 9000 explosive intensity. 95% the total damage of a syndicate bomb but spread across a larger area.
  categories: [ Debug ]
  name: max cap in a can
  suffix: Max Cap
  components:
  - type: GasCanister
    air:
      volume: 1500
      moles:
        Oxygen: 1400
        Tritium: 700
      temperature: 373.149

# 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: 100
        behaviors:
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:SpawnEntitiesBehavior
          spawn:
            SheetPlasteel1:
              min: 1
              max: 2
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - type: Damageable
      damageModifierSet: Metallic
    - type: Injurable
      damageContainer: Inorganic
    - 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
