From ca7a156c99a99c8bed93b932b327e20b991445d9 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Sun, 4 Jun 2017 00:30:29 -0700 Subject: [PATCH] Cloning no longer stops the heart Also fixes a runtime regarding emptying an EMP'd clone pod --- code/game/machinery/cloning.dm | 4 ++-- code/modules/surgery/organs/organ.dm | 6 +++++- code/modules/surgery/organs/organ_internal.dm | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index e5c9d1a0804..721372b56f5 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -332,7 +332,7 @@ while((progress / milestone) > INSTALLED && LAZYLEN(missing_organs)) var/obj/item/organ/I = pick_n_take(missing_organs) - I.replaced(occupant) + I.safe_replace(occupant) #undef INSTALLED @@ -377,7 +377,7 @@ return else connected_message("Authorized Ejection") - announce_radio_message("An authorized ejection of [occupant.real_name] has occured") + announce_radio_message("An authorized ejection of [(occupant) ? occupant.real_name : "the malfunctioning pod"] has occured") to_chat(user, "You force an emergency ejection.") go_out() diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm index 045e34ea41e..fb52fba69f9 100644 --- a/code/modules/surgery/organs/organ.dm +++ b/code/modules/surgery/organs/organ.dm @@ -327,6 +327,10 @@ var/list/organ_cache = list() /obj/item/organ/proc/replaced(var/mob/living/carbon/human/target) return // Nothing uses this, it is always overridden +// A version of `replaced` that "flattens" the process of insertion, making organs "Plug'n'play" +// (Particularly the heart, which stops beating when removed) +/obj/item/organ/proc/safe_replace(var/mob/living/carbon/human/target) + replaced(target) /obj/item/organ/proc/surgeryize() return @@ -370,4 +374,4 @@ I use this so that this can be made better once the organ overhaul rolls out -- // The only thing the official proc does is //instantiate the list and call this proc dna.deserialize(data["dna"]) - ..() \ No newline at end of file + ..() diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index 05f06f4b030..071d579b0c0 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -170,6 +170,10 @@ if(!owner) Stop() +/obj/item/organ/internal/heart/safe_replace(mob/living/carbon/human/target) + Restart() + ..() + /obj/item/organ/internal/heart/proc/Stop() beating = 0 update_icon()