Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 085bd5a

Browse files
Switched UI image to base64 from hedgehog's code
1 parent 4eab4e0 commit 085bd5a

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

code/modules/food_and_drinks/kitchen_machinery/food_cart.dm

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
///For sending images to the UI with base 64
2+
/datum/data/ui_image
3+
///Image to be shown in UI
4+
var/image = null
5+
6+
//Thanks hedgehog1029 for the help on this
7+
/datum/data/ui_image/New(obj/item/I)
8+
var/icon/icon = icon(I.icon, I.icon_state, SOUTH, 1)
9+
image = icon2base64(icon)
10+
111
/obj/machinery/food_cart
212
name = "food cart"
313
desc = "New generation hot dog stand."
@@ -73,18 +83,21 @@
7383
details["type_path"] = item.type
7484

7585
//Get an image for the UI
76-
var/icon/item_pic = getFlatIcon(item)
77-
var/md5 = md5(fcopy_rsc(item_pic))
78-
if(!SSassets.cache["photo_[md5]_[item.name]_icon.png"])
79-
SSassets.transport.register_asset("photo_[md5]_[item.name]_icon.png", item_pic)
80-
SSassets.transport.send_assets(user, list("photo_[md5]_[item.name]_icon.png" = item_pic))
81-
details["image"] = SSassets.transport.get_asset_url("photo_[md5]_[item.name]_icon.png")
86+
// var/icon/item_pic = getFlatIcon(item)
87+
// var/md5 = md5(fcopy_rsc(item_pic))
88+
// if(!SSassets.cache["photo_[md5]_[item.name]_icon.png"])
89+
// SSassets.transport.register_asset("photo_[md5]_[item.name]_icon.png", item_pic)
90+
// SSassets.transport.send_assets(user, list("photo_[md5]_[item.name]_icon.png" = item_pic))
91+
// details["image"] = SSassets.transport.get_asset_url("photo_[md5]_[item.name]_icon.png")
92+
var/datum/data/ui_image/ui_image = new /datum/data/ui_image(item)
93+
details["image"] = ui_image.image
8294

8395
//Add to food list
8496
data["food"] += list(details)
8597

86-
//Delete food item to prevent server being overrun by ghost food
98+
//Delete instances to prevent server being overrun by spoopy ghost items
8799
qdel(item)
100+
qdel(ui_image)
88101

89102
//Loop through drink list for data to send to cart's reagent storage tab
90103
for(var/datum/reagent/drink in reagents.reagent_list)

tgui/packages/tgui/interfaces/FoodCart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const FoodRow = (props, context) => {
158158
{/* Get image and then add it to the ui */}
159159
<Box
160160
as="img"
161-
src={resolveAsset(item.image)}
161+
src={`data:image/jpeg;base64,${item.image}`}
162162
height="32px"
163163
style={{
164164
'-ms-interpolation-mode': 'nearest-neighbor',

0 commit comments

Comments
 (0)