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,3 @@
|
||||
//var/following = null //Gross, but necessary as we loose all concept of who we're following otherwise
|
||||
/client/proc/mentor_follow(var/mob/living/M)
|
||||
if(!check_mentor())
|
||||
return
|
||||
@@ -10,7 +9,7 @@
|
||||
return
|
||||
|
||||
if(!holder)
|
||||
var/datum/mentors/mentor = mentor_datums[usr.client.ckey]
|
||||
var/datum/mentors/mentor = GLOB.mentor_datums[usr.client.ckey]
|
||||
mentor.following = M
|
||||
/* else
|
||||
holder.following = M*/
|
||||
@@ -18,7 +17,7 @@
|
||||
usr.reset_perspective(M)
|
||||
src.verbs += /client/proc/mentor_unfollow
|
||||
|
||||
to_chat(admins, "<span class='mentor'><span class='prefix'>MENTOR:</span> <EM>[key_name(usr)]</EM> is now following <EM>[key_name(M)]</span>")
|
||||
to_chat(GLOB.admins, "<span class='mentor'><span class='prefix'>MENTOR:</span> <EM>[key_name(usr)]</EM> is now following <EM>[key_name(M)]</span>")
|
||||
to_chat(usr, "<span class='info'>You are now following [M]. Click the \"Stop Following\" button in the Mentor tab to stop.</span>")
|
||||
log_mentor("[key_name(usr)] began following [key_name(M)]")
|
||||
|
||||
@@ -37,13 +36,13 @@
|
||||
|
||||
var/following = null
|
||||
if(!holder)
|
||||
var/datum/mentors/mentor = mentor_datums[usr.client.ckey]
|
||||
var/datum/mentors/mentor = GLOB.mentor_datums[usr.client.ckey]
|
||||
following = mentor.following
|
||||
/*else
|
||||
following = holder.following*/
|
||||
|
||||
|
||||
to_chat(admins, "<span class='mentor'><span class='prefix'>MENTOR:</span> <EM>[key_name(usr)]</EM> is no longer following <EM>[key_name(following)]</span>")
|
||||
to_chat(GLOB.admins, "<span class='mentor'><span class='prefix'>MENTOR:</span> <EM>[key_name(usr)]</EM> is no longer following <EM>[key_name(following)]</span>")
|
||||
to_chat(usr, "<span class='info'>You are no longer following [following].</span>")
|
||||
log_mentor("[key_name(usr)] stopped following [key_name(following)]")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var/list/mentor_datums = list()
|
||||
GLOBAL_LIST(mentor_datums)
|
||||
|
||||
/datum/mentors
|
||||
var/client/owner = null
|
||||
@@ -8,28 +8,28 @@ var/list/mentor_datums = list()
|
||||
if(!ckey)
|
||||
del(src)
|
||||
return
|
||||
mentor_datums[ckey] = src
|
||||
GLOB.mentor_datums[ckey] = src
|
||||
|
||||
/datum/mentors/proc/associate(client/C)
|
||||
if(istype(C))
|
||||
owner = C
|
||||
mentors |= C
|
||||
GLOB.mentors |= C
|
||||
|
||||
/datum/mentors/proc/disassociate()
|
||||
if(owner)
|
||||
mentors -= owner
|
||||
GLOB.mentors -= owner
|
||||
owner = null
|
||||
|
||||
/client/proc/dementor()
|
||||
var/mentor = mentor_datums[ckey]
|
||||
mentor_datums -= ckey
|
||||
var/mentor = GLOB.mentor_datums[ckey]
|
||||
GLOB.mentor_datums -= ckey
|
||||
qdel(mentor)
|
||||
|
||||
return 1
|
||||
|
||||
/proc/check_mentor()
|
||||
if(usr && usr.client)
|
||||
var/mentor = mentor_datums[usr.client.ckey]
|
||||
var/mentor = GLOB.mentor_datums[usr.client.ckey]
|
||||
if(mentor || check_rights(R_ADMIN,0))
|
||||
return 1
|
||||
|
||||
@@ -37,7 +37,7 @@ var/list/mentor_datums = list()
|
||||
|
||||
/proc/check_mentor_other(var/client/C)
|
||||
if(C)
|
||||
var/mentor = mentor_datums[C.ckey]
|
||||
var/mentor = GLOB.mentor_datums[C.ckey]
|
||||
if(C.holder && C.holder.rank)
|
||||
if(C.holder.rank.rights & R_ADMIN)
|
||||
return 1
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/proc/load_mentors()
|
||||
//clear the datums references
|
||||
mentor_datums.Cut()
|
||||
mentors.Cut()
|
||||
GLOB.mentor_datums.Cut()
|
||||
GLOB.mentors.Cut()
|
||||
|
||||
if(!config.mentor_legacy_system)
|
||||
if(!dbcon.IsConnected())
|
||||
if(!GLOB.dbcon.IsConnected())
|
||||
world.log << "Failed to connect to database in load_mentors()."
|
||||
diary << "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 = dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor")]")
|
||||
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(directory[ckey]) //find the client for a ckey if they are connected and associate them with the new mentor datum
|
||||
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")
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
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(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 = "mentors Built:\n"
|
||||
for(var/ckey in mentor_datums)
|
||||
for(var/ckey in GLOB.mentor_datums)
|
||||
msg += "\t[ckey] - mentor\n"
|
||||
testing(msg)
|
||||
#endif
|
||||
@@ -2,7 +2,7 @@
|
||||
set name = "Mentor Memos"
|
||||
set category = "Server"
|
||||
if(!check_rights(0)) return
|
||||
if(!dbcon.IsConnected())
|
||||
if(!GLOB.dbcon.IsConnected())
|
||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||
return
|
||||
var/memotask = input(usr,"Choose task.","Memo") in list("Show","Write","Edit","Remove")
|
||||
@@ -14,7 +14,7 @@
|
||||
set name = "Show Memos"
|
||||
set category = "Mentor"
|
||||
if(!check_mentor()) return
|
||||
if(!dbcon.IsConnected())
|
||||
if(!GLOB.dbcon.IsConnected())
|
||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||
return
|
||||
mentor_memo_output("Show")
|
||||
@@ -22,13 +22,13 @@
|
||||
/client/proc/mentor_memo_output(task)
|
||||
if(!task)
|
||||
return
|
||||
if(!dbcon.IsConnected())
|
||||
if(!GLOB.dbcon.IsConnected())
|
||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||
return
|
||||
var/sql_ckey = sanitizeSQL(src.ckey)
|
||||
switch(task)
|
||||
if("Write")
|
||||
var/DBQuery/query_memocheck = dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor_memo")] WHERE ckey = '[sql_ckey]'")
|
||||
var/DBQuery/query_memocheck = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor_memo")] WHERE ckey = '[sql_ckey]'")
|
||||
if(!query_memocheck.Execute())
|
||||
var/err = query_memocheck.ErrorMsg()
|
||||
log_game("SQL ERROR obtaining ckey from memo table. Error : \[[err]\]\n")
|
||||
@@ -41,7 +41,7 @@
|
||||
return
|
||||
memotext = sanitizeSQL(memotext)
|
||||
var/timestamp = SQLtime()
|
||||
var/DBQuery/query_memoadd = dbcon.NewQuery("INSERT INTO [format_table_name("mentor_memo")] (ckey, memotext, timestamp) VALUES ('[sql_ckey]', '[memotext]', '[timestamp]')")
|
||||
var/DBQuery/query_memoadd = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("mentor_memo")] (ckey, memotext, timestamp) VALUES ('[sql_ckey]', '[memotext]', '[timestamp]')")
|
||||
if(!query_memoadd.Execute())
|
||||
var/err = query_memoadd.ErrorMsg()
|
||||
log_game("SQL ERROR adding new memo. Error : \[[err]\]\n")
|
||||
@@ -49,7 +49,7 @@
|
||||
log_admin("[key_name(src)] has set a mentor memo: [memotext]")
|
||||
message_admins("[key_name_admin(src)] has set a mentor memo:<br>[memotext]")
|
||||
if("Edit")
|
||||
var/DBQuery/query_memolist = dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor_memo")]")
|
||||
var/DBQuery/query_memolist = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor_memo")]")
|
||||
if(!query_memolist.Execute())
|
||||
var/err = query_memolist.ErrorMsg()
|
||||
log_game("SQL ERROR obtaining ckey from memo table. Error : \[[err]\]\n")
|
||||
@@ -65,7 +65,7 @@
|
||||
if(!target_ckey)
|
||||
return
|
||||
var/target_sql_ckey = sanitizeSQL(target_ckey)
|
||||
var/DBQuery/query_memofind = dbcon.NewQuery("SELECT memotext FROM [format_table_name("mentor_memo")] WHERE ckey = '[target_sql_ckey]'")
|
||||
var/DBQuery/query_memofind = GLOB.dbcon.NewQuery("SELECT memotext FROM [format_table_name("mentor_memo")] WHERE ckey = '[target_sql_ckey]'")
|
||||
if(!query_memofind.Execute())
|
||||
var/err = query_memofind.ErrorMsg()
|
||||
log_game("SQL ERROR obtaining memotext from memo table. Error : \[[err]\]\n")
|
||||
@@ -78,7 +78,7 @@
|
||||
new_memo = sanitizeSQL(new_memo)
|
||||
var/edit_text = "Edited by [sql_ckey] on [SQLtime()] from<br>[old_memo]<br>to<br>[new_memo]<hr>"
|
||||
edit_text = sanitizeSQL(edit_text)
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE [format_table_name("mentor_memo")] SET memotext = '[new_memo]', last_editor = '[sql_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE ckey = '[target_sql_ckey]'")
|
||||
var/DBQuery/update_query = GLOB.dbcon.NewQuery("UPDATE [format_table_name("mentor_memo")] SET memotext = '[new_memo]', last_editor = '[sql_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE ckey = '[target_sql_ckey]'")
|
||||
if(!update_query.Execute())
|
||||
var/err = update_query.ErrorMsg()
|
||||
log_game("SQL ERROR editing memo. Error : \[[err]\]\n")
|
||||
@@ -90,7 +90,7 @@
|
||||
log_admin("[key_name(src)] has edited [target_sql_ckey]'s mentor memo from [old_memo] to [new_memo]")
|
||||
message_admins("[key_name_admin(src)] has edited [target_sql_ckey]'s mentor memo from<br>[old_memo]<br>to<br>[new_memo]")
|
||||
if("Show")
|
||||
var/DBQuery/query_memoshow = dbcon.NewQuery("SELECT ckey, memotext, timestamp, last_editor FROM [format_table_name("mentor_memo")]")
|
||||
var/DBQuery/query_memoshow = GLOB.dbcon.NewQuery("SELECT ckey, memotext, timestamp, last_editor FROM [format_table_name("mentor_memo")]")
|
||||
if(!query_memoshow.Execute())
|
||||
var/err = query_memoshow.ErrorMsg()
|
||||
log_game("SQL ERROR obtaining ckey, memotext, timestamp, last_editor from memo table. Error : \[[err]\]\n")
|
||||
@@ -110,7 +110,7 @@
|
||||
return
|
||||
to_chat(src, output)
|
||||
if("Remove")
|
||||
var/DBQuery/query_memodellist = dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor_memo")]")
|
||||
var/DBQuery/query_memodellist = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("mentor_memo")]")
|
||||
if(!query_memodellist.Execute())
|
||||
var/err = query_memodellist.ErrorMsg()
|
||||
log_game("SQL ERROR obtaining ckey from memo table. Error : \[[err]\]\n")
|
||||
@@ -126,7 +126,7 @@
|
||||
if(!target_ckey)
|
||||
return
|
||||
var/target_sql_ckey = sanitizeSQL(target_ckey)
|
||||
var/DBQuery/query_memodel = dbcon.NewQuery("DELETE FROM [format_table_name("memo")] WHERE ckey = '[target_sql_ckey]'")
|
||||
var/DBQuery/query_memodel = GLOB.dbcon.NewQuery("DELETE FROM [format_table_name("memo")] WHERE ckey = '[target_sql_ckey]'")
|
||||
if(!query_memodel.Execute())
|
||||
var/err = query_memodel.ErrorMsg()
|
||||
log_game("SQL ERROR removing memo. Error : \[[err]\]\n")
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
var/admin_msg = "<span class='mentornotice'><b><font color='purple'>MENTORHELP:</b> <b>[ADMIN_FULLMONTY(src.mob)]</b>: [msg]</font></span>"
|
||||
log_mentor("MENTORHELP: [key_name_mentor(src, 0, 0, 0, 0)]: [msg]")
|
||||
|
||||
for(var/client/X in mentors)
|
||||
for(var/client/X in GLOB.mentors)
|
||||
to_chat(X, 'sound/items/bikehorn.ogg')
|
||||
to_chat(X, mentor_msg)
|
||||
|
||||
for(var/client/A in admins)
|
||||
for(var/client/A in GLOB.admins)
|
||||
to_chat(A, 'sound/items/bikehorn.ogg')
|
||||
to_chat(A, admin_msg)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
/proc/get_mentor_counts()
|
||||
. = list("total" = 0, "afk" = 0, "present" = 0)
|
||||
for(var/client/X in mentors)
|
||||
for(var/client/X in GLOB.mentors)
|
||||
.["total"]++
|
||||
if(X.is_afk())
|
||||
.["afk"]++
|
||||
@@ -58,7 +58,7 @@
|
||||
else if(istext(whom))
|
||||
key = whom
|
||||
ckey = ckey(whom)
|
||||
C = directory[ckey]
|
||||
C = GLOB.directory[ckey]
|
||||
if(C)
|
||||
M = C.mob
|
||||
else
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
var/mob/M = whom
|
||||
C = M.client
|
||||
else if(istext(whom))
|
||||
C = directory[whom]
|
||||
C = GLOB.directory[whom]
|
||||
else if(istype(whom,/client))
|
||||
C = whom
|
||||
if(!C)
|
||||
@@ -66,9 +66,9 @@
|
||||
//we don't use message_Mentors here because the sender/receiver might get it too
|
||||
var/show_char_sender = !check_mentor_other(src) && config.mentors_mobname_only
|
||||
var/show_char_recip = !check_mentor_other(C) && config.mentors_mobname_only
|
||||
for(var/client/X in mentors)
|
||||
for(var/client/X in GLOB.mentors)
|
||||
if(X.key!=key && X.key!=C.key) //check client/X is an Mentor and isn't the sender or recipient
|
||||
to_chat(X, "<B><font color='green'>Mentor PM: [key_name_mentor(src, X, 0, 0, show_char_sender)]->[key_name_mentor(C, X, 0, 0, show_char_recip)]:</B> \blue [msg]</font>") //inform X
|
||||
for(var/client/A in admins)
|
||||
for(var/client/A in GLOB.admins)
|
||||
if(A.key!=key && A.key!=C.key) //check client/A is an Mentor and isn't the sender or recipient
|
||||
to_chat(A, "<B><font color='green'>Mentor PM: [key_name_mentor(src, A, 0, 0, show_char_sender)]->[key_name_mentor(C, A, 0, 0, show_char_recip)]:</B> \blue [msg]</font>") //inform A
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
if(check_rights(R_ADMIN,0))
|
||||
msg = "<span class='mentoradmin'><span class='prefix'>MENTOR:</span> <EM>[key_name(src, 0, 0)]</EM>: <span class='message'>[msg]</span></span>"
|
||||
to_chat(mentors, msg)
|
||||
to_chat(admins, msg)
|
||||
to_chat(GLOB.mentors, msg)
|
||||
to_chat(GLOB.admins, msg)
|
||||
|
||||
else
|
||||
msg = "<span class='mentor'><span class='prefix'>MENTOR:</span> <EM>[key_name(src, 0, 0)]</EM>: <span class='message'>[msg]</span></span>"
|
||||
to_chat(mentors, msg)
|
||||
to_chat(admins, msg)
|
||||
to_chat(GLOB.mentors, msg)
|
||||
to_chat(GLOB.admins, msg)
|
||||
|
||||
Reference in New Issue
Block a user