From ba18611bb3f2d24eb38d8ba97b5484160c14599a Mon Sep 17 00:00:00 2001 From: Chinsky Date: Thu, 12 Mar 2015 13:38:35 +0300 Subject: [PATCH] Added support for multiple cloning vats per single console. On spawn, console will attempt to connect to all unconnected cloning vats. You can change what console connects to which pod with multitool. --- code/game/machinery/cloning.dm | 44 +++---- code/game/machinery/computer/cloning.dm | 114 ++++++++++--------- code/game/objects/items/devices/multitool.dm | 1 + 3 files changed, 84 insertions(+), 75 deletions(-) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 343c8ab2db1..b79934974c8 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -33,7 +33,6 @@ icon = 'icons/obj/cloning.dmi' icon_state = "pod_0" req_access = list(access_genetics) //For premature unlocking. - var/mob/living/occupant var/heal_level = 20 //The clone is released once its health reaches this level. var/heal_rate = 1 @@ -57,8 +56,10 @@ component_parts += new /obj/item/stack/cable_coil(src, 2) RefreshParts() + update_icon() /obj/machinery/clonepod/attack_ai(mob/user as mob) + add_hiddenprint(user) return attack_hand(user) @@ -77,6 +78,7 @@ if(mess || attempting) return 0 var/datum/mind/clonemind = locate(R.mind) + if(!istype(clonemind, /datum/mind)) //not a mind return 0 if(clonemind.current && clonemind.current.stat != DEAD) //mind is associated with a non-dead body @@ -106,7 +108,6 @@ R.dna.real_name = "clone ([rand(0,999)])" H.real_name = R.dna.real_name - icon_state = "pod_1" //Get the clone body ready H.adjustCloneLoss(150) // New damage var so you can't eject a clone early then stab them to abuse the current damage system --NeoFite H.adjustBrainLoss(80) // Even if healed to full health, it will have some brain damage @@ -148,6 +149,7 @@ H.dna.UpdateUI() H.set_cloned_appearance() + update_icon() for(var/datum/language/L in R.languages) H.add_language(L.name) @@ -209,9 +211,6 @@ occupant = null if(locked) locked = 0 - if(!mess) - icon_state = "pod_0" - //use_power(200) return return @@ -256,7 +255,7 @@ else if(anchored) anchored = 0 - connected.pod1 = null + connected.pods -= src connected = null else anchored = 1 @@ -265,6 +264,11 @@ user.visible_message("[user] secures [src] to the floor.", "You secure [src] to the floor.") else user.visible_message("[user] unsecures [src] from the floor.", "You unsecure [src] from the floor.") + else if(istype(W, /obj/item/device/multitool)) + var/obj/item/device/multitool/M = W + M.connecting = src + user << "You load connection data from [src] to [M]." + return else ..() @@ -275,7 +279,7 @@ if(!message) return 0 - connected.temp = message + connected.temp = "[name] : [message]" connected.updateUsrDialog() return 1 @@ -311,41 +315,29 @@ if(mess) //Clean that mess and dump those gibs! mess = 0 gibs(loc) - icon_state = "pod_0" - - /* - for(var/obj/O in src) - O.loc = loc - */ + update_icon() return if(!(occupant)) return - /* - for(var/obj/O in src) - O.loc = loc - */ - if(occupant.client) occupant.client.eye = occupant.client.mob occupant.client.perspective = MOB_PERSPECTIVE occupant.loc = loc - icon_state = "pod_0" eject_wait = 0 //If it's still set somehow. domutcheck(occupant) //Waiting until they're out before possible monkeyizing. -// occupant.add_side_effect("Bad Stomach") // Give them an extra side-effect for free. occupant = null biomass -= CLONE_BIOMASS - + update_icon() return /obj/machinery/clonepod/proc/malfunction() if(occupant) connected_message("Critical Error!") mess = 1 - icon_state = "pod_g" + update_icon() occupant.ghostize() spawn(5) del(occupant) @@ -387,6 +379,14 @@ else return +/obj/machinery/clonepod/update_icon() + ..() + icon_state = "pod_0" + if (occupant && !(stat & NOPOWER)) + icon_state = "pod_1" + else if (mess) + icon_state = "pod_g" + //Health Tracker Implant /obj/item/weapon/implant/health diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index 484f39df250..b0317ed855d 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -5,7 +5,7 @@ circuit = "/obj/item/weapon/circuitboard/cloning" req_access = list(access_heads) //Only used for record deletion right now. var/obj/machinery/dna_scannernew/scanner = null //Linked scanner. For scanning. - var/obj/machinery/clonepod/pod1 = null //Linked cloning pod. + var/list/pods = list() //Linked cloning pods. var/temp = "" var/scantemp = "Scanner unoccupied" var/menu = 1 //Which menu screen to display @@ -23,38 +23,35 @@ /obj/machinery/computer/cloning/proc/updatemodules() src.scanner = findscanner() - src.pod1 = findcloner() - - if (!isnull(src.pod1)) - src.pod1.connected = src // Some variable the pod needs + findcloner() + var/num = 1 + for (var/obj/machinery/clonepod/pod in pods) + pod.connected = src + pod.name = "[initial(pod.name)] #[num++]" /obj/machinery/computer/cloning/proc/findscanner() var/obj/machinery/dna_scannernew/scannerf = null - // Loop through every direction + //Try to find scanner on adjacent tiles first for(dir in list(NORTH,EAST,SOUTH,WEST)) - - // Try to find a scanner in that direction scannerf = locate(/obj/machinery/dna_scannernew, get_step(src, dir)) + if (scannerf) + return scannerf - // If found, then we break, and return the scanner - if (!isnull(scannerf)) - break + //Then look for a free one in the area + if(!scannerf) + for(var/obj/machinery/dna_scannernew/S in get_area(src)) + return S - // If no scanner was found, it will return null - return scannerf + return /obj/machinery/computer/cloning/proc/findcloner() - var/obj/machinery/clonepod/podf = null + pods.Cut() + for(var/obj/machinery/clonepod/P in get_area(src)) + if(!P.connected) + pods += P - for(dir in list(NORTH,EAST,SOUTH,WEST)) - - podf = locate(/obj/machinery/clonepod, get_step(src, dir)) - - if (!isnull(podf)) - break - - return podf + return /obj/machinery/computer/cloning/attackby(obj/item/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/disk/data)) //INSERT SOME DISKETTES @@ -65,6 +62,14 @@ user << "You insert [W]." src.updateUsrDialog() return + else if(istype(W, /obj/item/device/multitool)) + var/obj/item/device/multitool/M = W + var/obj/machinery/clonepod/P = M.connecting + if(P && !(P in pods)) + pods += P + P.connected = src + P.name = "[initial(P.name)] #[pods.len]" + user << "You connect [P] to [src]." else ..() return @@ -92,13 +97,13 @@ dat += "

