Admin Ghostdrop sanity checks

Applies tgstation/-tg-station@2227b7a to admin.dm and observer.dm

Basically, this adds sanity checks, just to prevent runtimes in the odd
case that something happens. For instance, if one of the mobs suddenly
gets deleted, this will prevent it from runtiming. Sanity checks.
This commit is contained in:
Tigercat2000
2015-04-15 07:11:34 -07:00
parent f6d4aae74a
commit b7377185d9
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -988,6 +988,8 @@ proc/formatLocation(var/location)
proc/formatPlayerPanel(var/mob/U,var/text="PP")
return "<A HREF='?_src_=holder;adminplayeropts=\ref[U]'>[text]</A>"
//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
@@ -999,6 +1001,7 @@ proc/formatPlayerPanel(var/mob/U,var/text="PP")
if (!frommob.ckey)
return 0
var/question = ""
if (tomob.ckey)
question = "This mob already has a user ([tomob.key]) in control of it! "
@@ -1008,6 +1011,9 @@ proc/formatPlayerPanel(var/mob/U,var/text="PP")
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)