From 1a15dbd432f01f7a82ff71dc9e3f9c7b3154db56 Mon Sep 17 00:00:00 2001 From: DZD Date: Sun, 2 Aug 2015 21:06:49 -0400 Subject: [PATCH] Adminboooooooooooooos --- code/__HELPERS/unsorted.dm | 10 +++++++++- code/datums/datumvars.dm | 10 ++++++++++ code/modules/admin/admin_verbs.dm | 10 ++++++++-- code/modules/admin/verbs/debug.dm | 7 ++----- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 15a1bdcfb0f..567072e02f0 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1708,4 +1708,12 @@ var/mob/dview/dview_mob = new see_in_dark = 1e6 -/mob/dview/New() //For whatever reason, if this isn't called, then BYOND will throw a type mismatch runtime when attempting to add this to the mobs list. -Fox \ No newline at end of file +/mob/dview/New() //For whatever reason, if this isn't called, then BYOND will throw a type mismatch runtime when attempting to add this to the mobs list. -Fox + +/proc/IsValidSrc(var/A) + if(istype(A, /datum)) + var/datum/B = A + return isnull(B.gcDestroyed) + if(istype(A, /client)) + return 1 + return 0 \ No newline at end of file diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index d5c57c930b5..e0672681da8 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -238,6 +238,7 @@ client body += "" + body += "" if(ismob(D)) body += "" @@ -696,6 +697,15 @@ client src.holder.marked_datum = D href_list["datumrefresh"] = href_list["mark_object"] + else if(href_list["proc_call"]) + if(!check_rights(0)) + return + + var/T = locate(href_list["proc_call"]) + + if(T) + callproc_datum(T) + else if(href_list["rotatedatum"]) if(!check_rights(0)) return diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index cca7dcb27cc..9fe9638f4b9 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -406,8 +406,14 @@ var/list/admin_verbs_mentor = list( set category = "Event" set name = "Give Spell" set desc = "Gives a spell to a mob." - var/obj/effect/proc_holder/spell/wizard/S = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in spells - if(!S) return + var/list/spell_list = list() + var/type_length = length("/obj/effect/proc_holder/spell") + 2 + for(var/A in spells) + spell_list[copytext("[A]", type_length)] = A + var/obj/effect/proc_holder/spell/S = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in spell_list + if(!S) + return + S = spell_list[S] if(T.mind) T.mind.AddSpell(new S) else diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 6c82fc63185..9b2b092dbe1 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -83,16 +83,13 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that usr << "[procname] returned: [returnval ? returnval : "null"]" feedback_add_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/client/proc/callproc_datum(var/atom/A as null|area|mob|obj|turf) +/client/proc/callproc_datum(var/A as null|area|mob|obj|turf) set category = "Debug" set name = "Atom ProcCall" if(!check_rights(R_DEBUG)) return - if(!istype(A)) - return - var/procname = input("Proc name, eg: fake_blood","Proc:", null) as text|null if(!procname) return @@ -101,7 +98,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that if(!lst) return - if(!A || !isnull(A.gcDestroyed)) + if(!A || !IsValidSrc(A)) usr << "Error: callproc_datum(): owner of proc no longer exists." return if(!hascall(A,procname))