mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-25 22:12:58 +01:00
Upgrades smartfridge ui (#21906)
For smartfridges and subtypes, this makes the vend buttons a little neater and more importantly make it possible to see what you are buying as the icons are displayed. The icons are not displayed for produce for the time being. <img width="400" height="500" alt="image" src="https://github.com/user-attachments/assets/12632d10-8aea-4255-b4db-7643e0d1a9cb" />
This commit is contained in:
@@ -428,10 +428,35 @@
|
||||
var/K = item_quants[i]
|
||||
var/count = item_quants[K]
|
||||
if(count > 0)
|
||||
items.Add(list(list("display_name" = capitalize(K), "vend" = i, "quantity" = count)))
|
||||
|
||||
var/obj/item/item_used = null
|
||||
for (var/obj/item/O in contents)
|
||||
if(O.name == K)
|
||||
item_used = O
|
||||
break
|
||||
|
||||
var/icon/item_icon = null
|
||||
if(item_used)
|
||||
if(istype(item_used, /obj/item/seeds))
|
||||
var/obj/item/seeds/S = item_used
|
||||
item_icon = S.update_appearance(TRUE)
|
||||
else
|
||||
item_icon = new /icon(item_used.icon, item_used.icon_state)
|
||||
|
||||
var/final_icon = null
|
||||
if(item_icon)
|
||||
final_icon = icon2base64(item_icon)
|
||||
|
||||
items.Add(list(list(
|
||||
"display_name" = capitalize(K),
|
||||
"vend" = i,
|
||||
"quantity" = count,
|
||||
"icon" = final_icon,
|
||||
)))
|
||||
|
||||
if(length(items) > 0)
|
||||
data["contents"] = items
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/smartfridge/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
|
||||
Reference in New Issue
Block a user