Reagent overlays for bottles from the Chem Master.

Chemistry containers now have capacities in multiples of 60 (60 for bottles, pills and small beakers, 120 for large beakers and buckets) to make reactions more convenient.
This commit is contained in:
RavingManiac
2014-09-14 22:19:39 +08:00
parent a458377fd8
commit d91d5aad0b
6 changed files with 71 additions and 39 deletions
+12 -11
View File
@@ -128,8 +128,8 @@
amount = round(text2num(href_list["amount"]), 5) // round to nearest 5
if (amount < 0) // Since the user can actually type the commands himself, some sanity checking
amount = 0
if (amount > 100)
amount = 100
if (amount > 120)
amount = 120
if(href_list["dispense"])
if (dispensable_reagents.Find(href_list["dispense"]) && beaker != null)
@@ -250,7 +250,7 @@
/obj/machinery/chem_master/New()
..()
var/datum/reagents/R = new/datum/reagents(100)
var/datum/reagents/R = new/datum/reagents(120)
reagents = R
R.my_atom = src
@@ -396,7 +396,7 @@
return
var/amount_per_pill = reagents.total_volume/count
if (amount_per_pill > 50) amount_per_pill = 50
if (amount_per_pill > 60) amount_per_pill = 60
var/name = reject_bad_text(input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill] units)"))
@@ -423,8 +423,9 @@
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)
P.icon_state = "bottle-"+bottlesprite
reagents.trans_to(P,60)
P.update_icon()
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)
@@ -437,10 +438,10 @@
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
#define MAX_BOTTLE_SPRITE 4 //max icon state of the bottle sprites
var/dat = "<table>"
for(var/i = 1 to MAX_BOTTLE_SPRITE)
dat += "<tr><td><a href=\"?src=\ref[src]&bottle_sprite=[i]\"><img src=\"bottle[i].png\" /></a></td></tr>"
dat += "<tr><td><a href=\"?src=\ref[src]&bottle_sprite=[i]\"><img src=\"bottle-[i].png\" /></a></td></tr>"
dat += "</table>"
usr << browse(dat, "window=chem_master")
return
@@ -468,7 +469,7 @@
for(var/i = 1 to MAX_PILL_SPRITE)
usr << browse_rsc(icon('icons/obj/chemical.dmi', "pill" + num2text(i)), "pill[i].png")
for(var/i = 1 to MAX_BOTTLE_SPRITE)
usr << browse_rsc(icon('icons/obj/chemical.dmi', "bottle" + num2text(i)), "bottle[i].png")
usr << browse_rsc(icon('icons/obj/chemical.dmi', "bottle-" + num2text(i)), "bottle-[i].png")
var/dat = ""
if(!beaker)
dat = "Please insert beaker.<BR>"
@@ -510,9 +511,9 @@
else
dat += "Empty<BR>"
if(!condi)
dat += "<HR><BR><A href='?src=\ref[src];createpill=1'>Create pill (50 units max)</A><a href=\"?src=\ref[src]&change_pill=1\"><img src=\"pill[pillsprite].png\" /></a><BR>"
dat += "<HR><BR><A href='?src=\ref[src];createpill=1'>Create pill (60 units max)</A><a href=\"?src=\ref[src]&change_pill=1\"><img src=\"pill[pillsprite].png\" /></a><BR>"
dat += "<A href='?src=\ref[src];createpill_multiple=1'>Create multiple pills</A><BR>"
dat += "<A href='?src=\ref[src];createbottle=1'>Create bottle (30 units max)<a href=\"?src=\ref[src]&change_bottle=1\"><img src=\"bottle[bottlesprite].png\" /></A>"
dat += "<A href='?src=\ref[src];createbottle=1'>Create bottle (60 units max)<a href=\"?src=\ref[src]&change_bottle=1\"><img src=\"bottle-[bottlesprite].png\" /></A>"
else
dat += "<A href='?src=\ref[src];createbottle=1'>Create bottle (50 units max)</A>"
if(!condi)
@@ -10,8 +10,8 @@
icon_state = "null"
item_state = "null"
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,25,30,50)
volume = 50
possible_transfer_amounts = list(5,10,15,25,30,60)
volume = 60
flags = FPRINT | TABLEPASS | OPENCONTAINER
var/label_text = ""
@@ -206,9 +206,9 @@
desc = "A large beaker. Can hold up to 100 units."
icon_state = "beakerlarge"
matter = list("glass" = 5000)
volume = 100
volume = 120
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,25,30,50,100)
possible_transfer_amounts = list(5,10,15,25,30,60,120)
flags = FPRINT | TABLEPASS | OPENCONTAINER
/obj/item/weapon/reagent_containers/glass/beaker/noreact
@@ -216,7 +216,7 @@
desc = "A cryostasis beaker that allows for chemical storage without reactions. Can hold up to 50 units."
icon_state = "beakernoreact"
matter = list("glass" = 500)
volume = 50
volume = 60
amount_per_transfer_from_this = 10
flags = FPRINT | TABLEPASS | OPENCONTAINER | NOREACT
@@ -227,7 +227,7 @@
matter = list("glass" = 5000)
volume = 300
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,25,30,50,100,300)
possible_transfer_amounts = list(5,10,15,25,30,60,120,300)
flags = FPRINT | TABLEPASS | OPENCONTAINER
@@ -236,7 +236,7 @@
desc = "A small glass vial. Can hold up to 25 units."
icon_state = "vial"
matter = list("glass" = 250)
volume = 25
volume = 30
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,25)
flags = FPRINT | TABLEPASS | OPENCONTAINER
@@ -250,13 +250,13 @@
/obj/item/weapon/reagent_containers/glass/beaker/sulphuric
New()
..()
reagents.add_reagent("sacid", 50)
reagents.add_reagent("sacid", 60)
update_icon()
/obj/item/weapon/reagent_containers/glass/beaker/slime
New()
..()
reagents.add_reagent("slimejelly", 50)
reagents.add_reagent("slimejelly", 60)
update_icon()
/obj/item/weapon/reagent_containers/glass/bucket
@@ -268,8 +268,8 @@
matter = list("metal" = 200)
w_class = 3.0
amount_per_transfer_from_this = 20
possible_transfer_amounts = list(10,20,30,50,70)
volume = 70
possible_transfer_amounts = list(10,20,30,60,120)
volume = 120
flags = FPRINT | OPENCONTAINER
attackby(var/obj/D, mob/user as mob)
@@ -8,18 +8,49 @@
icon_state = null
item_state = "atoxinbottle"
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,25,30)
possible_transfer_amounts = list(5,10,15,25,30,60)
flags = FPRINT | TABLEPASS | OPENCONTAINER
volume = 30
volume = 60
on_reagent_change()
update_icon()
pickup(mob/user)
..()
update_icon()
dropped(mob/user)
..()
update_icon()
attack_hand()
..()
update_icon()
New()
..()
if(!icon_state)
icon_state = "bottle[rand(1,20)]"
icon_state = "bottle-[rand(1.4)]"
update_icon()
overlays.Cut()
if(reagents.total_volume && (icon_state == "bottle-1" || icon_state == "bottle-2" || icon_state == "bottle-3" || icon_state == "bottle-4"))
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]10")
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9) filling.icon_state = "[icon_state]--10"
if(10 to 24) filling.icon_state = "[icon_state]-10"
if(25 to 49) filling.icon_state = "[icon_state]-25"
if(50 to 74) filling.icon_state = "[icon_state]-50"
if(75 to 79) filling.icon_state = "[icon_state]-75"
if(80 to 90) filling.icon_state = "[icon_state]-80"
if(91 to INFINITY) filling.icon_state = "[icon_state]-100"
filling.icon += mix_color_from_reagents(reagents.reagent_list)
overlays += filling
if (!is_open_container())
var/image/lid = image(icon, src, "lid_bottle")
overlays += lid
@@ -32,7 +63,7 @@
New()
..()
reagents.add_reagent("inaprovaline", 30)
reagents.add_reagent("inaprovaline", 60)
/obj/item/weapon/reagent_containers/glass/bottle/toxin
name = "toxin bottle"
@@ -42,7 +73,7 @@
New()
..()
reagents.add_reagent("toxin", 30)
reagents.add_reagent("toxin", 60)
/obj/item/weapon/reagent_containers/glass/bottle/cyanide
name = "cyanide bottle"
@@ -52,7 +83,7 @@
New()
..()
reagents.add_reagent("cyanide", 30)
reagents.add_reagent("cyanide", 60)
/obj/item/weapon/reagent_containers/glass/bottle/stoxin
name = "soporific bottle"
@@ -62,7 +93,7 @@
New()
..()
reagents.add_reagent("stoxin", 30)
reagents.add_reagent("stoxin", 60)
/obj/item/weapon/reagent_containers/glass/bottle/chloralhydrate
name = "Chloral Hydrate Bottle"
@@ -72,7 +103,7 @@
New()
..()
reagents.add_reagent("chloralhydrate", 15) //Intentionally low since it is so strong. Still enough to knock someone out.
reagents.add_reagent("chloralhydrate", 30) //Intentionally low since it is so strong. Still enough to knock someone out.
/obj/item/weapon/reagent_containers/glass/bottle/antitoxin
name = "dylovene bottle"
@@ -82,7 +113,7 @@
New()
..()
reagents.add_reagent("anti_toxin", 30)
reagents.add_reagent("anti_toxin", 60)
/obj/item/weapon/reagent_containers/glass/bottle/mutagen
name = "unstable mutagen bottle"
@@ -92,7 +123,7 @@
New()
..()
reagents.add_reagent("mutagen", 30)
reagents.add_reagent("mutagen", 60)
/obj/item/weapon/reagent_containers/glass/bottle/ammonia
name = "ammonia bottle"
@@ -102,7 +133,7 @@
New()
..()
reagents.add_reagent("ammonia", 30)
reagents.add_reagent("ammonia", 60)
/obj/item/weapon/reagent_containers/glass/bottle/diethylamine
name = "diethylamine bottle"
@@ -112,7 +143,7 @@
New()
..()
reagents.add_reagent("diethylamine", 30)
reagents.add_reagent("diethylamine", 60)
/obj/item/weapon/reagent_containers/glass/bottle/flu_virion
name = "Flu virion culture bottle"
@@ -286,7 +317,7 @@
icon_state = "bottle17"
New()
..()
reagents.add_reagent("pacid", 30)
reagents.add_reagent("pacid", 60)
/obj/item/weapon/reagent_containers/glass/bottle/adminordrazine
name = "Adminordrazine Bottle"
@@ -295,7 +326,7 @@
icon_state = "holyflask"
New()
..()
reagents.add_reagent("adminordrazine", 30)
reagents.add_reagent("adminordrazine", 60)
/obj/item/weapon/reagent_containers/glass/bottle/capsaicin
name = "Capsaicin Bottle"
@@ -304,7 +335,7 @@
icon_state = "bottle3"
New()
..()
reagents.add_reagent("capsaicin", 30)
reagents.add_reagent("capsaicin", 60)
/obj/item/weapon/reagent_containers/glass/bottle/frostoil
name = "Frost Oil Bottle"
@@ -313,4 +344,4 @@
icon_state = "bottle17"
New()
..()
reagents.add_reagent("frostoil", 30)
reagents.add_reagent("frostoil", 60)
@@ -9,7 +9,7 @@
item_state = "pill"
possible_transfer_amounts = null
w_class = 1
volume = 50
volume = 60
New()
..()