From 4086fda4c9fb407828b88fa8b2532a05feb394f5 Mon Sep 17 00:00:00 2001 From: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Date: Sun, 10 Sep 2023 20:56:15 -0400 Subject: [PATCH] The Player Panel will now list out the player's Player Ranks (#23621) * Displays the player ranks into the player panel * Player ranks can now be checked without considering the admin bypass --- code/modules/admin/verbs/admingame.dm | 14 ++++++++++++++ .../modules/mentor/code/client_procs.dm | 11 +++++++++-- .../code/subsystem/player_ranks.dm | 18 ++++++++++++------ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/code/modules/admin/verbs/admingame.dm b/code/modules/admin/verbs/admingame.dm index 13178d32a5d..8bc58a7876c 100644 --- a/code/modules/admin/verbs/admingame.dm +++ b/code/modules/admin/verbs/admingame.dm @@ -32,6 +32,20 @@ if(M.client) body += "
\[First Seen: [M.client.player_join_date]\]\[Byond account registered on: [M.client.account_join_date]\]" + // SKYRAT EDIT ADDITION START - Player Ranks + var/list/player_ranks = list() + + if(SSplayer_ranks.is_donator(M.client, admin_bypass = FALSE)) + player_ranks += "Donator" + + if(SSplayer_ranks.is_mentor(M.client, admin_bypass = FALSE)) + player_ranks += "Mentor" + + if(SSplayer_ranks.is_veteran(M.client, admin_bypass = FALSE)) + player_ranks += "Veteran" + + body += "

Player Ranks: [length(player_ranks) ? player_ranks.Join(", ") : "None"]" + // SKYRAT EDIT END body += "

CentCom Galactic Ban DB: " if(CONFIG_GET(string/centcom_ban_db)) body += "Search" diff --git a/modular_skyrat/modules/mentor/code/client_procs.dm b/modular_skyrat/modules/mentor/code/client_procs.dm index af6ecae38e4..8c83b8c615e 100644 --- a/modular_skyrat/modules/mentor/code/client_procs.dm +++ b/modular_skyrat/modules/mentor/code/client_procs.dm @@ -44,6 +44,13 @@ cmd_mentor_dementor() -/client/proc/is_mentor() // admins are mentors too. - if(mentor_datum || check_rights_for(src, R_ADMIN)) +/** + * Returns whether or not the user is qualified as a mentor. + * + * Arguments: + * * admin_bypass - Whether or not admins can succeed this check, even if they + * do not actually possess the role. Defaults to `TRUE`. + */ +/client/proc/is_mentor(admin_bypass = TRUE) + if(mentor_datum || (admin_bypass && check_rights_for(src, R_ADMIN))) return TRUE diff --git a/modular_skyrat/modules/player_ranks/code/subsystem/player_ranks.dm b/modular_skyrat/modules/player_ranks/code/subsystem/player_ranks.dm index 8e20fcda771..264d9f8bedc 100644 --- a/modular_skyrat/modules/player_ranks/code/subsystem/player_ranks.dm +++ b/modular_skyrat/modules/player_ranks/code/subsystem/player_ranks.dm @@ -46,15 +46,17 @@ SUBSYSTEM_DEF(player_ranks) * * Arguments: * * user - The client to verify the donator status of. + * * admin_bypass - Whether or not admins can succeed this check, even if they + * do not actually possess the role. Defaults to `TRUE`. */ -/datum/controller/subsystem/player_ranks/proc/is_donator(client/user) +/datum/controller/subsystem/player_ranks/proc/is_donator(client/user, admin_bypass = TRUE) if(!istype(user)) CRASH("Invalid user type provided to is_donator(), expected 'client' and obtained '[user ? user.type : "null"]'.") if(GLOB.donator_list[user.ckey]) return TRUE - if(is_admin(user)) + if(admin_bypass && is_admin(user)) return TRUE return FALSE @@ -66,12 +68,14 @@ SUBSYSTEM_DEF(player_ranks) * * Arguments: * * user - The client to verify the mentor status of. + * * admin_bypass - Whether or not admins can succeed this check, even if they + * do not actually possess the role. Defaults to `TRUE`. */ -/datum/controller/subsystem/player_ranks/proc/is_mentor(client/user) +/datum/controller/subsystem/player_ranks/proc/is_mentor(client/user, admin_bypass = TRUE) if(!istype(user)) CRASH("Invalid user type provided to is_mentor(), expected 'client' and obtained '[user ? user.type : "null"]'.") - return user.is_mentor() + return user.is_mentor(admin_bypass) /** @@ -79,15 +83,17 @@ SUBSYSTEM_DEF(player_ranks) * * Arguments: * * user - The client to verify the veteran status of. + * * admin_bypass - Whether or not admins can succeed this check, even if they + * do not actually possess the role. Defaults to `TRUE`. */ -/datum/controller/subsystem/player_ranks/proc/is_veteran(client/user) +/datum/controller/subsystem/player_ranks/proc/is_veteran(client/user, admin_bypass = TRUE) if(!istype(user)) CRASH("Invalid user type provided to is_veteran(), expected 'client' and obtained '[user ? user.type : "null"]'.") if(GLOB.veteran_list[user.ckey]) return TRUE - if(is_admin(user)) + if(admin_bypass && is_admin(user)) return TRUE return FALSE