Makes chemmasters use spritesheets. (#10816)

This commit is contained in:
MarinaGryphon
2020-12-28 12:29:44 +02:00
committed by GitHub
parent 2e91b01ffa
commit 0e974c601c
3 changed files with 72 additions and 30 deletions
+14 -20
View File
@@ -61,7 +61,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the
while(client && !client.completed_asset_jobs.Find(job) && t < timeout_time) // Reception is handled in Topic()
sleep(1) // Lock up the caller until this is received.
t++
if(t >= timeout_time)
log_admin(SPAN_DANGER("Timeout time [timeout_time] exceeded for asset: [asset_name] for client [client]. Please notify a developer."))
@@ -175,25 +175,6 @@ var/list/asset_datums = list()
/datum/asset/simple/send(client)
send_asset_list(client,assets,verify)
/datum/asset/chem_master
var/list/bottle_sprites = list("bottle-1", "bottle-2", "bottle-3", "bottle-4")
var/max_pill_sprite = 20
var/list/assets = list()
/datum/asset/chem_master/register()
for (var/i = 1 to max_pill_sprite)
var/name = "pill[i].png"
register_asset(name, icon('icons/obj/chemical.dmi', "pill[i]"))
assets += name
for (var/sprite in bottle_sprites)
var/name = "[sprite].png"
register_asset(name, icon('icons/obj/chemical.dmi', sprite))
assets += name
/datum/asset/chem_master/send(client)
send_asset_list(client, assets)
/datum/asset/group
_abstract = /datum/asset/group
var/list/children
@@ -528,3 +509,16 @@ var/list/asset_datums = list()
else
Insert(imgid, I)
return ..()
/datum/asset/spritesheet/chem_master
name = "chemmaster"
var/list/bottle_sprites = list("bottle-1", "bottle-2", "bottle-3", "bottle-4")
var/max_pill_sprite = 20
/datum/asset/spritesheet/chem_master/register()
for (var/i = 1 to max_pill_sprite)
Insert("pill[i]", 'icons/obj/chemical.dmi', "pill[i]")
for (var/sprite in bottle_sprites)
Insert(sprite, icon('icons/obj/chemical.dmi', sprite))
return ..()
+17 -10
View File
@@ -26,6 +26,7 @@
var/pillsprite = "1"
var/max_pill_count = 20
flags = OPENCONTAINER
var/datum/asset/spritesheet/chem_master/chem_asset
/obj/machinery/chem_master/Initialize()
. = ..()
@@ -202,16 +203,23 @@
var/obj/item/reagent_containers/food/condiment/P = new/obj/item/reagent_containers/food/condiment(get_turf(src))
reagents.trans_to_obj(P,50)
else if(href_list["change_pill"])
var/dat = "<table>"
if(!chem_asset)
chem_asset = get_asset_datum(/datum/asset/spritesheet/chem_master)
var/dat = chem_asset.css_tag()
dat += "<table>"
for(var/i = 1 to MAX_PILL_SPRITE)
dat += "<tr><td><a href=\"?src=\ref[src]&pill_sprite=[i]\"><img src=\"pill[i].png\" /></a></td></tr>"
var/pillicon = "pill[i]"
dat += "<tr><td><a href=\"?src=\ref[src]&pill_sprite=[i]\">[chem_asset.icon_tag(pillicon)]</a></td></tr>"
dat += "</table>"
usr << browse(dat, "window=chem_master")
return
else if(href_list["change_bottle"])
var/dat = "<table>"
if(!chem_asset)
chem_asset = get_asset_datum(/datum/asset/spritesheet/chem_master)
var/dat = chem_asset.css_tag()
dat += "<table>"
for(var/sprite in BOTTLE_SPRITES)
dat += "<tr><td><a href=\"?src=\ref[src]&bottle_sprite=[sprite]\"><img src=\"[sprite].png\" /></a></td></tr>"
dat += "<tr><td><a href=\"?src=\ref[src]&bottle_sprite=[sprite]\">[chem_asset.icon_tag(sprite)]</a></td></tr>"
dat += "</table>"
usr << browse(dat, "window=chem_master")
return
@@ -233,10 +241,9 @@
return
user.set_machine(src)
var/datum/asset/pill_icons = get_asset_datum(/datum/asset/chem_master)
pill_icons.send(user.client)
var/dat = ""
if(!chem_asset)
chem_asset = get_asset_datum(/datum/asset/spritesheet/chem_master)
var/dat = chem_asset.css_tag()
if(!beaker)
dat = "Please insert beaker.<BR>"
if(src.loaded_pill_bottle)
@@ -277,9 +284,9 @@
else
dat += "Empty<BR>"
if(!condi)
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 += "<HR><BR><A href='?src=\ref[src];createpill=1'>Create pill (60 units max)</A><a href=\"?src=\ref[src]&change_pill=1\">[chem_asset.icon_tag("pill[pillsprite]")]</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 (60 units max)<a href=\"?src=\ref[src]&change_bottle=1\"><img src=\"[bottlesprite].png\" /></A>"
dat += "<A href='?src=\ref[src];createbottle=1'>Create bottle (60 units max)<a href=\"?src=\ref[src]&change_bottle=1\">[chem_asset.icon_tag(bottlesprite)]</A>"
else
dat += "<A href='?src=\ref[src];createbottle=1'>Create bottle (50 units max)</A>"
if(!condi)
+41
View File
@@ -0,0 +1,41 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: MoondancerPony
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- refactor: "Chemmaster UI icons are now sent via spritesheets."