Re-Admin verb for admins that De-Admin themselves during a round.

This commit is contained in:
Chris
2015-01-09 14:21:52 -06:00
parent f729061fe7
commit 72c650ab6b
5 changed files with 53 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
//List of ckeys that have de-adminned themselves during this round
var/global/list/deadmins = list()
// List of types and how many instances of each type there are.
var/global/list/type_instances[0]

View File

@@ -314,7 +314,8 @@ var/list/admin_verbs_mod = list(
/client/proc/cmd_admin_grantfullaccess,
/client/proc/kaboom,
/client/proc/splash,
/client/proc/cmd_admin_areatest
/client/proc/cmd_admin_areatest,
/client/proc/readmin,
)
/client/proc/hide_most_verbs()//Allows you to keep some functionality while hiding some verbs
@@ -663,11 +664,12 @@ var/list/admin_verbs_mod = list(
set category = "Admin"
if(holder)
if(alert("Confirm self-deadmin for the round? You can't re-admin yourself without someont promoting you.",,"Yes","No") == "Yes")
log_admin("[src] deadmined themself.")
message_admins("[src] deadmined themself.", 1)
deadmin()
src << "<span class='interface'>You are now a normal player.</span>"
log_admin("[src] deadminned themself.")
message_admins("[src] deadminned themself.")
deadmin()
verbs += /client/proc/readmin
deadmins += ckey
src << "<span class='interface'>You are now a normal player.</span>"
feedback_add_details("admin_verb","DAS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/toggle_log_hrefs()
@@ -831,3 +833,41 @@ var/list/admin_verbs_mod = list(
log_admin("[key_name(usr)] told everyone to man up and deal with it.")
message_admins("\blue [key_name_admin(usr)] told everyone to man up and deal with it.", 1)
/client/proc/readmin()
set name = "Re-admin self"
set category = "Admin"
set desc = "Regain your admin powers."
var/datum/admins/D = admin_datums[ckey]
if(config.admin_legacy_system)
src << "<span class='notice'>Legacy admins is not supported yet</span>"
return
else
if(!dbcon.IsConnected())
message_admins("Warning, mysql database is not connected.")
src << "Warning, mysql database is not connected."
return
if(D)
src << "You are already an admin."
verbs -= /client/proc/readmin
return
var/sql_ckey = sanitizeSQL(ckey)
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, rank, level, flags FROM erro_admin WHERE ckey = [sql_ckey]")
query.Execute()
while(query.NextRow())
var/ckey = query.item[1]
var/rank = query.item[2]
if(rank == "Removed") continue //This person was de-adminned. They are only in the admin list for archive purposes.
var/rights = query.item[4]
if(istext(rights)) rights = text2num(rights)
D = new /datum/admins(rank, rights, ckey)
//find the client for a ckey if they are connected and associate them with the new admin datum
D.associate(directory[ckey])
message_admins("[src] re-adminned themselves.")
log_admin("[src] re-adminned themselves.")
feedback_add_details("admin_verb","RAS")
verbs -= /client/proc/readmin
return

View File

@@ -30,6 +30,7 @@ var/list/admin_datums = list()
owner.holder = src
owner.add_admin_verbs() //TODO
admins |= C
owner.verbs -= /client/proc/readmin
/datum/admins/proc/disassociate()
if(owner)

View File

@@ -56,5 +56,7 @@
var/mob/living/carbon/human/H = src
if(H.species && H.species.abilities)
H.verbs |= H.species.abilities
if(ckey in deadmins)
verbs += /client/proc/readmin
CallHook("Login", list("client" = src.client, "mob" = src))

View File

@@ -27,6 +27,8 @@
loc = pick(watch_locations)
*/
new_player_panel()
if(ckey in deadmins)
verbs += /client/proc/readmin
spawn(0)
if(client)
//If the changelog has changed, show it to them