Files
GS13NG/code/modules/mentor/mentor_ranks.dm
Poojawa 7e9b96a00f 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.
2017-04-13 23:37:00 -05:00

43 lines
1.5 KiB
Plaintext

/proc/load_mentors()
//clear the datums references
GLOB.mentor_datums.Cut()
GLOB.mentors.Cut()
if(!config.mentor_legacy_system)
if(!GLOB.dbcon.IsConnected())
world.log << "Failed to connect to database in load_mentors()."
GLOB.diary << "Failed to connect to database in load_mentors()."
config.mentor_legacy_system = 1
load_mentors()
return
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor")]")
query.Execute()
while(query.NextRow())
var/ckey = ckey(query.item[1])
var/datum/mentors/D = new(ckey) //create the mentor datum and store it for later use
if(!D) continue //will occur if an invalid rank is provided
D.associate(GLOB.directory[ckey]) //find the client for a ckey if they are connected and associate them with the new mentor datum
else
world.log << "Using legacy mentor system."
var/list/Lines = file2list("config/mentors.txt")
//process each line seperately
for(var/line in Lines)
if(!length(line)) continue
if(findtextEx(line,"#",1,2)) continue
//ckey is before the first "="
var/ckey = ckey(line)
if(!ckey) continue
var/datum/mentors/D = new(ckey) //create the admin datum and store it for later use
if(!D) continue //will occur if an invalid rank is provided
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 = "mentors Built:\n"
for(var/ckey in GLOB.mentor_datums)
msg += "\t[ckey] - mentor\n"
testing(msg)
#endif