Ghost-possession sanity checks.

Adds sanity checks referred to in #8849.
This commit is contained in:
PsiOmega
2015-04-15 16:10:36 +02:00
parent 20cfea7813
commit a6a9cb76e8
2 changed files with 5 additions and 0 deletions

View File

@@ -1256,6 +1256,8 @@ var/global/floorIsLava = 0
//*********************************************************************************************************
//
//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(!istype(frommob))
return //Extra sanity check to make sure only observers are shoved into things
@@ -1272,6 +1274,8 @@ var/global/floorIsLava = 0
var/ask = alert(question, "Place ghost in control of mob?", "Yes", "No")
if (ask != "Yes")
return 1
if (!frommob || !tomob) //make sure the mobs don't go away while we waited for a response
return 1
if(tomob.client) //No need to ghostize if there is no client
tomob.ghostize(0)
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has put [frommob.ckey] in control of [tomob.name].</span>")

View File

@@ -484,6 +484,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
//This is called when a ghost is drag clicked to something.
/mob/dead/observer/MouseDrop(atom/over)
if(!usr || !over) return
if (isobserver(usr) && usr.client && usr.client.holder && isliving(over))
if (usr.client.holder.cmd_ghost_drag(src,over))
return