From d8ae61a49a07806ad9ada0ad27e5feb2229da826 Mon Sep 17 00:00:00 2001 From: Haha26315 Date: Mon, 23 Aug 2021 04:10:55 -0400 Subject: [PATCH] Change experimental cloning Depreciates experimental cloning's growclone method in favor of using the method of its parent object. Fixes sizecode, quirks, and genitals being copied over in so doing. Removes ability for ghosts to inhabit defective clones to reduce chance of prefbreaks with it. --- code/game/machinery/cloning.dm | 77 ++++++++++++++++++------------- code/game/machinery/exp_cloner.dm | 27 ++++++++++- 2 files changed, 71 insertions(+), 33 deletions(-) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 04030093..fb44aa02 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -38,6 +38,8 @@ var/list/unattached_flesh var/flesh_number = 0 + var/size = 1 + /obj/machinery/clonepod/Initialize() . = ..() @@ -61,7 +63,7 @@ QDEL_LIST(unattached_flesh) . = ..() -/obj/machinery/clonepod/RefreshParts() +/obj/machinery/clonepod/RefreshParts() speed_coeff = 0 efficiency = 0 for(var/obj/item/stock_parts/scanning_module/S in component_parts) @@ -126,34 +128,37 @@ return examine(user) //Start growing a human clone in the pod! -/obj/machinery/clonepod/proc/growclone(ckey, clonename, ui, mutation_index, mindref, datum/species/mrace, list/features, factions, list/quirks) +/obj/machinery/clonepod/proc/growclone(ckey, clonename, ui, mutation_index, mindref, datum/species/mrace, list/features, factions, list/quirks, experimental = FALSE) if(panel_open) return FALSE if(mess || attempting) return FALSE - clonemind = locate(mindref) in SSticker.minds - if(!istype(clonemind)) //not a mind - return FALSE - if(!QDELETED(clonemind.current)) - if(clonemind.current.stat != DEAD) //mind is associated with a non-dead body + + //only check for clone's mind if it's not experimental cloning + if(!experimental) + clonemind = locate(mindref) in SSticker.minds + if(!istype(clonemind)) //not a mind return FALSE - if(clonemind.current.suiciding) // Mind is associated with a body that is suiciding. + if(!QDELETED(clonemind.current)) + if(clonemind.current.stat != DEAD) //mind is associated with a non-dead body + return FALSE + if(clonemind.current.suiciding) // Mind is associated with a body that is suiciding. + return FALSE + if(clonemind.active) //somebody is using that mind + if( ckey(clonemind.key)!=ckey ) + return FALSE + else + // get_ghost() will fail if they're unable to reenter their body + var/mob/dead/observer/G = clonemind.get_ghost() + if(!G) + return FALSE + if(G.suiciding) // The ghost came from a body that is suiciding. + return FALSE + if(clonemind.damnation_type) //Can't clone the damned. + INVOKE_ASYNC(src, .proc/horrifyingsound) + mess = TRUE + update_icon() return FALSE - if(clonemind.active) //somebody is using that mind - if( ckey(clonemind.key)!=ckey ) - return FALSE - else - // get_ghost() will fail if they're unable to reenter their body - var/mob/dead/observer/G = clonemind.get_ghost() - if(!G) - return FALSE - if(G.suiciding) // The ghost came from a body that is suiciding. - return FALSE - if(clonemind.damnation_type) //Can't clone the damned. - INVOKE_ASYNC(src, .proc/horrifyingsound) - mess = TRUE - update_icon() - return FALSE attempting = TRUE //One at a time!! countdown.start() @@ -180,15 +185,17 @@ ADD_TRAIT(H, TRAIT_NOCRITDAMAGE, CLONING_POD_TRAIT) H.Unconscious(80) - clonemind.transfer_to(H) + //only transfer consciousness if the clone isn't experimental + if(!experimental) + clonemind.transfer_to(H) - if(grab_ghost_when == CLONER_FRESH_CLONE) - H.grab_ghost() - to_chat(H, "Consciousness slowly creeps over you as your body regenerates.
So this is what cloning feels like?
") + if(grab_ghost_when == CLONER_FRESH_CLONE) + H.grab_ghost() + to_chat(H, "Consciousness slowly creeps over you as your body regenerates.
So this is what cloning feels like?
") - if(grab_ghost_when == CLONER_MATURE_CLONE) - H.ghostize(TRUE) //Only does anything if they were still in their old body and not already a ghost - to_chat(H.get_ghost(TRUE), "Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.") + if(grab_ghost_when == CLONER_MATURE_CLONE) + H.ghostize(TRUE) //Only does anything if they were still in their old body and not already a ghost + to_chat(H.get_ghost(TRUE), "Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.") if(H) H.faction |= factions @@ -203,6 +210,14 @@ H.suiciding = FALSE attempting = FALSE + //sizecode stuff, check size of scanned individual to then pass in later. someone should turn size into a dna trait tbh + if(mindref) + clonemind = locate(mindref) in SSticker.minds + if(istype(clonemind)) + var/mob/living/current = clonemind.current //gets body of current mind + if(!isnull(current)) + size = current.size_multiplier * 100 + return TRUE //Grow clones to maturity then kick them out. FREELOADERS @@ -381,7 +396,7 @@ //Do the resize on ejection. The clone pod seems to do a lot of matrix transforms the way size code does, so we will handle our resize after. mob_occupant.previous_size = 1 //Set the previous size to default so the resize properly set health and speed. - mob_occupant.custom_body_size = mob_occupant.client.prefs.body_size + mob_occupant.custom_body_size = size //mob_occupant.client.prefs.body_size mob_occupant.resize(mob_occupant.custom_body_size * 0.01) occupant = null diff --git a/code/game/machinery/exp_cloner.dm b/code/game/machinery/exp_cloner.dm index db60a1a4..5343e922 100644 --- a/code/game/machinery/exp_cloner.dm +++ b/code/game/machinery/exp_cloner.dm @@ -9,6 +9,7 @@ internal_radio = FALSE //Start growing a human clone in the pod! +/* /obj/machinery/clonepod/experimental/growclone(ckey, clonename, ui, se, datum/species/mrace, list/features, factions) if(panel_open) return FALSE @@ -71,7 +72,7 @@ H.suiciding = FALSE attempting = FALSE return TRUE - +*/ //Prototype cloning console, much more rudimental and lacks modern functions such as saving records, autocloning, or safety checks. /obj/machinery/computer/prototype_cloning @@ -293,7 +294,29 @@ temp = "Cloning cycle already in progress." playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, 0) else - pod.growclone(null, mob_occupant.real_name, dna.uni_identity, dna.mutation_index, clone_species, dna.features, mob_occupant.faction) + + //disabled vars from how cloning.dm does it + //var/ckey = mob_occupant.ckey + var/name = mob_occupant.real_name + //var/id = copytext_char(md5(mob_occupant.real_name), 2, 6) + //var/UE = dna.unique_enzymes + var/mind = null + var/UI = dna.uni_identity + var/SE = dna.mutation_index + var/features = dna.features + var/factions = mob_occupant.faction + var/list/quirks = list() + + if (!isnull(mob_occupant.mind)) //Save that mind so traitors can continue traitoring after cloning. + mind = "[REF(mob_occupant.mind)]" + + for(var/V in mob_occupant.roundstart_quirks) + var/datum/quirk/T = V + quirks[T.type] = T.clone_data() + + //grows the clone, format; + // ckey, clonename, ui, mutation_index, mindref, datum/species/mrace, list/features, factions, list/quirks, experimental = FALSE + pod.growclone(null, name, UI, SE, mind, clone_species, features, factions, quirks, TRUE) temp = "[mob_occupant.real_name] => Cloning data sent to pod." playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)