From cb367a7d1ba3f5c51394fe1c171c0a2f618edbd7 Mon Sep 17 00:00:00 2001 From: Exxion Date: Thu, 1 Dec 2022 21:38:04 -0500 Subject: [PATCH] Changes bicon() to use the builtin 515 feature --- code/game/machinery/kitchen/smartfridge.dm | 4 +-- code/game/machinery/vending.dm | 4 +-- goon/code/datums/browserOutput.dm | 39 ++++------------------ 3 files changed, 10 insertions(+), 37 deletions(-) diff --git a/code/game/machinery/kitchen/smartfridge.dm b/code/game/machinery/kitchen/smartfridge.dm index 3688bfd182d2..18f816d0c7e1 100644 --- a/code/game/machinery/kitchen/smartfridge.dm +++ b/code/game/machinery/kitchen/smartfridge.dm @@ -261,7 +261,7 @@ icon_state = "bloodbank" icon_on = "bloodbank" - accepted_types = list(/obj/item/weapon/reagent_containers/blood) + accepted_types = list(/obj/item/weapon/reagent_containers/blood) /obj/machinery/smartfridge/bloodbank/New() . = ..() @@ -336,7 +336,7 @@ if(istype(thisPile)) thisPile.addAmount(1) else - piles[formatted_name] = new/datum/fridge_pile(formatted_name, src, 1, costly_bicon(O)) + piles[formatted_name] = new/datum/fridge_pile(formatted_name, src, 1, bicon(O)) /obj/machinery/smartfridge/proc/dump_bag(var/obj/item/weapon/storage/bag/B, var/mob/user) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index f61c7ef406b9..a5c95f27ba0b 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -191,7 +191,7 @@ var/global/num_vending_terminals = 1 qdel(coinbox) coinbox = null ..() - + /obj/machinery/vending/splashable() return FALSE @@ -587,7 +587,7 @@ var/global/num_vending_terminals = 1 var/datum/data/vending_product/R = new() R.custom = TRUE R.product_name = item.product_name() - R.mini_icon = costly_bicon(item) + R.mini_icon = bicon(item) R.display_color = pick("red", "blue", "green") R.amount = 1 if(item.price) // price tagger - only works on new items diff --git a/goon/code/datums/browserOutput.dm b/goon/code/datums/browserOutput.dm index 435061d122d4..9bc02f672300 100644 --- a/goon/code/datums/browserOutput.dm +++ b/goon/code/datums/browserOutput.dm @@ -238,45 +238,18 @@ For the main html chat area var/list/partial = splittext(iconData, "{") return replacetext(copytext(partial[2], 3, -5), "\n", "") -/proc/bicon(var/obj) - if (!obj) - return +/proc/bicon(atom/A) + if(isatom(A)) + A = A.appearance //The caching is not very smart if you use the object directly. + + 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. - if (isicon(obj)) - //Icons get pooled constantly, references are no good here. - /*if (!bicon_cache["\ref[obj]"]) // Doesn't exist yet, make it. - bicon_cache["\ref[obj]"] = icon2base64(obj) - return ""*/ - return "" - - // Either an atom or somebody fucked up and is gonna get a runtime, which I'm fine with. - var/atom/A = obj - var/key = ("[A.icon]" || "\ref[A.icon]")+":[A.icon_state]" - if (!bicon_cache[key]) // Doesn't exist, make it. - var/icon/I = icon(A.icon, A.icon_state, SOUTH, 1, 0) - if (!"[A.icon]") // Shitty workaround for a BYOND issue. - var/icon/temp = I - I = icon() - I.Insert(temp, dir = SOUTH) - bicon_cache[key] = icon2base64(I, key) - - return "" + return "" //Aliases for bicon /proc/bi(obj) bicon(obj) -//Costlier version of bicon() that uses getFlatIcon() to account for overlays, underlays, etc. Use with extreme moderation, ESPECIALLY on mobs. -/proc/costly_bicon(var/obj) - if (!obj) - return - - if (isicon(obj)) - return bicon(obj) - - var/icon/I = getFlatIcon(obj) - return bicon(I) - /proc/to_chat(target, message) //Ok so I did my best but I accept that some calls to this will be for shit like sound and images //It stands that we PROBABLY don't want to output those to the browser output so just handle them here