From 6eca3fed860e3f5dd3a36a55c4abb9568eb79fd5 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:16:45 +0100 Subject: [PATCH] Modular items update tweak, Water Sponge vapor function Changed modular items to update periodically though handle_fatness, not just when fatness is changed. Water Sponge vapor function restored and updated --- GainStation13/code/mechanics/water_sponge.dm | 25 +++++++++++-------- .../clothing/under/jobs/modular_items.dm | 3 +-- .../code/modules/mob/living/species.dm | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/GainStation13/code/mechanics/water_sponge.dm b/GainStation13/code/mechanics/water_sponge.dm index 6453dc8204..84d4b1e788 100644 --- a/GainStation13/code/mechanics/water_sponge.dm +++ b/GainStation13/code/mechanics/water_sponge.dm @@ -40,17 +40,22 @@ var/mob/living/carbon/L = AM L.reagents.add_reagent(/datum/reagent/water, 3) -/* Disabling this for now. -/mob/living/carbon/proc/water_check(datum/gas_mixture/breath) - if(HAS_TRAIT(src, TRAIT_WATER_SPONGE)) + +/obj/item/organ/lungs/proc/water_check(datum/gas_mixture/breath, mob/living/carbon/human/H) + if(HAS_TRAIT(H, TRAIT_WATER_SPONGE)) if(breath) - if(breath.gases) - var/breath_gases = breath.gases - if(breath_gases[/datum/gas/water_vapor]) - var/H2O_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/water_vapor]) - reagents.add_reagent(/datum/reagent/water, H2O_pp/10) - breath_gases[/datum/gas/water_vapor] -= H2O_pp -*/ + var/pressure = breath.return_pressure() + var/total_moles = breath.total_moles() + #define PP_MOLES(X) ((X / total_moles) * pressure) + #define PP(air, gas) PP_MOLES(air.get_moles(gas)) + var/gas_breathed = PP(breath,GAS_H2O) + if(gas_breathed > 0) + H.reagents.add_reagent(/datum/reagent/water, gas_breathed) + breath.adjust_moles(GAS_H2O, -gas_breathed) + +/obj/item/organ/lungs/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) + water_check(breath, H) + . = ..() /obj/structure/sink var/mob/living/attached diff --git a/GainStation13/code/modules/clothing/under/jobs/modular_items.dm b/GainStation13/code/modules/clothing/under/jobs/modular_items.dm index c29ef75b74..ea0543fc1d 100644 --- a/GainStation13/code/modules/clothing/under/jobs/modular_items.dm +++ b/GainStation13/code/modules/clothing/under/jobs/modular_items.dm @@ -1,8 +1,7 @@ /mob/living/carbon var/modular_items = list() -/mob/living/carbon/adjust_fatness(adjustment_amount, type_of_fattening = FATTENING_TYPE_ITEM) - ..() +/mob/living/carbon/proc/handle_modular_items(adjustment_amount, type_of_fattening = FATTENING_TYPE_ITEM) for(var/obj/item/item in modular_items) item.update_modular_overlays(src) diff --git a/GainStation13/code/modules/mob/living/species.dm b/GainStation13/code/modules/mob/living/species.dm index 235987bda0..133b41d9bc 100644 --- a/GainStation13/code/modules/mob/living/species.dm +++ b/GainStation13/code/modules/mob/living/species.dm @@ -222,6 +222,7 @@ /datum/species/proc/handle_fatness(mob/living/carbon/human/H) handle_helplessness(H) + H.handle_modular_items() // update movement speed var/fatness_delay = 0