[MIRROR] [MAJOR CHANGE] Admin rank datum (#10316)

Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-03-11 14:36:14 -07:00
committed by GitHub
parent 86d5086018
commit a57d38624d
89 changed files with 1997 additions and 775 deletions

9
code/_helpers/admin.dm Normal file
View File

@@ -0,0 +1,9 @@
/// Returns if the given client is an admin, REGARDLESS of if they're deadminned or not.
///proc/is_admin(client/client)
// return !isnull(GLOB.admin_datums[client.ckey]) || !isnull(GLOB.deadmins[client.ckey])
/// Sends a message in the event that someone attempts to elevate their permissions through invoking a certain proc.
/proc/alert_to_permissions_elevation_attempt(mob/user)
var/message = " has tried to elevate permissions!"
message_admins(key_name_admin(user) + message)
log_admin(key_name(user) + message)

View File

@@ -352,7 +352,7 @@
. += "<a href='byond://?priv_msg=\ref[C]'>"
if(C && C.holder && C.holder.fakekey)
. += C.holder.rank // CHOMPEdit: Stealth mode displays staff rank in PM Messages
. += C.holder.rank_names() // CHOMPEdit: Stealth mode displays staff rank in PM Messages
else
. += key

View File

@@ -631,3 +631,14 @@ GLOBAL_LIST_EMPTY(text_tag_cache)
/proc/sanitize_css_class_name(name)
var/static/regex/regex = new(@"[^a-zA-Z0-9]","g")
return replacetext(name, regex, "")
//finds the first occurrence of one of the characters from needles argument inside haystack
//it may appear this can be optimised, but it really can't. findtext() is so much faster than anything you can do in byondcode.
//stupid byond :(
/proc/findchar(haystack, needles, start=1, end=0)
var/temp
var/len = length(needles)
for(var/i=1, i<=len, i++)
temp = findtextEx(haystack, ascii2text(text2ascii(needles,i)), start, end) //Note: ascii2text(text2ascii) is faster than copytext()
if(temp) end = temp
return end