From f03759a246f97a1cf3b3b37334873834753e614e Mon Sep 17 00:00:00 2001 From: Chinsky Date: Thu, 12 Mar 2015 15:07:20 +0300 Subject: [PATCH] Fixes organ bioprinter and the organs. Now less debuggy and less buggy too. --- code/game/machinery/bioprinter.dm | 28 ++++++++++++++++++++-------- code/modules/organs/organ_objects.dm | 9 +++++++-- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/code/game/machinery/bioprinter.dm b/code/game/machinery/bioprinter.dm index a0ac4258cc..7710a6d6ec 100644 --- a/code/game/machinery/bioprinter.dm +++ b/code/game/machinery/bioprinter.dm @@ -1,7 +1,7 @@ //These machines are mostly just here for debugging/spawning. Skeletons of the feature to come. /obj/machinery/bioprinter - name = "bioprinter" + name = "organ bioprinter" desc = "It's a machine that grows replacement organs." icon = 'icons/obj/surgery.dmi' @@ -41,33 +41,45 @@ if(prints_prosthetics) O.robotic = 2 else if(loaded_dna) - visible_message("The printer would be using the DNA sample if it was coded.") - //TODO: Copy DNA hash or donor reference over to new organ. + visible_message("The printer injects stored DNA in used biomass..") + var/datum/organ/internal/I = new O.organ_type + I.transplant_data = list() + var/mob/living/carbon/C = loaded_dna["donor"] + I.transplant_data["species"] = C.species.name + I.transplant_data["blood_type"] = loaded_dna["blood_type"] + I.transplant_data["blood_DNA"] = loaded_dna["blood_DNA"] + O.organ_data = I + I.organ_holder = O - visible_message("The bioprinter spits out a new organ.") + + visible_message("The bioprinter spits out a new organ.") else - user << "There is not enough matter in the printer." + user << "There is not enough matter in the printer." /obj/machinery/bioprinter/attackby(obj/item/weapon/W, mob/user) // DNA sample from syringe. if(!prints_prosthetics && istype(W,/obj/item/weapon/reagent_containers/syringe)) - user << "You inject the blood sample into the bioprinter, but it isn't coded yet." + var/obj/item/weapon/reagent_containers/syringe/S = W + var/datum/reagent/blood/injected = locate() in S.reagents.reagent_list //Grab some blood + if(injected && injected.data) + loaded_dna = injected.data + user << "You inject the blood sample into the bioprinter." return // Meat for biomass. else if(!prints_prosthetics && istype(W, /obj/item/weapon/reagent_containers/food/snacks/meat)) - user << "\blue \The [src] processes \the [W]." stored_matter += 50 user.drop_item() + user << "\The [src] processes \the [W]. Levels of stored biomass now: [stored_matter]" del(W) return // Steel for matter. else if(prints_prosthetics && istype(W, /obj/item/stack/sheet/metal)) var/obj/item/stack/sheet/metal/M = W - user << "\blue \The [src] processes \the [W]." stored_matter += M.amount * 10 user.drop_item() + user << "\The [src] processes \the [W]. Levels of stored matter now: [stored_matter]" del(W) return else diff --git a/code/modules/organs/organ_objects.dm b/code/modules/organs/organ_objects.dm index 610e702ad1..a97f1f28f5 100644 --- a/code/modules/organs/organ_objects.dm +++ b/code/modules/organs/organ_objects.dm @@ -76,7 +76,7 @@ /obj/item/organ/proc/update() if(!organ_data) - organ_data = new /datum/organ/internal() + organ_data = new organ_type() if(robotic) organ_data.robotic = robotic @@ -93,6 +93,7 @@ organ_tag = "heart" fresh = 6 // Juicy. dead_icon = "heart-off" + organ_type = /datum/organ/internal/heart /obj/item/organ/lungs name = "lungs" @@ -101,6 +102,7 @@ prosthetic_name = "gas exchange system" prosthetic_icon = "lungs-prosthetic" organ_tag = "lungs" + organ_type = /datum/organ/internal/lungs /obj/item/organ/kidneys name = "kidneys" @@ -109,6 +111,7 @@ prosthetic_name = "prosthetic kidneys" prosthetic_icon = "kidneys-prosthetic" organ_tag = "kidneys" + organ_type = /datum/organ/internal/kidney /obj/item/organ/eyes name = "eyeballs" @@ -117,7 +120,7 @@ prosthetic_name = "visual prosthesis" prosthetic_icon = "eyes-prosthetic" organ_tag = "eyes" - + organ_type = /datum/organ/internal/eyes var/eye_colour /obj/item/organ/liver @@ -126,11 +129,13 @@ 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