Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev team chat #26669

Merged
merged 9 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions code/__DEFINES/admin_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#define BANTYPE_ADMIN_PERMA 7
#define BANTYPE_ADMIN_TEMP 8

//Please don't edit these values without speaking to Errorage first ~Carn
//Admin Permissions
#define R_BUILDMODE (1<<0)
#define R_ADMIN (1<<1)
Expand All @@ -40,11 +39,12 @@
#define R_PROCCALL (1<<15)
#define R_VIEWRUNTIMES (1<<16)
#define R_MAINTAINER (1<<17)
#define R_DEV_TEAM (1<<18)
// Update the following two defines if you add more

#define R_MAXPERMISSION (1<<17) //This holds the maximum value for a permission. It is used in iteration, so keep it updated.
#define R_MAXPERMISSION (1<<18) // This holds the maximum value for a permission. It is used in iteration, so keep it updated.

#define R_HOST ((1<<18)-1) //17 bit bitmask, update me if we ever add more admin permissions. Sum of all permissions to allow easy setting.
#define R_HOST ((1<<19)-1) // 18 bit bitmask, update me if we ever add more admin permissions. Sum of all permissions to allow easy setting.
S34NW marked this conversation as resolved.
Show resolved Hide resolved


#define ADMIN_QUE(user,display) "<a href='byond://?_src_=holder;adminmoreinfo=[user.UID()]'>[display]</a>"
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define MESSAGE_TYPE_COMBAT "combat"
#define MESSAGE_TYPE_ADMINCHAT "adminchat"
#define MESSAGE_TYPE_MENTORCHAT "mentorchat"
#define MESSAGE_TYPE_DEVCHAT "devchat"
#define MESSAGE_TYPE_EVENTCHAT "eventchat"
#define MESSAGE_TYPE_ADMINLOG "adminlog"
#define MESSAGE_TYPE_ATTACKLOG "attacklog"
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@

#define is_admin(user) (check_rights(R_ADMIN, 0, (user)) != 0)

#define is_developer(user) (check_rights(R_DEV_TEAM, 0, (user)) != 0)

#define SLEEP_CHECK_DEATH(X) sleep(X); if(QDELETED(src) || stat == DEAD) return;

// Locations
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/speech_channels.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
#define MENTOR_CHANNEL "Mentor"
#define ADMIN_CHANNEL "Admin"
#define DSAY_CHANNEL "Dsay"
#define DEV_CHANNEL "Dev"

4 changes: 4 additions & 0 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ GLOBAL_PROTECT(log_end)
if(GLOB.configuration.logging.adminchat_logging)
rustg_log_write(GLOB.world_game_log, "MENTORSAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")

/proc/log_devsay(text, mob/speaker)
if(GLOB.configuration.logging.adminchat_logging)
rustg_log_write(GLOB.world_game_log, "DEVSAY: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")

/proc/log_ghostsay(text, mob/speaker)
if(GLOB.configuration.logging.say_logging)
rustg_log_write(GLOB.world_game_log, "DEADCHAT: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")
Expand Down
1 change: 1 addition & 0 deletions code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
if(rights & R_MENTOR) . += "[seperator]+MENTOR"
if(rights & R_VIEWRUNTIMES) . += "[seperator]+VIEWRUNTIMES"
if(rights & R_MAINTAINER) . += "[seperator]+MAINTAINER"
if(rights & R_DEV_TEAM) . += "[seperator]+DEV_TEAM"

/proc/ui_style2icon(ui_style)
switch(ui_style)
Expand Down
5 changes: 5 additions & 0 deletions code/datums/keybindings/communication_keybinds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@
name = DSAY_CHANNEL
keys = list("F10")
required_rights = R_ADMIN

/datum/keybinding/client/communication/devsay
name = DEV_CHANNEL
keys = list("F2")
required_rights = R_DEV_TEAM | R_ADMIN
4 changes: 2 additions & 2 deletions code/game/verbs/who.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@

