From 59caa0847f8384bb3fcd80c8f21165155b075d98 Mon Sep 17 00:00:00 2001 From: Qlonever <42286723+Qlonever@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:22:54 +0300 Subject: [PATCH] [MIRROR] Fixes setOxyLoss() for humanoids --- .../mob/living/carbon/human/human_damage.dm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index a0661e921b6e8..16ccf53d7aae0 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -143,19 +143,18 @@ // Defined here solely to take species flags into account without having to recast at mob/living level. /mob/living/carbon/human/getOxyLoss() - if(!need_breathe()) + if (!need_breathe()) return 0 - else - var/obj/item/organ/internal/lungs/breathe_organ = internal_organs_by_name[species.breathing_organ] - if(!breathe_organ) - return maxHealth/2 - return breathe_organ.get_oxygen_deprivation() + var/obj/item/organ/internal/lungs/lungs = internal_organs_by_name[species.breathing_organ] + if (!lungs) + return 100 + return lungs.get_oxygen_deprivation() /mob/living/carbon/human/setOxyLoss(amount) - if(!need_breathe()) - return 0 - else - adjustOxyLoss(getOxyLoss()-amount) + if (!need_breathe()) + return + amount = clamp(amount, 0, 100) / 100 + adjustOxyLoss(amount * species.total_health) /mob/living/carbon/human/adjustOxyLoss(amount) if(!need_breathe())