From 6de72438629f31bc0f059be4a4c573cc83218ec0 Mon Sep 17 00:00:00 2001 From: Kelenius Date: Wed, 27 Jan 2016 13:30:13 +0300 Subject: [PATCH] Fixes #120 --- code/modules/reagents/Chemistry-Machinery.dm | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index d597e9d8efe..e92deb42fc6 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -115,21 +115,21 @@ if(href_list["amount"]) var/id = href_list["add"] - var/amount = isgoodnumber(text2num(href_list["amount"])) + var/amount = Clamp((text2num(href_list["amount"])), 0, 200) R.trans_id_to(src, id, amount) else if (href_list["addcustom"]) var/id = href_list["addcustom"] useramount = input("Select the amount to transfer.", 30, useramount) as num - useramount = isgoodnumber(useramount) + useramount = Clamp(useramount, 0, 200) src.Topic(null, list("amount" = "[useramount]", "add" = "[id]")) else if (href_list["remove"]) if(href_list["amount"]) var/id = href_list["remove"] - var/amount = isgoodnumber(text2num(href_list["amount"])) + var/amount = Clamp((text2num(href_list["amount"])), 0, 200) if(mode) reagents.trans_id_to(beaker, id, amount) else @@ -140,7 +140,7 @@ var/id = href_list["removecustom"] useramount = input("Select the amount to transfer.", 30, useramount) as num - useramount = isgoodnumber(useramount) + useramount = Clamp(useramount, 0, 200) src.Topic(null, list("amount" = "[useramount]", "remove" = "[id]")) else if (href_list["toggle"]) @@ -162,7 +162,8 @@ return if (href_list["createpill_multiple"]) - count = Clamp(isgoodnumber(input("Select the number of pills to make.", 10, pillamount) as num),1,max_pill_count) + count = input("Select the number of pills to make.", "Max [max_pill_count]", pillamount) as num + count = Clamp(count, 1, max_pill_count) if(reagents.total_volume/count < 1) //Sanity checking. return @@ -291,12 +292,6 @@ onclose(user, "chem_master") return -/obj/machinery/chem_master/proc/isgoodnumber(var/num) - if(isnum(num)) - return Clamp(round(num), 0, 200) - else - return 0 - /obj/machinery/chem_master/condimaster name = "CondiMaster 3000" condi = 1