Modules

" //dat += "Reload Modules" if (isnull(src.scanner)) - dat += " Scanner-ERROR
" + dat += " DNA scanner not found.
" else - dat += " Scanner-Found!
" - if (isnull(src.pod1)) - dat += " Pod-ERROR
" + dat += " DNA scanner found.
" + if (pods.len) + dat += " [pods.len] cloning vat\s found.
" else - dat += " Pod-Found!
" + dat += " No cloning vats found.
" // Scanner dat += "

Scanner Functions

" @@ -120,8 +125,9 @@ dat += "Lock status: [src.scanner.locked ? "Locked" : "Unlocked"]
" - if (!isnull(src.pod1)) - dat += "Biomass: [src.pod1.biomass]
" + if (pods.len) + for (var/obj/machinery/clonepod/pod in pods) + dat += "[pod] biomass: [pod.biomass]
" // Database dat += "

Database Functions

" @@ -167,10 +173,8 @@ dat += {"UI: [src.active_record.dna.uni_identity]
SE: [src.active_record.dna.struc_enzymes]

"} - if(pod1 && pod1.biomass >= CLONE_BIOMASS) + if(pods.len) dat += {"Clone
"} - else - dat += {"Insufficient biomass
"} if(4) if (!src.active_record) @@ -291,34 +295,38 @@ //Look for that player! They better be dead! if(istype(C)) //Can't clone without someone to clone. Or a pod. Or if the pod is busy. Or full of gibs. - if(!pod1) - temp = "Error: No Clonepod detected." - else if(pod1.occupant) - temp = "Error: Clonepod is currently occupied." - else if(pod1.biomass < CLONE_BIOMASS) - temp = "Error: Not enough biomass." - else if(pod1.mess) - temp = "Error: Clonepod malfunction." - else if(!config.revival_cloning) - temp = "Error: Unable to initiate cloning cycle." - - else if(pod1.growclone(C)) - temp = "Initiating cloning cycle..." - records.Remove(C) - del(C) - menu = 1 + if(!pods.len) + temp = "Error: No clone pods detected." else + var/obj/machinery/clonepod/pod = pods[1] + if (pods.len > 1) + pod = input(usr,"Select a cloning pod to use", "Pod selection") as anything in pods + if(pod.occupant) + temp = "Error: Clonepod is currently occupied." + else if(pod.biomass < CLONE_BIOMASS) + temp = "Error: Not enough biomass." + else if(pod.mess) + temp = "Error: Clonepod malfunction." + else if(!config.revival_cloning) + temp = "Error: Unable to initiate cloning cycle." - var/mob/selected = find_dead_player("[C.ckey]") - selected << 'sound/machines/chime.ogg' //probably not the best sound but I think it's reasonable - var/answer = alert(selected,"Do you want to return to life?","Cloning","Yes","No") - if(answer != "No" && pod1.growclone(C)) + else if(pod.growclone(C)) temp = "Initiating cloning cycle..." records.Remove(C) del(C) menu = 1 else - temp = "Initiating cloning cycle...
Error: Post-initialisation failed. Cloning cycle aborted." + + var/mob/selected = find_dead_player("[C.ckey]") + selected << 'sound/machines/chime.ogg' //probably not the best sound but I think it's reasonable + var/answer = alert(selected,"Do you want to return to life?","Cloning","Yes","No") + if(answer != "No" && pod.growclone(C)) + temp = "Initiating cloning cycle..." + records.Remove(C) + del(C) + menu = 1 + else + temp = "Initiating cloning cycle...
Error: Post-initialisation failed. Cloning cycle aborted." else temp = "Error: Data corruption." diff --git a/code/game/objects/items/devices/multitool.dm b/code/game/objects/items/devices/multitool.dm index 1765c32ade6..a31a866bc7e 100644 --- a/code/game/objects/items/devices/multitool.dm +++ b/code/game/objects/items/devices/multitool.dm @@ -20,3 +20,4 @@ origin_tech = "magnets=1;engineering=1" var/obj/machinery/telecomms/buffer // simple machine buffer for device linkage + var/obj/machinery/clonepod/connecting //same for cryopod linkage \ No newline at end of file