From 1980ecf62a17e573cee2c15ec05d849f979c36a1 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 3 Dec 2016 20:48:37 -0800 Subject: [PATCH 1/2] Makes cryopod auto-eject work with mech limbs - People with mechanical limbs are now auto-ejected properly from cryotubes once their organic parts have been healed. --- code/game/machinery/cryo.dm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 99ff973ca76..bb1d91cdc5d 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -122,7 +122,14 @@ ..() if(autoeject) if(occupant) - if(occupant.health >= 100) + var/mech_damage = 0 + if(istype(occupant, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = occupant + for(var/obj/item/organ/external/O in H.organs) + if(O.status & ORGAN_ROBOT) + mech_damage += O.brute_dam + mech_damage += O.burn_dam + if(occupant.health >= (100 - mech_damage)) on = 0 go_out() playsound(src.loc, 'sound/machines/ding.ogg', 50, 1) From d5e3e14dc9edd8d8615602a93d67f4f1452f0a47 Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 5 Dec 2016 14:21:32 -0800 Subject: [PATCH 2/2] Requested changes - Creates "has_organic_damage" proc and updates cryopod and medibot to use it. - For non-human mobs, this proc returns 1 for damaged mobs and 0 for full-health mobs. - For human mobs, this proc returns 1 for mobs with damage to organic parts, and 0 for mobs that are either full health, or have only got damage to robotic limbs. --- code/game/machinery/cryo.dm | 9 +-------- code/modules/mob/living/carbon/human/human_organs.dm | 9 +++++++++ code/modules/mob/living/living.dm | 4 ++++ code/modules/mob/living/simple_animal/bot/medbot.dm | 3 +++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index bb1d91cdc5d..67414971337 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -122,14 +122,7 @@ ..() if(autoeject) if(occupant) - var/mech_damage = 0 - if(istype(occupant, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = occupant - for(var/obj/item/organ/external/O in H.organs) - if(O.status & ORGAN_ROBOT) - mech_damage += O.brute_dam - mech_damage += O.burn_dam - if(occupant.health >= (100 - mech_damage)) + if(!occupant.has_organic_damage()) on = 0 go_out() playsound(src.loc, 'sound/machines/ding.ogg', 50, 1) diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index 50f1e7cd342..2f07fdacd07 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -201,3 +201,12 @@ I use this to standardize shadowling dethrall code return null var/obj/item/organ/internal/O = get_int_organ(organ_name) return O.parent_organ + +/mob/living/carbon/human/has_organic_damage() + var/odmg = 0 + for(var/obj/item/organ/external/O in organs) + if(O.status & ORGAN_ROBOT) + odmg += O.brute_dam + odmg += O.burn_dam + return (health < (100 - odmg)) + diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 6be18445b44..62102a2f662 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -287,6 +287,10 @@ adjustFireLoss(burn) src.updatehealth() +/mob/living/proc/has_organic_damage() + return (maxHealth - health) + + /mob/living/proc/restore_all_organs() return diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 92fe2c761bc..df3ae448cf6 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -368,6 +368,9 @@ if(declare_crit && C.health <= 0) //Critical condition! Call for help! declare(C) + if(!C.has_organic_damage()) + return 0 + //If they're injured, we're using a beaker, and don't have one of our WONDERCHEMS. if((reagent_glass) && (use_beaker) && ((C.getBruteLoss() >= heal_threshold) || (C.getToxLoss() >= heal_threshold) || (C.getToxLoss() >= heal_threshold) || (C.getOxyLoss() >= (heal_threshold + 15)))) for(var/datum/reagent/R in reagent_glass.reagents.reagent_list)