diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 019ccedade9..a78f3219e47 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -45,6 +45,7 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list( /datum/admins/proc/toggleemoji, /*toggles using emoji in ooc for everyone*/ /client/proc/game_panel, /*game panel, allows to change game-mode etc*/ /client/proc/cmd_admin_say, /*admin-only ooc chat*/ + /client/proc/gsay, /*cross-server asay*/ /datum/admins/proc/PlayerNotes, /client/proc/cmd_mentor_say, /datum/admins/proc/show_player_notes, diff --git a/code/modules/admin/verbs/gsay.dm b/code/modules/admin/verbs/gsay.dm new file mode 100644 index 00000000000..d777fa422b2 --- /dev/null +++ b/code/modules/admin/verbs/gsay.dm @@ -0,0 +1,27 @@ +// GSAY +// Like asay but global between instances! +// *Insert changeling hivemind :g joke here* + +/client/proc/gsay(msg as text) + set name = "gsay" + set hidden = TRUE + if(!check_rights(R_ADMIN)) + return + + if(!msg) + return + msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN)) + + // To whoever says "Why dont you just topic the full message with formatting" + // This lets us use this in other apps, like a discord bot, without HTML parsing + // It also removes a way to put whatever HTML we want in the chat window + var/built_topic = "gsay&msg=[url_encode(msg)]&usr=[url_encode(usr.ckey)]&src=[url_encode(GLOB.configuration.system.instance_id)]" + + // Send to peers + SSinstancing.topic_all_peers(built_topic) + // Send to online admins + for(var/client/C in GLOB.admins) + if(R_ADMIN & C.holder.rights) + to_chat(C, "GSAY: [usr.ckey]@[GLOB.configuration.system.instance_id]: [msg]") + + SSblackbox.record_feedback("tally", "admin_verb", 1, "gsay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/world_topic/gsay.dm b/code/modules/world_topic/gsay.dm new file mode 100644 index 00000000000..971375d8658 --- /dev/null +++ b/code/modules/world_topic/gsay.dm @@ -0,0 +1,18 @@ +// Just dumps the text in the admin chat box +/datum/world_topic_handler/gsay + topic_key = "gsay" + requires_commskey = TRUE + +/datum/world_topic_handler/gsay/execute(list/input, key_valid) + if(!input["msg"] || !input["usr"] || !input["src"]) + return json_encode(list("error" = "Malformed request")) + + var/message = input["msg"] + var/user = input["usr"] + var/source = input["source"] + + // Send to online admins + for(var/client/C in GLOB.admins) + if(R_ADMIN & C.holder.rights) + to_chat(C, "GSAY: [user]@[source]: [message]") + diff --git a/paradise.dme b/paradise.dme index 259a5eac574..5488d42c65c 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1210,6 +1210,7 @@ #include "code\modules\admin\verbs\freeze.dm" #include "code\modules\admin\verbs\getlogs.dm" #include "code\modules\admin\verbs\gimmick_team.dm" +#include "code\modules\admin\verbs\gsay.dm" #include "code\modules\admin\verbs\infiltratorteam_syndicate.dm" #include "code\modules\admin\verbs\logging_view.dm" #include "code\modules\admin\verbs\manage_queue.dm" @@ -2522,6 +2523,7 @@ #include "code\modules\world_topic\_topic_base.dm" #include "code\modules\world_topic\adminmsg.dm" #include "code\modules\world_topic\announce.dm" +#include "code\modules\world_topic\gsay.dm" #include "code\modules\world_topic\instance_announce.dm" #include "code\modules\world_topic\manifest.dm" #include "code\modules\world_topic\ping.dm"