mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Refactors asay+msay redis controllers (#18483)
This commit is contained in:
@@ -45,7 +45,6 @@ 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,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
data["author"] = usr.ckey
|
||||
data["source"] = GLOB.configuration.system.instance_id
|
||||
data["message"] = msg
|
||||
SSredis.publish("byond.asay.out", json_encode(data))
|
||||
SSredis.publish("byond.asay", json_encode(data))
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(R_ADMIN & C.holder.rights)
|
||||
@@ -64,7 +64,7 @@
|
||||
data["author"] = usr.ckey
|
||||
data["source"] = GLOB.configuration.system.instance_id
|
||||
data["message"] = msg
|
||||
SSredis.publish("byond.msay.out", json_encode(data))
|
||||
SSredis.publish("byond.msay", json_encode(data))
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(check_rights(R_ADMIN|R_MOD|R_MENTOR, 0, C.mob))
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// GSAY
|
||||
// Like asay but global between instances!
|
||||
// *Insert changeling hivemind :g joke here*
|
||||
|
||||
// TODO - May as well fold this into regular asay. We already have it global enough with the discord integration.
|
||||
// Same with msay
|
||||
/client/proc/gsay(msg as text)
|
||||
set name = "gsay"
|
||||
set hidden = TRUE
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
// Sanitize it all
|
||||
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
|
||||
|
||||
var/datum/server_command/gsay/GS = SSinstancing.registered_commands["gsay"]
|
||||
GS.custom_dispatch(usr.ckey, msg)
|
||||
|
||||
// Send to online admins
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(C.holder.rights & R_ADMIN)
|
||||
to_chat(C, "<span class='admin_channel'>GSAY: [usr.ckey]@[GLOB.configuration.system.instance_id]: [msg]</span>")
|
||||
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "gsay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
@@ -446,7 +446,7 @@
|
||||
data["author"] = "alice"
|
||||
data["source"] = GLOB.configuration.system.instance_id
|
||||
data["message"] = msg
|
||||
SSredis.publish("byond.msay.out", json_encode(data))
|
||||
SSredis.publish("byond.msay", json_encode(data))
|
||||
|
||||
else if(holder.rights & R_BAN)
|
||||
if(SSredis.connected)
|
||||
@@ -456,7 +456,7 @@
|
||||
data["author"] = "alice"
|
||||
data["source"] = GLOB.configuration.system.instance_id
|
||||
data["message"] = msg
|
||||
SSredis.publish("byond.asay.out", json_encode(data))
|
||||
SSredis.publish("byond.asay", json_encode(data))
|
||||
|
||||
/client/proc/announce_leave()
|
||||
if(!holder)
|
||||
@@ -472,7 +472,7 @@
|
||||
data["author"] = "alice"
|
||||
data["source"] = GLOB.configuration.system.instance_id
|
||||
data["message"] = msg
|
||||
SSredis.publish("byond.msay.out", json_encode(data))
|
||||
SSredis.publish("byond.msay", json_encode(data))
|
||||
|
||||
else if(holder.rights & R_BAN)
|
||||
if(SSredis.connected)
|
||||
@@ -484,7 +484,7 @@
|
||||
data["author"] = "alice"
|
||||
data["source"] = GLOB.configuration.system.instance_id
|
||||
data["message"] = msg
|
||||
SSredis.publish("byond.asay.out", json_encode(data))
|
||||
SSredis.publish("byond.asay", json_encode(data))
|
||||
|
||||
|
||||
/client/proc/donor_loadout_points()
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// Relays messages to asay
|
||||
/datum/redis_callback/asay_in
|
||||
channel = "byond.asay.in"
|
||||
channel = "byond.asay"
|
||||
|
||||
/datum/redis_callback/asay_in/on_message(message)
|
||||
var/list/data = json_decode(message)
|
||||
if(data["source"] == GLOB.configuration.system.instance_id) // Ignore self messages
|
||||
return
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(R_ADMIN & C.holder.rights)
|
||||
to_chat(C, "<span class='admin_channel'>ADMIN: <small>[data["author"]]@[data["source"]]</small>: [html_encode(data["message"])]</span>")
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// Relays messages to msay
|
||||
/datum/redis_callback/msay_in
|
||||
channel = "byond.msay.in"
|
||||
channel = "byond.msay"
|
||||
|
||||
/datum/redis_callback/msay_in/on_message(message)
|
||||
var/list/data = json_decode(message)
|
||||
if(data["source"] == GLOB.configuration.system.instance_id) // Ignore self messages
|
||||
return
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(check_rights(R_ADMIN|R_MOD|R_MENTOR, FALSE, C.mob))
|
||||
to_chat(C, "<span class='mentor_channel'>MENTOR: <small>[data["author"]]@[data["source"]]</small>: [html_encode(data["message"])]</span>")
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/datum/server_command/gsay
|
||||
command_name = "gsay"
|
||||
|
||||
/datum/server_command/gsay/execute(source, command_args)
|
||||
var/message = command_args["msg"]
|
||||
var/user = command_args["usr"]
|
||||
|
||||
// Send to online admins
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(C.holder.rights & R_ADMIN)
|
||||
to_chat(C, "<span class='admin_channel'>GSAY: [user]@[source]: [message]</span>")
|
||||
|
||||
/datum/server_command/gsay/custom_dispatch(ackey, message)
|
||||
var/list/cmd_args = list()
|
||||
cmd_args["usr"] = ackey
|
||||
cmd_args["msg"] = message
|
||||
|
||||
dispatch(cmd_args)
|
||||
@@ -1232,7 +1232,6 @@
|
||||
#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"
|
||||
@@ -2445,7 +2444,6 @@
|
||||
#include "code\modules\security_levels\keycard_authentication.dm"
|
||||
#include "code\modules\security_levels\security_levels.dm"
|
||||
#include "code\modules\server_commands\servermsg.dm"
|
||||
#include "code\modules\server_commands\commands\gsay.dm"
|
||||
#include "code\modules\server_commands\commands\newroundannounce.dm"
|
||||
#include "code\modules\shuttle\assault_pod.dm"
|
||||
#include "code\modules\shuttle\emergency.dm"
|
||||
|
||||
Reference in New Issue
Block a user