Files
Bubberstation/code/modules/admin/verbs/adminsay.dm
SkyratBot fb24e440a6 [MIRROR] Adds linking tickets in asay, referencing mob datums in asay, improves asay ref code [MDB IGNORE] (#12475)
* Adds linking tickets in asay, referencing mob datums in asay, improves asay ref code (#65634)

About The Pull Request

Continuing on the work started in #65154 and 61712, this PR expands what asay linking can be used for and improves the code for it. You can now link tickets in asay by saying #[ticket ID] like #1. This shows the ticket's status and who filed the ahelp. Might remove the ticket filer if it's not really useful.

This also fixes an oversight of mine with datum linking, with how mobs and certain other datums (armor datums, landmarks) don't follow the memory address format for their tag values. Datum linking now uses a @ [tag] format, so you can link to a mob by saying @ mob_702 and such.

dreamseeker_2022-03-22_21-51-41.png
Why It's Good For The Game

More robust admin tools
Changelog

cl Ryll/Shaps
admin: You can now link tickets in asay with #[ticket ID], like #1 and #5.
admin: asay datum linking now functions by saying '@ [datum's tag value]`, whether it's a normal datum (@ 0x2001169) or a mob (@ mob_702) or whatever else.

Discord_2022-03-16_23-38-09.png
(old pic)

* Adds linking tickets in asay, referencing mob datums in asay, improves asay ref code

Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
Co-authored-by: Funce <funce.973@gmail.com>
2022-04-07 15:42:34 +01:00

41 lines
1.8 KiB
Plaintext

/client/proc/cmd_admin_say(msg as text)
set category = "Admin"
set name = "Asay" //Gave this shit a shorter name so you only have to time out "asay" rather than "admin say" to use it --NeoFite
set hidden = TRUE
if(!check_rights(0))
return
msg = emoji_parse(copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN))
if(!msg)
return
if(findtext(msg, "@") || findtext(msg, "#"))
var/list/link_results = check_asay_links(msg)
if(length(link_results))
msg = link_results[ASAY_LINK_NEW_MESSAGE_INDEX]
link_results[ASAY_LINK_NEW_MESSAGE_INDEX] = null
var/list/pinged_admin_clients = link_results[ASAY_LINK_PINGED_ADMINS_INDEX]
for(var/iter_ckey in pinged_admin_clients)
var/client/iter_admin_client = pinged_admin_clients[iter_ckey]
if(!iter_admin_client?.holder)
continue
window_flash(iter_admin_client)
SEND_SOUND(iter_admin_client.mob, sound('sound/misc/asay_ping.ogg'))
mob.log_talk(msg, LOG_ASAY)
msg = keywords_lookup(msg)
send_asay_to_other_server(ckey, msg) //SKYRAT EDIT ADDITION
var/asay_color = prefs.read_preference(/datum/preference/color/asay_color)
var/custom_asay_color = (CONFIG_GET(flag/allow_admin_asaycolor) && asay_color) ? "<font color=[asay_color]>" : "<font color='[DEFAULT_ASAY_COLOR]'>"
msg = "[span_adminsay("[span_prefix("ADMIN:")] <EM>[key_name(usr, 1)]</EM> [ADMIN_FLW(mob)]: [custom_asay_color]<span class='message linkify'>[msg]")]</span>[custom_asay_color ? "</font>":null]"
to_chat(GLOB.admins,
type = MESSAGE_TYPE_ADMINCHAT,
html = msg,
confidential = TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Asay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/get_admin_say()
var/msg = input(src, null, "asay \"text\"") as text|null
cmd_admin_say(msg)