Refactor gasmix mole change into a proc (#95327)

## About The Pull Request
Refactor the majority of the current gasmix mole change use cases into a
proc called adjust_gas which simply adds the designated mole count of
the species into the gas mix while also handling asserting the gas and
garbage_collect()
I also added adjust_multiple_gases and convert_gas() for modifying
multiple gases and within a gasmix

## Why It's Good For The Game
Lemon wanted this to be done as part of the air group refactor 

## Changelog

🆑
refactor: refactored majority of gas_mix mole change into adjust_gas()
proc
/🆑
This commit is contained in:
FinancialGoose
2026-04-21 13:43:47 -07:00
committed by GitHub
parent 55366497a3
commit e98cb75c57
30 changed files with 211 additions and 218 deletions
@@ -1133,10 +1133,9 @@
/// H2O electrolysis
/obj/item/organ/lungs/ethereal/proc/consume_water(mob/living/carbon/breather, datum/gas_mixture/breath, h2o_pp, old_h2o_pp)
var/gas_breathed = breath.gases[/datum/gas/water_vapor][MOLES]
breath.gases[/datum/gas/water_vapor][MOLES] -= gas_breathed
breath_out.assert_gases(/datum/gas/oxygen, /datum/gas/hydrogen)
breath_out.gases[/datum/gas/oxygen][MOLES] += gas_breathed
breath_out.gases[/datum/gas/hydrogen][MOLES] += gas_breathed * 2
breath.adjust_gas(/datum/gas/water_vapor, -gas_breathed)
var/list/new_gases = list(/datum/gas/oxygen = gas_breathed, /datum/gas/hydrogen = gas_breathed * 2)
breath_out.adjust_multiple_gases(new_gases)
/obj/item/organ/lungs/pod