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
@@ -291,10 +291,9 @@
QDEL_NULL(hotspot)
var/datum/gas_mixture/air = location.air
var/list/gases = air.gases
if (gases[/datum/gas/plasma])
var/scrub_amt = min(30, gases[/datum/gas/plasma][MOLES]) //Absorb some plasma
gases[/datum/gas/plasma][MOLES] -= scrub_amt
if (air.gases[/datum/gas/plasma])
var/scrub_amt = min(30, air.gases[/datum/gas/plasma][MOLES]) //Absorb some plasma
air.adjust_gas(/datum/gas/plasma, -scrub_amt)
absorbed_plasma += scrub_amt
if (air.temperature > T20C)
air.temperature = max(air.temperature / 2, T20C)
@@ -297,11 +297,10 @@
if(!distcheck || get_dist(location, chilly) < blast) // Otherwise we'll get silliness like people using Nanofrost to kill people through walls with cold air
air.temperature = temperature
var/list/gases = air.gases
if(gases[/datum/gas/plasma])
air.assert_gas(/datum/gas/nitrogen)
gases[/datum/gas/nitrogen][MOLES] += gases[/datum/gas/plasma][MOLES]
gases[/datum/gas/plasma][MOLES] = 0
if(air.gases[/datum/gas/plasma])
var/mole_count = air.gases[/datum/gas/plasma][MOLES]
air.adjust_gas(/datum/gas/nitrogen, mole_count)
air.adjust_gas(/datum/gas/plasma, -mole_count)
air.garbage_collect()
for(var/obj/effect/hotspot/fire in chilly)