Files
Aurora-Old/code/modules/organs/organ_objects.dm
skull132 83b766de34 Life Support Enabled Operating Table - Update
* Gives carbon/humans the proc/isonlifesupport() to replace the constant checks done in other areas. Returns 1 if the target is on life support, 0 if is not.
* Adds support for removing brains from mobs, without them dying. The installation of a brain into a body is still impossible at this time (looking to fix that, somehow).
* Adds an internal log to the advanced operating table, which keeps track of just about everything important done to it. This log can be viewed and wiped from the operating computer.
* Adds a blood syphon option, which becomes available when the advanced operating table gets emagged.
2015-10-31 13:55:31 +02:00

296 lines
8.4 KiB
Plaintext

/obj/item/organ
name = "organ"
desc = "It looks like it probably just plopped out."
icon = 'icons/obj/surgery.dmi'
icon_state = "appendix"
health = 100 // Process() ticks before death.
var/fresh = 3 // Squirts of blood left in it.
var/dead_icon // Icon used when the organ dies.
var/robotic // Is the limb prosthetic?
var/organ_tag // What slot does it go in?
var/organ_type = /datum/organ/internal // Used to spawn the relevant organ data when produced via a machine or spawn().
var/datum/organ/internal/organ_data // Stores info when removed.
var/prosthetic_name = "prosthetic organ" // Flavour string for robotic organ.
var/prosthetic_icon // Icon for robotic organ.
/obj/item/organ/attack_self(mob/user as mob)
// Convert it to an edible form, yum yum.
if(!robotic && user.a_intent == "help" && user.zone_sel.selecting == "mouth")
bitten(user)
return
/obj/item/organ/New()
..()
create_reagents(5)
if(!robotic)
processing_objects += src
spawn(1)
update()
/obj/item/organ/Del()
if(!robotic) processing_objects -= src
..()
/obj/item/organ/process()
if(robotic)
processing_objects -= src
return
// Don't process if we're in a freezer, an MMI or a stasis bag. //TODO: ambient temperature?
if(istype(loc,/obj/item/device/mmi) || istype(loc,/obj/item/bodybag/cryobag) || istype(loc,/obj/structure/closet/crate/freezer))
return
if(fresh && prob(40))
fresh--
var/datum/reagent/blood/B = locate(/datum/reagent/blood) in reagents.reagent_list
blood_splatter(src,B,1)
health -= rand(1,3)
if(health <= 0)
die()
/obj/item/organ/proc/die()
name = "dead [initial(name)]"
if(dead_icon) icon_state = dead_icon
health = 0
processing_objects -= src
//TODO: Grey out the icon state.
//TODO: Inject an organ with peridaxon to make it alive again.
/obj/item/organ/proc/roboticize()
robotic = (organ_data && organ_data.robotic) ? organ_data.robotic : 1
if(prosthetic_name)
name = prosthetic_name
if(prosthetic_icon)
icon_state = prosthetic_icon
else
//TODO: convert to greyscale.
/obj/item/organ/proc/update()
if(!organ_data)
organ_data = new organ_type()
if(robotic)
organ_data.robotic = robotic
if(organ_data.robotic >= 2)
roboticize()
// Brain is defined in brain_item.dm.
/obj/item/organ/heart
name = "heart"
icon_state = "heart-on"
prosthetic_name = "circulatory pump"
prosthetic_icon = "heart-prosthetic"
organ_tag = "heart"
fresh = 6 // Juicy.
dead_icon = "heart-off"
organ_type = /datum/organ/internal/heart
/obj/item/organ/lungs
name = "lungs"
icon_state = "lungs"
gender = PLURAL
prosthetic_name = "gas exchange system"
prosthetic_icon = "lungs-prosthetic"
organ_tag = "lungs"
organ_type = /datum/organ/internal/lungs
/obj/item/organ/kidneys
name = "kidneys"
icon_state = "kidneys"
gender = PLURAL
prosthetic_name = "prosthetic kidneys"
prosthetic_icon = "kidneys-prosthetic"
organ_tag = "kidneys"
organ_type = /datum/organ/internal/kidney
/obj/item/organ/eyes
name = "eyeballs"
icon_state = "eyes"
gender = PLURAL
prosthetic_name = "visual prosthesis"
prosthetic_icon = "eyes-prosthetic"
organ_tag = "eyes"
organ_type = /datum/organ/internal/eyes
var/eye_colour
/obj/item/organ/liver
name = "liver"
icon_state = "liver"
prosthetic_name = "toxin filter"
prosthetic_icon = "liver-prosthetic"
organ_tag = "liver"
organ_type = /datum/organ/internal/liver
/obj/item/organ/appendix
name = "appendix"
icon_state = "appendix"
organ_tag = "appendix"
organ_type = /datum/organ/internal/appendix
//These are here so they can be printed out via the fabricator.
/obj/item/organ/heart/prosthetic
robotic = 2
/obj/item/organ/lungs/prosthetic
robotic = 2
/obj/item/organ/kidneys/prosthetic
robotic = 2
/obj/item/organ/eyes/prosthetic
robotic = 2
/obj/item/organ/eyes/robot
name = "charge-coupled device"
icon_state = ""
organ_type = /datum/organ/internal/eyes/robot
robotic = 2
exposed_to_the_world()
var/obj/item/robot_parts/robot_component/camera/Camera = new()
if(organ_data.damage)
Camera.brute = organ_data.damage
del(src)
return Camera
/obj/item/organ/liver/prosthetic
robotic = 2
/obj/item/organ/appendix
name = "appendix"
/obj/item/organ/proc/removed(var/mob/living/carbon/human/target,var/mob/living/user)
if(!istype(target) || !organ_data)
return
target.internal_organs_by_name[organ_tag] = null
target.internal_organs_by_name -= organ_tag
target.internal_organs -= organ_data
var/datum/organ/external/affected = target.get_organ(organ_data.parent_organ)
affected.internal_organs -= organ_data
loc = target.loc
organ_data.rejecting = null
var/datum/reagent/blood/organ_blood = locate(/datum/reagent/blood) in reagents.reagent_list
if(!organ_blood || !organ_blood.data["blood_DNA"])
target.vessel.trans_to(src, 5, 1, 1)
if(target && user && organ_data.vital)
user.attack_log += "\[[time_stamp()]\]<font color='red'> removed a vital organ ([src]) from [target.name] ([target.ckey]) (INTENT: [uppertext(user.a_intent)])</font>"
target.attack_log += "\[[time_stamp()]\]<font color='orange'> had a vital organ ([src]) removed by [user.name] ([user.ckey]) (INTENT: [uppertext(user.a_intent)])</font>"
msg_admin_attack("[user.name] ([user.ckey]) removed a vital organ ([src]) from [target.name] ([target.ckey]) (INTENT: [uppertext(user.a_intent)]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
if (!target.isonlifesupport())
target.death()
/obj/item/organ/proc/exposed_to_the_world() // this is only useful for organs that change when actually removed from the body
return
/obj/item/organ/appendix/removed(var/mob/living/target,var/mob/living/user)
..()
var/inflamed = 0
for(var/datum/disease/appendicitis/appendicitis in target.viruses)
inflamed = 1
appendicitis.cure()
target.resistances += appendicitis
if(inflamed)
icon_state = "appendixinflamed"
name = "inflamed appendix"
/obj/item/organ/eyes/removed(var/mob/living/target,var/mob/living/user)
if(!eye_colour)
eye_colour = list(0,0,0)
..() //Make sure target is set so we can steal their eye colour for later.
var/mob/living/carbon/human/H = target
if(istype(H))
eye_colour = list(
H.r_eyes ? H.r_eyes : 0,
H.g_eyes ? H.g_eyes : 0,
H.b_eyes ? H.b_eyes : 0
)
// Leave bloody red pits behind!
H.r_eyes = 128
H.g_eyes = 0
H.b_eyes = 0
H.update_body()
/obj/item/organ/proc/replaced(var/mob/living/carbon/human/target,var/datum/organ/external/affected)
if(!istype(target)) return
var/datum/reagent/blood/transplant_blood = locate(/datum/reagent/blood) in reagents.reagent_list
if(!transplant_blood)
organ_data.transplant_data = list()
organ_data.transplant_data["species"] = target.species.name
organ_data.transplant_data["blood_type"] = target.dna.b_type
organ_data.transplant_data["blood_DNA"] = target.dna.unique_enzymes
else
organ_data.transplant_data = list()
organ_data.transplant_data["species"] = transplant_blood.data["species"]
organ_data.transplant_data["blood_type"] = transplant_blood.data["blood_type"]
organ_data.transplant_data["blood_DNA"] = transplant_blood.data["blood_DNA"]
organ_data.organ_holder = null
organ_data.owner = target
target.internal_organs |= organ_data
affected.internal_organs |= organ_data
target.internal_organs_by_name[organ_tag] = organ_data
organ_data.status |= ORGAN_CUT_AWAY
del(src)
/obj/item/organ/eyes/replaced(var/mob/living/carbon/human/target)
// Apply our eye colour to the target.
if(istype(target) && eye_colour)
target.r_eyes = eye_colour[1]
target.g_eyes = eye_colour[2]
target.b_eyes = eye_colour[3]
target.update_body()
..()
/obj/item/organ/proc/bitten(mob/user)
if(robotic)
return
user << "\blue You take an experimental bite out of \the [src]."
var/datum/reagent/blood/B = locate(/datum/reagent/blood) in reagents.reagent_list
blood_splatter(src,B,1)
user.drop_from_inventory(src)
var/obj/item/weapon/reagent_containers/food/snacks/organ/O = new(get_turf(src))
O.name = name
O.icon_state = dead_icon ? dead_icon : icon_state
// Pass over the blood.
reagents.trans_to(O, reagents.total_volume)
if(fingerprints) O.fingerprints = fingerprints.Copy()
if(fingerprintshidden) O.fingerprintshidden = fingerprintshidden.Copy()
if(fingerprintslast) O.fingerprintslast = fingerprintslast
user.put_in_active_hand(O)
del(src)