Made chemmasters a lot more responsive.

This commit is contained in:
Miniature
2012-04-15 22:53:21 +09:30
parent d2032c0509
commit 6f088e4695
+24 -6
View File
@@ -173,6 +173,7 @@
var/condi = 0
var/bottlesprite = "1" //yes, strings
var/pillsprite = "1"
var/client/has_sprites = list()
New()
var/datum/reagents/R = new/datum/reagents(100)
@@ -314,7 +315,6 @@
#define MAX_PILL_SPRITE 20 //max icon state of the pill sprites
var/dat = "<table>"
for(var/i = 1 to MAX_PILL_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "pill" + num2text(i)), "pill[i].png")
dat += "<tr><td><a href=\"?src=\ref[src]&pill_sprite=[i]\"><img src=\"pill[i].png\" /></a></td></tr>"
dat += "</table>"
usr << browse(dat, "window=chem_master")
@@ -323,7 +323,6 @@
#define MAX_BOTTLE_SPRITE 20 //max icon state of the bottle sprites
var/dat = "<table>"
for(var/i = 1 to MAX_BOTTLE_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "bottle" + num2text(i)), "bottle[i].png")
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")
@@ -346,13 +345,34 @@
attack_hand(mob/user as mob)
if(stat & BROKEN)
spawn()
if(!(user.client in has_sprites)) //yes, it's in three places, so they get downloaded even when they arent going to be shown, because they could be in the future
spawn()
has_sprites += user.client
for(var/i = 1 to MAX_PILL_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "pill" + num2text(i)), "pill[i].png")
for(var/i = 1 to MAX_BOTTLE_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "bottle" + num2text(i)), "bottle[i].png")
return
user.machine = src
var/dat = ""
if(!beaker)
dat = "Please insert beaker.<BR>"
dat += "<A href='?src=\ref[src];close=1'>Close</A>"
if(!(user.client in has_sprites))
spawn()
has_sprites += user.client
for(var/i = 1 to MAX_PILL_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "pill" + num2text(i)), "pill[i].png")
for(var/i = 1 to MAX_BOTTLE_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "bottle" + num2text(i)), "bottle[i].png")
else
if(!(user.client in has_sprites))
has_sprites += user.client
for(var/i = 1 to MAX_PILL_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "pill" + num2text(i)), "pill[i].png")
for(var/i = 1 to MAX_BOTTLE_SPRITE)
usr << browse_rsc(icon('chemical.dmi', "bottle" + num2text(i)), "bottle[i].png")
var/datum/reagents/R = beaker:reagents
dat += "<A href='?src=\ref[src];eject=1'>Eject beaker and Clear Buffer</A><BR><BR>"
if(!R.total_volume)
@@ -381,10 +401,8 @@
else
dat += "Empty<BR>"
if(!condi)
usr << browse_rsc(icon('chemical.dmi', "pill" + pillsprite), "pill.png")
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.png\" /></a><BR>"
usr << browse_rsc(icon('chemical.dmi', "bottle" + bottlesprite), "bottle.png")
dat += "<A href='?src=\ref[src];createbottle=1'>Create bottle (30 units max)</A><a href=\"?src=\ref[src]&change_bottle=1\"><img src=\"bottle.png\" /></a>"
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];createbottle=1'>Create bottle (30 units max)</A><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)