mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-17 10:03:50 +01:00
Gives engicart a radial menu (#22922)
* Gives engicart a radial menu * correct names * Update code/game/objects/structures/engicart.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> --------- Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
@@ -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, "<span class='notice'>You put [I] into [src].</span>")
|
||||
return
|
||||
|
||||
/obj/structure/engineeringcart/attackby(obj/item/I, mob/user, params)
|
||||
var/fail_msg = "<span class='notice'>There is already one of those in [src].</span>"
|
||||
if(!I.is_robot_module())
|
||||
@@ -101,70 +101,79 @@
|
||||
to_chat(usr, "<span class='warning'>You cannot interface your modules [src]!</span>")
|
||||
|
||||
/obj/structure/engineeringcart/attack_hand(mob/user)
|
||||
user.set_machine(src)
|
||||
var/dat
|
||||
if(myglass)
|
||||
dat += "<a href='?src=[UID()];glass=1'>[myglass.name]</a><br>"
|
||||
if(mymetal)
|
||||
dat += "<a href='?src=[UID()];metal=1'>[mymetal.name]</a><br>"
|
||||
if(myplasteel)
|
||||
dat += "<a href='?src=[UID()];plasteel=1'>[myplasteel.name]</a><br>"
|
||||
if(myflashlight)
|
||||
dat += "<a href='?src=[UID()];flashlight=1'>[myflashlight.name]</a><br>"
|
||||
if(mybluetoolbox)
|
||||
dat += "<a href='?src=[UID()];bluetoolbox=1'>[mybluetoolbox.name]</a><br>"
|
||||
if(myredtoolbox)
|
||||
dat += "<a href='?src=[UID()];redtoolbox=1'>[myredtoolbox.name]</a><br>"
|
||||
if(myyellowtoolbox)
|
||||
dat += "<a href='?src=[UID()];yellowtoolbox=1'>[myyellowtoolbox.name]</a><br>"
|
||||
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, "<span class='notice'>You take [myglass] from [src].</span>")
|
||||
myglass = null
|
||||
if(href_list["metal"])
|
||||
if(mymetal)
|
||||
if("Metal")
|
||||
if(!mymetal)
|
||||
return
|
||||
user.put_in_hands(mymetal)
|
||||
to_chat(user, "<span class='notice'>You take [mymetal] from [src].</span>")
|
||||
mymetal = null
|
||||
if(href_list["plasteel"])
|
||||
if(myplasteel)
|
||||
if("Plasteel")
|
||||
if(!myplasteel)
|
||||
return
|
||||
user.put_in_hands(myplasteel)
|
||||
to_chat(user, "<span class='notice'>You take [myplasteel] from [src].</span>")
|
||||
myplasteel = null
|
||||
if(href_list["flashlight"])
|
||||
if(myflashlight)
|
||||
if("Flashlight")
|
||||
if(!myflashlight)
|
||||
return
|
||||
user.put_in_hands(myflashlight)
|
||||
to_chat(user, "<span class='notice'>You take [myflashlight] from [src].</span>")
|
||||
myflashlight = null
|
||||
if(href_list["bluetoolbox"])
|
||||
if(mybluetoolbox)
|
||||
if("Mechanical Toolbox")
|
||||
if(!mybluetoolbox)
|
||||
return
|
||||
user.put_in_hands(mybluetoolbox)
|
||||
to_chat(user, "<span class='notice'>You take [mybluetoolbox] from [src].</span>")
|
||||
mybluetoolbox = null
|
||||
if(href_list["redtoolbox"])
|
||||
if(myredtoolbox)
|
||||
if("Emergency Toolbox")
|
||||
if(!myredtoolbox)
|
||||
return
|
||||
user.put_in_hands(myredtoolbox)
|
||||
to_chat(user, "<span class='notice'>You take [myredtoolbox] from [src].</span>")
|
||||
myredtoolbox = null
|
||||
if(href_list["yellowtoolbox"])
|
||||
if(myyellowtoolbox)
|
||||
if("Electrical Toolbox")
|
||||
if(!myyellowtoolbox)
|
||||
return
|
||||
user.put_in_hands(myyellowtoolbox)
|
||||
to_chat(user, "<span class='notice'>You take [myyellowtoolbox] from [src].</span>")
|
||||
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()
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user