mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-30 18:06:56 +01:00
refactors admin narrate (#7319)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
/client/proc/cmd_admin_delete(atom/A as obj|mob|turf in world)
|
||||
set category = "Admin"
|
||||
set name = "Delete"
|
||||
|
||||
if(!check_rights(R_SPAWN|R_DEBUG|R_ADMIN))
|
||||
return
|
||||
|
||||
admin_delete(A)
|
||||
@@ -1,5 +1,5 @@
|
||||
/client/proc/Debug2()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Debug-Game"
|
||||
set desc = "Toggles game debugging."
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
return types[key]
|
||||
|
||||
/client/proc/cmd_del_all(object as text)
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Del-All"
|
||||
set desc = "Delete all datums with the specified type."
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
message_admins("[key_name_admin(src)] has deleted all ([counter]) instances of [type_to_del].")
|
||||
|
||||
/client/proc/cmd_del_all_force(object as text)
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Force-Del-All"
|
||||
set desc = "Forcibly delete all datums with the specified type."
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
message_admins("[key_name_admin(src)] has force-deleted all ([counter]) instances of [type_to_del].")
|
||||
|
||||
/client/proc/cmd_del_all_hard(object as text)
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Hard-Del-All"
|
||||
set desc = "Hard delete all datums with the specified type."
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
message_admins("[key_name_admin(src)] has hard deleted all ([counter]) instances of [type_to_del].")
|
||||
|
||||
/client/proc/cmd_debug_make_powernets()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Make Powernets"
|
||||
set desc = "Regenerates all powernets for all cables."
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
feedback_add_details("admin_verb","MPWN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_admin_grantfullaccess(var/mob/M in GLOB.mob_list)
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Grant Full Access"
|
||||
set desc = "Grant full access to a mob."
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
message_admins(SPAN_ADMINNOTICE("[key_name_admin(usr)] has granted [M.key] full access."))
|
||||
|
||||
/client/proc/cmd_debug_mob_lists()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Debug Mob Lists"
|
||||
set desc = "For when you just gotta know"
|
||||
|
||||
@@ -274,7 +274,7 @@
|
||||
to_chat(usr, jointext(GLOB.clients,","), confidential = TRUE)
|
||||
|
||||
/client/proc/cmd_display_del_log()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Display del() Log"
|
||||
set desc = "Display del's log of everything that's passed through it."
|
||||
|
||||
@@ -307,7 +307,7 @@
|
||||
browser.open()
|
||||
|
||||
/client/proc/cmd_display_overlay_log()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Display overlay Log"
|
||||
set desc = "Display SSoverlays log of everything that's passed through it."
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
render_stats(SSoverlays.stats, src)
|
||||
|
||||
/client/proc/cmd_display_init_log()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Display Initialize() Log"
|
||||
set desc = "Displays a list of things that didn't handle Initialize() properly"
|
||||
|
||||
@@ -327,7 +327,7 @@
|
||||
browser.open()
|
||||
|
||||
/datum/admins/proc/view_runtimes()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "View Runtimes"
|
||||
set desc = "Open the Runtime Viewer"
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
alert(src, "[warning]. Proceed with caution. If you really need to see the runtimes, download the runtime log and view it in a text editor.", "HEED THIS WARNING CAREFULLY MORTAL")
|
||||
|
||||
/client/proc/check_timer_sources()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Check Timer Sources"
|
||||
set desc = "Checks the sources of running timers."
|
||||
|
||||
@@ -365,7 +365,7 @@
|
||||
browser.open()
|
||||
|
||||
/client/proc/toggle_browser_inspect()
|
||||
set category = ADMIN_CATEGORY_DEBUG
|
||||
set category = VERB_CATEGORY_DEBUG
|
||||
set name = "Toggle Browser Inspect"
|
||||
set desc = "Toggle browser debugging via inspect"
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//* This file is explicitly licensed under the MIT license. *//
|
||||
//* Copyright (c) 2025 Citadel Station Developers *//
|
||||
|
||||
ADMIN_VERB_DEF(narrate, R_ADMIN, "Narrate", "Perform narration.", VERB_CATEGORY_GAME, atom/target as null|obj|mob|turf in world)
|
||||
caller.holder.open_admin_modal(/datum/admin_modal/admin_narrate, target)
|
||||
@@ -0,0 +1,95 @@
|
||||
//* This file is explicitly licensed under the MIT license. *//
|
||||
//* Copyright (c) 2025 Citadel Station Developers *//
|
||||
|
||||
ADMIN_VERB_DEF(narrate_quick, R_ADMIN, "Narrate (Quick)", "Perform narration.", VERB_CATEGORY_GAME, atom/target as null|obj|mob|turf in world)
|
||||
|
||||
var/use_global
|
||||
var/datum/weakref/use_viewers
|
||||
var/datum/weakref/use_overmap
|
||||
var/datum/weakref/use_direct
|
||||
|
||||
var/target_name_descriptor = "ERROR"
|
||||
var/target_long_descriptor = "ERROR"
|
||||
|
||||
if(isnull(target))
|
||||
use_global = TRUE
|
||||
target_name_descriptor = "(Everyone)"
|
||||
target_long_descriptor = "Narrate to the entire server, even those in lobby."
|
||||
else if(istype(target, /obj/overmap/entity))
|
||||
use_overmap = WEAKREF(target)
|
||||
target_name_descriptor = "([target])"
|
||||
target_long_descriptor = "Narrate to everyone aboard / present on \the [target]."
|
||||
else if(isturf(target))
|
||||
use_viewers = WEAKREF(target)
|
||||
target_name_descriptor = "(viewing [target] @ [target.x], [target.y], [target.y])"
|
||||
target_long_descriptor = "Narrate to everyone who can view the turf ([target]) at [target.x], [target.y], [target.z]."
|
||||
else if(ismovable(target))
|
||||
var/atom/movable/target_movable = target
|
||||
if(target_movable.admin_resolve_narrate())
|
||||
use_direct = WEAKREF(target_movable)
|
||||
target_name_descriptor = "([target])"
|
||||
target_long_descriptor = "Narrate to everyone inside / the person at / the target of '[target]' (currently at \the [get_area(target)])."
|
||||
else
|
||||
use_viewers = WEAKREF(target_movable)
|
||||
target_name_descriptor = "(viewing [target])"
|
||||
target_long_descriptor = "Narrate to everyone who can see '[target]' (currently at \the [get_area(target)])."
|
||||
|
||||
var/emit = tgui_input_text(caller, target_long_descriptor, "Narrate to [target_name_descriptor]", "", 65535, TRUE, FALSE)
|
||||
if(!emit)
|
||||
return
|
||||
|
||||
var/list/mob/targets = list()
|
||||
var/reject
|
||||
|
||||
if(use_global)
|
||||
for(var/client/C as anything in GLOB.clients)
|
||||
targets += C.mob
|
||||
else if(use_viewers)
|
||||
var/atom/resolved = use_viewers.resolve()
|
||||
if(!istype(resolved))
|
||||
reject = "use_viewers failed atom resolution; this is a bug."
|
||||
else
|
||||
for(var/mob/maybe_viewing in viewers(35, resolved))
|
||||
if(!maybe_viewing.client)
|
||||
continue
|
||||
targets += maybe_viewing
|
||||
else if(use_overmap)
|
||||
var/obj/overmap/entity/resolved = use_viewers.resolve()
|
||||
if(!istype(resolved))
|
||||
reject = "use_overmap failed entity resolution; this is a bug."
|
||||
else
|
||||
// sigh make this better later
|
||||
for(var/client/C as anything in GLOB.clients)
|
||||
if(get_overmap_sector(C.mob) == resolved)
|
||||
targets += C.mob
|
||||
else if(use_direct)
|
||||
var/atom/movable/resolved = use_viewers.resolve()
|
||||
if(!istype(resolved))
|
||||
reject = "use_direct failed target resolution; this is a bug."
|
||||
else
|
||||
targets = resolved.admin_resolve_narrate()
|
||||
else
|
||||
reject = "no narrate mode resolved; this is a bug."
|
||||
|
||||
if(!reject && !length(targets))
|
||||
reject = "no targets in range; skipping narrate sequence."
|
||||
|
||||
if(reject)
|
||||
var/list/html = list(
|
||||
"<hr>",
|
||||
SPAN_BLOCKQUOTE(emit, null),
|
||||
"<hr>",
|
||||
"<center><span style='font-weight: bold; color: red;'>^^^ ERROR: The above was not sent; [reject] ^^^</span></center>",
|
||||
)
|
||||
to_chat(caller, jointext(html, ""))
|
||||
return
|
||||
|
||||
var/list/view_target_to_list = list()
|
||||
for(var/mob/viewing in targets)
|
||||
view_target_to_list += "[key_name(viewing)]"
|
||||
var/view_target_list = jointext(view_target_to_list, ", ")
|
||||
message_admins("[key_name(caller)] sent a [SPAN_TOOLTIP("[html_encode(emit)]", "global narrate")] to [SPAN_TOOLTIP("[view_target_list]", "[length(targets)] target(s)")].")
|
||||
log_admin("[key_name(caller)] sent a global narrate to [length(targets)] targets; VIEWERS: '[view_target_list]'', TEXT: '[emit]'")
|
||||
|
||||
for(var/mob/viewing in targets)
|
||||
to_chat(viewing, emit)
|
||||
@@ -101,86 +101,6 @@
|
||||
admin_ticket_log(M, msg)
|
||||
feedback_add_details("admin_verb","SMS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_admin_world_narrate()
|
||||
set category = "Special Verbs"
|
||||
set name = "Global Narrate"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/msg = input("Message:", "Enter the text you wish to appear to everyone:") as text|null
|
||||
|
||||
if (!msg)
|
||||
return
|
||||
to_chat(world, "[msg]")
|
||||
log_admin("GlobalNarrate: [key_name(usr)] : [msg]")
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(usr)] Sent a global narrate</span>")
|
||||
// SSblackbox.record_feedback("tally", "admin_verb", 1, "Global Narrate") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_admin_direct_narrate(mob/M)
|
||||
set category = "Special Verbs"
|
||||
set name = "Direct Narrate"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
if(!M)
|
||||
M = input("Direct narrate to whom?", "Active Players") as null|anything in GLOB.player_list
|
||||
|
||||
if(!M)
|
||||
return
|
||||
|
||||
var/msg = input("Message:", "Enter the text you wish to appear to your target:") as text|null
|
||||
|
||||
if( !msg )
|
||||
return
|
||||
|
||||
to_chat(M, msg)
|
||||
log_admin("DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]")
|
||||
msg = "<span class='adminnotice'><b> DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]):</b> [msg]<BR></span>"
|
||||
message_admins(msg)
|
||||
admin_ticket_log(M, msg)
|
||||
// SSblackbox.record_feedback("tally", "admin_verb", 1, "Direct Narrate") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_admin_local_narrate(atom/A)
|
||||
set category = "Special Verbs"
|
||||
set name = "Local Narrate"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
if(!A)
|
||||
return
|
||||
var/range = input("Range:", "Narrate to mobs within how many tiles:", 7) as num|null
|
||||
if(!range)
|
||||
return
|
||||
var/msg = input("Message:", "Enter the text you wish to appear to everyone within view:") as text|null
|
||||
if (!msg)
|
||||
return
|
||||
for(var/mob/M in view(range,A))
|
||||
to_chat(M, msg)
|
||||
|
||||
log_admin("LocalNarrate: [key_name(usr)] at [AREACOORD(A)]: [msg]")
|
||||
message_admins("<span class='adminnotice'><b> LocalNarrate: [key_name_admin(usr)] at [ADMIN_COORDJMP(A)]:</b> [msg]<BR></span>")
|
||||
// SSblackbox.record_feedback("tally", "admin_verb", 1, "Local Narrate") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_admin_z_narrate()
|
||||
set category = "Special Verbs"
|
||||
set name = "Z Narrate"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/msg = input("Enter the text you wish to show an entire Z level:", "Z Narrate:") as text|null
|
||||
|
||||
if (!msg)
|
||||
return
|
||||
|
||||
for(var/mob/M in range(192)) //Yes this is lazy
|
||||
to_chat(M, msg)
|
||||
|
||||
log_admin("ZNarrate: [key_name(usr)] at [ADMIN_COORDJMP(usr)]: [msg]")
|
||||
message_admins("<span class='adminnotice'><b> ZNarrate: [key_name_admin(usr)] at [ADMIN_COORDJMP(usr)]:</b> [msg]<BR></span>")
|
||||
|
||||
|
||||
/client/proc/cmd_admin_godmode(mob/M as mob in GLOB.mob_list)
|
||||
set category = "Special Verbs"
|
||||
@@ -632,15 +552,6 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
message_admins("[key_name_admin(src)] has created a command report", 1)
|
||||
feedback_add_details("admin_verb","CCR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_admin_delete(atom/A as obj|mob|turf in world)
|
||||
set category = "Admin"
|
||||
set name = "Delete"
|
||||
|
||||
if(!check_rights(R_SPAWN|R_DEBUG|R_ADMIN))
|
||||
return
|
||||
|
||||
admin_delete(A)
|
||||
|
||||
/client/proc/cmd_admin_list_open_jobs()
|
||||
set category = "Admin"
|
||||
set name = "List free slots"
|
||||
|
||||
Reference in New Issue
Block a user