Skip to content

Commit cb367a7

Browse files
committed
Changes bicon() to use the builtin 515 feature
1 parent 1010fae commit cb367a7

File tree

3 files changed

+10
-37
lines changed

3 files changed

+10
-37
lines changed

code/game/machinery/kitchen/smartfridge.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
icon_state = "bloodbank"
262262
icon_on = "bloodbank"
263263

264-
accepted_types = list(/obj/item/weapon/reagent_containers/blood)
264+
accepted_types = list(/obj/item/weapon/reagent_containers/blood)
265265

266266
/obj/machinery/smartfridge/bloodbank/New()
267267
. = ..()
@@ -336,7 +336,7 @@
336336
if(istype(thisPile))
337337
thisPile.addAmount(1)
338338
else
339-
piles[formatted_name] = new/datum/fridge_pile(formatted_name, src, 1, costly_bicon(O))
339+
piles[formatted_name] = new/datum/fridge_pile(formatted_name, src, 1, bicon(O))
340340

341341

342342
/obj/machinery/smartfridge/proc/dump_bag(var/obj/item/weapon/storage/bag/B, var/mob/user)

code/game/machinery/vending.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ var/global/num_vending_terminals = 1
191191
qdel(coinbox)
192192
coinbox = null
193193
..()
194-
194+
195195
/obj/machinery/vending/splashable()
196196
return FALSE
197197

@@ -587,7 +587,7 @@ var/global/num_vending_terminals = 1
587587
var/datum/data/vending_product/R = new()
588588
R.custom = TRUE
589589
R.product_name = item.product_name()
590-
R.mini_icon = costly_bicon(item)
590+
R.mini_icon = bicon(item)
591591
R.display_color = pick("red", "blue", "green")
592592
R.amount = 1
593593
if(item.price) // price tagger - only works on new items

goon/code/datums/browserOutput.dm

+6-33
Original file line numberDiff line numberDiff line change
@@ -238,45 +238,18 @@ For the main html chat area
238238
var/list/partial = splittext(iconData, "{")
239239
return replacetext(copytext(partial[2], 3, -5), "\n", "")
240240

241-
/proc/bicon(var/obj)
242-
if (!obj)
243-
return
241+
/proc/bicon(atom/A)
242+
if(isatom(A))
243+
A = A.appearance //The caching is not very smart if you use the object directly.
244+
245+
spawn(5){} //Do nothing. Just hold onto a ref of A for a moment. Hopefully there will be a better way to do this later.
244246

245-
if (isicon(obj))
246-
//Icons get pooled constantly, references are no good here.
247-
/*if (!bicon_cache["\ref[obj]"]) // Doesn't exist yet, make it.
248-
bicon_cache["\ref[obj]"] = icon2base64(obj)
249-
return "<img class='icon misc' src='data:image/png;base64,[bicon_cache["\ref[obj]"]]'>"*/
250-
return "<img class='icon misc' src='data:image/png;base64,[icon2base64(obj)]'>"
251-
252-
// Either an atom or somebody fucked up and is gonna get a runtime, which I'm fine with.
253-
var/atom/A = obj
254-
var/key = ("[A.icon]" || "\ref[A.icon]")+":[A.icon_state]"
255-
if (!bicon_cache[key]) // Doesn't exist, make it.
256-
var/icon/I = icon(A.icon, A.icon_state, SOUTH, 1, 0)
257-
if (!"[A.icon]") // Shitty workaround for a BYOND issue.
258-
var/icon/temp = I
259-
I = icon()
260-
I.Insert(temp, dir = SOUTH)
261-
bicon_cache[key] = icon2base64(I, key)
262-
263-
return "<img class='icon [A.icon_state]' src='data:image/png;base64,[bicon_cache[key]]'>"
247+
return "<img class='icon' src='\ref[A]'>"
264248

265249
//Aliases for bicon
266250
/proc/bi(obj)
267251
bicon(obj)
268252

269-
//Costlier version of bicon() that uses getFlatIcon() to account for overlays, underlays, etc. Use with extreme moderation, ESPECIALLY on mobs.
270-
/proc/costly_bicon(var/obj)
271-
if (!obj)
272-
return
273-
274-
if (isicon(obj))
275-
return bicon(obj)
276-
277-
var/icon/I = getFlatIcon(obj)
278-
return bicon(I)
279-
280253
/proc/to_chat(target, message)
281254
//Ok so I did my best but I accept that some calls to this will be for shit like sound and images
282255
//It stands that we PROBABLY don't want to output those to the browser output so just handle them here

0 commit comments

Comments
 (0)