Adds UIs to magma crucibles and smart hoppers (#29941)

* Add UI to magma crucible and smart hopper

* Use multitile component in magma_crucible

* Move magma crucible in lavaland

* Increase smart hopper scanning range

* Build /tg/ui (#40)

Co-authored-by: /tg/ui Builder <41898282+github-actions[bot]@users.noreply.github.com>

* Remove identical variable

* Build /tg/ui (#42)

Co-authored-by: /tg/ui Builder <41898282+github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: Kyani <65205627+EmeraldCandy@users.noreply.github.com>
Co-authored-by: Arthri <41360489+a@users.noreply.github.com>
Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Co-authored-by: Toastical <20125180+Toastical@users.noreply.github.com>
Co-authored-by: Ahzpy <88119260+Ahzpy@users.noreply.github.com>
Co-authored-by: Alan <alfalfascout@users.noreply.github.com>
Co-authored-by: Charlie Nolan <funnyman3595@gmail.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: warriorstar-orion <orion@snowfrost.garden>
Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Co-authored-by: Kyani <65205627+EmeraldCandy@users.noreply.github.com>
Co-authored-by: kyunkyunkyun <120701975+kyunkyunkyun@users.noreply.github.com>
Co-authored-by: Aleksandr Sakrukin <99011379+JustSanyK@users.noreply.github.com>
This commit is contained in:
Arthri
2025-08-12 06:08:16 +00:00
committed by GitHub
co-authored by /tg/ui Builder <41898282+github-actions[bot]@users.noreply.github.com> /tg/ui Builder <41898282+github-actions[bot]@users.noreply.github.com> Arthri paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com> github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Qwertytoforty Toastical Ahzpy Alan Charlie Nolan Burzah warriorstar-orion CRUNCH Contrabang PollardTheDragon Kyani kyunkyunkyun Aleksandr Sakrukin
parent 66879bc883
commit 0634be6107
9 changed files with 219 additions and 13 deletions
@@ -4,12 +4,7 @@
icon = 'icons/obj/machines/magma_crucible.dmi'
icon_state = "crucible"
max_integrity = 300
pixel_x = -32 // 3x3
pixel_y = -32
bound_width = 96
bound_x = -32
bound_height = 96
bound_y = -32
anchored = TRUE
density = TRUE
resistance_flags = FIRE_PROOF
@@ -27,6 +22,11 @@
/obj/machinery/magma_crucible/Initialize(mapload)
. = ..()
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE, MAT_PALLADIUM, MAT_IRIDIUM, MAT_PLATINUM, MAT_BRASS), INFINITY, FALSE, list(/obj/item/stack, /obj/item/smithed_item), null, null)
AddComponent(/datum/component/multitile, list(
list(1, 1, 1),
list(MACH_CENTER, 1, 1),
list(1, 1, 1),
))
// Stock parts
component_parts = list()
component_parts += new /obj/item/circuitboard/magma_crucible(null)
@@ -123,6 +123,16 @@
pouring = FALSE
update_icon(UPDATE_OVERLAYS)
/obj/machinery/magma_crucible/attack_ghost(mob/dead/observer/user)
if(..())
return TRUE
ui_interact(user)
/obj/machinery/magma_crucible/attack_hand(mob/user)
if(..())
return TRUE
ui_interact(user)
/obj/machinery/magma_crucible/multitool_act(mob/living/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
@@ -145,3 +155,22 @@
continue
msgs += "[M.name]: [floor(M.amount / MINERAL_MATERIAL_AMOUNT)] sheets."
to_chat(user, chat_box_regular(msgs.Join("<br>")))
/obj/machinery/magma_crucible/ui_state(mob/user)
return GLOB.default_state
/obj/machinery/magma_crucible/ui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "MaterialContainer", name)
ui.open()
/obj/machinery/magma_crucible/ui_data(mob/user)
..()
var/datum/component/material_container/material_container = GetComponent(/datum/component/material_container)
return material_container.get_ui_data(user)
/obj/machinery/magma_crucible/ui_static_data(mob/user)
..()
var/datum/component/material_container/material_container = GetComponent(/datum/component/material_container)
return material_container.get_ui_static_data(user)
@@ -38,7 +38,7 @@
component_parts += new /obj/item/stack/sheet/glass(null)
RefreshParts()
// Try to link to magma crucible on initialize. Link to the first crucible it can find.
for(var/obj/machinery/magma_crucible/crucible in view(2, src))
for(var/obj/machinery/magma_crucible/crucible in view(3, src))
linked_crucible = crucible
linked_crucible.linked_machines |= src
return
@@ -220,3 +220,32 @@
var/time_to_animate = max(ore_amount * 2, 1 SECONDS)
addtimer(VARSET_CALLBACK(src, icon_state, "hopper"), time_to_animate)
linked_crucible.animate_transfer(time_to_animate)
/obj/machinery/mineral/smart_hopper/attack_ghost(mob/dead/observer/user)
. = ..()
ui_interact(user)
/obj/machinery/mineral/smart_hopper/attack_hand(mob/user)
. = ..()
ui_interact(user)
/obj/machinery/mineral/smart_hopper/ui_state(mob/user)
return GLOB.default_state
/obj/machinery/mineral/smart_hopper/ui_interact(mob/user, datum/tgui/ui = null)
if(!linked_crucible)
return FALSE
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "MaterialContainer", name)
ui.open()
/obj/machinery/mineral/smart_hopper/ui_data(mob/user)
..()
var/datum/component/material_container/material_container = linked_crucible.GetComponent(/datum/component/material_container)
return material_container.get_ui_data(user)
/obj/machinery/mineral/smart_hopper/ui_static_data(mob/user)
..()
var/datum/component/material_container/material_container = linked_crucible.GetComponent(/datum/component/material_container)
return material_container.get_ui_static_data(user, TRUE, point_upgrade)