mirror of
https://github.com/evilew/GS13-Citadel.git
synced 2026-08-25 06:07:36 +01:00
Mentor System (#5235)
* reworked mentor system, again. wew * Update admin.txt * uhg
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
/client/proc/citaPPoptions(mob/M) // why is this client and not /datum/admins? noone knows, in PP src == client, instead of holder. wtf.
|
||||
var/body = "<br>"
|
||||
if(M.client)
|
||||
body += "<A href='?_src_=holder;[HrefToken()];makementor=[M.ckey]'>Make mentor</A> | "
|
||||
body += "<A href='?_src_=holder;[HrefToken()];removementor=[M.ckey]'>Remove mentor</A>"
|
||||
return body
|
||||
@@ -0,0 +1,14 @@
|
||||
/datum/admins
|
||||
var/following = null
|
||||
|
||||
/datum/admins/associate(client/C)
|
||||
removeMentor(C.ckey) //safety to avoid multiple datums and other weird shit i cannot comprehend
|
||||
..()
|
||||
if(istype(C))
|
||||
C.mentor_datum_set(TRUE)
|
||||
|
||||
/datum/admins/disassociate()
|
||||
if(owner)
|
||||
owner.remove_mentor_verbs()
|
||||
owner.mentor_datum = null
|
||||
..()
|
||||
@@ -0,0 +1,8 @@
|
||||
/datum/admins/proc/CitadelMentorLogSecret()
|
||||
var/dat = "<B>Mentor Log<HR></B>"
|
||||
for(var/l in GLOB.mentorlog)
|
||||
dat += "<li>[l]</li>"
|
||||
|
||||
if(!GLOB.mentorlog.len)
|
||||
dat += "No mentors have done anything this round!"
|
||||
usr << browse(dat, "window=mentor_log")
|
||||
@@ -0,0 +1,55 @@
|
||||
/datum/admins/proc/citaTopic(href, href_list)
|
||||
|
||||
/datum/admins/proc/makeMentor(ckey)
|
||||
if(!usr.client)
|
||||
return
|
||||
if (!check_rights(0))
|
||||
return
|
||||
if(!ckey)
|
||||
return
|
||||
var/client/C = GLOB.directory[ckey]
|
||||
if(C)
|
||||
if(check_rights_for(C, R_ADMIN,0))
|
||||
to_chat(usr, "<span class='danger'>The client chosen is an admin! Cannot mentorize.</span>")
|
||||
return
|
||||
if(SSdbcore.Connect())
|
||||
var/datum/DBQuery/query_get_mentor = SSdbcore.NewQuery("SELECT id FROM [format_table_name("mentor")] WHERE ckey = '[ckey]'")
|
||||
if(query_get_mentor.NextRow())
|
||||
to_chat(usr, "<span class='danger'>[ckey] is already a mentor.</span>")
|
||||
return
|
||||
var/datum/DBQuery/query_add_mentor = SSdbcore.NewQuery("INSERT INTO `[format_table_name("mentor")]` (`id`, `ckey`) VALUES (null, '[ckey]')")
|
||||
if(!query_add_mentor.warn_execute())
|
||||
return
|
||||
var/datum/DBQuery/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new mentor [ckey]');")
|
||||
if(!query_add_admin_log.warn_execute())
|
||||
return
|
||||
else
|
||||
to_chat(usr, "<span class='danger'>Failed to establish database connection. The changes will last only for the current round.</span>")
|
||||
new /datum/mentors(ckey)
|
||||
to_chat(usr, "<span class='adminnotice'>New mentor added.</span>")
|
||||
|
||||
/datum/admins/proc/removeMentor(ckey)
|
||||
if(!usr.client)
|
||||
return
|
||||
if (!check_rights(0))
|
||||
return
|
||||
if(!ckey)
|
||||
return
|
||||
var/client/C = GLOB.directory[ckey]
|
||||
if(C)
|
||||
if(check_rights_for(C, R_ADMIN,0))
|
||||
to_chat(usr, "<span class='danger'>The client chosen is an admin, not a mentor! Cannot de-mentorize.</span>")
|
||||
return
|
||||
C.remove_mentor_verbs()
|
||||
C.mentor_datum = null
|
||||
GLOB.mentors -= C
|
||||
if(SSdbcore.Connect())
|
||||
var/datum/DBQuery/query_remove_mentor = SSdbcore.NewQuery("DELETE FROM [format_table_name("mentor")] WHERE ckey = '[ckey]'")
|
||||
if(!query_remove_mentor.warn_execute())
|
||||
return
|
||||
var/datum/DBQuery/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed mentor [ckey]');")
|
||||
if(!query_add_admin_log.warn_execute())
|
||||
return
|
||||
else
|
||||
to_chat(usr, "<span class='danger'>Failed to establish database connection. The changes will last only for the current round.</span>")
|
||||
to_chat(usr, "<span class='adminnotice'>Mentor removed.</span>")
|
||||
Reference in New Issue
Block a user