From 28889d2b6af6c6f0acd9256ded38f972cdc80dc9 Mon Sep 17 00:00:00 2001 From: xxalpha Date: Fri, 4 Sep 2015 17:37:17 +0100 Subject: [PATCH] Changed protolathe code to use material container. Clean proc, typo fix Standard sheet values --- code/datums/material_container.dm | 34 ++-- code/game/machinery/autolathe.dm | 2 +- code/game/machinery/recycler.dm | 2 +- code/modules/clothing/shoes/bananashoes.dm | 2 +- code/modules/research/designs.dm | 1 + code/modules/research/experimentor.dm | 4 +- code/modules/research/protolathe.dm | 123 +++------------ code/modules/research/rdconsole.dm | 172 +++++++++------------ 8 files changed, 127 insertions(+), 213 deletions(-) diff --git a/code/datums/material_container.dm b/code/datums/material_container.dm index 5675052009571..6870c3d303b01 100644 --- a/code/datums/material_container.dm +++ b/code/datums/material_container.dm @@ -48,10 +48,10 @@ if(amt > 0 && has_space(amt)) var/total_amount_saved = total_amount if(material_type) - for(var/datum/material/M in materials) - if(M.material_type == material_type) - M.amount += amt - total_amount += amt + var/datum/material/M = materials[material_type] + if(M) + M.amount += amt + total_amount += amt else for(var/datum/material/M in materials) M.amount += amt @@ -93,21 +93,21 @@ //For consuming material //mats is a list of types of material to use and the corresponding amounts, example: list(MAT_METAL=100, MAT_GLASS=200) -/datum/material_container/proc/use_amount(list/mats) +/datum/material_container/proc/use_amount(list/mats, multiplier=1) if(!mats || !mats.len) return 0 var/datum/material/M for(var/MAT in materials) M = materials[MAT] - if(M.amount < mats[MAT]) + if(M.amount < (mats[MAT] * multiplier)) return 0 var/total_amount_save = total_amount for(var/MAT in materials) M = materials[MAT] - M.amount -= mats[MAT] - total_amount -= mats[MAT] + M.amount -= mats[MAT] * multiplier + total_amount -= mats[MAT] * multiplier return total_amount_save - total_amount @@ -124,7 +124,9 @@ //For spawning mineral sheets; internal use only /datum/material_container/proc/retrieve(sheet_amt, datum/material/M) - if(sheet_amt > 0 && M.amount >= (sheet_amt * MINERAL_MATERIAL_AMOUNT)) + if(sheet_amt > 0) + if(M.amount < (sheet_amt * MINERAL_MATERIAL_AMOUNT)) + sheet_amt = round(M.amount / MINERAL_MATERIAL_AMOUNT) var/count = 0 while(sheet_amt > MAX_STACK_SIZE) @@ -159,6 +161,17 @@ /datum/material_container/proc/has_space(amt = 0) return (total_amount + amt) <= max_amount +/datum/material_container/proc/has_materials(list/mats, multiplier=1) + if(!mats || !mats.len) + return 0 + + var/datum/material/M + for(var/MAT in mats) + M = materials[MAT] + if(M.amount < (mats[MAT] * multiplier)) + return 0 + return 1 + /datum/material_container/proc/amount2sheet(amt) if(amt >= MINERAL_MATERIAL_AMOUNT) return round(amt / MINERAL_MATERIAL_AMOUNT) @@ -173,9 +186,6 @@ var/datum/material/M = materials[material_type] return M ? M.amount : 0 -/datum/material_container/proc/can_insert(obj/item/I) - return get_item_material_amount(I) - //returns the amount of material relevant to this container; //if this container does not support glass, any glass in 'I' will not be taken into account /datum/material_container/proc/get_item_material_amount(obj/item/I) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 7a6a84a443e33..e5235f412f443 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -116,7 +116,7 @@ if (stat) return 1 - var/material_amount = materials.can_insert(O) + var/material_amount = materials.get_item_material_amount(O) if(!material_amount) user << "This object does not contain sufficient amounts of metal or glass to be accepted by the autolathe." return 1 diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 60e6cd9f6ed48..57fd990d2dd08 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -119,7 +119,7 @@ var/const/SAFETY_COOLDOWN = 100 if(sound) playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) - var/material_amount = materials.can_insert(I) + var/material_amount = materials.get_item_material_amount(I) if(!material_amount) qdel(I) return diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index 8ecc971b7dd7e..795490b381f9e 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -37,7 +37,7 @@ user << "You cannot retrieve any bananium from the prototype shoes." /obj/item/clothing/shoes/clown_shoes/banana_shoes/attackby(obj/item/O, mob/user, params) - if(!bananium.can_insert(O)) + if(!bananium.get_item_material_amount(O)) user << "This item has no bananium!" return if(!user.unEquip(O)) diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 4f7414e34575f..8e117dc0beef8 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -40,6 +40,7 @@ other types of metals and chemistry for reagents). var/construction_time //Amount of time required for building the object var/build_path = "" //The file path of the object that gets created var/list/category = null //Primarily used for Mech Fabricators, but can be used for anything + var/reagents //A proc to calculate the reliability of a design based on tech levels and innate modifiers. diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 6282be27194e3..37fe63e90e092 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -456,8 +456,8 @@ visible_message("[src]'s crushing mechanism slowly and smoothly descends, flattening the [exp_on]!") new /obj/item/stack/sheet/plasteel(get_turf(pick(oview(1,src)))) if(linked_console.linked_lathe) - linked_console.linked_lathe.m_amount += min((linked_console.linked_lathe.max_material_storage - linked_console.linked_lathe.TotalMaterials()), (exp_on.materials[MAT_METAL])) - linked_console.linked_lathe.g_amount += min((linked_console.linked_lathe.max_material_storage - linked_console.linked_lathe.TotalMaterials()), (exp_on.materials[MAT_GLASS])) + for(var/material in exp_on.materials) + linked_console.linked_lathe.materials.insert_amount( min((linked_console.linked_lathe.materials.max_amount - linked_console.linked_lathe.materials.total_amount), (exp_on.materials[material])), material) if(prob(EFFECT_PROB_VERYLOW-badThingCoeff)) visible_message("[src]'s crusher goes way too many levels too high, crushing right through space-time!") playsound(src.loc, 'sound/effects/supermatter.ogg', 50, 1, -3) diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index 0e998a0cb1b80..5b2ddee54a0cc 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -13,16 +13,7 @@ Note: Must be placed west/left of and R&D console to function. icon_state = "protolathe" flags = OPENCONTAINER - var/max_material_storage = 100000 //All this could probably be done better with a list but meh. - var/m_amount = 0.0 - var/g_amount = 0.0 - var/gold_amount = 0.0 - var/silver_amount = 0.0 - var/plasma_amount = 0.0 - var/uranium_amount = 0.0 - var/diamond_amount = 0.0 - var/clown_amount = 0.0 - var/adamantine_amount = 0.0 + var/datum/material_container/materials var/efficiency_coeff var/list/categories = list( @@ -51,12 +42,14 @@ Note: Must be placed west/left of and R&D console to function. component_parts += new /obj/item/weapon/stock_parts/manipulator(src) component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src) component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src) + materials = new(src, list(MAT_METAL=1, MAT_GLASS=1, MAT_SILVER=1, MAT_GOLD=1, MAT_DIAMOND=1, MAT_PLASMA=1, MAT_URANIUM=1, MAT_BANANIUM=1)) RefreshParts() reagents.my_atom = src -/obj/machinery/r_n_d/protolathe/proc/TotalMaterials() //returns the total of all the stored materials. Makes code neater. - return m_amount + g_amount + gold_amount + silver_amount + plasma_amount + uranium_amount + diamond_amount + clown_amount +/obj/machinery/r_n_d/protolathe/Destroy() + qdel(materials) + return ..() /obj/machinery/r_n_d/protolathe/RefreshParts() var/T = 0 @@ -64,33 +57,16 @@ Note: Must be placed west/left of and R&D console to function. G.reagents.trans_to(src, G.reagents.total_volume) for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts) T += M.rating - max_material_storage = T * 75000 + materials.max_amount = T * 75000 T = 0 for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts) T += (M.rating/3) efficiency_coeff = max(T, 1) /obj/machinery/r_n_d/protolathe/proc/check_mat(datum/design/being_built, M) // now returns how many times the item can be built with the material - var/A = 0 - switch(M) - if(MAT_METAL) - A = m_amount - if(MAT_GLASS) - A = g_amount - if(MAT_GOLD) - A = gold_amount - if(MAT_SILVER) - A = silver_amount - if(MAT_PLASMA) - A = plasma_amount - if(MAT_URANIUM) - A = uranium_amount - if(MAT_DIAMOND) - A = diamond_amount - if(MAT_BANANIUM) - A = clown_amount - else - A = reagents.get_reagent_amount(M) + var/A = materials.amount(M) + if(!A) + A = reagents.get_reagent_amount(M) A = A / max(1, (being_built.materials[M]/efficiency_coeff)) return A @@ -110,33 +86,7 @@ Note: Must be placed west/left of and R&D console to function. if(istype(O, /obj/item/weapon/crowbar)) for(var/obj/item/weapon/reagent_containers/glass/G in component_parts) reagents.trans_to(G, G.reagents.maximum_volume) - if(m_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/metal/G = new /obj/item/stack/sheet/metal(src.loc) - G.amount = round(m_amount / G.perunit) - if(g_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(src.loc) - G.amount = round(g_amount / G.perunit) - if(plasma_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/mineral/plasma/G = new /obj/item/stack/sheet/mineral/plasma(src.loc) - G.amount = round(plasma_amount / G.perunit) - if(silver_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/mineral/silver/G = new /obj/item/stack/sheet/mineral/silver(src.loc) - G.amount = round(silver_amount / G.perunit) - if(gold_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/mineral/gold/G = new /obj/item/stack/sheet/mineral/gold(src.loc) - G.amount = round(gold_amount / G.perunit) - if(uranium_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium(src.loc) - G.amount = round(uranium_amount / G.perunit) - if(diamond_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond(src.loc) - G.amount = round(diamond_amount / G.perunit) - if(clown_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/mineral/bananium/G = new /obj/item/stack/sheet/mineral/bananium(src.loc) - G.amount = round(clown_amount / G.perunit) - if(adamantine_amount >= MINERAL_MATERIAL_AMOUNT) - var/obj/item/stack/sheet/mineral/adamantine/G = new /obj/item/stack/sheet/mineral/adamantine(src.loc) - G.amount = round(adamantine_amount / G.perunit) + materials.retrieve_all() default_deconstruction_crowbar(O) return 1 else @@ -152,52 +102,27 @@ Note: Must be placed west/left of and R&D console to function. return 1 if (O.is_open_container()) return - if (!istype(O, /obj/item/stack/sheet) || istype(O, /obj/item/stack/sheet/mineral/wood)) - user << "You cannot insert this item into the [src.name]!" - return 1 if (stat) return 1 if(istype(O,/obj/item/stack/sheet)) - var/obj/item/stack/sheet/S = O - if (TotalMaterials() + S.perunit > max_material_storage) + if(!materials.has_space( materials.get_item_material_amount(O) )) user << "The [src.name]'s material bin is full! Please remove material before adding more." return 1 var/obj/item/stack/sheet/stack = O var/amount = round(input("How many sheets do you want to add?") as num)//No decimals - if(!stack || stack.amount <= 0 || amount <= 0 || !in_range(src, stack) || !user.Adjacent(src)) + if(!in_range(src, stack) || !user.Adjacent(src)) return - if(amount > stack.amount) - amount = stack.amount - if(max_material_storage - TotalMaterials() < (amount*stack.perunit))//Can't overfill - amount = min(stack.amount, round((max_material_storage-TotalMaterials())/stack.perunit)) - - busy = 1 - use_power(max(1000, (MINERAL_MATERIAL_AMOUNT*amount/10))) - user << "You add [amount] sheets to the [src.name]." - if(istype(stack, /obj/item/stack/sheet/metal)) - m_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/glass)) - g_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/mineral/gold)) - gold_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/mineral/silver)) - silver_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/mineral/plasma)) - plasma_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/mineral/uranium)) - uranium_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/mineral/diamond)) - diamond_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/mineral/bananium)) - clown_amount += amount * MINERAL_MATERIAL_AMOUNT - else if(istype(stack, /obj/item/stack/sheet/mineral/adamantine)) - adamantine_amount += amount * MINERAL_MATERIAL_AMOUNT - stack.use(amount) + var/amount_inserted = materials.insert_stack(O,amount) + if(!amount_inserted) + user << "You could not insert [O], it has no usable materials." + return 1 + else + busy = 1 + use_power(max(1000, (MINERAL_MATERIAL_AMOUNT*amount_inserted/10))) + user << "You add [amount_inserted] sheets to the [src.name]." + overlays += "protolathe_[stack.name]" + sleep(10) + overlays -= "protolathe_[stack.name]" + busy = 0 updateUsrDialog() - - overlays += "protolathe_[stack.name]" - sleep(10) - overlays -= "protolathe_[stack.name]" - busy = 0 - diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 7cbe1fe68f147..f8f5cbd1c0d4c 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -276,8 +276,8 @@ won't update every console in existence) but it's more of a hassle to do. Also, else //Same design always gain quality screen = 2.3 //Crit fail gives the same design a lot of reliability, like really a lot if(linked_lathe) //Also sends salvaged materials to a linked protolathe, if any. - linked_lathe.m_amount += min((linked_lathe.max_material_storage - linked_lathe.TotalMaterials()), (linked_destroy.loaded_item.materials[MAT_METAL]*(linked_destroy.decon_mod/10))) - linked_lathe.g_amount += min((linked_lathe.max_material_storage - linked_lathe.TotalMaterials()), (linked_destroy.loaded_item.materials[MAT_GLASS]*(linked_destroy.decon_mod/10))) + for(var/material in linked_destroy.loaded_item.materials) + linked_lathe.materials.insert_amount(min((linked_lathe.materials.max_amount - linked_lathe.materials.total_amount), (linked_destroy.loaded_item.materials[material]*(linked_destroy.decon_mod/10))), material) feedback_add_details("item_deconstructed","[linked_destroy.loaded_item.type]") linked_destroy.loaded_item = null else @@ -377,33 +377,17 @@ won't update every console in existence) but it's more of a hassle to do. Also, flick("protolathe_n",linked_lathe) use_power(power) - for(var/M in being_built.materials) - if(linked_lathe.check_mat(being_built, M) < amount) - src.visible_message("The [src.name] beeps, \"Not enough materials to complete prototype.\"") - enough_materials = 0 - g2g = 0 - break + var/list/efficient_mats = list() + for(var/MAT in being_built.materials) + efficient_mats[MAT] = being_built.materials[MAT] / coeff + + if(!linked_lathe.materials.has_materials(efficient_mats, amount)) + src.visible_message("The [src.name] beeps, \"Not enough materials to complete prototype.\"") + enough_materials = 0 + g2g = 0 + if(enough_materials) - for(var/M in being_built.materials) - switch(M) - if(MAT_METAL) - linked_lathe.m_amount = max(0, (linked_lathe.m_amount-(being_built.materials[M]/coeff * amount))) - if(MAT_GLASS) - linked_lathe.g_amount = max(0, (linked_lathe.g_amount-(being_built.materials[M]/coeff * amount))) - if(MAT_GOLD) - linked_lathe.gold_amount = max(0, (linked_lathe.gold_amount-(being_built.materials[M]/coeff * amount))) - if(MAT_SILVER) - linked_lathe.silver_amount = max(0, (linked_lathe.silver_amount-(being_built.materials[M]/coeff * amount))) - if(MAT_PLASMA) - linked_lathe.plasma_amount = max(0, (linked_lathe.plasma_amount-(being_built.materials[M]/coeff * amount))) - if(MAT_URANIUM) - linked_lathe.uranium_amount = max(0, (linked_lathe.uranium_amount-(being_built.materials[M]/coeff * amount))) - if(MAT_DIAMOND) - linked_lathe.diamond_amount = max(0, (linked_lathe.diamond_amount-(being_built.materials[M]/coeff * amount))) - if(MAT_BANANIUM) - linked_lathe.clown_amount = max(0, (linked_lathe.clown_amount-(being_built.materials[M]/coeff * amount))) - else - linked_lathe.reagents.remove_reagent(M, being_built.materials[M]/coeff * amount) + linked_lathe.materials.use_amount(efficient_mats, amount) var/P = being_built.build_path //lets save these values before the spawn() just in case. Nobody likes runtimes. var/R = being_built.reliability @@ -495,40 +479,26 @@ won't update every console in existence) but it's more of a hassle to do. Also, else if(href_list["lathe_ejectsheet"] && linked_lathe) //Causes the protolathe to eject a sheet of material var/desired_num_sheets = text2num(href_list["lathe_ejectsheet_amt"]) - var/res_amount, type + var/MAT switch(href_list["lathe_ejectsheet"]) if("metal") - type = /obj/item/stack/sheet/metal - res_amount = "m_amount" + MAT = MAT_METAL if("glass") - type = /obj/item/stack/sheet/glass - res_amount = "g_amount" + MAT = MAT_GLASS if("gold") - type = /obj/item/stack/sheet/mineral/gold - res_amount = "gold_amount" + MAT = MAT_GOLD if("silver") - type = /obj/item/stack/sheet/mineral/silver - res_amount = "silver_amount" + MAT = MAT_SILVER if("plasma") - type = /obj/item/stack/sheet/mineral/plasma - res_amount = "plasma_amount" + MAT = MAT_PLASMA if("uranium") - type = /obj/item/stack/sheet/mineral/uranium - res_amount = "uranium_amount" + MAT = MAT_URANIUM if("diamond") - type = /obj/item/stack/sheet/mineral/diamond - res_amount = "diamond_amount" + MAT = MAT_DIAMOND if("clown") - type = /obj/item/stack/sheet/mineral/bananium - res_amount = "clown_amount" - if(ispath(type) && hasvar(linked_lathe, res_amount)) - var/obj/item/stack/sheet/sheet = new type(linked_lathe.loc) - var/available_num_sheets = round(linked_lathe.vars[res_amount]/sheet.perunit) - if(available_num_sheets>0) - sheet.amount = min(available_num_sheets, desired_num_sheets) - linked_lathe.vars[res_amount] = max(0, (linked_lathe.vars[res_amount]-sheet.amount * sheet.perunit)) - else - qdel(sheet) + MAT = MAT_BANANIUM + linked_lathe.materials.retrieve_sheets(desired_num_sheets, MAT) + else if(href_list["imprinter_ejectsheet"] && linked_imprinter) //Causes the protolathe to eject a sheet of material var/desired_num_sheets = text2num(href_list["imprinter_ejectsheet_amt"]) var/res_amount, type @@ -816,7 +786,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, dat += "Material Storage" dat += "Chemical Storage
" dat += "

