Deadmin tweaks: Admins without +AUTOLOGIN start deadmined. AUTOLOGIN defaults to on. (#33480)

* Deadmin tweaks, Admins without +ADMIN start deadmined.
Deadmining no longer destroys the admin datum.
Admins without +ADMIN start deadmined, reloading admins re-deadmins them.
Moved some code around to make it more sane
People with +PERMISSION can now deadmin or readmin other admins at will.

* Adds new flag for if the role should automatically log in, defaults to on, can be removed with -AUTOLOGIN
Also fixes a bug in permission panel not handling these cases gracefully
This commit is contained in:
Kyle Spier-Swenson
2017-12-13 22:03:37 -05:00
committed by Joan Lung
parent 5ffec027af
commit 4e929c74a9
11 changed files with 171 additions and 105 deletions
+13 -11
View File
@@ -638,12 +638,7 @@ GLOBAL_LIST_INIT(admin_verbs_hideable, list(
if(has_antag_hud())
toggle_antag_hud()
holder.disassociate()
qdel(holder)
GLOB.deadmins += ckey
GLOB.admin_datums -= ckey
verbs += /client/proc/readmin
holder.deactivate()
to_chat(src, "<span class='interface'>You are now a normal player.</span>")
log_admin("[src] deadmined themself.")
@@ -655,13 +650,20 @@ GLOBAL_LIST_INIT(admin_verbs_hideable, list(
set category = "Admin"
set desc = "Regain your admin powers."
load_admins(ckey)
var/datum/admins/A = GLOB.deadmins[ckey]
if(!holder) // Something went wrong...
return
if(!A)
A = GLOB.admin_datums[ckey]
if (!A)
var/msg = " is trying to readmin but they have no deadmin entry"
message_admins("[key_name_admin(src)][msg]")
log_admin_private("[key_name(src)][msg]")
return
GLOB.deadmins -= ckey
verbs -= /client/proc/readmin
A.associate(src)
if (!holder)
return //This can happen if an admin attempts to vv themself into somebody elses's deadmin datum by getting ref via brute force
to_chat(src, "<span class='interface'>You are now an admin.</span>")
message_admins("[src] re-adminned themselves.")