Files
Aurora.3/code/game/objects/structures/machinery/bioprinter.dm
BatrachophrenoandGitHub 1c8c0c2221 Bugfix pile (#22823)
Fixes several runtimes from the past few weeks, some additional material
repath regressions, and the fact that if I shoot you with a stream of
ionized deuterium particles, it doesn't riddle you with cancer.

changes:
- bugfix: "Fixes emergency shields runtiming when hit by thrown
objects."
  - bugfix: "Fixes several stale global list runtimes."
- bugfix: "Fixes several health percentage checks that could use unset
initial health values."
  - bugfix: "Fixes additional materials regressions in INDRA code."
  - bugfix: "Fixes invalid fuel injector depletion math."
- bugfix: "Makes accelerated particles apply radiation damage to living
mobs they pass through."
2026-07-12 18:06:28 +00:00

88 lines
3.3 KiB
Plaintext

//These machines are mostly just here for debugging/spawning. Skeletons of the feature to come.
/obj/structure/machinery/bioprinter
name = "organ bioprinter"
desc = "It's a machine that grows replacement organs."
icon = 'icons/obj/surgery.dmi'
anchored = 1
density = 1
idle_power_usage = 40
icon_state = "bioprinter"
var/prints_prosthetics
var/stored_matter = 200
var/loaded_dna //Blood sample for DNA hashing.
var/list/products = list(
BP_HEART = list(/obj/item/organ/internal/heart, 50),
BP_LUNGS = list(/obj/item/organ/internal/lungs, 40),
BP_KIDNEYS = list(/obj/item/organ/internal/kidneys,20),
BP_EYES = list(/obj/item/organ/internal/eyes, 30),
BP_LIVER = list(/obj/item/organ/internal/liver, 50)
)
/obj/structure/machinery/bioprinter/prosthetics
name = "prosthetics fabricator"
desc = "It's a machine that prints prosthetic organs."
prints_prosthetics = 1
/obj/structure/machinery/bioprinter/attack_hand(mob/user)
var/choice = tgui_input_list(usr, "What would you like to print?", "Bioprinter", products)
if(!choice)
return
if(stored_matter >= products[choice][2])
stored_matter -= products[choice][2]
var/new_organ = products[choice][1]
var/obj/item/organ/O = new new_organ(get_turf(src))
if(prints_prosthetics)
O.robotic = ROBOTIC_MECHANICAL
else if(loaded_dna)
visible_message("<span class='notice'>The printer injects the stored DNA into the biomass.</span>.")
O.transplant_data = list()
var/datum/weakref/W = loaded_dna["donor"]
var/mob/living/carbon/C = W.resolve()
if (C)
O.transplant_data["species"] = C.species.name
O.transplant_data["blood_type"] = loaded_dna["blood_type"]
O.transplant_data["blood_DNA"] = loaded_dna["blood_DNA"]
visible_message("<span class='info'>The bioprinter spits out a new organ.</span>")
else
to_chat(user, SPAN_WARNING("There is not enough matter in the printer."))
/obj/structure/machinery/bioprinter/attackby(obj/item/attacking_item, mob/user)
// DNA sample from syringe.
if(!prints_prosthetics && istype(attacking_item, /obj/item/reagent_containers/syringe))
var/obj/item/reagent_containers/syringe/S = attacking_item
if(REAGENT_DATA(S.reagents, /singleton/reagent/blood))
loaded_dna = REAGENT_DATA(S.reagents, /singleton/reagent/blood)
S.reagents.clear_reagents()
to_chat(user, "<span class='info'>You inject the blood sample into the bioprinter.</span>")
return TRUE
// Meat for biomass.
if(!prints_prosthetics && istype(attacking_item, /obj/item/reagent_containers/food/snacks/meat))
stored_matter += 50
user.drop_from_inventory(attacking_item, src)
to_chat(user, "<span class='info'>\The [src] processes \the [attacking_item]. Levels of stored biomass now: [stored_matter]</span>")
qdel(attacking_item)
return TRUE
// Steel for matter.
var/obj/item/stack/material/metal_stack = attacking_item
var/singleton/material/metal_material = metal_stack?.get_material()
if(prints_prosthetics && istype(metal_stack) && metal_material?.type == MATERIAL_STEEL)
var/obj/item/stack/S = metal_stack
stored_matter += S.amount * 10
user.drop_from_inventory(attacking_item, src)
to_chat(user, "<span class='info'>\The [src] processes \the [attacking_item]. Levels of stored matter now: [stored_matter]</span>")
qdel(attacking_item)
return TRUE
return..()