Combines some admin verbs together (#15159)

* Admin Jumping

* GLOB.clients

* Review suggestions

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* Blackbox comments

* Not sure why it wasn't a proc in the first place to be honest...

Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
SabreML
2021-03-14 10:26:07 +00:00
committed by GitHub
parent 9ee679cded
commit 7343ec3747
2 changed files with 46 additions and 32 deletions
+1 -4
View File
@@ -24,12 +24,9 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
/client/proc/cmd_admin_check_contents, /*displays the contents of an instance*/
/client/proc/cmd_admin_open_logging_view,
/client/proc/getserverlogs, /*allows us to fetch server logs (diary) for other days*/
/client/proc/jumptocoord, /*we ghost and jump to a coordinate*/
/client/proc/Getmob, /*teleports a mob to our location*/
/client/proc/Getkey, /*teleports a mob with a certain ckey to our location*/
/client/proc/Jump,
/client/proc/jumptokey, /*allows us to jump to the location of a mob with a certain ckey*/
/client/proc/jumptomob, /*allows us to jump to a specific mob*/
/client/proc/jump_to, /*Opens a menu for jumping to an Area, Mob, Key or Coordinate*/
/client/proc/jumptoturf, /*allows us to jump to a specific turf*/
/client/proc/admin_call_shuttle, /*allows us to call the emergency shuttle*/
/client/proc/admin_cancel_shuttle, /*allows us to cancel the emergency shuttle, sending it back to centcomm*/
+45 -28
View File
@@ -1,23 +1,56 @@
/client/proc/Jump(area/A in return_sorted_areas())
set name = "Jump to Area"
set desc = "Area to jump to"
/client/proc/jump_to()
set name = "Jump to..."
set desc = "Area, Mob, Key or Coordinate"
set category = "Admin"
var/list/choices = list("Area", "Mob", "Key", "Coordinates")
if(!check_rights(R_ADMIN))
return
if(!A)
var/chosen = input(src, null, "Jump to...") as null|anything in choices
if(!chosen)
return
var/jumping // Thing to jump to
switch(chosen)
if("Area")
jumping = input(src, "Area to jump to", "Jump to Area") as null|anything in return_sorted_areas()
if(jumping)
return jumptoarea(jumping)
if("Mob")
jumping = input(src, "Mob to jump to", "Jump to Mob") as null|anything in GLOB.mob_list
if(jumping)
return jumptomob(jumping)
if("Key")
jumping = input(src, "Key to jump to", "Jump to Key") as null|anything in sortKey(GLOB.clients)
if(jumping)
return jumptokey(jumping)
if("Coordinates")
var/x = input(src, "X Coordinate", "Jump to Coordinates") as null|num
if(!x)
return
var/y = input(src, "Y Coordinate", "Jump to Coordinates") as null|num
if(!y)
return
var/z = input(src, "Z Coordinate", "Jump to Coordinates") as null|num
if(!z)
return
return jumptocoord(x, y, z)
/client/proc/jumptoarea(area/A)
if(!A || !check_rights(R_ADMIN))
return
var/list/turfs = list()
for(var/turf/T in A)
if(T.density)
continue
if(locate(/obj/structure/grille, T)) // Quick check to not spawn in windows
if(locate(/obj/structure/grille) in T) // Quick check to not spawn in windows
continue
turfs.Add(T)
turfs += T
var/turf/T = pick_n_take(turfs)
var/turf/T = safepick(turfs)
if(!T)
to_chat(src, "Nowhere to jump to!")
return
@@ -49,11 +82,9 @@
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Turf") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
/client/proc/jumptomob(mob/M in GLOB.mob_list)
set category = "Admin"
/client/proc/jumptomob(mob/M)
set name = "Jump to Mob"
if(!check_rights(R_ADMIN))
if(!M || !check_rights(R_ADMIN))
return
log_admin("[key_name(usr)] jumped to [key_name(M)]")
@@ -72,9 +103,6 @@
to_chat(A, "This mob is not located in the game world.")
/client/proc/jumptocoord(tx as num, ty as num, tz as num)
set category = "Admin"
set name = "Jump to Coordinate"
if(!isobserver(usr) && !check_rights(R_ADMIN)) // Only admins can jump without being a ghost
return
@@ -91,21 +119,10 @@
if(!isobserver(usr))
message_admins("[key_name_admin(usr)] jumped to coordinates [tx], [ty], [tz]")
/client/proc/jumptokey()
set category = "Admin"
set name = "Jump to Key"
if(!check_rights(R_ADMIN))
/client/proc/jumptokey(client/C)
if(!C?.mob || !check_rights(R_ADMIN))
return
var/list/keys = list()
for(var/mob/M in GLOB.player_list)
keys += M.client
var/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in sortKey(keys)
if(!selection)
to_chat(src, "No keys found.")
return
var/mob/M = selection:mob
var/mob/M = C.mob
log_admin("[key_name(usr)] jumped to [key_name(M)]")
if(!isobserver(usr))
message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1)