mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Basically replaced biological cloning so far
This commit is contained in:
259
code/modules/resleeving/computers.dm
Normal file
259
code/modules/resleeving/computers.dm
Normal file
@@ -0,0 +1,259 @@
|
||||
/obj/machinery/computer/transhuman/resleeving
|
||||
name = "resleeving control console"
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_keyboard = "med_key"
|
||||
icon_screen = "dna"
|
||||
light_color = "#315ab4"
|
||||
circuit = /obj/item/weapon/circuitboard/cloning
|
||||
req_access = list(access_heads) //Only used for record deletion right now.
|
||||
var/list/pods = list() //Linked grower pods.
|
||||
var/list/sleevers = list() //Linked resleeving booths.
|
||||
var/temp = ""
|
||||
var/menu = 1 //Which menu screen to display
|
||||
var/datum/transhuman/body_record/active_br = null
|
||||
var/datum/transhuman/mind_record/active_mr = null
|
||||
var/datum/transhuman/infocore/TC //Easy debugging access
|
||||
var/organic_capable = 1
|
||||
var/synthetic_capable = 0
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/initialize()
|
||||
..()
|
||||
updatemodules()
|
||||
TC = transcore
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/Destroy()
|
||||
releasepods()
|
||||
..()
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/proc/updatemodules()
|
||||
releasepods()
|
||||
findpods()
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/proc/releasepods()
|
||||
for(var/obj/machinery/clonepod/transhuman/P in pods)
|
||||
P.connected = null
|
||||
P.name = initial(P.name)
|
||||
pods.Cut()
|
||||
for(var/obj/machinery/transhuman/resleever/P in sleevers)
|
||||
P.connected = null
|
||||
P.name = initial(P.name)
|
||||
sleevers.Cut()
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/proc/findpods()
|
||||
var/num = 1
|
||||
var/area/A = get_area(src)
|
||||
for(var/obj/machinery/clonepod/transhuman/P in A.get_contents())
|
||||
if(!P.connected)
|
||||
pods += P
|
||||
P.connected = src
|
||||
P.name = "[initial(P.name)] #[num++]"
|
||||
for(var/obj/machinery/transhuman/resleever/P in A.get_contents())
|
||||
if(!P.connected)
|
||||
sleevers += P
|
||||
P.connected = src
|
||||
P.name = "[initial(P.name)] #[num++]"
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
var/obj/item/device/multitool/M = W
|
||||
var/obj/machinery/clonepod/transhuman/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
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/attack_ai(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
add_fingerprint(user)
|
||||
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
updatemodules()
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
user.set_machine(src)
|
||||
|
||||
var/data[0]
|
||||
|
||||
var/bodyrecords_list_ui[0]
|
||||
for(var/N in TC.body_scans)
|
||||
var/datum/transhuman/body_record/BR = TC.body_scans[N]
|
||||
bodyrecords_list_ui[++bodyrecords_list_ui.len] = list("name" = N, "recref" = "\ref[BR]")
|
||||
|
||||
var/mindrecords_list_ui[0]
|
||||
for(var/N in TC.backed_up)
|
||||
var/datum/transhuman/mind_record/MR = TC.backed_up[N]
|
||||
mindrecords_list_ui[++mindrecords_list_ui.len] = list("name" = N, "recref" = "\ref[MR]")
|
||||
|
||||
var/pods_list_ui[0]
|
||||
for(var/obj/machinery/clonepod/transhuman/pod in pods)
|
||||
pods_list_ui[++pods_list_ui.len] = list("pod" = pod, "biomass" = pod.biomass)
|
||||
|
||||
var/sleevers_list_ui[0]
|
||||
for(var/obj/machinery/transhuman/resleever/resleever in sleevers)
|
||||
sleevers_list_ui[++sleevers_list_ui.len] = list("sleever" = resleever, "occupant" = resleever.occupant ? resleever.occupant.real_name : "None")
|
||||
|
||||
if(pods)
|
||||
data["pods"] = pods_list_ui
|
||||
else
|
||||
data["pods"] = null
|
||||
|
||||
if(sleevers)
|
||||
data["sleevers"] = sleevers_list_ui
|
||||
else
|
||||
data["pods"] = null
|
||||
|
||||
if(bodyrecords_list_ui.len)
|
||||
data["bodyrecords"] = bodyrecords_list_ui
|
||||
else
|
||||
data["bodyrecords"] = null
|
||||
|
||||
if(mindrecords_list_ui.len)
|
||||
data["mindrecords"] = mindrecords_list_ui
|
||||
else
|
||||
data["mindrecords"] = null
|
||||
|
||||
|
||||
if(active_br)
|
||||
var/can_grow_active = 1
|
||||
if(!synthetic_capable && active_br.synthetic) //Disqualified due to being synthetic in an organic pod.
|
||||
can_grow_active = 0
|
||||
else if(!organic_capable && !active_br.synthetic) //Disqualified for the opposite.
|
||||
can_grow_active = 0
|
||||
else if(!synthetic_capable && !organic_capable) //What have you done??
|
||||
can_grow_active = 0
|
||||
else if(!pods.len)
|
||||
can_grow_active = 0
|
||||
|
||||
data["activeBodyRecord"] = list("real_name" = active_br.mydna.name, \
|
||||
"speciesname" = active_br.speciesname, \
|
||||
"gender" = active_br.bodygender, \
|
||||
"synthetic" = active_br.synthetic ? "Yes" : "No", \
|
||||
"cando" = can_grow_active)
|
||||
else
|
||||
data["activeRecord"] = null
|
||||
|
||||
if(active_mr)
|
||||
var/can_sleeve_current = 1
|
||||
if(!sleevers.len)
|
||||
can_sleeve_current = 0
|
||||
data["activeMindRecord"] = list("charname" = active_mr.charname, \
|
||||
"obviously_dead" = active_mr.obviously_dead ? "Past-due" : "Current", \
|
||||
"cando" = can_sleeve_current)
|
||||
else
|
||||
data["activeMindRecord"] = null
|
||||
|
||||
|
||||
data["menu"] = menu
|
||||
data["podsLen"] = pods.len
|
||||
data["sleeversLen"] = sleevers.len
|
||||
data["temp"] = temp
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "sleever.tmpl", src.name, 400, 450)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(5)
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
else if (href_list["view_brec"])
|
||||
active_br = locate(href_list["view_brec"])
|
||||
if(active_br && istype(active_br.mydna))
|
||||
menu = 4
|
||||
else
|
||||
active_br = null
|
||||
temp = "ERROR: Record missing."
|
||||
|
||||
else if (href_list["view_mrec"])
|
||||
active_mr = locate(href_list["view_mrec"])
|
||||
if(active_mr && istype(active_mr))
|
||||
menu = 5
|
||||
else
|
||||
active_mr = null
|
||||
temp = "ERROR: Record missing."
|
||||
|
||||
else if (href_list["refresh"])
|
||||
updateUsrDialog()
|
||||
|
||||
else if (href_list["grow"])
|
||||
if(istype(active_br))
|
||||
if(!pods.len)
|
||||
temp = "Error: No growpods detected."
|
||||
else
|
||||
var/obj/machinery/clonepod/transhuman/pod = pods[1]
|
||||
if (pods.len > 1)
|
||||
pod = input(usr,"Select a growing pod to use", "Pod selection") as anything in pods
|
||||
if(pod.occupant)
|
||||
temp = "Error: Growpod is currently occupied."
|
||||
else if(pod.biomass < CLONE_BIOMASS)
|
||||
temp = "Error: Not enough biomass."
|
||||
else if(pod.mess)
|
||||
temp = "Error: Growpod malfunction."
|
||||
else if(!config.revival_cloning)
|
||||
temp = "Error: Unable to initiate growing cycle."
|
||||
else if(pod.growclone(active_br.mydna))
|
||||
temp = "Initiating growing cycle..."
|
||||
menu = 1
|
||||
else
|
||||
temp = "Initiating growing cycle...<br>Error: Post-initialisation failed. Growing cycle aborted."
|
||||
else
|
||||
temp = "Error: Data corruption."
|
||||
|
||||
else if (href_list["sleeve"])
|
||||
if(istype(active_mr))
|
||||
if(!sleevers.len)
|
||||
temp = "Error: No sleevers detected."
|
||||
else
|
||||
var/obj/machinery/transhuman/resleever/sleever = sleevers[1]
|
||||
if (sleevers.len > 1)
|
||||
sleever = input(usr,"Select a resleeving pod to use", "Resleever selection") as anything in sleevers
|
||||
|
||||
//No body to sleeve into.
|
||||
if(!sleever.occupant)
|
||||
temp = "Error: Resleeving pod is not occupied."
|
||||
|
||||
//Body to sleeve into, but mind is in another living body.
|
||||
else if(active_mr.mind.current && active_mr.mind.current.stat != DEAD) //Mind is in a body already that's alive
|
||||
var/answer = alert(active_mr.mind.current,"Someone is attempting to restore a CURRENT backup of your mind into another body. Do you want to move to that body? You should suffer no memory loss.","Resleeving","Yes","No")
|
||||
|
||||
//They declined to be moved.
|
||||
if(answer == "No")
|
||||
temp = "Initiating resleeving...<br>Error: Post-initialisation failed. Resleeving cycle aborted."
|
||||
menu = 1
|
||||
|
||||
//They approved being moved.
|
||||
else
|
||||
sleever.putmind(active_mr)
|
||||
temp = "Initiating current backup & resleeving..."
|
||||
menu = 1
|
||||
|
||||
//They were dead, or otherwise available.
|
||||
else
|
||||
sleever.putmind(active_mr)
|
||||
temp = "Initiating resleeving..."
|
||||
menu = 1
|
||||
|
||||
//IDK but it broke somehow.
|
||||
else
|
||||
temp = "Error: Data corruption."
|
||||
|
||||
else if (href_list["menu"])
|
||||
menu = href_list["menu"]
|
||||
temp = ""
|
||||
|
||||
nanomanager.update_uis(src)
|
||||
add_fingerprint(usr)
|
||||
9
code/modules/resleeving/consoles.dm
Normal file
9
code/modules/resleeving/consoles.dm
Normal file
@@ -0,0 +1,9 @@
|
||||
////////////////////////////////
|
||||
//// Consoles for resleeving tech
|
||||
//// for printing bodies and 'decanting'
|
||||
////////////////////////////////
|
||||
|
||||
//TODO Tweaked cloning console
|
||||
//TODO Subtype for synths
|
||||
|
||||
//TODO Mind-backup management console
|
||||
53
code/modules/resleeving/general.dm
Normal file
53
code/modules/resleeving/general.dm
Normal file
@@ -0,0 +1,53 @@
|
||||
////////////////////////////////
|
||||
//// General resleeving stuff common to
|
||||
//// robotics and medical both
|
||||
////////////////////////////////
|
||||
|
||||
//The backup implant itself
|
||||
/obj/item/weapon/implant/backup
|
||||
name = "backup implant"
|
||||
desc = "Do you wanna live forever?"
|
||||
var/datum/transhuman/mind_record/my_record
|
||||
|
||||
/obj/item/weapon/implant/backup/get_data()
|
||||
var/dat = {"
|
||||
<b>Implant Specifications:</b><BR>
|
||||
<b>Name:</b> [company_name] Employee Backup Implant<BR>
|
||||
<b>Life:</b> ~8 hours.<BR>
|
||||
<b>Important Notes:</b> Implant is life-limited due to KHI licensing restrictions. Dissolves into harmless biomaterial after around ~8 hours, the typical work shift.<BR>
|
||||
<HR>
|
||||
<b>Implant Details:</b><BR>
|
||||
<b>Function:</b> Contains a small swarm of nanobots that perform neuron scanning to create mind-backups.<BR>
|
||||
<b>Special Features:</b> Will allow restoring of backups during the 8-hour period it is active.<BR>
|
||||
<b>Integrity:</b> Generally very survivable. Susceptible to being destroyed by acid."}
|
||||
return dat
|
||||
|
||||
/obj/item/weapon/implant/backup/implanted(var/mob/living/carbon/human/H)
|
||||
..()
|
||||
if(istype(H))
|
||||
my_record = new(H,src,1)
|
||||
return 1
|
||||
|
||||
//The glass case for the implant
|
||||
/obj/item/weapon/implantcase/backup
|
||||
name = "glass case - 'backup'"
|
||||
desc = "A case containing a backup implant."
|
||||
icon_state = "implantcase-b"
|
||||
|
||||
/obj/item/weapon/implantcase/backup/New()
|
||||
src.imp = new /obj/item/weapon/implant/backup(src)
|
||||
..()
|
||||
return
|
||||
|
||||
//The box of backup implants
|
||||
/obj/item/weapon/storage/box/backup_kit
|
||||
name = "backup implant kit"
|
||||
desc = "Box of stuff used to implant backup implants."
|
||||
icon_state = "implant"
|
||||
item_state_slots = list(slot_r_hand_str = "syringe_kit", slot_l_hand_str = "syringe_kit")
|
||||
|
||||
/obj/item/weapon/storage/box/backup_kit/New()
|
||||
..()
|
||||
for(var/i = 1 to 7)
|
||||
new /obj/item/weapon/implantcase/backup(src)
|
||||
new /obj/item/weapon/implanter(src)
|
||||
147
code/modules/resleeving/infocore.dm
Normal file
147
code/modules/resleeving/infocore.dm
Normal file
@@ -0,0 +1,147 @@
|
||||
////////////////////////////////
|
||||
//// Mind/body data storage system
|
||||
//// for the resleeving tech
|
||||
////////////////////////////////
|
||||
|
||||
var/datum/transhuman/infocore/transcore = new/datum/transhuman/infocore
|
||||
|
||||
//Mind-backup database
|
||||
/datum/transhuman/infocore
|
||||
var/notify_min = 5 MINUTES
|
||||
var/notify_max = 15 MINUTES
|
||||
var/ping_time = 3 MINUTES
|
||||
|
||||
var/datum/transhuman/mind_record/list/backed_up = list()
|
||||
var/datum/transhuman/mind_record/list/has_left = list()
|
||||
var/datum/transhuman/body_record/list/body_scans = list()
|
||||
|
||||
var/in_use = 1 //Whether to use this thing at all
|
||||
var/time_to_ping = 0 //When to do the next backup 'ping', in world.time
|
||||
|
||||
/datum/transhuman/infocore/New()
|
||||
process()
|
||||
|
||||
/datum/transhuman/infocore/proc/process()
|
||||
if(!in_use)
|
||||
return
|
||||
|
||||
for(var/N in backed_up)
|
||||
var/datum/transhuman/mind_record/curr_MR = backed_up[N]
|
||||
if(!curr_MR)
|
||||
log_debug("Tried to process [N] in transcore w/o a record!")
|
||||
else
|
||||
if(!curr_MR.imp_ref || curr_MR.imp_ref.loc != curr_MR.mob_ref) //Implant gone
|
||||
curr_MR.secretly_dead = DEAD
|
||||
spawn(rand(notify_min,notify_max))
|
||||
curr_MR.obviously_dead = curr_MR.secretly_dead
|
||||
|
||||
else if(!curr_MR.secretly_dead && (!curr_MR.mob_ref || curr_MR.mob_ref.stat >= DEAD)) //Mob appears to be dead
|
||||
curr_MR.secretly_dead = curr_MR.mob_ref.stat
|
||||
spawn(rand(notify_min,notify_max))
|
||||
if(!curr_MR.mob_ref || curr_MR.mob_ref.stat >= DEAD) //Still dead
|
||||
curr_MR.obviously_dead = curr_MR.secretly_dead
|
||||
else
|
||||
curr_MR.secretly_dead = curr_MR.mob_ref.stat //Not dead now, restore status.
|
||||
|
||||
spawn(ping_time)
|
||||
process()
|
||||
|
||||
/datum/transhuman/infocore/proc/add_backup(var/datum/transhuman/mind_record/MR)
|
||||
ASSERT(MR)
|
||||
backed_up[MR.charname] = MR
|
||||
log_debug("Added [MR.charname] to transcore DB.")
|
||||
|
||||
/datum/transhuman/infocore/proc/stop_backup(var/datum/transhuman/mind_record/MR)
|
||||
ASSERT(MR)
|
||||
has_left[MR.charname] = MR
|
||||
backed_up.Remove("[MR.charname]")
|
||||
log_debug("Put [MR.charname] in transcore suspended DB.")
|
||||
|
||||
/datum/transhuman/infocore/proc/add_body(var/datum/transhuman/body_record/BR)
|
||||
ASSERT(BR)
|
||||
body_scans[BR.mydna.name] = BR
|
||||
log_debug("Added [BR.mydna.name] to transcore body DB.")
|
||||
|
||||
/////// Mind-backup record ///////
|
||||
/datum/transhuman/mind_record
|
||||
//User visible
|
||||
var/charname = "!!ERROR!!"
|
||||
var/implanted_at
|
||||
var/body_type
|
||||
var/obviously_dead
|
||||
var/id_gender
|
||||
|
||||
//Backend
|
||||
var/obj/item/weapon/implant/backup/imp_ref
|
||||
var/ckey = ""
|
||||
var/mob/living/carbon/human/mob_ref
|
||||
var/client/client
|
||||
var/datum/mind/mind
|
||||
var/cryo_at
|
||||
var/secretly_dead
|
||||
var/languages
|
||||
|
||||
/datum/transhuman/mind_record/New(var/mob/living/carbon/human/M,var/obj/item/weapon/implant/backup/imp,var/add_to_db = 1)
|
||||
ASSERT(M && imp)
|
||||
|
||||
if(!istype(M))
|
||||
return //Only works with humanoids.
|
||||
|
||||
//Scrape info from mob.
|
||||
mob_ref = M
|
||||
charname = M.name
|
||||
implanted_at = world.time
|
||||
body_type = M.isSynthetic()
|
||||
id_gender = M.identifying_gender
|
||||
|
||||
imp_ref = imp
|
||||
ckey = M.ckey
|
||||
cryo_at = 0
|
||||
languages = M.languages.Copy()
|
||||
|
||||
//If these are gone then it's a problemmmm.
|
||||
client = M.client
|
||||
mind = M.mind
|
||||
|
||||
if(add_to_db)
|
||||
transcore.add_backup(src)
|
||||
|
||||
|
||||
/////// Body Record ///////
|
||||
/datum/transhuman/body_record
|
||||
var/datum/dna2/record/mydna
|
||||
|
||||
//These may or may not be set, mostly irrelevant since it's just a body record.
|
||||
var/ckey
|
||||
var/client/client_ref
|
||||
var/datum/mind/mind_ref
|
||||
var/synthetic
|
||||
var/speciesname
|
||||
var/bodygender
|
||||
|
||||
/datum/transhuman/body_record/New(var/mob/living/carbon/human/M,var/add_to_db = 1)
|
||||
ASSERT(M)
|
||||
|
||||
synthetic = M.isSynthetic()
|
||||
speciesname = M.custom_species ? M.custom_species : M.dna.species
|
||||
bodygender = M.gender
|
||||
|
||||
//Probably should
|
||||
M.dna.check_integrity()
|
||||
|
||||
//The DNA2 stuff
|
||||
mydna = new ()
|
||||
mydna.dna = M.dna.Clone()
|
||||
mydna.ckey = M.ckey
|
||||
mydna.id = copytext(md5(M.real_name), 2, 6)
|
||||
mydna.name = M.dna.real_name
|
||||
mydna.types = DNA2_BUF_UI|DNA2_BUF_UE|DNA2_BUF_SE
|
||||
mydna.flavor = M.flavor_texts.Copy()
|
||||
|
||||
//My stuff
|
||||
client_ref = M.client
|
||||
ckey = M.ckey
|
||||
mind_ref = M.mind
|
||||
|
||||
if(add_to_db)
|
||||
transcore.add_body(src)
|
||||
238
code/modules/resleeving/machines.dm
Normal file
238
code/modules/resleeving/machines.dm
Normal file
@@ -0,0 +1,238 @@
|
||||
////////////////////////////////
|
||||
//// Machines required for body printing
|
||||
//// and decanting into bodies
|
||||
////////////////////////////////
|
||||
|
||||
/////// Grower Pod ///////
|
||||
/obj/machinery/clonepod/transhuman
|
||||
name = "grower pod"
|
||||
|
||||
/obj/machinery/clonepod/transhuman/growclone(var/datum/dna2/record/R)
|
||||
if(mess || attempting)
|
||||
return 0
|
||||
|
||||
attempting = 1 //One at a time!!
|
||||
locked = 1
|
||||
|
||||
eject_wait = 1
|
||||
spawn(30)
|
||||
eject_wait = 0
|
||||
|
||||
var/mob/living/carbon/human/H = new /mob/living/carbon/human(src, R.dna.species)
|
||||
occupant = H
|
||||
|
||||
if(!R.dna.real_name)
|
||||
R.dna.real_name = "clone ([rand(0,999)])"
|
||||
H.real_name = R.dna.real_name
|
||||
|
||||
H.adjustCloneLoss(150)
|
||||
H.Paralyse(4)
|
||||
H.updatehealth()
|
||||
|
||||
if(!R.dna)
|
||||
H.dna = new /datum/dna()
|
||||
H.dna.real_name = H.real_name
|
||||
else
|
||||
H.dna = R.dna
|
||||
H.UpdateAppearance()
|
||||
H.sync_organ_dna()
|
||||
if(heal_level < 60)
|
||||
randmutb(H)
|
||||
H.dna.UpdateSE()
|
||||
H.dna.UpdateUI()
|
||||
|
||||
H.set_cloned_appearance()
|
||||
update_icon()
|
||||
|
||||
H.flavor_texts = R.flavor.Copy()
|
||||
H.suiciding = 0
|
||||
attempting = 0
|
||||
return 1
|
||||
|
||||
/obj/machinery/clonepod/transhuman/process()
|
||||
if(stat & NOPOWER)
|
||||
if(occupant)
|
||||
locked = 0
|
||||
go_out()
|
||||
return
|
||||
|
||||
if((occupant) && (occupant.loc == src))
|
||||
if(occupant.stat == DEAD)
|
||||
locked = 0
|
||||
go_out()
|
||||
connected_message("Clone Rejected: Deceased.")
|
||||
return
|
||||
|
||||
else if(occupant.health < heal_level && occupant.getCloneLoss() > 0)
|
||||
occupant.Paralyse(4)
|
||||
|
||||
//Slowly get that clone healed and finished.
|
||||
occupant.adjustCloneLoss(-2 * heal_rate)
|
||||
|
||||
//Premature clones may have brain damage.
|
||||
occupant.adjustBrainLoss(-(ceil(0.5*heal_rate)))
|
||||
|
||||
//So clones don't die of oxyloss in a running pod.
|
||||
if(occupant.reagents.get_reagent_amount("inaprovaline") < 30)
|
||||
occupant.reagents.add_reagent("inaprovaline", 60)
|
||||
occupant.Sleeping(30)
|
||||
//Also heal some oxyloss ourselves because inaprovaline is so bad at preventing it!!
|
||||
occupant.adjustOxyLoss(-4)
|
||||
|
||||
use_power(7500) //This might need tweaking.
|
||||
return
|
||||
|
||||
else if((occupant.health >= heal_level) && (!eject_wait))
|
||||
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
|
||||
audible_message("\The [src] signals that the growing process is complete.")
|
||||
connected_message("Growing Process Complete.")
|
||||
locked = 0
|
||||
go_out()
|
||||
return
|
||||
|
||||
else if((!occupant) || (occupant.loc != src))
|
||||
occupant = null
|
||||
if(locked)
|
||||
locked = 0
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
/////// Resleever Pod ///////
|
||||
/obj/machinery/transhuman/resleever
|
||||
name = "resleeving pod"
|
||||
desc = "Used to combine mind and body into one unit."
|
||||
icon = 'icons/obj/machines/implantchair.dmi'
|
||||
icon_state = "implantchair"
|
||||
density = 1
|
||||
opacity = 0
|
||||
anchored = 1
|
||||
|
||||
var/mob/living/carbon/human/occupant = null
|
||||
var/connected = null
|
||||
|
||||
/obj/machinery/transhuman/resleever/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
var/health_text = ""
|
||||
var/mind_text = ""
|
||||
if(src.occupant)
|
||||
if(src.occupant.stat >= DEAD)
|
||||
health_text = "<FONT color=red>DEAD</FONT>"
|
||||
else if(src.occupant.health < 0)
|
||||
health_text = "<FONT color=red>[round(src.occupant.health,0.1)]</FONT>"
|
||||
else
|
||||
health_text = "[round(src.occupant.health,0.1)]"
|
||||
|
||||
if(src.occupant.client)
|
||||
mind_text = "Mind present"
|
||||
else
|
||||
mind_text = "Mind absent"
|
||||
|
||||
var/dat ="<B>Resleever Status</B><BR>"
|
||||
dat +="<B>Current occupant:</B> [src.occupant ? "<BR>Name: [src.occupant]<BR>Health: [health_text]<BR>" : "<FONT color=red>None</FONT>"]<BR>"
|
||||
dat +="<B>Mind status:</B> [mind_text]<BR>"
|
||||
user.set_machine(src)
|
||||
user << browse(dat, "window=resleever")
|
||||
onclose(user, "resleever")
|
||||
|
||||
/obj/machinery/transhuman/resleever/attackby(var/obj/item/weapon/G as obj, var/mob/user as mob)
|
||||
if(istype(G, /obj/item/weapon/grab))
|
||||
if(!ismob(G:affecting))
|
||||
return
|
||||
for(var/mob/living/carbon/slime/M in range(1,G:affecting))
|
||||
if(M.Victim == G:affecting)
|
||||
usr << "[G:affecting:name] will not fit into the [src.name] because they have a slime latched onto their head."
|
||||
return
|
||||
var/mob/M = G:affecting
|
||||
if(put_mob(M))
|
||||
qdel(G)
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/transhuman/resleever/proc/putmind(var/datum/transhuman/mind_record/MR)
|
||||
if(!occupant || !istype(occupant) || occupant.stat >= DEAD)
|
||||
return 0
|
||||
|
||||
//In case they already had a mind!
|
||||
occupant << "<span class='warning'>You feel your mind being overwritten...</span>"
|
||||
|
||||
//Attach as much stuff as possible to the mob.
|
||||
for(var/datum/language/L in MR.languages)
|
||||
occupant.add_language(L.name)
|
||||
occupant.identifying_gender = MR.id_gender
|
||||
occupant.client = MR.client
|
||||
occupant.mind = MR.mind
|
||||
occupant.ckey = MR.ckey
|
||||
|
||||
//Give them a backup implant
|
||||
var/obj/item/weapon/implant/backup/new_imp = new()
|
||||
if(new_imp.implanted(occupant))
|
||||
new_imp.loc = occupant
|
||||
new_imp.imp_in = occupant
|
||||
new_imp.implanted = 1
|
||||
//Put it in the head! Makes sense.
|
||||
var/obj/item/organ/external/affected = occupant.get_organ(BP_HEAD)
|
||||
affected.implants += new_imp
|
||||
new_imp.part = affected
|
||||
|
||||
//Update the database record
|
||||
MR.mob_ref = occupant
|
||||
MR.imp_ref = new_imp
|
||||
MR.secretly_dead = occupant.stat
|
||||
MR.obviously_dead = 0
|
||||
|
||||
//Inform them and make them a little dizzy.
|
||||
occupant << "<span class='warning'>You feel a small pain in your head as you're given a new backup implant. Oh, and a new body. It's disorienting, to say the least.</span>"
|
||||
occupant.confused = max(occupant.confused, 15)
|
||||
occupant.eye_blurry = max(occupant.eye_blurry, 15)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/transhuman/resleever/proc/go_out(var/mob/M)
|
||||
if(!( src.occupant ))
|
||||
return
|
||||
if (src.occupant.client)
|
||||
src.occupant.client.eye = src.occupant.client.mob
|
||||
src.occupant.client.perspective = MOB_PERSPECTIVE
|
||||
src.occupant.loc = src.loc
|
||||
src.occupant = null
|
||||
icon_state = "implantchair"
|
||||
return
|
||||
|
||||
/obj/machinery/transhuman/resleever/proc/put_mob(mob/living/carbon/human/M as mob)
|
||||
if(!ishuman(M))
|
||||
usr << "<span class='warning'>\The [src] cannot hold this!</span>"
|
||||
return
|
||||
if(src.occupant)
|
||||
usr << "<span class='warning'>\The [src] is already occupied!</span>"
|
||||
return
|
||||
if(M.client)
|
||||
M.client.perspective = EYE_PERSPECTIVE
|
||||
M.client.eye = src
|
||||
M.stop_pulling()
|
||||
M.loc = src
|
||||
src.occupant = M
|
||||
src.add_fingerprint(usr)
|
||||
icon_state = "implantchair_on"
|
||||
return 1
|
||||
|
||||
/obj/machinery/transhuman/resleever/verb/get_out()
|
||||
set name = "EJECT Occupant"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
if(usr.stat != 0)
|
||||
return
|
||||
src.go_out(usr)
|
||||
add_fingerprint(usr)
|
||||
return
|
||||
|
||||
/obj/machinery/transhuman/resleever/verb/move_inside()
|
||||
set name = "Move INSIDE"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
if(usr.stat != 0 || stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
put_mob(usr)
|
||||
return
|
||||
Reference in New Issue
Block a user