From 345c1616f29cdb1602dcc8e58c2c3fc65cc83a64 Mon Sep 17 00:00:00 2001 From: Artur <24881678+Arturlang@users.noreply.github.com> Date: Thu, 10 Feb 2022 18:49:24 +0200 Subject: [PATCH] Adds a way to build bodies using the limbgrower --- code/game/machinery/limbgrower.dm | 101 ++++++++++++++---- code/modules/mob/living/carbon/human/human.dm | 3 + .../research/designs/limbgrower_designs.dm | 9 ++ tgui/packages/tgui/interfaces/Limbgrower.js | 23 ++-- 4 files changed, 109 insertions(+), 27 deletions(-) diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index dc87322b57..68270b11bf 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -52,23 +52,30 @@ /obj/machinery/limbgrower/ui_data(mob/user) var/list/data = list() - - for(var/datum/reagent/reagent_id in reagents.reagent_list) - var/list/reagent_data = list( - reagent_name = reagent_id.name, - reagent_amount = reagent_id.volume, - reagent_type = reagent_id.type - ) - data["reagents"] += list(reagent_data) - + if(reagents.reagent_list.len) + for(var/datum/reagent/reagent_id in reagents.reagent_list) + var/list/reagent_data = list( + reagent_name = reagent_id.name, + reagent_amount = reagent_id.volume, + reagent_type = reagent_id.type + ) + data["reagents"] += list(reagent_data) + else + data["reagents"] = list() data["total_reagents"] = reagents.total_volume data["max_reagents"] = reagents.maximum_volume data["busy"] = busy var/list/disk_data = list() disk_data["disk"] = dna_disk //Do i, the machine, have a disk? - disk_data["name"] = dna_disk?.fields["name"] //Name for the human saved if there is one + if(dna_disk) + if(dna_disk.fields["name"]) + disk_data["name"] = dna_disk.fields["name"] + else if(dna_disk.genetic_makeup_buffer["name"]) + disk_data["name"] = dna_disk.genetic_makeup_buffer["name"] + else + disk_data["name"] = "No name" + //Name for the human saved if there is one data["disk"] = disk_data - return data /obj/machinery/limbgrower/ui_static_data(mob/user) @@ -119,6 +126,15 @@ if (busy) to_chat(user, "\The [src] is busy. Please wait for completion of previous operation.") return + if(ispath(user_item.type, /obj/item/reagent_containers/blood) && user.a_intent != INTENT_HARM) + var/obj/item/reagent_containers/blood/B = user_item + if(!B.reagents.get_reagents()) + to_chat(user, "You can't fill the [src] with a empty [B]!") + return + user.visible_message("[user] drains the [user_item] into the [src] using the blood bag port on [src].", + "You drain the [user_item] into the [src] using the blood bag port.") + B.reagents.trans_to(src, B.amount_per_transfer_from_this) + return if(default_deconstruction_screwdriver(user, "limbgrower_panelopen", "limbgrower_idleoff", user_item)) ui_close(user) @@ -180,7 +196,7 @@ for(var/reagent_id in consumed_reagents_list) consumed_reagents_list[reagent_id] *= production_coefficient if(!reagents.has_reagent(reagent_id, consumed_reagents_list[reagent_id])) - audible_message("\The [src] buzzes.") + audible_message("\The [src] buzzes, with a screen showing: INSUFFICENT REAGENTS") playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) return @@ -206,17 +222,13 @@ * modified_consumed_reagents_list - the list of reagents we will consume on build, modified by the production coefficient. */ /obj/machinery/limbgrower/proc/build_item(list/modified_consumed_reagents_list) - for(var/reagent_id in modified_consumed_reagents_list) - if(!reagents.has_reagent(reagent_id, modified_consumed_reagents_list[reagent_id])) - audible_message("\The [src] buzzes.") - playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) - break - - reagents.remove_reagent(reagent_id, modified_consumed_reagents_list[reagent_id]) - + HandleReagentUsage(modified_consumed_reagents_list) var/built_typepath = being_built.build_path // If we have a bodypart, we need to initialize the limb on its own. Otherwise we can build it here. - if(ispath(built_typepath, /obj/item/bodypart)) + if(ispath(built_typepath, /mob/living/carbon/human/chestonly)) + if(!build_mob_chest(built_typepath, FALSE)) + HandleReagentUsage(modified_consumed_reagents_list, FALSE) + else if(ispath(built_typepath, /obj/item/bodypart)) build_limb(built_typepath) else if(ispath(built_typepath, /obj/item/organ/genital)) //genitals are uhh... customizable build_genital(built_typepath) @@ -227,6 +239,17 @@ flick("limbgrower_unfill", src) icon_state = "limbgrower_idleoff" +/obj/machinery/limbgrower/proc/HandleReagentUsage(modified_consumed_reagents_list, remove = TRUE) + for(var/reagent_id in modified_consumed_reagents_list) + if(!reagents.has_reagent(reagent_id, modified_consumed_reagents_list[reagent_id])) + audible_message("\The [src] buzzes, with a screen showing: INSUFFICENT REAGENTS") + playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) + break + if(remove) + reagents.remove_reagent(reagent_id, modified_consumed_reagents_list[reagent_id]) + else + reagents.add_reagent(reagent_id, modified_consumed_reagents_list[reagent_id]) + /* * The process of putting together a limb. * This is called from after we remove the reagents, so this proc is just initializing the limb type. @@ -306,6 +329,42 @@ else new built_typepath(loc) +/obj/machinery/limbgrower/proc/build_mob_chest(built_typepath) + // Create a mob with a chest, but nothing else + if(!ispath(built_typepath, /mob/living/carbon/human/chestonly)) + playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) + visible_message(src, "Buzzes, a error screen appearing on it's display.") + return FALSE + var/dna = dna_disk?.genetic_makeup_buffer["name"] + var/mob/living/carbon/human/chestonly/C = new(loc) + if(dna) + C.real_name = dna + else + C.dna.nameless = TRUE + C.real_name = "Synthetic Humanoid #[rand(10000, 99999)]" + C.set_resting(TRUE, TRUE) + C.stat = DEAD + C.adjustOxyLoss(200) + C.adjustCloneLoss(50) + C.med_hud_set_status() + C.med_hud_set_health() + C.underwear = "Nude" + C.undershirt = "Nude" + C.saved_underwear = "" + C.saved_undershirt = "" + C.hair_style = "bald" + C.skin_tone = "albino" + // Just enough to start reviving them, I hope + C.blood_volume = BLOOD_VOLUME_SURVIVE + // At some point, make a way to deal with species regenerate_organs + // Remove all the organs + for(var/organ in C.internal_organs) + var/obj/item/organ/O = organ + O.Remove(organ) + + C.update_appearance() + return TRUE + /obj/machinery/limbgrower/RefreshParts() reagents.maximum_volume = 0 for(var/obj/item/reagent_containers/glass/our_beaker in component_parts) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 4fc60cc6ac..3e7f2f59e3 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -942,6 +942,9 @@ . += "[t_He] [t_is] a [spec_trait_examine_font()][dna.custom_species ? dna.custom_species : dna.species.name]" SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, usr, .) +/mob/living/carbon/human/chestonly + bodyparts = list(/obj/item/bodypart/chest) + /mob/living/carbon/human/species/abductor race = /datum/species/abductor diff --git a/code/modules/research/designs/limbgrower_designs.dm b/code/modules/research/designs/limbgrower_designs.dm index 8da18c453c..39bba19176 100644 --- a/code/modules/research/designs/limbgrower_designs.dm +++ b/code/modules/research/designs/limbgrower_designs.dm @@ -2,6 +2,15 @@ //////////Limb Grower Designs /////// ///////////////////////////////////// + +/datum/design/chestmob + name = "Synthetic Humanoid Framework Chest" + id = "chestmob" + build_type = LIMBGROWER + reagents_list = list(/datum/reagent/medicine/synthflesh = 100, /datum/reagent/blood = BLOOD_VOLUME_SURVIVE) + build_path = /mob/living/carbon/human/chestonly + category = list("initial","human","lizard","fly","insect","plasmaman","mammal","xeno") + /datum/design/leftarm name = "Left Arm" id = "leftarm" diff --git a/tgui/packages/tgui/interfaces/Limbgrower.js b/tgui/packages/tgui/interfaces/Limbgrower.js index b91c7e4b45..004137782e 100644 --- a/tgui/packages/tgui/interfaces/Limbgrower.js +++ b/tgui/packages/tgui/interfaces/Limbgrower.js @@ -1,5 +1,5 @@ import { useBackend, useSharedState } from '../backend'; -import { Box, Button, Dimmer, Icon, LabeledList, Section, Tabs } from '../components'; +import { Box, Button, Dimmer, Icon, LabeledList, Section, Tabs, ProgressBar } from '../components'; import { Window } from '../layouts'; export const Limbgrower = (props, context) => { @@ -22,7 +22,7 @@ export const Limbgrower = (props, context) => { + height={760}> {!!busy && ( @@ -47,7 +47,16 @@ export const Limbgrower = (props, context) => { - {total_reagents} / {max_reagents} reagent capacity used. + {!!total_reagents && max_reagents + ? ( + + {`Total Reagents/Maximum Reagents: + ${total_reagents}/${max_reagents}`} + + ) + : null} + {reagents.map(reagent => ( @@ -56,13 +65,15 @@ export const Limbgrower = (props, context) => { label={reagent.reagent_name} buttons={( act('empty_reagent', { - reagent_type: reagent.reagent_type, - })} /> + onClick={() => { + act('empty_reagent', { reagent_type: reagent.reagent_type }); + + }} /> )}> {reagent.reagent_amount}u
+ {`Total Reagents/Maximum Reagents: + ${total_reagents}/${max_reagents}`} +