Protolathe Menu:


" - dat += "Material Amount: [linked_lathe.TotalMaterials()] / [linked_lathe.max_material_storage]
" + dat += "Material Amount: [linked_lathe.materials.total_amount] / [linked_lathe.materials.max_amount]
" dat += "Chemical Volume: [linked_lathe.reagents.total_volume] / [linked_lathe.reagents.maximum_volume]
" dat += "
\ @@ -834,7 +804,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, dat += "Main Menu" dat += "Protolathe Menu" dat += "

Browsing [selected_category]:


" - dat += "Material Amount: [linked_lathe.TotalMaterials()] / [linked_lathe.max_material_storage]
" + dat += "Material Amount: [linked_lathe.materials.total_amount] / [linked_lathe.materials.max_amount]
" dat += "Chemical Volume: [linked_lathe.reagents.total_volume] / [linked_lathe.reagents.maximum_volume]
" var/coeff = linked_lathe.efficiency_coeff @@ -869,7 +839,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, dat += "Main Menu" dat += "Protolathe Menu" dat += "

Search results:


" - dat += "Material Amount: [linked_lathe.TotalMaterials()] / [linked_lathe.max_material_storage]
" + dat += "Material Amount: [linked_lathe.materials.total_amount] / [linked_lathe.materials.max_amount]
" dat += "Chemical Volume: [linked_lathe.reagents.total_volume] / [linked_lathe.reagents.maximum_volume]
" var/coeff = linked_lathe.efficiency_coeff @@ -903,52 +873,60 @@ won't update every console in existence) but it's more of a hassle to do. Also, dat += "Protolathe Menu
" dat += "

