From ca425ce9686d101952da0429375f6884cff3e69a Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 19 Feb 2017 17:34:50 -0500 Subject: [PATCH] Added code to allow adding more steel or glass to the synth body printer. --- code/modules/resleeving/computers.dm | 8 +++--- code/modules/resleeving/machines.dm | 40 +++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/code/modules/resleeving/computers.dm b/code/modules/resleeving/computers.dm index d6ed8223f22..94d7887926b 100644 --- a/code/modules/resleeving/computers.dm +++ b/code/modules/resleeving/computers.dm @@ -111,7 +111,7 @@ var/spods_list_ui[0] for(var/obj/machinery/transhuman/synthprinter/spod in spods) - spods_list_ui[++spods_list_ui.len] = list("spod" = spod, "steel" = spod.steel, "glass" = spod.glass) + spods_list_ui[++spods_list_ui.len] = list("spod" = spod, "steel" = spod.stored_material[DEFAULT_WALL_MATERIAL], "glass" = spod.stored_material["glass"]) var/sleevers_list_ui[0] for(var/obj/machinery/transhuman/resleever/resleever in sleevers) @@ -229,9 +229,9 @@ temp = "Error: SynthFab is currently busy." //Not enough steel or glass - else if(spod.steel < spod.body_cost) - temp = "Error: Not enough steel in SynthFab." - else if(spod.glass < spod.body_cost) + else if(spod.stored_material[DEFAULT_WALL_MATERIAL] < spod.body_cost) + temp = "Error: Not enough [DEFAULT_WALL_MATERIAL] in SynthFab." + else if(spod.stored_material["glass"] < spod.body_cost) temp = "Error: Not enough glass in SynthFab." //Gross pod (broke mid-cloning or something). diff --git a/code/modules/resleeving/machines.dm b/code/modules/resleeving/machines.dm index d1553bd056b..df6ba9d68e8 100644 --- a/code/modules/resleeving/machines.dm +++ b/code/modules/resleeving/machines.dm @@ -150,8 +150,7 @@ density = 1 anchored = 1 - var/steel = 30000 //Starting steel - var/glass = 30000 //Starting glass + var/list/stored_material = list(DEFAULT_WALL_MATERIAL = 30000, "glass" = 30000) var/connected //What console it's done up with var/busy = 0 //Busy cloning var/body_cost = 15000 //Cost of a cloned body (metal and glass ea.) @@ -189,7 +188,7 @@ if(!istype(BR) || busy) return 0 - if(steel < body_cost || glass < body_cost) + if(stored_material[DEFAULT_WALL_MATERIAL] < body_cost || stored_material["glass"] < body_cost) return 0 current_project = BR @@ -249,8 +248,8 @@ H.adjustFireLoss(20) //Cha-ching. - steel -= body_cost - glass -= body_cost + stored_material[DEFAULT_WALL_MATERIAL] -= body_cost + stored_material["glass"] -= body_cost //Plonk them here. H.loc = get_turf(src) @@ -267,13 +266,42 @@ /obj/machinery/transhuman/synthprinter/attackby(obj/item/W as obj, mob/user as mob) src.add_fingerprint(user) + if(busy) + user << "\The [src] is busy. Please wait for completion of previous operation." + return if(default_deconstruction_screwdriver(user, W)) return if(default_deconstruction_crowbar(user, W)) return if(default_part_replacement(user, W)) return - return ..() + if(panel_open) + user << "You can't load \the [src] while it's opened." + return + if(!istype(W, /obj/item/stack/material)) + user << "You cannot insert this item into \the [src]!" + return + + var/obj/item/stack/material/S = W + if(!(S.material.name in stored_material)) + user << "\the [src] doesn't accept [S.material]!" + return + + var/amnt = S.perunit + var/max_res_amount = 30000 + if(stored_material[S.material.name] + amnt <= max_res_amount) + if(S && S.amount >= 1) + var/count = 0 + while(stored_material[S.material.name] + amnt <= max_res_amount && S.amount >= 1) + stored_material[S.material.name] += amnt + S.use(1) + count++ + user << "You insert [count] [S.name] into \the [src]." + else + user << "\the [src] cannot hold more [S.name]." + + updateUsrDialog() + return /obj/machinery/transhuman/synthprinter/update_icon() ..()