From fb8f3de22aa2ea3b6ccf8cf051f798bd54ec8e93 Mon Sep 17 00:00:00 2001 From: "giacomand@gmail.com" Date: Wed, 28 Nov 2012 05:04:01 +0000 Subject: [PATCH] Fixed an exploit with the Chem Master. Added some general improvements. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5216 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/reagents/Chemistry-Machinery.dm | 83 ++++++++------------ 1 file changed, 32 insertions(+), 51 deletions(-) diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index a8a87cc73c8..726dec39875 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -127,7 +127,7 @@ if (amount > 100) amount = 100 - for(var/mob/player) + for(var/mob/player in player_list) if (player.machine == src && player.client) updateWindow(player) @@ -149,7 +149,7 @@ user.drop_item() B.loc = src user << "You add the beaker to the machine!" - for(var/mob/player) + for(var/mob/player in player_list) if (player.machine == src && player.client) updateWindow(player) @@ -244,7 +244,6 @@ src.updateUsrDialog() return - /obj/machinery/chem_master/Topic(href, href_list) if(stat & (BROKEN|NOPOWER)) return if(usr.stat || usr.restrained()) return @@ -273,58 +272,42 @@ dat += "Condimaster 3000Condiment infos:

Name:
[href_list["name"]]

Description:
[href_list["desc"]]


(Back)" usr << browse(dat, "window=chem_master;size=575x400") return - else if (href_list["add1"]) - /* - (this fixes a pretty serious exploit) ~~ Doohl - R.remove_reagent(href_list["add1"], 1) //Remove/add used instead of trans_to since we're moving a specific reagent. - reagents.add_reagent(href_list["add1"], 1) - */ + else if (href_list["add"]) - R.trans_id_to(src, href_list["add1"], 1) + if(href_list["amount"]) + var/id = href_list["add"] + var/amount = text2num(href_list["amount"]) + R.trans_id_to(src, id, amount) - else if (href_list["add5"]) - R.trans_id_to(src, href_list["add5"], 5) - else if (href_list["add10"]) - R.trans_id_to(src, href_list["add10"], 10) - else if (href_list["addall"]) - var/temp_amt = R.get_reagent_amount(href_list["addall"]) - R.trans_id_to(src, href_list["addall"], temp_amt) else if (href_list["addcustom"]) var/id = href_list["addcustom"] useramount = input("Select the amount to transfer.", 30, useramount) as num useramount = isgoodnumber(useramount) - var/realamount = R.get_reagent_amount(id) - R.trans_id_to(src, href_list["addcustom"], realamount) + src.Topic(null, list("amount" = "[useramount]", "add" = "[id]")) + + else if (href_list["remove"]) + + if(href_list["amount"]) + var/id = href_list["remove"] + var/amount = text2num(href_list["amount"]) + if(mode) + reagents.trans_id_to(beaker, id, amount) + else + reagents.remove_reagent(id, amount) + - else if (href_list["remove1"]) - reagents.remove_reagent(href_list["remove1"], 1) - if(mode) R.add_reagent(href_list["remove1"], 1) - else if (href_list["remove5"]) - reagents.remove_reagent(href_list["remove5"], 5) - if(mode) R.add_reagent(href_list["remove5"], 5) - else if (href_list["remove10"]) - reagents.remove_reagent(href_list["remove10"], 10) - if(mode) R.add_reagent(href_list["remove10"], 10) - else if (href_list["removeall"]) - if(mode) - var/temp_amt = reagents.get_reagent_amount(href_list["removeall"]) - R.add_reagent(href_list["removeall"], temp_amt) - reagents.del_reagent(href_list["removeall"]) else if (href_list["removecustom"]) var/id = href_list["removecustom"] useramount = input("Select the amount to transfer.", 30, useramount) as num useramount = isgoodnumber(useramount) - reagents.remove_reagent(id, useramount) - if(mode) R.add_reagent(id, useramount) + src.Topic(null, list("amount" = "[useramount]", "remove" = "[id]")) else if (href_list["toggle"]) - if(mode) - mode = 0 - else - mode = 1 + mode = !mode + else if (href_list["main"]) attack_hand(usr) return @@ -397,23 +380,21 @@ for(var/datum/reagent/G in R.reagent_list) dat += "[G.name] , [G.volume] Units - " dat += "(Analyze) " - dat += "(1) " - if(G.volume >= 5) dat += "(5) " - if(G.volume >= 10) dat += "(10) " - dat += "(All) " + dat += "(1) " + dat += "(5) " + dat += "(10) " + dat += "(All) " dat += "(Custom)
" - if(!mode) - dat += "
Transfer to disposal:
" - else - dat += "
Transfer to beaker:
" + + dat += "
Transfer to [(!mode ? "disposal" : "beaker")]:
" if(reagents.total_volume) for(var/datum/reagent/N in reagents.reagent_list) dat += "[N.name] , [N.volume] Units - " dat += "(Analyze) " - dat += "(1) " - if(N.volume >= 5) dat += "(5) " - if(N.volume >= 10) dat += "(10) " - dat += "(All) " + dat += "(1) " + dat += "(5) " + dat += "(10) " + dat += "(All) " dat += "(Custom)
" else dat += "Empty
"