Material Storage:



" //Metal - dat += "* [linked_lathe.m_amount] of Metal: " - if(linked_lathe.m_amount >= 3750) dat += "Eject " - if(linked_lathe.m_amount >= 18750) dat += "5x " - if(linked_lathe.m_amount >= 3750) dat += "All" + var/m_amount = linked_lathe.materials.amount(MAT_METAL) + dat += "* [m_amount] of Metal: " + if(m_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(m_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(m_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Glass - dat += "* [linked_lathe.g_amount] of Glass: " - if(linked_lathe.g_amount >= 3750) dat += "Eject " - if(linked_lathe.g_amount >= 18750) dat += "5x " - if(linked_lathe.g_amount >= 3750) dat += "All" + var/g_amount = linked_lathe.materials.amount(MAT_GLASS) + dat += "* [g_amount] of Glass: " + if(g_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(g_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(g_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Gold - dat += "* [linked_lathe.gold_amount] of Gold: " - if(linked_lathe.gold_amount >= 2000) dat += "Eject " - if(linked_lathe.gold_amount >= 10000) dat += "5x " - if(linked_lathe.gold_amount >= 2000) dat += "All" + var/gold_amount = linked_lathe.materials.amount(MAT_GOLD) + dat += "* [gold_amount] of Gold: " + if(gold_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(gold_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(gold_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Silver - dat += "* [linked_lathe.silver_amount] of Silver: " - if(linked_lathe.silver_amount >= 2000) dat += "Eject " - if(linked_lathe.silver_amount >= 10000) dat += "5x " - if(linked_lathe.silver_amount >= 2000) dat += "All" + var/silver_amount = linked_lathe.materials.amount(MAT_SILVER) + dat += "* [silver_amount] of Silver: " + if(silver_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(silver_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(silver_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Plasma - dat += "* [linked_lathe.plasma_amount] of Solid Plasma: " - if(linked_lathe.plasma_amount >= 2000) dat += "Eject " - if(linked_lathe.plasma_amount >= 10000) dat += "5x " - if(linked_lathe.plasma_amount >= 2000) dat += "All" + var/plasma_amount = linked_lathe.materials.amount(MAT_PLASMA) + dat += "* [plasma_amount] of Solid Plasma: " + if(plasma_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(plasma_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(plasma_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Uranium - dat += "* [linked_lathe.uranium_amount] of Uranium: " - if(linked_lathe.uranium_amount >= 2000) dat += "Eject " - if(linked_lathe.uranium_amount >= 10000) dat += "5x " - if(linked_lathe.uranium_amount >= 2000) dat += "All" + var/uranium_amount = linked_lathe.materials.amount(MAT_URANIUM) + dat += "* [uranium_amount] of Uranium: " + if(uranium_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(uranium_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(uranium_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Diamond - dat += "* [linked_lathe.diamond_amount] of Diamond: " - if(linked_lathe.diamond_amount >= 2000) dat += "Eject " - if(linked_lathe.diamond_amount >= 10000) dat += "5x " - if(linked_lathe.diamond_amount >= 2000) dat += "All" + var/diamond_amount = linked_lathe.materials.amount(MAT_DIAMOND) + dat += "* [diamond_amount] of Diamond: " + if(diamond_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(diamond_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(diamond_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Bananium - dat += "* [linked_lathe.clown_amount] of Bananium: " - if(linked_lathe.clown_amount >= 2000) dat += "Eject " - if(linked_lathe.clown_amount >= 10000) dat += "5x " - if(linked_lathe.clown_amount >= 2000) dat += "All" + var/bananium_amount = linked_lathe.materials.amount(MAT_BANANIUM) + dat += "* [bananium_amount] of Bananium: " + if(bananium_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(bananium_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(bananium_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" if(3.3) @@ -1048,21 +1026,21 @@ won't update every console in existence) but it's more of a hassle to do. Also, dat += "

