diff --git a/code/modules/surgery/organs/internal/lungs/_lungs.dm b/code/modules/surgery/organs/internal/lungs/_lungs.dm index 5463a37cd5e..53a310981d4 100644 --- a/code/modules/surgery/organs/internal/lungs/_lungs.dm +++ b/code/modules/surgery/organs/internal/lungs/_lungs.dm @@ -998,13 +998,13 @@ #define GAS_TOLERANCE 5 /obj/item/organ/lungs/lavaland/Initialize(mapload) - var/datum/gas_mixture/immutable/planetary/mix = SSair.planetary[LAVALAND_DEFAULT_ATMOS] + var/datum/gas_mixture/volumed_mix = new(BREATH_VOLUME * 1000) // to be safe + var/datum/gas_mixture/immutable/planetary/mix = SSair.parse_gas_string(LAVALAND_DEFAULT_ATMOS, /datum/gas_mixture/immutable/planetary) - if(!mix?.total_moles()) // this typically means we didn't load lavaland, like if we're using the LOWMEMORYMODE define - return ..() + volumed_mix.copy_from(mix) // Take a "breath" of the air - var/datum/gas_mixture/breath = mix.remove(mix.total_moles() * BREATH_PERCENTAGE) + var/datum/gas_mixture/breath = volumed_mix.remove(volumed_mix.total_moles() * BREATH_PERCENTAGE) var/list/breath_gases = breath.gases diff --git a/code/modules/unit_tests/breath.dm b/code/modules/unit_tests/breath.dm index faba1a08e22..2746ea6f461 100644 --- a/code/modules/unit_tests/breath.dm +++ b/code/modules/unit_tests/breath.dm @@ -87,15 +87,21 @@ /datum/unit_test/breath/breath_sanity_ashwalker/Run() var/mob/living/carbon/human/species/lizard/ashwalker/lab_rat = allocate(/mob/living/carbon/human/species/lizard/ashwalker) - lab_rat.forceMove(run_loc_floor_bottom_left) - var/turf/open/to_fill = run_loc_floor_bottom_left - to_fill.initial_gas_mix = LAVALAND_DEFAULT_ATMOS - to_fill.air = to_fill.create_gas_mixture() + + turn_room_into_lavaland() lab_rat.breathe() TEST_ASSERT(!lab_rat.has_alert(ALERT_NOT_ENOUGH_OXYGEN), "Ashwalkers can't get a full breath from the Lavaland's initial_gas_mix on a turf") -/datum/unit_test/breath/breath_sanity_ashwalker/Destroy() - //Reset initial_gas_mix to avoid future issues on other tests - var/turf/open/to_fill = run_loc_floor_bottom_left - to_fill.initial_gas_mix = OPENTURF_DEFAULT_ATMOS - return ..() +/// Replaces the air mix in the entire room with lavaland air mix +/datum/unit_test/breath/breath_sanity_ashwalker/proc/turn_room_into_lavaland() + var/area/unit_test_area = get_area(run_loc_floor_bottom_left) + var/list/turf/lavalandable_turfs = unit_test_area.get_turfs_from_all_zlevels() + + var/datum/gas_mixture/lavaland_mix = SSair.parse_gas_string(LAVALAND_DEFAULT_ATMOS, /datum/gas_mixture/immutable/planetary) + var/datum/gas_mixture/volumetric_mix = allocate(/datum/gas_mixture, 2500) + + volumetric_mix.copy_from(lavaland_mix) + + for(var/turf/open/tile in lavalandable_turfs) + tile.copy_air(volumetric_mix) + tile.air_update_turf(update = FALSE, remove = FALSE) diff --git a/code/modules/unit_tests/lungs.dm b/code/modules/unit_tests/lungs.dm index b426ea9264c..446873d6aa1 100644 --- a/code/modules/unit_tests/lungs.dm +++ b/code/modules/unit_tests/lungs.dm @@ -191,12 +191,7 @@ /// Set up an Lavaland gas mix which is "ideal" for Ashwalker life. /datum/unit_test/lungs/proc/create_lavaland_mix() - if(!SSair.planetary[LAVALAND_DEFAULT_ATMOS]) - var/datum/gas_mixture/immutable/planetary/mix = new - mix.parse_string_immutable(LAVALAND_DEFAULT_ATMOS) - SSair.planetary[LAVALAND_DEFAULT_ATMOS] = mix - - var/datum/gas_mixture/immutable/planetary/lavaland_mix = SSair.planetary[LAVALAND_DEFAULT_ATMOS] + var/datum/gas_mixture/immutable/planetary/lavaland_mix = SSair.parse_gas_string(LAVALAND_DEFAULT_ATMOS, /datum/gas_mixture/immutable/planetary) var/datum/gas_mixture/test_mix = allocate(/datum/gas_mixture, 2500) test_mix.copy_from(lavaland_mix) return test_mix