From ad4e4408b8ef51de3b9051a96b1987f9bbd4159a Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Tue, 6 Jul 2021 22:05:23 -0400 Subject: [PATCH] Fix a handful of ghost/admin verbs --- code/modules/admin/topic.dm | 9 +++- code/modules/admin/verbs/adminjump.dm | 43 ++++++++------- code/modules/mob/dead/observer/observer.dm | 61 +++++++++++++++------- 3 files changed, 74 insertions(+), 39 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 3868c4271a..4649296b14 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1570,9 +1570,16 @@ var/mob/M = locate(href_list["sendmob"]) if(!M) return - var/area/A = tgui_input_list(usr, "Pick an area:", "Send Mob", return_sorted_areas()) + + var/list/areachoices = return_sorted_areas() + var/choice = tgui_input_list(usr, "Pick an area:", "Send Mob", areachoices) + if(!choice) + return + + var/area/A = areachoices[choice] if(!A) return + M.on_mob_jump() M.forceMove(pick(get_area_turfs(A))) var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(M)]" diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index fc32742583..95442b0f82 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -4,25 +4,32 @@ /mob/observer/dead/on_mob_jump() following = null -/client/proc/Jump() +/client/proc/Jump(areaname as null|anything in return_sorted_areas()) set name = "Jump to Area" set desc = "Area to jump to" set category = "Admin" if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(config.allow_admin_jump) - var/area/A = tgui_input_list(usr, "Pick an area:", "Jump to Area", return_sorted_areas()) - if(!A) - return - usr.on_mob_jump() - usr.forceMove(pick(get_area_turfs(A))) - - log_admin("[key_name(usr)] jumped to [A]") - message_admins("[key_name_admin(usr)] jumped to [A]", 1) - feedback_add_details("admin_verb","JA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - else + if(!config.allow_admin_jump) tgui_alert_async(usr, "Admin jumping disabled") + return + + var/area/A + + if(areaname) + A = return_sorted_areas()[areaname] + else + A = tgui_input_list(usr, "Pick an area:", "Jump to Area", return_sorted_areas()) + + if(!A) + return + + usr.on_mob_jump() + usr.forceMove(pick(get_area_turfs(A))) + log_admin("[key_name(usr)] jumped to [A]") + message_admins("[key_name_admin(usr)] jumped to [A]", 1) + feedback_add_details("admin_verb","JA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/jumptoturf(var/turf/T in world) set name = "Jump to Turf" @@ -40,7 +47,7 @@ return /// Verb wrapper around do_jumptomob() -/client/proc/jumptomob() +/client/proc/jumptomob(mob as null|anything in mob_list) set category = "Admin" set name = "Jump to Mob" set popup_menu = FALSE //VOREStation Edit - Declutter. @@ -48,16 +55,16 @@ if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - var/mob/M = tgui_input_list(usr, "Pick a mob:", "Jump to Mob", mob_list) - if(!M) // Cancelled - return - do_jumptomob(M) + do_jumptomob(mob) -/// Performs the jumps +/// Performs the jumps, also called from admin Topic() for JMP links /client/proc/do_jumptomob(var/mob/M) if(!config.allow_admin_jump) tgui_alert_async(usr, "Admin jumping disabled") return + + if(!M) + M = tgui_input_list(usr, "Pick a mob:", "Jump to Mob", mob_list) if(!M) return diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index e0fc08d8ba..f6550249f1 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -98,7 +98,6 @@ sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF see_invisible = SEE_INVISIBLE_OBSERVER see_in_dark = world.view //I mean. I don't even know if byond has occlusion culling... but... - verbs += /mob/observer/dead/proc/dead_tele var/turf/T if(ismob(body)) @@ -342,6 +341,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/area/A = areas[key] if(A.z in using_map?.secret_levels) areas -= key + return areas /mob/observer/dead/proc/jumpable_mobs() @@ -353,41 +353,62 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/mobz = get_z(mobs[key]) if(mobz in using_map?.secret_levels) mobs -= key + return mobs -/mob/observer/dead/proc/dead_tele() - set category = "Ghost" +/mob/observer/dead/verb/dead_tele(areaname as null|anything in jumpable_areas()) set name = "Teleport" - set desc = "Teleport to a location" + set category = "Ghost" + set desc = "Teleport to a location." if(!istype(usr, /mob/observer/dead)) to_chat(usr, "Not when you're not dead!") return - var/list/areas = jumpable_areas() - var/input = tgui_input_list(usr, "Select an area:", "Ghost Teleport", areas) - if(!input) - return + var/area/A - var/area/A = areas[input] - if(!A) return - usr.forceMove(pick(get_area_turfs(A))) + if(!areaname) + var/list/areas = jumpable_areas() + var/input = tgui_input_list(usr, "Select an area:", "Ghost Teleport", areas) + if(!input) + return + A = areas[input] + if(!A) + return + + if(!istype(usr, /mob/observer/dead)) + to_chat(usr, "Not when you're not dead!") + return + + usr.forceMove(pick(get_area_turfs(A || jumpable_areas()[areaname]))) usr.on_mob_jump() -/mob/observer/dead/verb/follow() +/mob/observer/dead/verb/follow(mobname as null|anything in jumpable_mobs()) + set name = "Follow" set category = "Ghost" - set name = "Follow" // "Haunt" set desc = "Follow and haunt a mob." - var/list/possible_mobs = jumpable_mobs() - var/input = tgui_input_list(usr, "Select a mob:", "Ghost Follow", possible_mobs) - if(!input) + if(!istype(usr, /mob/observer/dead)) + to_chat(usr, "Not when you're not dead!") return - - var/target = possible_mobs[input] - if(!target) return - ManualFollow(target) + var/mob/M + + if(!mobname) + var/list/possible_mobs = jumpable_mobs() + var/input = tgui_input_list(usr, "Select a mob:", "Ghost Follow", possible_mobs) + if(!input) + return + M = possible_mobs[input] + if(!M) + return + + if(!istype(usr, /mob/observer/dead)) + to_chat(usr, "Not when you're not dead!") + return + + ManualFollow(M || jumpable_mobs()[mobname]) + /mob/observer/dead/forceMove(atom/destination) if(client?.holder) return ..()