mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
[MIRROR] [MAJOR CHANGE] Admin rank datum (#10316)
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
86d5086018
commit
a57d38624d
9
code/_helpers/admin.dm
Normal file
9
code/_helpers/admin.dm
Normal 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)
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user