diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 04030093..628e7cd1 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,40 @@ 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 + + //runtime error protection + if(mindref) + clonemind = locate(mindref) in SSticker.minds + + //only exit out of cloning with no mind if cloning is not experimental. + if(!experimental) + 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,7 +188,14 @@ 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) + var/list/candidates = pollCandidatesForMob("Do you want to play as [clonename]'s defective clone?", null, null, null, 100, H) + if(LAZYLEN(candidates)) + var/mob/dead/observer/C = pick(candidates) + H.key = C.key + else + clonemind.transfer_to(H) if(grab_ghost_when == CLONER_FRESH_CLONE) H.grab_ghost() @@ -203,6 +218,12 @@ 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(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 +402,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..c5b40a46 100644 --- a/code/game/machinery/exp_cloner.dm +++ b/code/game/machinery/exp_cloner.dm @@ -8,7 +8,8 @@ circuit = /obj/item/circuitboard/machine/clonepod/experimental internal_radio = FALSE -//Start growing a human clone in the pod! +//Start growing a human clone in the pod! Depreciated and replaced with parent object's growclone method. +/* /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,26 @@ 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) + + //put here for ease of use / ability to change, rather than in the method call to growclone + var/name = mob_occupant.real_name + 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)