num_admins_online++

else if(check_rights(R_MENTOR|R_MOD, 0, C.mob))
else if(check_rights(R_MENTOR|R_MOD|R_DEV_TEAM, 0, C.mob))
// Their rank may not have a defined colour, only set colour if so
var/rank_colour = client2rankcolour(C)
if(rank_colour)
Expand Down Expand Up @@ -172,7 +172,7 @@
msg += "<b>[C]</b> is a [C.holder.rank]"
msg += "\n"
num_admins_online++
else if(check_rights(R_MOD|R_MENTOR, 0, C.mob) && !check_rights(R_ADMIN, 0, C.mob))
else if(check_rights(R_MOD|R_MENTOR|R_DEV_TEAM, 0, C.mob) && !check_rights(R_ADMIN, 0, C.mob))
var/rank_colour = client2rankcolour(C)
if(rank_colour)
modmsg += "<font color='[rank_colour]'><b>[C]</b></font> is a [C.holder.rank]"
Expand Down
1 change: 1 addition & 0 deletions code/modules/admin/admin_ranks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ GLOBAL_PROTECT(admin_ranks) // this shit is being protected for obvious reasons
if("spawn","create") rights |= R_SPAWN
if("mod") rights |= R_MOD
if("mentor") rights |= R_MENTOR
if("developer") rights |= R_DEV_TEAM
if("proccall") rights |= R_PROCCALL
if("viewruntimes") rights |= R_VIEWRUNTIMES
if("maintainer") rights |= R_MAINTAINER
Expand Down
3 changes: 2 additions & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
/client/proc/library_manager,
/client/proc/view_asays,
/client/proc/view_msays,
/client/proc/view_devsays,
/client/proc/empty_ai_core_toggle_latejoin,
/client/proc/aooc,
/client/proc/freeze,
Expand Down Expand Up @@ -1179,7 +1180,7 @@ GLOBAL_LIST_INIT(view_runtimes_verbs, list(
message_admins("[key_name_admin(usr)] is visualising interesting atmos turfs. Server may lag.")

var/list/zlevel_turf_indexes = list()

var/list/coords = get_interesting_atmos_tiles()
if(!length(coords))
to_chat(mob, "<span class='notice'>There are no interesting turfs. How interesting!</span>")
Expand Down
8 changes: 7 additions & 1 deletion code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
if(length(GLOB.admin_ranks))
new_rank = input("Please select a rank", "New rank", null, null) as null|anything in (GLOB.admin_ranks|"*New Rank*")
else
new_rank = input("Please select a rank", "New rank", null, null) as null|anything in list("Mentor", "Trial Admin", "Game Admin", "*New Rank*")
new_rank = input("Please select a rank", "New rank", null, null) as null|anything in list("Mentor", "Trial Admin", "Game Admin", "Developer", "*New Rank*")

var/rights = 0
if(D)
Expand Down Expand Up @@ -1275,6 +1275,12 @@

usr.client.view_msays()

else if(href_list["devsays"])
if(!check_rights(R_ADMIN | R_DEV_TEAM))
return

usr.client.view_devsays()

else if(href_list["tdome1"])
if(!check_rights(R_SERVER|R_EVENT)) return

Expand Down
42 changes: 42 additions & 0 deletions code/modules/admin/verbs/adminsay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,48 @@
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

if(!check_rights(R_ADMIN|R_DEV_TEAM)) // Catch any non-admins trying to use this proc
return

msg = emoji_parse(copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN))
log_devsay(msg, src)
var/datum/say/devsay = new(usr.ckey, usr.client.holder.rank, msg, world.timeofday)
GLOB.devsays += devsay
mob.create_log(OOC_LOG, "DEVSAY: [msg]")

if(!msg)
return

// Do this up here before it gets sent to everyone & emoji'd
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.devsay", json_encode(data))
S34NW marked this conversation as resolved.
Show resolved Hide resolved

for(var/client/C in GLOB.admins)
if(check_rights(R_ADMIN|R_MOD|R_DEV_TEAM, 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) ? "dev_channel_admin" : "dev_channel"]'>DEV: <span class='name'>[display_name]</span> ([admin_jump_link(mob)]): <span class='message'>[msg]</span></span>", MESSAGE_TYPE_DEVCHAT, confidential = TRUE)

SSblackbox.record_feedback("tally", "admin_verb", 1, "Msay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
S34NW marked this conversation as resolved.
Show resolved Hide resolved

/client/proc/cmd_mentor_say(msg as text)
set name = "Msay"
set hidden = 1
Expand Down
11 changes: 11 additions & 0 deletions code/modules/admin/verbs/asays.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GLOBAL_LIST_EMPTY(asays)
GLOBAL_LIST_EMPTY(msays)
GLOBAL_LIST_EMPTY(devsays)

/datum/say
var/ckey
Expand All @@ -23,6 +24,16 @@ GLOBAL_LIST_EMPTY(msays)

display_says(GLOB.msays, "msay")

/client/proc/view_devsays()
set name = "Devsays"
set desc = "View Devsays from the current round."
set category = "Admin"

if(!check_rights(R_DEV_TEAM | R_ADMIN))
return

display_says(GLOB.devsays, "devsay")

/client/proc/view_asays()
set name = "Asays"
set desc = "View Asays from the current round."
Expand Down
3 changes: 3 additions & 0 deletions code/modules/admin/verbs/deadsay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
if(check_rights(R_MENTOR, 0))
stafftype = "MENTOR"

if(check_rights(R_DEV_TEAM, 0))
stafftype = "DEVELOPER"

if(check_rights(R_MOD, 0))
stafftype = "MOD"

Expand Down
3 changes: 3 additions & 0 deletions code/modules/tgui_input/say_modal/tgui_say_speech.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
if(DSAY_CHANNEL)
client.dsay(entry)
return TRUE
if(DEV_CHANNEL)
client.cmd_dev_say(entry)
return TRUE
return FALSE

/**
Expand Down
6 changes: 5 additions & 1 deletion config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ enable_localhost_autoadmin = true
# +SPAWN (or +CREATE) = mob transformations, spawning of most atoms including mobs
# +MOD = Access to low level moderation tools. Not used in Paradise production
# +MENTOR = Access only to the Question's Ahelp and has little way of metagaming the game.
# +DEV_TEAM = Access to dev team chat
# +PROCCALL = Access to call procs on anything. Be careful who you grant this too!
# +VIEWRUNTIMES = Allows a player to view the runtimes of the server, but not use other debug verbs
S34NW marked this conversation as resolved.
Show resolved Hide resolved
admin_ranks = [
Expand Down Expand Up @@ -101,6 +102,9 @@ admin_ranks = [
{ name = "Maintainers", rights = [
"+EVERYTHING",
] },
{ name = "Developer", rights = [
"+DEV_TEAM",
] },
]
# List of people and the admin rank they are assigned to
admin_assignments = [
Expand All @@ -116,7 +120,7 @@ admin_rank_colour_map = [
{ name = "Community Manager", colour = "#e91e63" },
{ name = "Game Admin", colour = "#238afa" },
{ name = "Trial Admin", colour = "#7fb6fc" },
{ name = "PR Reviewer", colour = "#c27c0e" },
{ name = "Developer", colour = "#c27c0e" },
S34NW marked this conversation as resolved.
Show resolved Hide resolved
S34NW marked this conversation as resolved.
Show resolved Hide resolved
{ name = "Mentor", colour = "#f1c40f" },
]
# Map of common CIDs that should not be banned, plus their reasons
Expand Down
8 changes: 8 additions & 0 deletions tgui/packages/tgui-panel/chat/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const MESSAGE_TYPE_MENTORPM = 'mentorpm';
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_EVENTCHAT = 'eventchat';
export const MESSAGE_TYPE_ADMINLOG = 'adminlog';
export const MESSAGE_TYPE_ATTACKLOG = 'attacklog';
Expand Down Expand Up @@ -124,6 +125,13 @@ export const MESSAGE_TYPES = [
selector: '.mentor_channel',
admin: true,
},
{
type: MESSAGE_TYPE_DEVCHAT,
name: 'Developer Chat',
description: 'DEVSAY messages',
selector: '.dev_channel',
admin: true,
},
{
type: MESSAGE_TYPE_ADMINLOG,
name: 'Admin Log',
Expand Down
10 changes: 10 additions & 0 deletions tgui/packages/tgui-panel/styles/tgchat/chat-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,16 @@ em {
font-weight: bold;
}

.dev_channel {
color: #775bff;
S34NW marked this conversation as resolved.
Show resolved Hide resolved
font-weight: bold;
}

.dev_channel_admin {
color: #a35cff;
font-weight: bold;
}

.djradio {
color: #996600;
}
Expand Down
10 changes: 10 additions & 0 deletions tgui/packages/tgui-panel/styles/tgchat/chat-light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,16 @@ em {
font-weight: bold;
}

.dev_channel {
color: #775bff;
font-weight: bold;
}

.dev_channel_admin {
color: #a35cff;
font-weight: bold;
}

.djradio {
color: #663300;
}
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-say/ChannelIterator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, and Dsay are blacklisted so should be skipped
expect(channelIterator.next()).toBe('Say'); // Admin, Mentor, Dsay, and Dev are blacklisted so should be skipped
});

it('should set a channel properly', () => {
Expand Down
19 changes: 15 additions & 4 deletions tgui/packages/tgui-say/ChannelIterator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type Channel = 'Say' | 'Radio' | 'Whisper' | 'Me' | 'OOC' | 'LOOC' | 'Mentor' | 'Admin' | 'Dsay';
export type Channel = 'Say' | 'Radio' | 'Whisper' | 'Me' | 'OOC' | 'LOOC' | 'Mentor' | 'Admin' | 'Dsay' | 'Dev';

/**
* ### ChannelIterator
Expand All @@ -8,9 +8,20 @@ export type Channel = 'Say' | 'Radio' | 'Whisper' | 'Me' | 'OOC' | 'LOOC' | 'Men
*/
export class ChannelIterator {
private index: number = 0;
private readonly channels: Channel[] = ['Say', 'Radio', 'Whisper', 'Me', 'OOC', 'LOOC', 'Mentor', 'Admin', 'Dsay'];
private readonly blacklist: Channel[] = ['Mentor', 'Admin', 'Dsay'];
private readonly quiet: Channel[] = ['OOC', 'LOOC', 'Mentor', 'Admin', 'Dsay'];
private readonly channels: Channel[] = [
'Say',
'Radio',
'Whisper',
'Me',
'OOC',
'LOOC',
'Mentor',
'Admin',
'Dsay',
'Dev',
];
private readonly blacklist: Channel[] = ['Mentor', 'Admin', 'Dsay', 'Dev'];
private readonly quiet: Channel[] = ['OOC', 'LOOC', 'Mentor', 'Admin', 'Dsay', 'Dev'];

public next(): Channel {
if (this.blacklist.includes(this.channels[this.index])) {
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui-say/styles/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $_channel_map: (
'Me': #5975da,
'Med': #57b8f0,
'Mentor': #d6c208,
'Dev': #61b413,
'OOC': #cca300,
'Proc': #b84f92,
'R-Ear': #a4bad6,
Expand Down
2 changes: 1 addition & 1 deletion tgui/public/tgui-panel.bundle.css

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions tgui/public/tgui-panel.bundle.js

Large diffs are not rendered by default.

Loading