Merge pull request #17 from alex-gh/improved_bottles

Made bottles behave visually like beakers.
This commit is contained in:
ZomgPonies
2013-10-29 08:53:39 -07:00
3 changed files with 33 additions and 2 deletions
+2 -2
View File
@@ -386,12 +386,12 @@
reagents.clear_reagents()
icon_state = "mixer0"
else if (href_list["createpill"] || href_list["createpill_multiple"])
var/name = reject_bad_text(input(usr,"Name:","Name your pill!",reagents.get_master_reagent_name()))
var/count = 1
if (href_list["createpill_multiple"]) count = isgoodnumber(input("Select the number of pills to make.", 10, pillamount) as num)
if (count > 20) count = 20 //Pevent people from creating huge stacks of pills easily. Maybe move the number to defines?
var/amount_per_pill = reagents.total_volume/count
if (amount_per_pill > 50) amount_per_pill = 50
var/name = reject_bad_text(input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill] units)"))
while (count--)
var/obj/item/weapon/reagent_containers/pill/P = new/obj/item/weapon/reagent_containers/pill(src.loc)
if(!name) name = reagents.get_master_reagent_name()
@@ -501,7 +501,7 @@
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 += "<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 (30 units max)</A>"
else
dat += "<A href='?src=\ref[src];createbottle=1'>Create bottle (50 units max)</A>"
if(!condi)
@@ -17,9 +17,40 @@
if(!icon_state)
icon_state = "bottle[rand(1,20)]"
//Copypasta from /obj/item/weapon/reagent_containers/glass/beaker
on_reagent_change()
update_icon()
pickup(mob/user)
..()
update_icon()
dropped(mob/user)
..()
update_icon()
attack_hand()
..()
update_icon()
update_icon()
overlays.Cut()
if(reagents.total_volume)
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 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 90) filling.icon_state = "[icon_state]75"
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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB