From 3d556ea9702c9d62c4c08279467acc60fed3c0f2 Mon Sep 17 00:00:00 2001 From: Razharas Date: Sat, 27 Jun 2015 18:00:57 +0300 Subject: [PATCH] Some varedit improvements Fixed give spell window hiding most important part of the spell types Added call proc to varedit so all things you can open in varedit you can also call procs on --- code/__HELPERS/unsorted.dm | 8 ++++++++ code/datums/datumvars.dm | 9 +++++++++ code/modules/admin/admin_verbs.dm | 9 +++++++-- code/modules/admin/verbs/debug.dm | 7 ++----- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index c4cee037c58..c0181912414 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1323,3 +1323,11 @@ var/list/WALLITEMS = list( "lime","darkgreen","cyan","navy","teal","purple","indigo") else return "white" + +/proc/IsValidSrc(var/A) + if(istype(A, /datum)) + var/datum/B = A + return !B.gc_destroyed + if(istype(A, /client)) + return 1 + return 0 diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index c4e3856e295..cca3970fb00 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -237,6 +237,7 @@ body += "" + body += "" if(ismob(D)) body += "" @@ -443,6 +444,14 @@ body 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["regenerateicons"]) if(!check_rights(0)) return diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index c48b54bc764..0ce5eef9209 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -463,13 +463,18 @@ var/list/admin_verbs_hideable = list( set category = "Fun" set name = "Give Spell" set desc = "Gives a spell to a mob." - var/obj/effect/proc_holder/spell/S = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in spells + + 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] feedback_add_details("admin_verb","GS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] gave [key_name(T)] the spell [S].") message_admins("[key_name_admin(usr)] gave [key_name(T)] the spell [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 02aac7f6db8..9dc2e9482ba 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 || A.gc_destroyed) + if(!A || !IsValidSrc(A)) usr << "Error: callproc_datum(): owner of proc no longer exists." return if(!hascall(A,procname))