diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index 677cc7512eb..2672bfd5777 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -102,3 +102,7 @@ #define MACHINE_NOT_ELECTRIFIED 0 #define MACHINE_ELECTRIFIED_PERMANENT -1 #define MACHINE_DEFAULT_ELECTRIFY_TIME 30 + +//cloning defines. These are flags. +#define CLONING_SUCCESS (1<<0) +#define CLONING_DELETE_RECORD (1<<1) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 6c664acfdf3..685bcbf88c0 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -139,32 +139,32 @@ //Start growing a human clone in the pod! /obj/machinery/clonepod/proc/growclone(clonename, ui, mutation_index, mindref, last_death, datum/species/mrace, list/features, factions, list/quirks, datum/bank_account/insurance) if(panel_open) - return FALSE + return NONE if(mess || attempting) - return FALSE + return NONE clonemind = locate(mindref) in SSticker.minds if(!istype(clonemind)) //not a mind - return FALSE + return NONE if(clonemind.last_death != last_death) //The soul has advanced, the record has not. - return FALSE + return NONE if(!QDELETED(clonemind.current)) if(clonemind.current.stat != DEAD) //mind is associated with a non-dead body - return FALSE + return NONE if(clonemind.current.suiciding) // Mind is associated with a body that is suiciding. - return FALSE + return NONE if(!clonemind.active) // get_ghost() will fail if they're unable to reenter their body var/mob/dead/observer/G = clonemind.get_ghost() if(!G) - return FALSE + return NONE if(G.suiciding) // The ghost came from a body that is suiciding. - return FALSE + return NONE if(clonemind.damnation_type) //Can't clone the damned. INVOKE_ASYNC(src, .proc/horrifyingsound) mess = TRUE icon_state = "pod_g" update_icon() - return FALSE + return NONE current_insurance = insurance attempting = TRUE //One at a time!! countdown.start() @@ -222,7 +222,7 @@ H.set_suicide(FALSE) attempting = FALSE - return TRUE + return CLONING_SUCCESS //Grow clones to maturity then kick them out. FREELOADERS /obj/machinery/clonepod/process() diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index 58088939a46..5997787e0d3 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -81,8 +81,12 @@ if(pod.occupant) break - if(grow_clone_from_record(pod, R)) + var/result = grow_clone_from_record(pod, R) + if(result & CLONING_SUCCESS) temp = "[R.fields["name"]] => Cloning cycle in progress..." + if(result & CLONING_DELETE_RECORD) + records -= R + /obj/machinery/computer/cloning/proc/updatemodules(findfirstcloner) scanner = findscanner() @@ -456,6 +460,7 @@ //Look for that player! They better be dead! if(C) var/obj/machinery/clonepod/pod = GetAvailablePod() + var/success = FALSE //Can't clone without someone to clone. Or a pod. Or if the pod is busy. Or full of gibs. if(!LAZYLEN(pods)) temp = "No Clonepods detected." @@ -469,13 +474,22 @@ else if(pod.occupant) temp = "Cloning cycle already in progress." playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, 0) - else if(grow_clone_from_record(pod, C)) - temp = "[C.fields["name"]] => Cloning cycle in progress..." - playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0) - if(active_record == C) - active_record = null - menu = 1 - else + else + var/result = grow_clone_from_record(pod, C) + if(result & CLONING_SUCCESS) + temp = "[C.fields["name"]] => Cloning cycle in progress..." + playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0) + if(active_record == C) + active_record = null + menu = 1 + success = TRUE + if(result & CLONING_DELETE_RECORD) + if(active_record == C) + active_record = null + menu = 1 + records -= C + + if(!success) temp = "[C.fields["name"]] => Initialisation failure." playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, 0) diff --git a/code/game/machinery/exp_cloner.dm b/code/game/machinery/exp_cloner.dm index dab00750b7c..99f0f6314b0 100644 --- a/code/game/machinery/exp_cloner.dm +++ b/code/game/machinery/exp_cloner.dm @@ -9,18 +9,18 @@ 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) +/obj/machinery/clonepod/experimental/growclone(clonename, ui, mutation_index, mindref, last_death, datum/species/mrace, list/features, factions, list/quirks, datum/bank_account/insurance) if(panel_open) - return FALSE + return NONE if(mess || attempting) - return FALSE + return NONE attempting = TRUE //One at a time!! countdown.start() var/mob/living/carbon/human/H = new /mob/living/carbon/human(src) - H.hardset_dna(ui, se, H.real_name, null, mrace, features) + H.hardset_dna(ui, mutation_index, H.real_name, null, mrace, features) if(efficiency > 2) var/list/unclean_mutations = (GLOB.not_good_mutations|GLOB.bad_mutations) @@ -69,7 +69,7 @@ H.set_suicide(FALSE) attempting = FALSE - return TRUE + return CLONING_DELETE_RECORD | CLONING_SUCCESS //so that we don't spam clones with autoprocess unless we leave a body in the scanner //Prototype cloning console, much more rudimental and lacks modern functions such as saving records, autocloning, or safety checks. @@ -298,6 +298,6 @@ 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) + pod.growclone(mob_occupant.real_name, dna.uni_identity, dna.mutation_index, null, null, clone_species, dna.features, mob_occupant.faction) temp = "[mob_occupant.real_name] => Cloning data sent to pod." playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)