From a7af778252f4cd11d56e8dfdd46390e1bc3abdba Mon Sep 17 00:00:00 2001 From: DamianX Date: Fri, 8 May 2020 14:57:32 +0200 Subject: [PATCH] Fuck this code so much holy shit (#26356) --- code/modules/admin/admin_verbs.dm | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index e3cfd047251..a0f4ee6b396 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -900,8 +900,32 @@ var/list/admin_verbs_mod = list( set desc = "Regain your admin powers." var/datum/admins/D = admin_datums[ckey] if(config.admin_legacy_system) - to_chat(src, "Legacy admins is not supported yet") - return + var/list/lines = file2list("config/admins.txt") + for(var/line in lines) + // if the line doesn't begin with our ckey we don't care + if(findtext(ckey(line), ckey) != 1) + continue + //Split the line at every "-" + var/list/List = splittext(line, "-") + if(!List.len) + continue + + //rank follows the first "-" + var/rank = "" + if(List.len >= 2) + rank = ckeyEx(List[2]) + + //load permissions associated with this rank + var/rights = admin_ranks[rank] + + //create the admin datum and store it for later use + D = new /datum/admins(rank, rights, ckey) + + //associate them with the new admin datum + D.associate(src) + + if(D.rights & (R_DEBUG|R_SERVER)) // Grant profile/reboot access + world.SetConfig("APP/admin", ckey, "role=admin") else if(!dbcon.IsConnected()) message_admins("Warning, mysql database is not connected.") @@ -1273,4 +1297,4 @@ var/list/admin_verbs_mod = list( if(holder) holder.ViewAllRods() feedback_add_details("admin_verb","V-ROD") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - return \ No newline at end of file + return