From 9efde25a606f038acc5caa9d0aded7f9553a5349 Mon Sep 17 00:00:00 2001 From: Miniature Date: Fri, 17 Feb 2012 01:15:36 +1030 Subject: [PATCH] Added a thing to select pill and bottle sprites to the chemmaster At some point I'd like to see bottles doing the same thing as beakers, where they show what chemicals are in them on the sprite. That however would involve messing with sprites and overlays and stuff, so I can't be bothered to actually do it at the moment. Just remember that this stuff will need to be changed for that. --- code/modules/chemical/Chemistry-Machinery.dm | 32 ++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/code/modules/chemical/Chemistry-Machinery.dm b/code/modules/chemical/Chemistry-Machinery.dm index aebb052e6e9..e4635fbdf70 100644 --- a/code/modules/chemical/Chemistry-Machinery.dm +++ b/code/modules/chemical/Chemistry-Machinery.dm @@ -171,6 +171,8 @@ var/beaker = null var/mode = 0 var/condi = 0 + var/bottlesprite = "1" //yes, strings + var/pillsprite = "1" New() var/datum/reagents/R = new/datum/reagents(100) @@ -293,6 +295,7 @@ P.name = "[name] pill" P.pixel_x = rand(-7, 7) //random position P.pixel_y = rand(-7, 7) + P.icon_state = "pill"+pillsprite reagents.trans_to(P,50) else if (href_list["createbottle"]) if(!condi) @@ -302,10 +305,33 @@ P.name = "[name] bottle" P.pixel_x = rand(-7, 7) //random position P.pixel_y = rand(-7, 7) + P.icon_state = "bottle"+bottlesprite reagents.trans_to(P,30) else var/obj/item/weapon/reagent_containers/food/condiment/P = new/obj/item/weapon/reagent_containers/food/condiment(src.loc) reagents.trans_to(P,50) + else if(href_list["change_pill"]) + #define MAX_PILL_SPRITE 20 //max icon state of the pill sprites + var/dat = "" + for(var/i = 1 to MAX_PILL_SPRITE) + usr << browse_rsc(icon('chemical.dmi', "pill" + num2text(i)), "pill[i].png") + dat += "" + dat += "
" + usr << browse(dat, "window=chem_master") + return + else if(href_list["change_bottle"]) + #define MAX_BOTTLE_SPRITE 20 //max icon state of the bottle sprites + var/dat = "" + for(var/i = 1 to MAX_BOTTLE_SPRITE) + usr << browse_rsc(icon('chemical.dmi', "bottle" + num2text(i)), "bottle[i].png") + dat += "" + dat += "
" + usr << browse(dat, "window=chem_master") + return + else if(href_list["pill_sprite"]) + pillsprite = min(max(href_list["pill_sprite"],0),MAX_PILL_SPRITE) + else if(href_list["bottle_sprite"]) + bottlesprite = min(max(href_list["bottlesprite"],0),MAX_BOTTLE_SPRITE) else usr << browse(null, "window=chem_master") src.updateUsrDialog() @@ -355,8 +381,10 @@ else dat += "Empty
" if(!condi) - dat += "

Create pill (50 units max)
" - dat += "Create bottle (30 units max)" + usr << browse_rsc(icon('chemical.dmi', "pill" + pillsprite), "pill.png") + dat += "

Create pill (50 units max)
" + usr << browse_rsc(icon('chemical.dmi', "bottle" + bottlesprite), "bottle.png") + dat += "Create bottle (30 units max)" else dat += "Create bottle (50 units max)" if(!condi)