Adds Staff-say (#28813)

* staff say

* finally, staffsays

* oops

* deconflict

* yea

* bonk

* build
This commit is contained in:
Contrabang
2025-05-13 13:00:15 -04:00
committed by GitHub
parent dfacf83e18
commit 43439da811
21 changed files with 147 additions and 28 deletions
+1
View File
@@ -21,6 +21,7 @@
#define MESSAGE_TYPE_ADMINCHAT "adminchat"
#define MESSAGE_TYPE_MENTORCHAT "mentorchat"
#define MESSAGE_TYPE_DEVCHAT "devchat"
#define MESSAGE_TYPE_STAFFCHAT "staffchat"
#define MESSAGE_TYPE_EVENTCHAT "eventchat"
#define MESSAGE_TYPE_ADMINLOG "adminlog"
#define MESSAGE_TYPE_ATTACKLOG "attacklog"
+1
View File
@@ -9,4 +9,5 @@
#define ADMIN_CHANNEL "Admin"
#define DSAY_CHANNEL "Dsay"
#define DEV_CHANNEL "Dev"
#define STAFF_CHANNEL "Staff"
+6
View File
@@ -142,6 +142,12 @@ GLOBAL_PROTECT(log_end)
rustlibs_log_write(GLOB.world_game_log, "[message][GLOB.log_end]")
log_if_mismatch(speaker, message)
/proc/log_staffsay(text, mob/speaker)
if(GLOB.configuration.logging.adminchat_logging)
var/message = "STAFFSAY: [speaker.simple_info_line()]: [html_decode(text)]"
rustlibs_log_write(GLOB.world_game_log, "[message][GLOB.log_end]")
log_if_mismatch(speaker, message)
/proc/log_ghostsay(text, mob/speaker)
if(GLOB.configuration.logging.say_logging)
var/message = "DEADCHAT: [speaker.simple_info_line()]: [html_decode(text)]"
@@ -77,3 +77,8 @@
name = DEV_CHANNEL
keys = list("F2")
required_rights = R_DEV_TEAM | R_ADMIN
/datum/keybinding/client/communication/staffsay
name = STAFF_CHANNEL
keys = list("-")
required_rights = R_DEV_TEAM | R_MENTOR | R_ADMIN
+13 -2
View File
@@ -43,6 +43,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/cmd_staff_say,
/datum/admins/proc/PlayerNotes,
/client/proc/cmd_mentor_say,
/client/proc/cmd_dev_say,
@@ -55,6 +56,7 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
/client/proc/view_asays,
/client/proc/view_msays,
/client/proc/view_devsays,
/client/proc/view_staffsays,
/client/proc/empty_ai_core_toggle_latejoin,
/client/proc/aooc,
/client/proc/freeze,
@@ -225,8 +227,16 @@ GLOBAL_LIST_INIT(admin_verbs_mentor, list(
/client/proc/admin_observe_target,
/client/proc/cmd_mentor_say, /* mentor say*/
/client/proc/view_msays,
/client/proc/cmd_staff_say,
/client/proc/view_staffsays
// cmd_mentor_say is added/removed by the toggle_mentor_chat verb
))
GLOBAL_LIST_INIT(admin_verbs_dev, list(
/client/proc/cmd_dev_say,
/client/proc/view_devsays,
/client/proc/cmd_staff_say,
/client/proc/view_staffsays
))
GLOBAL_LIST_INIT(admin_verbs_proccall, list(
/client/proc/callproc,
/client/proc/callproc_datum,
@@ -311,7 +321,7 @@ GLOBAL_LIST_INIT(view_runtimes_verbs, list(
spawn(1) // This setting exposes the profiler for people with R_VIEWRUNTIMES. They must still have it set in cfg/admin.txt
control_freak = 0
if(holder.rights & R_DEV_TEAM)
add_verb(src, /client/proc/cmd_dev_say)
add_verb(src, GLOB.admin_verbs_dev)
if(is_connecting_from_localhost())
add_verb(src, /client/proc/export_current_character)
@@ -344,7 +354,8 @@ GLOBAL_LIST_INIT(view_runtimes_verbs, list(
GLOB.admin_verbs_proccall,
GLOB.admin_verbs_show_debug_verbs,
GLOB.admin_verbs_ticket,
GLOB.admin_verbs_maintainer
GLOB.admin_verbs_maintainer,
GLOB.admin_verbs_dev
))
add_verb(src, /client/proc/show_verbs)
+6
View File
@@ -1350,6 +1350,12 @@
usr.client.view_devsays()
else if(href_list["staffsays"])
if(!check_rights(R_ADMIN | R_DEV_TEAM))
return
usr.client.view_staffsays()
else if(href_list["tdome1"])
if(!check_rights(R_SERVER|R_EVENT)) return
+37 -15
View File
@@ -35,21 +35,6 @@
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()
if(check_rights(R_ADMIN, FALSE))
var/msg = input(src, null, "asay \"text\"") as text|null
cmd_admin_say(msg)
/client/proc/get_mentor_say()
if(check_rights(R_MENTOR | R_ADMIN | R_MOD))
var/msg = input(src, null, "msay \"text\"") as text|null
cmd_mentor_say(msg)
/client/proc/get_dev_team_say()
if(check_rights(R_DEV_TEAM | R_ADMIN | R_MOD))
var/msg = input(src, null, "devsay \"text\"") as text|null
cmd_dev_say(msg)
/client/proc/cmd_dev_say(msg as text)
set name = "Devsay"
set hidden = TRUE
@@ -87,6 +72,43 @@
SSblackbox.record_feedback("tally", "admin_verb", 1, "Devsay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/cmd_staff_say(msg as text)
set name = "Staffsay"
set hidden = TRUE
if(!check_rights(R_DEV_TEAM|R_ADMIN|R_MENTOR))
return
msg = emoji_parse(copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN))
if(!msg)
return
log_staffsay(msg, src)
var/datum/say/staffsay = new(usr.ckey, usr.client.holder.rank, msg, world.timeofday)
GLOB.staffsays += staffsay
mob.create_log(OOC_LOG, "STAFFSAY: [msg]")
if(SSredis.connected)
var/list/data = list()
data["author"] = usr.ckey
data["source"] = GLOB.configuration.system.instance_id
data["message"] = html_decode(msg)
SSredis.publish("byond.staffsay", json_encode(data))
for(var/client/C in GLOB.admins)
if(check_rights(0, 0, C.mob))
var/display_name = key
if(holder.fakekey)
if(C.holder && C.holder.rights & R_ADMIN)
display_name = "[holder.fakekey]/([key])"
else
display_name = holder.fakekey
msg = "<span class='emoji_enabled'>[msg]</span>"
to_chat(C, "<span class='[check_rights(R_ADMIN, 0) ? "staff_channel_admin" : "staff_channel"]'>STAFF: <span class='name'>[display_name]</span> ([admin_jump_link(mob)]): <span class='message'>[msg]</span></span>", MESSAGE_TYPE_STAFFCHAT, confidential = TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Staffsay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/cmd_mentor_say(msg as text)
set name = "Msay"
set hidden = 1
+11
View File
@@ -1,6 +1,7 @@
GLOBAL_LIST_EMPTY(asays)
GLOBAL_LIST_EMPTY(msays)
GLOBAL_LIST_EMPTY(devsays)
GLOBAL_LIST_EMPTY(staffsays)
/datum/say
var/ckey
@@ -44,6 +45,16 @@ GLOBAL_LIST_EMPTY(devsays)
display_says(GLOB.asays, "asay")
/client/proc/view_staffsays()
set name = "Staffsays"
set desc = "View Staffsays from the current round."
set category = "Admin"
if(!check_rights(R_DEV_TEAM | R_ADMIN))
return
display_says(GLOB.staffsays, "devsay")
/client/proc/display_says(list/say_list, title)
var/list/output = list({"
@@ -0,0 +1,11 @@
// Relays messages to staff
/datum/redis_callback/staff_in
channel = "byond.staffsay"
/datum/redis_callback/staff_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(null, FALSE, C.mob))
to_chat(C, "<span class='staff_channel'>STAFF: <small>[data["author"]]@[data["source"]]</small>: [html_encode(data["message"])]</span>")
@@ -39,6 +39,9 @@
if(DEV_CHANNEL)
client.cmd_dev_say(entry)
return TRUE
if(STAFF_CHANNEL)
client.cmd_staff_say(entry)
return TRUE
return FALSE
/**
+1
View File
@@ -2910,6 +2910,7 @@
#include "code\modules\redis\callbacks\dev_callback.dm"
#include "code\modules\redis\callbacks\msay_callback.dm"
#include "code\modules\redis\callbacks\server_messages_callback.dm"
#include "code\modules\redis\callbacks\staff_callback.dm"
#include "code\modules\research\backup_console.dm"
#include "code\modules\research\circuitprinter.dm"
#include "code\modules\research\designs.dm"
@@ -34,6 +34,7 @@ export const MESSAGE_TYPE_COMBAT = 'combat';
export const MESSAGE_TYPE_ADMINCHAT = 'adminchat';
export const MESSAGE_TYPE_MENTORCHAT = 'mentorchat';
export const MESSAGE_TYPE_DEVCHAT = 'devchat';
export const MESSAGE_TYPE_STAFFCHAT = 'staffchat';
export const MESSAGE_TYPE_EVENTCHAT = 'eventchat';
export const MESSAGE_TYPE_ADMINLOG = 'adminlog';
export const MESSAGE_TYPE_ATTACKLOG = 'attacklog';
@@ -132,6 +133,13 @@ export const MESSAGE_TYPES = [
selector: '.dev_channel',
admin: true,
},
{
type: MESSAGE_TYPE_STAFFCHAT,
name: 'Staff Chat',
description: 'STAFFSAY messages',
selector: '.staff_channel',
admin: true,
},
{
type: MESSAGE_TYPE_ADMINLOG,
name: 'Admin Log',
@@ -179,12 +179,12 @@ h2.alert {
}
.mentor_channel {
color: #775bff;
color: #b4af13;
font-weight: bold;
}
.mentor_channel_admin {
color: #a35cff;
color: #f1ec50;
font-weight: bold;
}
@@ -230,6 +230,16 @@ h2.alert {
font-weight: bold;
}
.staff_channel {
color: #775bff;
font-weight: bold;
}
.staff_channel_admin {
color: #a35cff;
font-weight: bold;
}
// MARK: Radio
.radio {
color: #20b142;
@@ -66,10 +66,12 @@ h2.alert {
.mentor_channel {
color: #775bff;
color: #5e6812;
}
.mentor_channel_admin {
color: #a35cff;
color: #94a419;
}
.adminhelp {
@@ -100,6 +102,14 @@ h2.alert {
color: #26a419;
}
.staff_channel {
color: #775bff;
}
.staff_channel_admin {
color: #a35cff;
}
// MARK: Radio
.radio {
color: #408010;
@@ -14,7 +14,7 @@ describe('ChannelIterator', () => {
expect(channelIterator.next()).toBe('Me');
expect(channelIterator.next()).toBe('OOC');
expect(channelIterator.next()).toBe('LOOC');
expect(channelIterator.next()).toBe('Say'); // Admin, Mentor, Dsay, and Dev are blacklisted so should be skipped
expect(channelIterator.next()).toBe('Say'); // Admin, Mentor, Dsay, Dev, and Staff are blacklisted so should be skipped
});
it('should set a channel properly', () => {
+15 -3
View File
@@ -1,4 +1,15 @@
export type Channel = 'Say' | 'Radio' | 'Whisper' | 'Me' | 'OOC' | 'LOOC' | 'Mentor' | 'Admin' | 'Dsay' | 'Dev';
export type Channel =
| 'Say'
| 'Radio'
| 'Whisper'
| 'Me'
| 'OOC'
| 'LOOC'
| 'Mentor'
| 'Admin'
| 'Dsay'
| 'Dev'
| 'Staff';
/**
* ### ChannelIterator
@@ -19,9 +30,10 @@ export class ChannelIterator {
'Admin',
'Dsay',
'Dev',
'Staff',
];
private readonly blacklist: Channel[] = ['Mentor', 'Admin', 'Dsay', 'Dev'];
private readonly quiet: Channel[] = ['OOC', 'LOOC', 'Mentor', 'Admin', 'Dsay', 'Dev'];
private readonly blacklist: Channel[] = ['Mentor', 'Admin', 'Dsay', 'Dev', 'Staff'];
private readonly quiet: Channel[] = ['OOC', 'LOOC', 'Mentor', 'Admin', 'Dsay', 'Dev', 'Staff'];
public next(): Channel {
if (this.blacklist.includes(this.channels[this.index])) {
@@ -23,6 +23,7 @@ $_channel_map: (
'Med': #57b8f0,
'Mentor': #d6c208,
'Dev': #61b413,
'Staff': #775bff,
'OOC': #cca300,
'Proc': #b84f92,
'R-Ear': #a4bad6,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long