From f6d4aae74af79f40a7f5b5ea9d9d9098ad9bbca1 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Tue, 14 Apr 2015 16:21:40 -0700 Subject: [PATCH] Allow admins to drag-drop ghosts into mobs This allows administrators to drag their mouse from a ghost to a type of /mob/living, which will then prompt them if they wish to put that ghost in control of the mob, and obviously, that is exactly what happens if you select yes. --- code/modules/admin/admin.dm | 32 ++++++++++++++++++++++ code/modules/mob/dead/observer/observer.dm | 8 ++++++ 2 files changed, 40 insertions(+) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index dee6c2afaaf..3ca884da7bd 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -987,3 +987,35 @@ proc/formatLocation(var/location) proc/formatPlayerPanel(var/mob/U,var/text="PP") return "[text]" + +/datum/admins/proc/cmd_ghost_drag(var/mob/dead/observer/frommob, var/mob/living/tomob) + if(!istype(frommob)) + return //extra sanity check to make sure only observers are shoved into things + + //same as assume-direct-control perm requirements. + if (!check_rights(R_VAREDIT,0) || !check_rights(R_ADMIN|R_DEBUG,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]?" + + var/ask = alert(question, "Place ghost in control of mob?", "Yes", "No") + if (ask != "Yes") + return 1 + + if(tomob.client) //no need to ghostize if there is no client + tomob.ghostize(0) + + message_admins("[key_name_admin(usr)] has put [frommob.ckey] in control of [tomob.name].") + 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 \ No newline at end of file diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 7ae495373e3..b5a67bd61dd 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -487,6 +487,14 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp src << browse(dat, "window=manifest;size=370x420;can_close=1") +//this is called when a ghost is drag clicked to something. +/mob/dead/observer/MouseDrop(atom/over) + if (isobserver(usr) && usr.client && usr.client.holder && isliving(over)) + if (usr.client.holder.cmd_ghost_drag(src,over)) + return + + return ..() + //BEGIN TELEPORT HREF CODE /mob/dead/observer/Topic(href, href_list) if(usr != src)