From a6a9cb76e8af6b0b8db8e9432c55d189f2e41c84 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Wed, 15 Apr 2015 16:10:36 +0200 Subject: [PATCH] Ghost-possession sanity checks. Adds sanity checks referred to in #8849. --- code/modules/admin/admin.dm | 4 ++++ code/modules/mob/dead/observer/observer.dm | 1 + 2 files changed, 5 insertions(+) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index a9f39fb127..7b5a4558cf 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -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("[key_name_admin(usr)] has put [frommob.ckey] in control of [tomob.name].") diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index ee8194a004..5c33250a97 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -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