From f7c900103df9e2ff2c35201d4e083a0920fd7a0f Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 10 Jul 2023 10:13:17 -0700 Subject: [PATCH 1/4] goodbye-the-end --- code/__DEFINES/speech_channels.dm | 1 - code/datums/keybinding/communication.dm | 7 ---- code/datums/redis/callbacks/msay.dm | 16 -------- code/modules/admin/admin_verbs.dm | 1 - code/modules/admin/tabs/admin_tab.dm | 44 ---------------------- code/modules/client/client_procs.dm | 11 +----- code/modules/tgui/tgui-say/modal.dm | 2 +- code/modules/tgui/tgui-say/speech.dm | 5 +-- colonialmarines.dme | 1 - tgui/packages/tgui-panel/chat/constants.js | 10 +---- tgui/packages/tgui-say/helpers/index.tsx | 5 +-- tgui/packages/tgui-say/styles/colors.scss | 2 - 12 files changed, 6 insertions(+), 99 deletions(-) delete mode 100644 code/datums/redis/callbacks/msay.dm diff --git a/code/__DEFINES/speech_channels.dm b/code/__DEFINES/speech_channels.dm index 405506678407..3f6e4720bde9 100644 --- a/code/__DEFINES/speech_channels.dm +++ b/code/__DEFINES/speech_channels.dm @@ -4,6 +4,5 @@ #define ME_CHANNEL "Me" #define OOC_CHANNEL "OOC" #define LOOC_CHANNEL "LOOC" -#define MOD_CHANNEL "MSAY" #define ADMIN_CHANNEL "ASAY" #define MENTOR_CHANNEL "Mentor" diff --git a/code/datums/keybinding/communication.dm b/code/datums/keybinding/communication.dm index 9a438fc6dabd..4164198d4818 100644 --- a/code/datums/keybinding/communication.dm +++ b/code/datums/keybinding/communication.dm @@ -42,13 +42,6 @@ full_name = "IC Comms (;)" keybind_signal = COMSIG_KG_CLIENT_RADIO_DOWN -/datum/keybinding/client/communication/mod_say - hotkey_keys = list("Unbound") - classic_keys = list("Unbound") - name = MOD_CHANNEL - full_name = "Mod Say" - keybind_signal = COMSIG_KB_ADMIN_ASAY_DOWN - /datum/keybinding/client/communication/asay hotkey_keys = list("F3") classic_keys = list("F5") diff --git a/code/datums/redis/callbacks/msay.dm b/code/datums/redis/callbacks/msay.dm deleted file mode 100644 index 3c0db7638a3a..000000000000 --- a/code/datums/redis/callbacks/msay.dm +++ /dev/null @@ -1,16 +0,0 @@ -/datum/redis_callback/msay - channel = "byond.msay" - -/datum/redis_callback/msay/on_message(message) - var/list/data = json_decode(message) - - if(data["source"] == SSredis.instance_name) - return - - var/msg = "[data["rank"]]: [data["author"]]@[data["source"]]: [strip_html(data["message"])]" - - for(var/client/client in GLOB.admins) - if(!(R_MOD & client.admin_holder.rights)) - continue - - to_chat(client, msg) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index ba5d52a23f97..93f2dd2b0c9b 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -27,7 +27,6 @@ var/list/admin_verbs_default = list( /client/proc/invismin, /client/proc/set_explosive_antigrief, /client/proc/check_explosive_antigrief, - /client/proc/cmd_mod_say, /client/proc/dsay, /client/proc/chem_panel, /*chem panel, allows viewing, editing and creation of reagent and chemical_reaction datums*/ /client/proc/player_panel_new, /*shows an interface for all players, with links to various panels*/ diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index c0ffeada9883..4b439a2ca330 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -328,50 +328,6 @@ var/msg = input(src, null, "asay \"text\"") as text|null cmd_admin_say(msg) -/client/proc/cmd_mod_say(msg as text) - set name = "Msay" - set category = "Admin" - set hidden = TRUE - - if(!check_rights(R_ADMIN|R_MOD)) - return - - msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN) - - if (!msg) - return - - REDIS_PUBLISH("byond.msay", "author" = src.key, "message" = strip_html(msg), "admin" = CLIENT_HAS_RIGHTS(src, R_ADMIN), "rank" = admin_holder.rank) - - 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?.admin_holder) - continue - window_flash(iter_admin_client) - SEND_SOUND(iter_admin_client.mob, sound('sound/misc/asay_ping.ogg')) - - log_adminpm("MOD: [key_name(src)] : [msg]") - - var/color = "mod" - if (check_rights(R_ADMIN,0)) - color = "adminmod" - - var/channel = "MOD:" - channel = "[admin_holder.rank]:" - for(var/client/C in GLOB.admins) - if((R_ADMIN|R_MOD) & C.admin_holder.rights) - to_chat(C, "[channel] [key_name(src,1)] [ADMIN_JMP_USER(mob)]: [msg]") - -/client/proc/get_mod_say() - var/msg = input(src, null, "msay \"text\"") as text|null - cmd_mod_say(msg) - /client/proc/cmd_mentor_say(msg as text) set name = "MentorSay" set category = "OOC" diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 6926175c835a..c700a226295e 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -713,17 +713,8 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[looc]") else winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=looc") - if(MOD_CHANNEL) - if(admin_holder?.check_for_rights(R_MOD)) - if(prefs.tgui_say) - var/msay = tgui_say_create_open_command(MOD_CHANNEL) - winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[msay]") - else - winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=msay") - else - winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=") if(ADMIN_CHANNEL) - if(admin_holder?.check_for_rights(R_ADMIN)) + if(admin_holder?.check_for_rights(R_MOD)) if(prefs.tgui_say) var/asay = tgui_say_create_open_command(ADMIN_CHANNEL) winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=[asay]") diff --git a/code/modules/tgui/tgui-say/modal.dm b/code/modules/tgui/tgui-say/modal.dm index b959019b894f..f1e87e001cef 100644 --- a/code/modules/tgui/tgui-say/modal.dm +++ b/code/modules/tgui/tgui-say/modal.dm @@ -83,7 +83,7 @@ if(!payload?["channel"]) CRASH("No channel provided to an open TGUI-Say") window_open = TRUE - if(payload["channel"] != OOC_CHANNEL && payload["channel"] != LOOC_CHANNEL && payload["channel"] != MOD_CHANNEL && payload["channel"] != ADMIN_CHANNEL && payload["channel"] != MENTOR_CHANNEL) + if(payload["channel"] != OOC_CHANNEL && payload["channel"] != LOOC_CHANNEL && payload["channel"] != ADMIN_CHANNEL && payload["channel"] != MENTOR_CHANNEL) start_thinking() return TRUE diff --git a/code/modules/tgui/tgui-say/speech.dm b/code/modules/tgui/tgui-say/speech.dm index f278361ac0d0..7bce349e1b7f 100644 --- a/code/modules/tgui/tgui-say/speech.dm +++ b/code/modules/tgui/tgui-say/speech.dm @@ -47,9 +47,6 @@ if(LOOC_CHANNEL) client.looc(entry) return TRUE - if(MOD_CHANNEL) - client.cmd_mod_say(entry) - return TRUE if(ADMIN_CHANNEL) client.cmd_admin_say(entry) return TRUE @@ -94,7 +91,7 @@ return TRUE if(type == "force") var/target_channel = payload["channel"] - if(target_channel == ME_CHANNEL || target_channel == OOC_CHANNEL || target_channel == LOOC_CHANNEL || target_channel == MOD_CHANNEL) + if(target_channel == ME_CHANNEL || target_channel == OOC_CHANNEL || target_channel == LOOC_CHANNEL || target_channel == ADMIN_CHANNEL) target_channel = SAY_CHANNEL // No ooc leaks delegate_speech(alter_entry(payload), target_channel) return TRUE diff --git a/colonialmarines.dme b/colonialmarines.dme index 204c144c8916..c3d32ee37cff 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -556,7 +556,6 @@ #include "code\datums\redis\redis_message.dm" #include "code\datums\redis\callbacks\_redis_callback.dm" #include "code\datums\redis\callbacks\asay.dm" -#include "code\datums\redis\callbacks\msay.dm" #include "code\datums\stamina\_stamina.dm" #include "code\datums\stamina\none.dm" #include "code\datums\statistics\cause_data.dm" diff --git a/tgui/packages/tgui-panel/chat/constants.js b/tgui/packages/tgui-panel/chat/constants.js index a73003e13267..ac9346d8d5f0 100644 --- a/tgui/packages/tgui-panel/chat/constants.js +++ b/tgui/packages/tgui-panel/chat/constants.js @@ -125,14 +125,8 @@ export const MESSAGE_TYPES = [ type: MESSAGE_TYPE_ADMINCHAT, name: 'Admin Chat', description: 'ASAY messages', - selector: '.admin_channel, .adminsay, .headminsay', - admin: true, - }, - { - type: MESSAGE_TYPE_MODCHAT, - name: 'Mod Chat', - description: 'MSAY messages', - selector: '.mod_channel, .mod, .adminmod, .staffsay', + selector: + '.admin_channel, .adminsay, .headminsay, .mod_channel, .mod, .adminmod, .staffsay', admin: true, }, { diff --git a/tgui/packages/tgui-say/helpers/index.tsx b/tgui/packages/tgui-say/helpers/index.tsx index 44225cb876d3..c359c79a940f 100644 --- a/tgui/packages/tgui-say/helpers/index.tsx +++ b/tgui/packages/tgui-say/helpers/index.tsx @@ -166,13 +166,10 @@ export const getAvailableChannels = ( return availableChannels; } - if (roles.includes('Mod')) { - availableChannels.push('MSAY'); - } if (roles.includes('Mentor')) { availableChannels.push('Mentor'); } - if (roles.includes('Admin')) { + if (roles.includes('Mod')) { availableChannels.push('ASAY'); } diff --git a/tgui/packages/tgui-say/styles/colors.scss b/tgui/packages/tgui-say/styles/colors.scss index 509b3e17f5ef..e0abb717edf3 100644 --- a/tgui/packages/tgui-say/styles/colors.scss +++ b/tgui/packages/tgui-say/styles/colors.scss @@ -14,7 +14,6 @@ $comms: #b4b4b4; $me: #5975da; $ooc: #1c52f5; $looc: #e362b4; -$msay: #74471b; $mentor: #b5850d; $asay: #9611d4; @@ -49,7 +48,6 @@ $_channel_map: ( 'ooc': $ooc, 'looc': $looc, 'whisper': $say, - 'msay': $msay, 'mentor': $mentor, 'asay': $asay, 'department': $comms, From 499825b81344bb18be109fc11d56fe6ab3ab5a76 Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 10 Jul 2023 11:16:26 -0700 Subject: [PATCH 2/4] asay update --- code/modules/admin/tabs/admin_tab.dm | 33 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index 4b439a2ca330..4d0a844cfb73 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -223,25 +223,40 @@ set category = "Admin" set hidden = TRUE - if(!check_rights(R_ADMIN)) + if(!check_rights(R_ADMIN|R_MOD)) return msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN) - if(!msg) + + if (!msg) return - log_adminpm("ADMIN : [key_name(src)] : [msg]") - REDIS_PUBLISH("byond.asay", "author" = src.key, "message" = strip_html(msg), "host" = ishost(src), "rank" = admin_holder.rank) + REDIS_PUBLISH("byond.asay", "author" = src.key, "message" = strip_html(msg), "admin" = CLIENT_HAS_RIGHTS(src, R_ADMIN), "rank" = admin_holder.rank) + + 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?.admin_holder) + continue + window_flash(iter_admin_client) + SEND_SOUND(iter_admin_client.mob, sound('sound/misc/asay_ping.ogg')) + + log_adminpm("ADMIN: [key_name(src)] : [msg]") var/color = "adminsay" if(ishost(usr)) color = "headminsay" - if(check_rights(R_ADMIN,0)) - msg = "ADMIN: [key_name(usr, 1)] [ADMIN_JMP_USER(mob)]: [msg]" - for(var/client/C in GLOB.admins) - if(R_ADMIN & C.admin_holder.rights) - to_chat(C, msg) + var/channel = "ADMIN:" + channel = "[admin_holder.rank]:" + for(var/client/client as anything in GLOB.admins) + if((R_ADMIN|R_MOD) & client.admin_holder.rights) + to_chat(client, "[channel] [key_name(src,1)] [ADMIN_JMP_USER(mob)]: [msg]") /datum/admins/proc/alertall() set name = "Alert All" From 330a9cd10d2b08e7389a4c2563668c4135241df4 Mon Sep 17 00:00:00 2001 From: John Doe Date: Tue, 11 Jul 2023 00:14:12 -0700 Subject: [PATCH 3/4] allows use of msay as well --- code/modules/admin/admin_verbs.dm | 1 + code/modules/admin/tabs/admin_tab.dm | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 93f2dd2b0c9b..4aabfe1507aa 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -80,6 +80,7 @@ var/list/admin_verbs_admin = list( /client/proc/toggle_hear_radio, /*toggles whether we hear the radio*/ /client/proc/event_panel, /client/proc/cmd_admin_say, /*admin-only ooc chat*/ + /client/proc/cmd_mod_say, /* alternate way of typing asay, no different than cmd_admin_say */ /client/proc/free_slot, /*frees slot for chosen job*/ /client/proc/modify_slot, /client/proc/cmd_admin_rejuvenate, diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index 4d0a844cfb73..5a98faa6ddaa 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -218,6 +218,13 @@ message_admins("[key_name(usr)] used Toggle Wake In View.") +/client/proc/cmd_mod_say(msg as text) + set name = "Msay" // This exists for ease of admins who were used to using msay instead of asay + set category = "Admin" + set hidden = TRUE + + cmd_admin_say(msg) + /client/proc/cmd_admin_say(msg as text) 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 category = "Admin" From 25ecd9af5b73fb0a51a8fdd1e19dd14f76a856f9 Mon Sep 17 00:00:00 2001 From: John Doe Date: Tue, 11 Jul 2023 04:44:49 -0700 Subject: [PATCH 4/4] a --- code/modules/admin/admin_verbs.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 4aabfe1507aa..6154bb4f8c32 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -67,6 +67,8 @@ var/list/admin_verbs_default = list( /datum/admins/proc/alertall, /datum/admins/proc/imaginary_friend, /client/proc/toggle_ares_ping, + /client/proc/cmd_admin_say, /*staff-only ooc chat*/ + /client/proc/cmd_mod_say, /* alternate way of typing asay, no different than cmd_admin_say */ ) var/list/admin_verbs_admin = list( @@ -79,8 +81,6 @@ var/list/admin_verbs_admin = list( /client/proc/toggleprayers, /*toggles prayers on/off*/ /client/proc/toggle_hear_radio, /*toggles whether we hear the radio*/ /client/proc/event_panel, - /client/proc/cmd_admin_say, /*admin-only ooc chat*/ - /client/proc/cmd_mod_say, /* alternate way of typing asay, no different than cmd_admin_say */ /client/proc/free_slot, /*frees slot for chosen job*/ /client/proc/modify_slot, /client/proc/cmd_admin_rejuvenate,