[MIRROR] Refactors admin PMs to be hopefully more resilient [MDB IGNORE] (#15348)

* Refactors admin PMs to be hopefully more resilient

* autoconflict resolution

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-08-04 15:47:52 +01:00
committed by GitHub
co-authored by LemonInTheDark Gandalf
parent 299eb5bba6
commit def879e5b4
9 changed files with 653 additions and 323 deletions
+30 -16
View File
@@ -407,24 +407,38 @@ GLOBAL_PROTECT(admin_verbs_poll)
holder.poll_list_panel()
SSblackbox.record_feedback("tally", "admin_verb", 1, "Server Poll Management") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/findStealthKey(txt)
if(txt)
for(var/P in GLOB.stealthminID)
if(GLOB.stealthminID[P] == txt)
return P
txt = GLOB.stealthminID[ckey]
return txt
/// Returns this client's stealthed ckey
/client/proc/getStealthKey()
return GLOB.stealthminID[ckey]
/// Takes a stealthed ckey as input, returns the true key it represents
/proc/findTrueKey(stealth_key)
if(!stealth_key)
return
for(var/potentialKey in GLOB.stealthminID)
if(GLOB.stealthminID[potentialKey] == stealth_key)
return potentialKey
/// Hands back a stealth ckey to use, guarenteed to be unique
/proc/generateStealthCkey()
var/guess = rand(0, 1000)
var/text_guess
var/valid_found = FALSE
while(valid_found == FALSE)
valid_found = TRUE
text_guess = "@[num2text(guess)]"
// We take a guess at some number, and if it's not in the existing stealthmin list we exit
for(var/key in GLOB.stealthminID)
// If it is in the list tho, we up one number, and redo the loop
if(GLOB.stealthminID[key] == text_guess)
guess += 1
valid_found = FALSE
break
return text_guess
/client/proc/createStealthKey()
var/num = (rand(0,1000))
var/i = 0
while(i == 0)
i = 1
for(var/P in GLOB.stealthminID)
if(num == GLOB.stealthminID[P])
num++
i = 0
GLOB.stealthminID["[ckey]"] = "@[num2text(num)]"
GLOB.stealthminID["[ckey]"] = generateStealthCkey()
/client/proc/stealth()
set category = "Admin"