Material Storage:



" //Glass dat += "* [linked_imprinter.g_amount] glass: " - if(linked_imprinter.g_amount >= 3750) dat += "Eject " - if(linked_imprinter.g_amount >= 18750) dat += "5x " - if(linked_imprinter.g_amount >= 3750) dat += "All" + if(linked_imprinter.g_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(linked_imprinter.g_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(linked_imprinter.g_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Gold dat += "* [linked_imprinter.gold_amount] gold: " - if(linked_imprinter.gold_amount >= 2000) dat += "Eject " - if(linked_imprinter.gold_amount >= 10000) dat += "5x " - if(linked_imprinter.gold_amount >= 2000) dat += "All" + if(linked_imprinter.gold_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(linked_imprinter.gold_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(linked_imprinter.gold_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" //Diamond dat += "* [linked_imprinter.diamond_amount] diamond: " - if(linked_imprinter.diamond_amount >= 2000) dat += "Eject " - if(linked_imprinter.diamond_amount >= 10000) dat += "5x " - if(linked_imprinter.diamond_amount >= 2000) dat += "All" + if(linked_imprinter.diamond_amount >= MINERAL_MATERIAL_AMOUNT) dat += "Eject " + if(linked_imprinter.diamond_amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "5x " + if(linked_imprinter.diamond_amount >= MINERAL_MATERIAL_AMOUNT) dat += "All" dat += "
" var/datum/browser/popup = new(user, "rndconsole", name, 460, 550)