mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
Adds ghost drag-dropping into mobs.
A port of https://github.com/tgstation/-tg-station/pull/8957. This is so slick, you have no idea.
This commit is contained in:
@@ -1353,3 +1353,36 @@ proc/formatLocation(location)
|
||||
|
||||
proc/formatPlayerPanel(var/mob/U,var/text="PP")
|
||||
return "<A HREF='?_src_=holder;adminplayeropts=\ref[U]'>[text]</A>"
|
||||
|
||||
//Credit to MrStonedOne from TG for this QoL improvement
|
||||
//returns 1 to let the dragdrop code know we are trapping this event
|
||||
//returns 0 if we don't plan to trap the event
|
||||
/datum/admins/proc/cmd_ghost_drag(var/mob/dead/observer/frommob, var/mob/living/tomob)
|
||||
|
||||
//if we couldn't do it manually, we can't do it here - the 0 means no message is displayed for failure
|
||||
if (!check_rights(R_VAREDIT, 0))
|
||||
return 0
|
||||
|
||||
if (!frommob.ckey)
|
||||
return 0
|
||||
|
||||
var/question = ""
|
||||
if (tomob.ckey)
|
||||
question = "This mob already has a user ([tomob.key]) in control of it! "
|
||||
question += "Are you sure you want to place [frommob.name]([frommob.key]) in control of [tomob.name]?"
|
||||
if(alert(question, "Place ghost in control of mob?", "Yes", "No") != "Yes")
|
||||
return 1
|
||||
|
||||
if (!frommob || !tomob) //make sure the mobs don't go away while we waited for a response
|
||||
return 1
|
||||
|
||||
tomob.ghostize(0) //boot the old mob out
|
||||
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has put [frommob.ckey] in control of [tomob.name].</span>")
|
||||
log_admin("[key_name(usr)] stuffed [frommob.ckey] into [tomob.name].")
|
||||
feedback_add_details("admin_verb","CGD")
|
||||
tomob.ckey = frommob.ckey
|
||||
qdel(frommob)
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user