/client/proc/Debug2() set category = "Debug" set name = "Debug-Game" if(!check_rights(R_DEBUG)) return if(GLOB.Debug2) GLOB.Debug2 = 0 message_admins("[key_name(src)] toggled debugging off.") log_admin("[key_name(src)] toggled debugging off.") else GLOB.Debug2 = 1 message_admins("[key_name(src)] toggled debugging on.") log_admin("[key_name(src)] toggled debugging on.") SSblackbox.record_feedback("tally", "admin_verb", 1, "Toggle Debug Two") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /* 21st Sept 2010 Updated by Skie -- Still not perfect but better! Stuff you can't do: Call proc /mob/proc/Dizzy() for some player Because if you select a player mob as owner it tries to do the proc for /mob/living/carbon/human/ instead. And that gives a run-time error. But you can call procs that are of type /mob/living/carbon/human/proc/ for that player. */ /client/proc/callproc() set category = "Debug" set name = "Advanced ProcCall" set waitfor = 0 if(!check_rights(R_DEBUG)) return var/datum/target = null var/targetselected = 0 var/returnval = null switch(alert("Proc owned by something?",,"Yes","No")) if("Yes") targetselected = 1 var/list/value = vv_get_value(default_class = VV_ATOM_REFERENCE, classes = list(VV_ATOM_REFERENCE, VV_DATUM_REFERENCE, VV_MOB_REFERENCE, VV_CLIENT)) if (!value["class"] || !value["value"]) return target = value["value"] if("No") target = null targetselected = 0 var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null if(!procname) return //hascall() doesn't support proc paths (eg: /proc/gib(), it only supports "gib") var/testname = procname if(targetselected) //Find one of the 3 possible ways they could have written /proc/PROCNAME if(findtext(procname, "/proc/")) testname = replacetext(procname, "/proc/", "") else if(findtext(procname, "/proc")) testname = replacetext(procname, "/proc", "") else if(findtext(procname, "proc/")) testname = replacetext(procname, "proc/", "") //Clear out any parenthesis if they're a dummy testname = replacetext(testname, "()", "") if(targetselected && !hascall(target,testname)) to_chat(usr, "Error: callproc(): type [target.type] has no proc named [procname].") return else var/procpath = text2path(procname) if (!procpath) to_chat(usr, "Error: callproc(): proc [procname] does not exist. (Did you forget the /proc/ part?)") return var/list/lst = get_callproc_args() if(!lst) return if(targetselected) if(!target) to_chat(usr, "Error: callproc(): owner of proc no longer exists.") return var/msg = "[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]." log_admin(msg) message_admins(msg) admin_ticket_log(target, msg) returnval = WrapAdminProcCall(target, procname, lst) // Pass the lst as an argument list to the proc else //this currently has no hascall protection. wasn't able to get it working. log_admin("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") message_admins("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") returnval = WrapAdminProcCall(GLOBAL_PROC, procname, lst) // Pass the lst as an argument list to the proc . = get_callproc_returnval(returnval, procname) if(.) to_chat(usr, .) SSblackbox.record_feedback("tally", "admin_verb", 1, "Advanced ProcCall") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! GLOBAL_VAR(AdminProcCaller) GLOBAL_PROTECT(AdminProcCaller) GLOBAL_VAR_INIT(AdminProcCallCount, 0) GLOBAL_PROTECT(AdminProcCallCount) GLOBAL_VAR(LastAdminCalledTargetRef) GLOBAL_PROTECT(LastAdminCalledTargetRef) GLOBAL_VAR(LastAdminCalledTarget) GLOBAL_PROTECT(LastAdminCalledTarget) GLOBAL_VAR(LastAdminCalledProc) GLOBAL_PROTECT(LastAdminCalledProc) GLOBAL_LIST_EMPTY(AdminProcCallSpamPrevention) GLOBAL_PROTECT(AdminProcCallSpamPrevention) /proc/WrapAdminProcCall(datum/target, procname, list/arguments) if(target && procname == "Del") to_chat(usr, "Calling Del() is not allowed") return if(target != GLOBAL_PROC && !target.CanProcCall(procname)) to_chat(usr, "Proccall on [target.type]/proc/[procname] is disallowed!") return var/current_caller = GLOB.AdminProcCaller var/ckey = usr ? usr.client.ckey : GLOB.AdminProcCaller if(!ckey) CRASH("WrapAdminProcCall with no ckey: [target] [procname] [english_list(arguments)]") if(current_caller && current_caller != ckey) if(!GLOB.AdminProcCallSpamPrevention[ckey]) to_chat(usr, "Another set of admin called procs are still running, your proc will be run after theirs finish.") GLOB.AdminProcCallSpamPrevention[ckey] = TRUE UNTIL(!GLOB.AdminProcCaller) to_chat(usr, "Running your proc") GLOB.AdminProcCallSpamPrevention -= ckey else UNTIL(!GLOB.AdminProcCaller) GLOB.LastAdminCalledProc = procname if(target != GLOBAL_PROC) GLOB.LastAdminCalledTargetRef = "[REF(target)]" GLOB.AdminProcCaller = ckey //if this runtimes, too bad for you ++GLOB.AdminProcCallCount . = world.WrapAdminProcCall(target, procname, arguments) if(--GLOB.AdminProcCallCount == 0) GLOB.AdminProcCaller = null //adv proc call this, ya nerds /world/proc/WrapAdminProcCall(datum/target, procname, list/arguments) if(target == GLOBAL_PROC) return call(procname)(arglist(arguments)) else if(target != world) return call(target, procname)(arglist(arguments)) else log_admin_private("[key_name(usr)] attempted to call world/proc/[procname] with arguments: [english_list(arguments)]") /proc/IsAdminAdvancedProcCall() #ifdef TESTING return FALSE #else return usr && usr.client && GLOB.AdminProcCaller == usr.client.ckey #endif /client/proc/callproc_datum(datum/A as null|area|mob|obj|turf) set category = "Debug" set name = "Atom ProcCall" set waitfor = 0 if(!check_rights(R_DEBUG)) return var/procname = input("Proc name, eg: fake_blood","Proc:", null) as text|null if(!procname) return if(!hascall(A,procname)) to_chat(usr, "Error: callproc_datum(): type [A.type] has no proc named [procname].") return var/list/lst = get_callproc_args() if(!lst) return if(!A || !IsValidSrc(A)) to_chat(usr, "Error: callproc_datum(): owner of proc no longer exists.") return log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") var/msg = "[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]." message_admins(msg) admin_ticket_log(A, msg) SSblackbox.record_feedback("tally", "admin_verb", 1, "Atom ProcCall") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! var/returnval = WrapAdminProcCall(A, procname, lst) // Pass the lst as an argument list to the proc . = get_callproc_returnval(returnval,procname) if(.) to_chat(usr, .) /client/proc/get_callproc_args() var/argnum = input("Number of arguments","Number:",0) as num|null if(isnull(argnum)) return . = list() var/list/named_args = list() while(argnum--) var/named_arg = input("Leave blank for positional argument. Positional arguments will be considered as if they were added first.", "Named argument") as text|null var/value = vv_get_value(restricted_classes = list(VV_RESTORE_DEFAULT)) if (!value["class"]) return if(named_arg) named_args[named_arg] = value["value"] else . += value["value"] if(LAZYLEN(named_args)) . += named_args /client/proc/get_callproc_returnval(returnval,procname) . = "" if(islist(returnval)) var/list/returnedlist = returnval . = "" if(returnedlist.len) var/assoc_check = returnedlist[1] if(istext(assoc_check) && (returnedlist[assoc_check] != null)) . += "[procname] returned an associative list:" for(var/key in returnedlist) . += "\n[key] = [returnedlist[key]]" else . += "[procname] returned a list:" for(var/elem in returnedlist) . += "\n[elem]" else . = "[procname] returned an empty list" . += "" else . = "[procname] returned: [!isnull(returnval) ? returnval : "null"]" /client/proc/Cell() set category = "Debug" set name = "Air Status in Location" if(!mob) return var/turf/T = get_turf(mob) if(!isturf(T)) return show_air_status_to(T, usr) SSblackbox.record_feedback("tally", "admin_verb", 1, "Air Status In Location") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_admin_robotize(mob/M in GLOB.mob_list) set category = "Fun" set name = "Make Robot" if(!SSticker.HasRoundStarted()) alert("Wait until the game starts") return if(ishuman(M)) log_admin("[key_name(src)] has robotized [M.key].") var/mob/living/carbon/human/H = M spawn(0) H.Robotize() else alert("Invalid mob") /client/proc/cmd_admin_blobize(mob/M in GLOB.mob_list) set category = "Fun" set name = "Make Blob" if(!SSticker.HasRoundStarted()) alert("Wait until the game starts") return if(ishuman(M)) log_admin("[key_name(src)] has blobized [M.key].") var/mob/living/carbon/human/H = M H.become_overmind() else alert("Invalid mob") /client/proc/cmd_admin_animalize(mob/M in GLOB.mob_list) set category = "Fun" set name = "Make Simple Animal" if(!SSticker.HasRoundStarted()) alert("Wait until the game starts") return if(!M) alert("That mob doesn't seem to exist, close the panel and try again.") return if(isnewplayer(M)) alert("The mob must not be a new_player.") return log_admin("[key_name(src)] has animalized [M.key].") spawn(0) M.Animalize() /client/proc/makepAI(turf/T in GLOB.mob_list) set category = "Fun" set name = "Make pAI" set desc = "Specify a location to spawn a pAI device, then specify a key to play that pAI" var/list/available = list() for(var/mob/C in GLOB.mob_list) if(C.key) available.Add(C) var/mob/choice = input("Choose a player to play the pAI", "Spawn pAI") in available if(!choice) return 0 if(!isobserver(choice)) var/confirm = input("[choice.key] isn't ghosting right now. Are you sure you want to yank him out of them out of their body and place them in this pAI?", "Spawn pAI Confirmation", "No") in list("Yes", "No") if(confirm != "Yes") return 0 var/obj/item/paicard/card = new(T) var/mob/living/silicon/pai/pai = new(card) pai.name = input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text pai.real_name = pai.name pai.key = choice.key card.setPersonality(pai) for(var/datum/paiCandidate/candidate in SSpai.candidates) if(candidate.key == choice.key) SSpai.candidates.Remove(candidate) SSblackbox.record_feedback("tally", "admin_verb", 1, "Make pAI") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_admin_alienize(mob/M in GLOB.mob_list) set category = "Fun" set name = "Make Alien" if(!SSticker.HasRoundStarted()) alert("Wait until the game starts") return if(ishuman(M)) INVOKE_ASYNC(M, /mob/living/carbon/human/proc/Alienize) SSblackbox.record_feedback("tally", "admin_verb", 1, "Make Alien") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] made [key_name(M)] into an alien.") message_admins("[key_name_admin(usr)] made [key_name(M)] into an alien.") else alert("Invalid mob") /client/proc/cmd_admin_slimeize(mob/M in GLOB.mob_list) set category = "Fun" set name = "Make slime" if(!SSticker.HasRoundStarted()) alert("Wait until the game starts") return if(ishuman(M)) INVOKE_ASYNC(M, /mob/living/carbon/human/proc/slimeize) SSblackbox.record_feedback("tally", "admin_verb", 1, "Make Slime") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] made [key_name(M)] into a slime.") message_admins("[key_name_admin(usr)] made [key_name(M)] into a slime.") else alert("Invalid mob") /proc/make_types_fancy(var/list/types) if (ispath(types)) types = list(types) . = list() for(var/type in types) var/typename = "[type]" var/static/list/TYPES_SHORTCUTS = list( /obj/effect/decal/cleanable = "CLEANABLE", /obj/item/radio/headset = "HEADSET", /obj/item/clothing/head/helmet/space = "SPESSHELMET", /obj/item/book/manual = "MANUAL", /obj/item/reagent_containers/food/drinks = "DRINK", //longest paths comes first /obj/item/reagent_containers/food = "FOOD", /obj/item/reagent_containers = "REAGENT_CONTAINERS", /obj/machinery/atmospherics = "ATMOS_MECH", /obj/machinery/portable_atmospherics = "PORT_ATMOS", /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack = "MECHA_MISSILE_RACK", /obj/item/mecha_parts/mecha_equipment = "MECHA_EQUIP", /obj/item/organ = "ORGAN", /obj/item = "ITEM", /obj/machinery = "MACHINERY", /obj/effect = "EFFECT", /obj = "O", /datum = "D", /turf/open = "OPEN", /turf/closed = "CLOSED", /turf = "T", /mob/living/carbon = "CARBON", /mob/living/simple_animal = "SIMPLE", /mob/living = "LIVING", /mob = "M" ) for (var/tn in TYPES_SHORTCUTS) if (copytext(typename,1, length("[tn]/")+1)=="[tn]/" /*findtextEx(typename,"[tn]/",1,2)*/ ) typename = TYPES_SHORTCUTS[tn]+copytext(typename,length("[tn]/")) break .[typename] = type /proc/get_fancy_list_of_atom_types() var/static/list/pre_generated_list if (!pre_generated_list) //init pre_generated_list = make_types_fancy(typesof(/atom)) return pre_generated_list /proc/get_fancy_list_of_datum_types() var/static/list/pre_generated_list if (!pre_generated_list) //init pre_generated_list = make_types_fancy(sortList(typesof(/datum) - typesof(/atom))) return pre_generated_list /proc/filter_fancy_list(list/L, filter as text) var/list/matches = new for(var/key in L) var/value = L[key] if(findtext("[key]", filter) || findtext("[value]", filter)) matches[key] = value return matches //TODO: merge the vievars version into this or something maybe mayhaps /client/proc/cmd_debug_del_all(object as text) set category = "Debug" set name = "Del-All" var/list/matches = get_fancy_list_of_atom_types() if (!isnull(object) && object!="") matches = filter_fancy_list(matches, object) if(matches.len==0) return var/hsbitem = input(usr, "Choose an object to delete.", "Delete:") as null|anything in matches if(hsbitem) hsbitem = matches[hsbitem] var/counter = 0 for(var/atom/O in world) if(istype(O, hsbitem)) counter++ qdel(O) CHECK_TICK log_admin("[key_name(src)] has deleted all ([counter]) instances of [hsbitem].") message_admins("[key_name_admin(src)] has deleted all ([counter]) instances of [hsbitem].", 0) SSblackbox.record_feedback("tally", "admin_verb", 1, "Delete All") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_debug_make_powernets() set category = "Debug" set name = "Make Powernets" SSmachines.makepowernets() log_admin("[key_name(src)] has remade the powernet. makepowernets() called.") message_admins("[key_name_admin(src)] has remade the powernets. makepowernets() called.", 0) SSblackbox.record_feedback("tally", "admin_verb", 1, "Make Powernets") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_admin_grantfullaccess(mob/M in GLOB.mob_list) set category = "Admin" set name = "Grant Full Access" if(!SSticker.HasRoundStarted()) alert("Wait until the game starts") return if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/worn = H.wear_id var/obj/item/card/id/id = null if(worn) id = worn.GetID() if(id) id.icon_state = "gold" id.access = get_all_accesses()+get_all_centcom_access()+get_all_syndicate_access() else id = new /obj/item/card/id/gold(H.loc) id.access = get_all_accesses()+get_all_centcom_access()+get_all_syndicate_access() id.registered_name = H.real_name id.assignment = "Captain" id.update_label() if(worn) if(istype(worn, /obj/item/pda)) var/obj/item/pda/PDA = worn PDA.id = id id.forceMove(PDA) else if(istype(worn, /obj/item/storage/wallet)) var/obj/item/storage/wallet/W = worn W.front_id = id id.forceMove(W) W.update_icon() else H.equip_to_slot(id,SLOT_WEAR_ID) else alert("Invalid mob") SSblackbox.record_feedback("tally", "admin_verb", 1, "Grant Full Access") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(src)] has granted [M.key] full access.") message_admins("[key_name_admin(usr)] has granted [M.key] full access.") /client/proc/cmd_assume_direct_control(mob/M in GLOB.mob_list) set category = "Admin" set name = "Assume direct control" set desc = "Direct intervention" if(M.ckey) if(alert("This mob is being controlled by [M.ckey]. Are you sure you wish to assume control of it? [M.ckey] will be made a ghost.",,"Yes","No") != "Yes") return else var/mob/dead/observer/ghost = new/mob/dead/observer(M,1) ghost.ckey = M.ckey message_admins("[key_name_admin(usr)] assumed direct control of [M].") log_admin("[key_name(usr)] assumed direct control of [M].") var/mob/adminmob = src.mob M.ckey = src.ckey if( isobserver(adminmob) ) qdel(adminmob) SSblackbox.record_feedback("tally", "admin_verb", 1, "Assume Direct Control") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_admin_test_atmos_controllers() set category = "Mapping" set name = "Test Atmos Monitoring Consoles" var/list/dat = list() if(SSticker.current_state == GAME_STATE_STARTUP) to_chat(usr, "Game still loading, please hold!") return message_admins("[key_name_admin(usr)] used the Test Atmos Monitor debug command.") log_admin("[key_name(usr)] used the Test Atmos Monitor debug command.") var/bad_shit = 0 for(var/obj/machinery/computer/atmos_control/tank/console in GLOB.atmos_air_controllers) dat += "