diff --git a/code/game/objects/structures/engicart.dm b/code/game/objects/structures/engicart.dm index d545bd3190c..7a605c46ff6 100644 --- a/code/game/objects/structures/engicart.dm +++ b/code/game/objects/structures/engicart.dm @@ -27,9 +27,9 @@ /obj/structure/engineeringcart/proc/put_in_cart(obj/item/I, mob/user) user.drop_item() I.loc = src - updateUsrDialog() to_chat(user, "You put [I] into [src].") return + /obj/structure/engineeringcart/attackby(obj/item/I, mob/user, params) var/fail_msg = "There is already one of those in [src]." if(!I.is_robot_module()) @@ -101,70 +101,79 @@ to_chat(usr, "You cannot interface your modules [src]!") /obj/structure/engineeringcart/attack_hand(mob/user) - user.set_machine(src) - var/dat - if(myglass) - dat += "[myglass.name]
" - if(mymetal) - dat += "[mymetal.name]
" - if(myplasteel) - dat += "[myplasteel.name]
" - if(myflashlight) - dat += "[myflashlight.name]
" - if(mybluetoolbox) - dat += "[mybluetoolbox.name]
" - if(myredtoolbox) - dat += "[myredtoolbox.name]
" - if(myyellowtoolbox) - dat += "[myyellowtoolbox.name]
" - var/datum/browser/popup = new(user, "engicart", name, 240, 160) - popup.set_content(dat) - popup.open() + var/list/engicart_items = list() -/obj/structure/engineeringcart/Topic(href, href_list) - if(!in_range(src, usr)) + if(myglass) + engicart_items["Glass"] = image(icon = myglass.icon, icon_state = myglass.icon_state) + if(mymetal) + engicart_items["Metal"] = image(icon = mymetal.icon, icon_state = mymetal.icon_state) + if(myplasteel) + engicart_items["Plasteel"] = image(icon = myplasteel.icon, icon_state = myplasteel.icon_state) + if(myflashlight) + engicart_items["Flashlight"] = image(icon = myflashlight.icon, icon_state = myflashlight.icon_state) + if(mybluetoolbox) + engicart_items["Mechanical Toolbox"] = image(icon = mybluetoolbox.icon, icon_state = mybluetoolbox.icon_state) + if(myredtoolbox) + engicart_items["Emergency Toolbox"] = image(icon = myredtoolbox.icon, icon_state = myredtoolbox.icon_state) + if(myyellowtoolbox) + engicart_items["Electrical Toolbox"] = image(icon = myyellowtoolbox.icon, icon_state = myyellowtoolbox.icon_state) + + if(!length(engicart_items)) return - if(!isliving(usr)) + + var/pick = show_radial_menu(user, src, engicart_items, custom_check = CALLBACK(src, PROC_REF(check_menu), user), require_near = TRUE) + + if(!pick) return - var/mob/living/user = usr - if(href_list["glass"]) - if(myglass) + + switch(pick) + if("Glass") + if(!myglass) + return user.put_in_hands(myglass) to_chat(user, "You take [myglass] from [src].") myglass = null - if(href_list["metal"]) - if(mymetal) + if("Metal") + if(!mymetal) + return user.put_in_hands(mymetal) to_chat(user, "You take [mymetal] from [src].") mymetal = null - if(href_list["plasteel"]) - if(myplasteel) + if("Plasteel") + if(!myplasteel) + return user.put_in_hands(myplasteel) to_chat(user, "You take [myplasteel] from [src].") myplasteel = null - if(href_list["flashlight"]) - if(myflashlight) + if("Flashlight") + if(!myflashlight) + return user.put_in_hands(myflashlight) to_chat(user, "You take [myflashlight] from [src].") myflashlight = null - if(href_list["bluetoolbox"]) - if(mybluetoolbox) + if("Mechanical Toolbox") + if(!mybluetoolbox) + return user.put_in_hands(mybluetoolbox) to_chat(user, "You take [mybluetoolbox] from [src].") mybluetoolbox = null - if(href_list["redtoolbox"]) - if(myredtoolbox) + if("Emergency Toolbox") + if(!myredtoolbox) + return user.put_in_hands(myredtoolbox) to_chat(user, "You take [myredtoolbox] from [src].") myredtoolbox = null - if(href_list["yellowtoolbox"]) - if(myyellowtoolbox) + if("Electrical Toolbox") + if(!myyellowtoolbox) + return user.put_in_hands(myyellowtoolbox) to_chat(user, "You take [myyellowtoolbox] from [src].") myyellowtoolbox = null update_icon(UPDATE_OVERLAYS) - updateUsrDialog() + +/obj/structure/engineeringcart/proc/check_menu(mob/living/user) + return istype(user) && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) /obj/structure/engineeringcart/update_overlays() . = ..()