Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into tgui-alerts-and-what-not

This commit is contained in:
SandPoot
2021-10-16 14:11:00 -03:00
30 changed files with 8625 additions and 7826 deletions
+35 -5
View File
@@ -161,13 +161,14 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
var/client/initiator //semi-misnomer, it's the person who ahelped/was bwoinked
var/initiator_ckey
var/initiator_key_name
var/heard_by_no_admins = FALSE
var/list/_interactions //use AddInteraction() or, preferably, admin_ticket_log()
var/obj/effect/statclick/ahelp/statclick
var/static/ticket_counter = 0
/// did we send "answered" to irc yet
var/answered = FALSE
//call this on its own to create a ticket, don't manually assign current_ticket
//msg is the title of the ticket: usually the ahelp text
@@ -209,7 +210,6 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
log_admin_private("Ticket #[id]: [key_name(initiator)]: [name] - heard by [admin_number_present] non-AFK admins who have +BAN.")
if(admin_number_present <= 0)
to_chat(C, "<span class='notice'>No active admins are online, your adminhelp was sent to the admin irc.</span>")
heard_by_no_admins = TRUE
else
// citadel edit: send anyways
send2adminchat(initiator_ckey, "Ticket #[id]: [name] - Heard by [admin_number_present] admins present with +BAN.")
@@ -223,9 +223,8 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
return ..()
/datum/admin_help/proc/AddInteraction(formatted_message)
// if(heard_by_no_admins usr && usr.ckey != initiator_ckey)
// heard_by_no_admins = FALSE
if(usr && (usr.ckey != initiator_ckey))
if(usr && (usr.ckey != initiator_ckey) && !answered)
answered = TRUE
send2adminchat(initiator_ckey, "Ticket #[id]: Answered by [key_name(usr)]")
_interactions += "[TIME_STAMP("hh:mm:ss", FALSE)]: [formatted_message]"
@@ -732,3 +731,34 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
return founds
return msg
/**
* Checks a given message to see if any of the words contain an active admin's ckey with an @ before it
*
* Returns nothing if no pings are found, otherwise returns an associative list with ckey -> client
* Also modifies msg to underline the pings, then stores them in the key [ADMINSAY_PING_UNDERLINE_NAME_INDEX] for returning
*
* Arguments:
* * msg - the message being scanned
*/
/proc/check_admin_pings(msg)
//explode the input msg into a list
var/list/msglist = splittext(msg, " ")
var/list/admins_to_ping = list()
var/i = 0
for(var/word in msglist)
i++
if(!length(word))
continue
if(word[1] != "@")
continue
var/ckey_check = lowertext(copytext(word, 2))
var/client/client_check = GLOB.directory[ckey_check]
if(client_check?.holder)
msglist[i] = "<u>[word]</u>"
admins_to_ping[ckey_check] = client_check
if(length(admins_to_ping))
admins_to_ping[ADMINSAY_PING_UNDERLINE_NAME_INDEX] = jointext(msglist, " ") // without tuples, we must make do!
return admins_to_ping
+13
View File
@@ -8,6 +8,19 @@
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg)
return
var/list/pinged_admin_clients = check_admin_pings(msg)
if(length(pinged_admin_clients) && pinged_admin_clients[ADMINSAY_PING_UNDERLINE_NAME_INDEX])
msg = pinged_admin_clients[ADMINSAY_PING_UNDERLINE_NAME_INDEX]
pinged_admin_clients -= ADMINSAY_PING_UNDERLINE_NAME_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/bloop.ogg'))
msg = emoji_parse(msg)
mob.log_talk(msg, LOG_ASAY)