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.
This commit is contained in:
Chinsky
2015-03-13 13:21:19 +03:00
parent 00dfef8d02
commit ba18611bb3
3 changed files with 84 additions and 75 deletions
+22 -22
View File
@@ -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 << "<span class='notice'>You load connection data from [src] to [M].</span>"
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
+61 -53
View File
@@ -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 << "<span class='notice'>You connect [P] to [src].</span>"
else
..()
return
@@ -92,13 +97,13 @@
dat += "<h4>Modules</h4>"
//dat += "<a href='byond://?src=\ref[src];relmodules=1'>Reload Modules</a>"
if (isnull(src.scanner))
dat += " <font color=red>Scanner-ERROR</font><br>"
dat += " <font color=red>DNA scanner not found.</font><br>"
else
dat += " <font color=green>Scanner-Found!</font><br>"
if (isnull(src.pod1))
dat += " <font color=red>Pod-ERROR</font><br>"
dat += " <font color=green>DNA scanner found.</font><br>"
if (pods.len)
dat += " <font color=green>[pods.len] cloning vat\s found.</font><br>"
else
dat += " <font color=green>Pod-Found!</font><br>"
dat += " <font color=red>No cloning vats found.</font><br>"
// Scanner
dat += "<h4>Scanner Functions</h4>"
@@ -120,8 +125,9 @@
dat += "Lock status: <a href='byond://?src=\ref[src];lock=1'>[src.scanner.locked ? "Locked" : "Unlocked"]</a><br>"
if (!isnull(src.pod1))
dat += "Biomass: <i>[src.pod1.biomass]</i><br>"
if (pods.len)
for (var/obj/machinery/clonepod/pod in pods)
dat += "[pod] biomass: <i>[pod.biomass]</i><br>"
// Database
dat += "<h4>Database Functions</h4>"
@@ -167,10 +173,8 @@
dat += {"<b>UI:</b> [src.active_record.dna.uni_identity]<br>
<b>SE:</b> [src.active_record.dna.struc_enzymes]<br><br>"}
if(pod1 && pod1.biomass >= CLONE_BIOMASS)
if(pods.len)
dat += {"<a href='byond://?src=\ref[src];clone=\ref[src.active_record]'>Clone</a><br>"}
else
dat += {"<b>Insufficient biomass</b><br>"}
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...<br>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...<br>Error: Post-initialisation failed. Cloning cycle aborted."
else
temp = "Error: Data corruption."
@@ -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