April sync (#360)
* Maps and things no code/icons * helpers defines globalvars * Onclick world.dm orphaned_procs * subsystems Round vote and shuttle autocall done here too * datums * Game folder * Admin - chatter modules * clothing - mining * modular computers - zambies * client * mob level 1 * mob stage 2 + simple_animal * silicons n brains * mob stage 3 + Alien/Monkey * human mobs * icons updated * some sounds * emitter y u no commit * update tgstation.dme * compile fixes * travis fixes Also removes Fast digest mode, because reasons. * tweaks for travis Mentors are broke again Also fixes Sizeray guns * oxygen loss fix for vore code. * removes unused code * some code updates * bulk fixes * further fixes * outside things * whoops. * Maint bar ported * GLOBs.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
GLOBAL_LIST_EMPTY(admin_ranks) //list of all admin_rank datums
|
||||
GLOBAL_PROTECT(admin_ranks)
|
||||
|
||||
/datum/admin_rank
|
||||
var/name = "NoRank"
|
||||
@@ -99,7 +100,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
|
||||
//load our rank - > rights associations
|
||||
/proc/load_admin_ranks()
|
||||
admin_ranks.Cut()
|
||||
GLOB.admin_ranks.Cut()
|
||||
|
||||
if(config.admin_legacy_system)
|
||||
var/previous_rights = 0
|
||||
@@ -114,7 +115,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
var/datum/admin_rank/R = new(ckeyEx(copytext(line, 1, next)))
|
||||
if(!R)
|
||||
continue
|
||||
admin_ranks += R
|
||||
GLOB.admin_ranks += R
|
||||
|
||||
var/prev = findchar(line, "+-", next, 0)
|
||||
while(prev)
|
||||
@@ -124,14 +125,14 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
|
||||
previous_rights = R.rights
|
||||
else
|
||||
if(!dbcon.Connect())
|
||||
if(!GLOB.dbcon.Connect())
|
||||
log_world("Failed to connect to database in load_admin_ranks(). Reverting to legacy system.")
|
||||
diary << "Failed to connect to database in load_admin_ranks(). Reverting to legacy system."
|
||||
GLOB.diary << "Failed to connect to database in load_admin_ranks(). Reverting to legacy system."
|
||||
config.admin_legacy_system = 1
|
||||
load_admin_ranks()
|
||||
return
|
||||
|
||||
var/DBQuery/query_load_admin_ranks = dbcon.NewQuery("SELECT rank, flags FROM [format_table_name("admin_ranks")]")
|
||||
var/DBQuery/query_load_admin_ranks = GLOB.dbcon.NewQuery("SELECT rank, flags FROM [format_table_name("admin_ranks")]")
|
||||
if(!query_load_admin_ranks.Execute())
|
||||
return
|
||||
while(query_load_admin_ranks.NextRow())
|
||||
@@ -142,11 +143,11 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
var/datum/admin_rank/R = new(rank_name, flags)
|
||||
if(!R)
|
||||
continue
|
||||
admin_ranks += R
|
||||
GLOB.admin_ranks += R
|
||||
|
||||
#ifdef TESTING
|
||||
var/msg = "Permission Sets Built:\n"
|
||||
for(var/datum/admin_rank/R in admin_ranks)
|
||||
for(var/datum/admin_rank/R in GLOB.admin_ranks)
|
||||
msg += "\t[R.name]"
|
||||
var/rights = rights2text(R.rights,"\n\t\t",R.adds,R.subs)
|
||||
if(rights)
|
||||
@@ -158,18 +159,18 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
/proc/load_admins(target = null)
|
||||
//clear the datums references
|
||||
if(!target)
|
||||
admin_datums.Cut()
|
||||
for(var/client/C in admins)
|
||||
GLOB.admin_datums.Cut()
|
||||
for(var/client/C in GLOB.admins)
|
||||
C.remove_admin_verbs()
|
||||
C.holder = null
|
||||
admins.Cut()
|
||||
GLOB.admins.Cut()
|
||||
load_admin_ranks()
|
||||
//Clear profile access
|
||||
for(var/A in world.GetConfig("admin"))
|
||||
world.SetConfig("APP/admin", A, null)
|
||||
|
||||
var/list/rank_names = list()
|
||||
for(var/datum/admin_rank/R in admin_ranks)
|
||||
for(var/datum/admin_rank/R in GLOB.admin_ranks)
|
||||
rank_names[R.name] = R
|
||||
|
||||
if(config.admin_legacy_system)
|
||||
@@ -197,16 +198,16 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
continue //will occur if an invalid rank is provided
|
||||
if(D.rank.rights & R_DEBUG) //grant profile access
|
||||
world.SetConfig("APP/admin", ckey, "role=admin")
|
||||
D.associate(directory[ckey]) //find the client for a ckey if they are connected and associate them with the new admin datum
|
||||
D.associate(GLOB.directory[ckey]) //find the client for a ckey if they are connected and associate them with the new admin datum
|
||||
else
|
||||
if(!dbcon.Connect())
|
||||
if(!GLOB.dbcon.Connect())
|
||||
log_world("Failed to connect to database in load_admins(). Reverting to legacy system.")
|
||||
diary << "Failed to connect to database in load_admins(). Reverting to legacy system."
|
||||
GLOB.diary << "Failed to connect to database in load_admins(). Reverting to legacy system."
|
||||
config.admin_legacy_system = 1
|
||||
load_admins()
|
||||
return
|
||||
|
||||
var/DBQuery/query_load_admins = dbcon.NewQuery("SELECT ckey, rank FROM [format_table_name("admin")]")
|
||||
var/DBQuery/query_load_admins = GLOB.dbcon.NewQuery("SELECT ckey, rank FROM [format_table_name("admin")]")
|
||||
if(!query_load_admins.Execute())
|
||||
return
|
||||
while(query_load_admins.NextRow())
|
||||
@@ -224,19 +225,19 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
continue //will occur if an invalid rank is provided
|
||||
if(D.rank.rights & R_DEBUG) //grant profile access
|
||||
world.SetConfig("APP/admin", ckey, "role=admin")
|
||||
D.associate(directory[ckey]) //find the client for a ckey if they are connected and associate them with the new admin datum
|
||||
D.associate(GLOB.directory[ckey]) //find the client for a ckey if they are connected and associate them with the new admin datum
|
||||
|
||||
#ifdef TESTING
|
||||
var/msg = "Admins Built:\n"
|
||||
for(var/ckey in admin_datums)
|
||||
var/datum/admins/D = admin_datums[ckey]
|
||||
for(var/ckey in GLOB.admin_datums)
|
||||
var/datum/admins/D = GLOB.admin_datums[ckey]
|
||||
msg += "\t[ckey] - [D.rank.name]\n"
|
||||
testing(msg)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TESTING
|
||||
/client/verb/changerank(newrank in admin_ranks)
|
||||
/client/verb/changerank(newrank in GLOB.admin_ranks)
|
||||
if(holder)
|
||||
holder.rank = newrank
|
||||
else
|
||||
@@ -266,7 +267,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
var/new_ckey = ckey(input(usr,"New admin's ckey","Admin ckey", null) as text|null)
|
||||
if(!new_ckey)
|
||||
return
|
||||
if(new_ckey in admin_datums)
|
||||
if(new_ckey in GLOB.admin_datums)
|
||||
to_chat(usr, "<font color='red'>Error: Topic 'editrights': [new_ckey] is already an admin</font>")
|
||||
return
|
||||
adm_ckey = new_ckey
|
||||
@@ -277,7 +278,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
to_chat(usr, "<font color='red'>Error: Topic 'editrights': No valid ckey</font>")
|
||||
return
|
||||
|
||||
var/datum/admins/D = admin_datums[adm_ckey]
|
||||
var/datum/admins/D = GLOB.admin_datums[adm_ckey]
|
||||
|
||||
switch(task)
|
||||
if("remove")
|
||||
@@ -288,7 +289,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
message_admins("[key_name_admin(usr)] attempted to remove [adm_ckey] from the admins list without sufficient rights.")
|
||||
log_admin("[key_name(usr)] attempted to remove [adm_ckey] from the admins list without sufficient rights.")
|
||||
return
|
||||
admin_datums -= adm_ckey
|
||||
GLOB.admin_datums -= adm_ckey
|
||||
D.disassociate()
|
||||
|
||||
updateranktodb(adm_ckey, "player")
|
||||
@@ -300,7 +301,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
var/datum/admin_rank/R
|
||||
|
||||
var/list/rank_names = list("*New Rank*")
|
||||
for(R in admin_ranks)
|
||||
for(R in GLOB.admin_ranks)
|
||||
rank_names[R.name] = R
|
||||
|
||||
var/new_rank = input("Please select a rank", "New rank", null, null) as null|anything in rank_names
|
||||
@@ -325,7 +326,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
R = new(new_rank, D.rank.rights, D.rank.adds, D.rank.subs) //duplicate our previous admin_rank but with a new name
|
||||
else
|
||||
R = new(new_rank) //blank new admin_rank
|
||||
admin_ranks += R
|
||||
GLOB.admin_ranks += R
|
||||
|
||||
if(D) //they were previously an admin
|
||||
D.disassociate() //existing admin needs to be disassociated
|
||||
@@ -333,7 +334,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
else
|
||||
D = new(R,adm_ckey) //new admin
|
||||
|
||||
var/client/C = directory[adm_ckey] //find the client with the specified ckey (if they are logged in)
|
||||
var/client/C = GLOB.directory[adm_ckey] //find the client with the specified ckey (if they are logged in)
|
||||
D.associate(C) //link up with the client and add verbs
|
||||
|
||||
updateranktodb(adm_ckey, new_rank)
|
||||
@@ -362,7 +363,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
|
||||
D.rank.process_keyword(keyword)
|
||||
|
||||
var/client/C = directory[adm_ckey] //find the client with the specified ckey (if they are logged in)
|
||||
var/client/C = GLOB.directory[adm_ckey] //find the client with the specified ckey (if they are logged in)
|
||||
D.associate(C) //link up with the client and add verbs
|
||||
|
||||
message_admins("[key_name(usr)] added keyword [keyword] to permission of [adm_ckey]")
|
||||
@@ -372,10 +373,10 @@ var/list/admin_ranks = list() //list of all admin_rank datums
|
||||
edit_admin_permissions()
|
||||
|
||||
/datum/admins/proc/updateranktodb(ckey,newrank)
|
||||
if(!dbcon.Connect())
|
||||
if(!GLOB.dbcon.Connect())
|
||||
return
|
||||
var/sql_ckey = sanitizeSQL(ckey)
|
||||
var/sql_admin_rank = sanitizeSQL(newrank)
|
||||
|
||||
var/DBQuery/query_admin_rank_update = dbcon.NewQuery("UPDATE [format_table_name("player")] SET lastadminrank = '[sql_admin_rank]' WHERE ckey = '[sql_ckey]'")
|
||||
var/DBQuery/query_admin_rank_update = GLOB.dbcon.NewQuery("UPDATE [format_table_name("player")] SET lastadminrank = '[sql_admin_rank]' WHERE ckey = '[sql_ckey]'")
|
||||
query_admin_rank_update.Execute()
|
||||
|
||||
Reference in New Issue
Block a user