Skip to content

Commit

Permalink
Only admins with +ADMIN override deadchat viewing restrictions (#2673)
Browse files Browse the repository at this point in the history
* Only admins with +ADMIN override deadchat viewing restrictions

* add a useful helper for the future
  • Loading branch information
Absolucy authored Jul 19, 2024
1 parent 7634ac5 commit cda7633
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@ GLOBAL_LIST_EMPTY(species_list)
toggles = prefs.toggles
ignoring = prefs.ignoring
if(admin_only)
if (!M.client?.holder)
if (!M.client?.holder?.check_for_rights(R_ADMIN)) // monkestation edit: only include admins with the +ADMIN permission
return
else
message += span_deadsay(" (This is viewable to admins only).")
var/override = FALSE
if(M.client?.holder && (chat_toggles & CHAT_DEAD))
if(M.client?.holder?.check_for_rights(R_ADMIN) && (chat_toggles & CHAT_DEAD)) // monkestation edit: only include admins with the +ADMIN permission
override = TRUE
if(HAS_TRAIT(M, TRAIT_SIXTHSENSE) && message_type == DEADCHAT_REGULAR)
override = TRUE
Expand Down
6 changes: 6 additions & 0 deletions code/__HELPERS/~monkestation-helpers/clients.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@
log_admin("[key_name(usr)] kicked [key_name(to_kick)].")
message_admins(span_adminnotice("[key_name_admin(usr)] kicked [key_name_admin(to_kick)]."))
qdel(to_kick)

/// When passed a mob, client, or mind, returns their admin holder, if they have one.
/proc/get_admin_holder(doohickey) as /datum/admins
RETURN_TYPE(/datum/admins)
var/client/client = CLIENT_FROM_VAR(doohickey)
return client?.holder

0 comments on commit cda7633

Please sign in to comment.