mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-29 02:21:44 +00:00
## About The Pull Request Upstream port of https://github.com/Monkestation/Monkestation2.0/pull/4215 This changes some tgui UIs that used icon2base64/getFlatIcon to display items to instead use DmIcon, just passing the icon/icon_state instead. To be specific: the ORM, the "ore container", and the order console (produce, mining, and bitrunning vendors) <details> <summary><h3>UI screenshots / proof of testing</h3></summary>      </details> ## Why It's Good For The Game gfi bad, especially in ui(_static)_data, dmicon good. ## Changelog 🆑 refactor: The ORM, "ore container", and order console UIs (produce, mining, bitrunner vendors) now load icons in a more efficient manner. /🆑
54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
///structure to contain ores
|
|
/obj/structure/ore_container
|
|
|
|
/obj/structure/ore_container/attackby(obj/item/ore, mob/living/carbon/human/user, list/modifiers)
|
|
if(istype(ore, /obj/item/stack/ore) && !user.combat_mode)
|
|
ore.forceMove(src)
|
|
return
|
|
return ..()
|
|
|
|
/obj/structure/ore_container/Entered(atom/movable/mover)
|
|
. = ..()
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
|
|
/obj/structure/ore_container/Exited(atom/movable/mover)
|
|
. = ..()
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
|
|
/obj/structure/ore_container/ui_interact(mob/user, datum/tgui/ui)
|
|
. = ..()
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "OreContainer")
|
|
ui.open()
|
|
|
|
/obj/structure/ore_container/ui_data(mob/user)
|
|
var/list/ores = list()
|
|
for(var/obj/item/stack/ore/ore_item in contents)
|
|
ores += list(list(
|
|
"id" = REF(ore_item),
|
|
"name" = ore_item.name,
|
|
"amount" = ore_item.amount,
|
|
"icon" = ore_item::icon,
|
|
"icon_state" = ore_item::icon_state,
|
|
))
|
|
return list("ores" = ores)
|
|
|
|
/obj/structure/ore_container/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
|
|
if(. || !isliving(ui.user))
|
|
return TRUE
|
|
|
|
var/mob/living/customer = ui.user
|
|
var/obj/item/stack_to_move
|
|
switch(action)
|
|
if("withdraw")
|
|
if(isnull(params["reference"]))
|
|
return TRUE
|
|
stack_to_move = locate(params["reference"]) in contents
|
|
if(isnull(stack_to_move))
|
|
return TRUE
|
|
stack_to_move.forceMove(get_turf(customer))
|
|
return TRUE
|