From e5ed4b3dea213e929b4da0c8392a3d2c01643156 Mon Sep 17 00:00:00 2001 From: Ghilker <42839747+Ghilker@users.noreply.github.com> Date: Tue, 22 Mar 2022 14:58:45 +0100 Subject: [PATCH] Cryocell works with all gases now ; Cryox requires being KOd (#65513) * refactored cryo * fixes * always forget maps * requested changes, cryoxadone only heal if sleeping --- .../map_files/Deltastation/DeltaStation2.dmm | 4 +-- .../map_files/IceBoxStation/IceBoxStation.dmm | 4 +-- _maps/map_files/KiloStation/KiloStation.dmm | 4 +-- _maps/map_files/MetaStation/MetaStation.dmm | 4 +-- _maps/map_files/tramstation/tramstation.dmm | 4 +-- code/__DEFINES/atmospherics/atmos_core.dm | 5 ++++ .../components/unary_devices/cryo.dm | 26 ++++++++++++------- .../machinery/portable/canister.dm | 14 +++++++++- code/modules/mob/living/carbon/life.dm | 2 -- .../chemistry/reagents/medicine_reagents.dm | 25 +++++++++--------- 10 files changed, 57 insertions(+), 35 deletions(-) diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm index 6fd021f1b7f..abb8476918c 100644 --- a/_maps/map_files/Deltastation/DeltaStation2.dmm +++ b/_maps/map_files/Deltastation/DeltaStation2.dmm @@ -26023,13 +26023,13 @@ /turf/open/floor/iron, /area/engineering/atmos) "flk" = ( -/obj/machinery/portable_atmospherics/canister/oxygen, /obj/effect/turf_decal/stripes/line{ dir = 6 }, /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 1 }, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron, /area/medical/cryo) "fll" = ( @@ -74952,13 +74952,13 @@ /turf/open/floor/iron/dark, /area/command/bridge) "tBh" = ( -/obj/machinery/portable_atmospherics/canister/oxygen, /obj/effect/turf_decal/stripes/line{ dir = 10 }, /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 1 }, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron, /area/medical/cryo) "tBt" = ( diff --git a/_maps/map_files/IceBoxStation/IceBoxStation.dmm b/_maps/map_files/IceBoxStation/IceBoxStation.dmm index 5df4fb7a128..24c318b6b42 100644 --- a/_maps/map_files/IceBoxStation/IceBoxStation.dmm +++ b/_maps/map_files/IceBoxStation/IceBoxStation.dmm @@ -11668,7 +11668,7 @@ /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 8 }, -/obj/machinery/portable_atmospherics/canister/oxygen, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/white, /area/medical/cryo) "dgf" = ( @@ -52465,7 +52465,7 @@ /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 4 }, -/obj/machinery/portable_atmospherics/canister/oxygen, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/white, /area/medical/cryo) "xwY" = ( diff --git a/_maps/map_files/KiloStation/KiloStation.dmm b/_maps/map_files/KiloStation/KiloStation.dmm index 85523edda8e..651ea8f1185 100644 --- a/_maps/map_files/KiloStation/KiloStation.dmm +++ b/_maps/map_files/KiloStation/KiloStation.dmm @@ -5851,13 +5851,13 @@ /turf/closed/wall, /area/medical/exam_room) "aFp" = ( -/obj/machinery/portable_atmospherics/canister/oxygen, /obj/machinery/atmospherics/components/unary/portables_connector/visible, /obj/effect/turf_decal/bot, /obj/effect/turf_decal/tile/neutral, /obj/effect/turf_decal/tile/neutral{ dir = 8 }, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/dark, /area/medical/medbay/central) "aFq" = ( @@ -7842,9 +7842,9 @@ /obj/effect/turf_decal/tile/neutral{ dir = 8 }, -/obj/machinery/portable_atmospherics/canister/oxygen, /obj/machinery/atmospherics/components/unary/portables_connector/visible, /obj/effect/turf_decal/bot, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/dark, /area/medical/medbay/central) "aSe" = ( diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm index d556d4b6bb5..73ab40e721a 100644 --- a/_maps/map_files/MetaStation/MetaStation.dmm +++ b/_maps/map_files/MetaStation/MetaStation.dmm @@ -21319,10 +21319,10 @@ /obj/effect/turf_decal/stripes/line{ dir = 9 }, -/obj/machinery/portable_atmospherics/canister/oxygen, /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 1 }, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/dark, /area/medical/cryo) "gtG" = ( @@ -29899,13 +29899,13 @@ /turf/open/floor/iron, /area/security/brig) "jJq" = ( -/obj/machinery/portable_atmospherics/canister/oxygen, /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 1 }, /obj/effect/turf_decal/stripes/line{ dir = 1 }, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/dark, /area/medical/cryo) "jJK" = ( diff --git a/_maps/map_files/tramstation/tramstation.dmm b/_maps/map_files/tramstation/tramstation.dmm index 5eedb496a65..5335698016a 100644 --- a/_maps/map_files/tramstation/tramstation.dmm +++ b/_maps/map_files/tramstation/tramstation.dmm @@ -17106,8 +17106,8 @@ /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 8 }, -/obj/machinery/portable_atmospherics/canister/oxygen, /obj/machinery/light/directional/east, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/dark, /area/medical/treatment_center) "eNN" = ( @@ -33293,7 +33293,7 @@ /obj/machinery/atmospherics/components/unary/portables_connector/visible{ dir = 8 }, -/obj/machinery/portable_atmospherics/canister/oxygen, +/obj/machinery/portable_atmospherics/canister/anesthetic_mix, /turf/open/floor/iron/dark, /area/medical/treatment_center) "kCT" = ( diff --git a/code/__DEFINES/atmospherics/atmos_core.dm b/code/__DEFINES/atmospherics/atmos_core.dm index 9d8eb769be1..10513a47d89 100644 --- a/code/__DEFINES/atmospherics/atmos_core.dm +++ b/code/__DEFINES/atmospherics/atmos_core.dm @@ -151,6 +151,11 @@ /// liters in a cell #define CELL_VOLUME 2500 +///O2 value for anesthetic canister +#define O2_ANESTHETIC 0.65 +///N2O value for anesthetic canister +#define N2O_ANESTHETIC 0.35 + //CANATMOSPASS #define ATMOS_PASS_YES 1 #define ATMOS_PASS_NO 0 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 77f33fa1b0b..c172844d47c 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -121,6 +121,8 @@ occupant_vis = new(null, src) vis_contents += occupant_vis + if(airs[1]) + airs[1].volume = CELL_VOLUME * 0.5 /obj/machinery/atmospherics/components/unary/cryo_cell/set_occupant(atom/movable/new_occupant) . = ..() @@ -262,10 +264,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics var/datum/gas_mixture/air1 = airs[1] - if(air1.gases[/datum/gas/oxygen][MOLES] > CRYO_MIN_GAS_MOLES) - if(mob_occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic. - mob_occupant.Sleeping((mob_occupant.bodytemperature * sleep_factor) * 1000 * delta_time) - mob_occupant.Unconscious((mob_occupant.bodytemperature * unconscious_factor) * 1000 * delta_time) + if(air1.total_moles() > CRYO_MIN_GAS_MOLES) if(beaker) beaker.reagents.trans_to(occupant, (CRYO_TX_QTY / (efficiency * CRYO_MULTIPLY_FACTOR)) * delta_time, efficiency * CRYO_MULTIPLY_FACTOR, methods = VAPOR) // Transfer reagents. consume_gas = TRUE @@ -279,7 +278,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics var/datum/gas_mixture/air1 = airs[1] - if(!nodes[1] || !airs[1] || !air1.gases.len || air1.gases[/datum/gas/oxygen][MOLES] < CRYO_MIN_GAS_MOLES) // Turn off if the machine won't work. + if(!nodes[1] || !airs[1] || !air1.gases.len || air1.total_moles() < CRYO_MIN_GAS_MOLES) // Turn off if the machine won't work. var/msg = "Insufficient cryogenic gas, shutting down." radio.talk_into(src, msg, radio_channel) set_on(FALSE) @@ -307,11 +306,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics var/mob/living/carbon/human/humi = mob_occupant humi.adjust_coretemperature(humi.bodytemperature - humi.coretemperature) - if(consume_gas) // Transferring reagent costs us extra gas - air1.gases[/datum/gas/oxygen][MOLES] -= max(0, 2 / efficiency + 1 / efficiency) // Magically consume gas? Why not, we run on cryo magic. - consume_gas = FALSE - if(!consume_gas) - air1.gases[/datum/gas/oxygen][MOLES] -= max(0, 2 / efficiency) + air1.garbage_collect() if(air1.temperature > 2000) @@ -319,6 +314,17 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics update_parents() +/obj/machinery/atmospherics/components/unary/cryo_cell/handle_internal_lifeform(mob/lifeform_inside_me, breath_request) + + if(breath_request <= 0) + return null + var/datum/gas_mixture/air1 = airs[1] + var/breath_percentage = breath_request / air1.volume + return air1.remove(air1.total_moles() * breath_percentage) + +/obj/machinery/atmospherics/components/unary/cryo_cell/assume_air(datum/gas_mixture/giver) + airs[1].merge(giver) + /obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/living/user, direction) if(message_cooldown <= world.time) message_cooldown = world.time + 50 diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 706ac7f02a4..9bac4961e7e 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -297,6 +297,18 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister()) air_contents.temperature = 10000 SSair.start_processing_machine(src) +/obj/machinery/portable_atmospherics/canister/anesthetic_mix + name = "Anesthetic mix" + desc = "A mixture of N2O and Oxygen" + greyscale_config = /datum/greyscale_config/canister/double_stripe + greyscale_colors = "#9fba6c#3d4680" + +/obj/machinery/portable_atmospherics/canister/anesthetic_mix/create_gas() + air_contents.add_gases(/datum/gas/oxygen, /datum/gas/nitrous_oxide) + air_contents.gases[/datum/gas/oxygen][MOLES] = (O2_ANESTHETIC * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) + air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (N2O_ANESTHETIC * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) + SSair.start_processing_machine(src) + /** * Getter for the amount of time left in the timer of prototype canisters */ @@ -413,7 +425,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister()) if((10) to (5 * ONE_ATMOSPHERE)) . += mutable_appearance(canister_overlay_file, "can-0") . += emissive_appearance(canister_overlay_file, "can-0-light", alpha = src.alpha) - + update_window() /obj/machinery/portable_atmospherics/canister/update_greyscale() diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 6c0c877f00b..f5ff872ee45 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -73,8 +73,6 @@ var/obj/item/organ/lungs = getorganslot(ORGAN_SLOT_LUNGS) if(reagents.has_reagent(/datum/reagent/toxin/lexorin, needs_metabolizing = TRUE)) return - if(istype(loc, /obj/machinery/atmospherics/components/unary/cryo_cell)) - return var/datum/gas_mixture/environment if(loc) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 18524f63ddd..b65c3c52632 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -161,18 +161,19 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/medicine/cryoxadone/on_mob_life(mob/living/carbon/M, delta_time, times_fired) - var/power = -0.00003 * (M.bodytemperature ** 2) + 3 - if(M.bodytemperature < T0C) - M.adjustOxyLoss(-3 * power * REM * delta_time, 0) - M.adjustBruteLoss(-power * REM * delta_time, 0) - M.adjustFireLoss(-power * REM * delta_time, 0) - M.adjustToxLoss(-power * REM * delta_time, 0, TRUE) //heals TOXINLOVERs - M.adjustCloneLoss(-power * REM * delta_time, 0) - for(var/i in M.all_wounds) - var/datum/wound/iter_wound = i - iter_wound.on_xadone(power * REAGENTS_EFFECT_MULTIPLIER * delta_time) - REMOVE_TRAIT(M, TRAIT_DISFIGURED, TRAIT_GENERIC) //fixes common causes for disfiguration - . = TRUE + if(M.IsSleeping() || M.IsUnconscious()) + var/power = -0.00003 * (M.bodytemperature ** 2) + 3 + if(M.bodytemperature < T0C) + M.adjustOxyLoss(-3 * power * REM * delta_time, 0) + M.adjustBruteLoss(-power * REM * delta_time, 0) + M.adjustFireLoss(-power * REM * delta_time, 0) + M.adjustToxLoss(-power * REM * delta_time, 0, TRUE) //heals TOXINLOVERs + M.adjustCloneLoss(-power * REM * delta_time, 0) + for(var/i in M.all_wounds) + var/datum/wound/iter_wound = i + iter_wound.on_xadone(power * REAGENTS_EFFECT_MULTIPLIER * delta_time) + REMOVE_TRAIT(M, TRAIT_DISFIGURED, TRAIT_GENERIC) //fixes common causes for disfiguration + . = TRUE metabolization_rate = REAGENTS_METABOLISM * (0.00001 * (M.bodytemperature ** 2) + 0.5) ..()