# SPDX-FileCopyrightText: 2021 Kara D <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Fooberticus Bazly <34943053+fooberticus@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Myctai <108953437+Myctai@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Rane <60792108+Elijahrane@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 fooberticus <fooberticus@protonmail.com>
# SPDX-FileCopyrightText: 2023 Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 DangerRevoltion <142105406+DangerRevoltion@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Errant <35878406+dmnct@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 Kevin Zheng <kevinz5000@gmail.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 sneb <96957003+snebl@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 themias <89101928+themias@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: MIT
# Moles calculation
#
#   moles = 1000 / (8.31446261 * 293.15 / volume)
#
#   More practically:
#
#   moles = volume * 0.41027581
#
#   Yes, you do need all those digits or your pressure wont end up exactly 1000
#
#
# The number 1000 comes from the default MaxReleasePressure for a GasCanister,
# which is 10 * Atmospherics.OneAtmosphere, rounded down.
#
# 8.31446261 is the universal gas constant
#
# 293.15 is our default atmospheric temperature
#

# If you change the mole amounts, you can calculate the new gas supply times with:
# minutes = (moles / outputPressure) * 325

- type: entity
  id: OxygenTankFilled
  parent: OxygenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 21.3
    air:
      # 31 minutes
      volume: 5
      moles:
        - 2.051379050 # oxygen
      temperature: 293.15

- type: entity
  id: EmergencyOxygenTankFilled
  parent: EmergencyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 21.3
    air:
      # 4 minutes
      volume: 0.66
      moles:
        - 0.270782035 # oxygen
      temperature: 293.15

- type: entity
  id: EmergencyNitrogenTankFilled
  parent: EmergencyNitrogenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 21.3
    air:
      # 4 minutes
      volume: 0.66
      moles:
        - 0 # oxygen
        - 0.270782035 # nitrogen
      temperature: 293.15


- type: entity
  id: ExtendedEmergencyOxygenTankFilled
  parent: ExtendedEmergencyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 21.3
    air:
      # 9 minutes
      volume: 1.5
      moles:
        - 0.615413715 # oxygen
      temperature: 293.15

- type: entity
  id: ExtendedEmergencyNitrogenTankFilled
  parent: ExtendedEmergencyNitrogenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 21.3
    air:
      # 9 minutes
      volume: 1.5
      moles:
        - 0 # oxygen
        - 0.615413715 # nitrogen
      temperature: 293.15


- type: entity
  id: DoubleEmergencyOxygenTankFilled
  parent: DoubleEmergencyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 21.3
    air:
      # 15 minutes
      volume: 2.5
      moles:
        - 1.025689525 # oxygen
      temperature: 293.15

- type: entity
  id: DoubleEmergencyNitrogenTankFilled
  parent: DoubleEmergencyNitrogenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 21.3
    air:
      # 15 minutes
      volume: 2.5
      moles:
        - 0 # oxygen
        - 1.025689525 # nitrogen
      temperature: 293.15

- type: entity
  id: EmergencyFunnyOxygenTankFilled
  parent: EmergencyFunnyOxygenTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 22.4
    air:
      # 4 minutes
      volume: 0.66
      moles:
        - 0.270782035 # 95% oxygen
        - 0 # nitrogen
        - 0 # CO2
        - 0 # plasma
        - 0 # tritium
        - 0 # water vapor
        - 0 # ammonia
        - 0.014251686 # 5% N2O
        # 0.285033721       total
      temperature: 293.15

- type: entity
  id: AirTankFilled
  parent: AirTank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 101.3
    air:
      # 6 minutes due to output pressure
      volume: 5
      moles:
        - 0.451303391 # 22% oxygen
        - 1.600075659 # 78% nitrogen
        # 2.051379050       total
      temperature: 293.15

- type: entity
  id: NitrogenTankFilled
  parent: NitrogenTank
  suffix: Filled
  name: nitrogen tank
  components:
  - type: GasTank
    air:
      # 31 minutes
      volume: 5
      moles:
        - 0           # oxygen not included
        - 2.051379050 # nitrogen
      temperature: 293.15

- type: entity
  id: NitrousOxideTankFilled
  parent: NitrousOxideTank
  suffix: Filled
  name: nitrous oxide tank
  components:
  - type: GasTank
    #      0.21  | % oxygen in normal atmosphere
    #  /   0.7   | % oxygen in this mixture
    #  * 101.325 | one atmosphere
    # __________
    #    30.3975   optimal output pressure
    outputPressure: 30.4
    air:
      # only 22 minutes due to pressure
      volume: 5
      moles:
        - 1.435965335 # 70% oxygen
        - 0 # nitrogen
        - 0 # CO2
        - 0 # plasma
        - 0 # tritium
        - 0 # water vapor
        - 0 # ammonia
        - 0.615413715 # 30% N2O
        # 2.051379050       total
      temperature: 293.15

- type: entity
  id: PlasmaTankFilled
  parent: PlasmaTank
  name: plasma tank
  suffix: Filled
  components:
  - type: GasTank
    outputPressure: 5.325
    air:
      # 125.2 minutes with plasmaman lungs
      volume: 5
      moles:
        - 0           # oxygen
        - 0           # nitrogen
        - 0           # CO2
        - 2.051379050 # plasma
      temperature: 293.15
