From c612462b8c8ff179e5d5fa1ff006fac709facc39 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 18 Jan 2020 03:39:27 -0800 Subject: [PATCH] some demodularization + new eligibility stuff --- .../datums/elements/ghost_role_eligibility.dm | 2 + code/modules/admin/admin.dm | 40 +++++++++-- code/modules/admin/topic.dm | 69 ++++++++++++++++++- modular_citadel/code/modules/admin/admin.dm | 39 ----------- modular_citadel/code/modules/admin/topic.dm | 59 ---------------- tgstation.dme | 2 - 6 files changed, 106 insertions(+), 105 deletions(-) delete mode 100644 modular_citadel/code/modules/admin/admin.dm delete mode 100644 modular_citadel/code/modules/admin/topic.dm diff --git a/code/datums/elements/ghost_role_eligibility.dm b/code/datums/elements/ghost_role_eligibility.dm index 8ecb579bc8..e57aaddd5a 100644 --- a/code/datums/elements/ghost_role_eligibility.dm +++ b/code/datums/elements/ghost_role_eligibility.dm @@ -22,6 +22,8 @@ if(!(M.ckey in timeouts)) timeouts += M.ckey timeouts[M.ckey] = 0 + else if(timeouts[M.ckey] == CANT_REENTER_ROUND) + return timeouts[M.ckey] = max(timeouts[M.ckey],penalty) /datum/element/ghost_role_eligibility/Detach(mob/M) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 88e68158ed..372902e8d6 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -185,7 +185,6 @@ body += "Shade" body += "
" - if (M.client) body += "

" body += "Other actions:" body += "
" @@ -194,9 +193,9 @@ body += "Thunderdome 2 | " body += "Thunderdome Admin | " body += "Thunderdome Observer | " - - body += usr.client.citaPPoptions(M) // CITADEL - + body += "Make mentor | " + body += "Remove mentor" + body += "Allow reentering round" body += "
" body += "" @@ -1009,3 +1008,36 @@ "Admin login: [key_name(src)]") if(string) message_admins("[string]") + +/client/proc/cmd_admin_man_up(mob/M in GLOB.mob_list) + set category = "Special Verbs" + set name = "Man Up" + + if(!M) + return + if(!check_rights(R_ADMIN)) + return + + to_chat(M, "Man up, and deal with it.
Move on.") + M.playsound_local(M, 'sound/voice/manup.ogg', 50, FALSE, pressure_affected = FALSE) + + log_admin("Man up: [key_name(usr)] told [key_name(M)] to man up") + var/message = "[key_name_admin(usr)] told [key_name_admin(M)] to man up." + message_admins(message) + admin_ticket_log(M, message) + SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up") + +/client/proc/cmd_admin_man_up_global() + set category = "Special Verbs" + set name = "Man Up Global" + + if(!check_rights(R_ADMIN)) + return + + to_chat(world, "Man up, and deal with it.
Move on.") + for(var/mob/M in GLOB.player_list) + M.playsound_local(M, 'sound/voice/manup.ogg', 50, FALSE, pressure_affected = FALSE) + + log_admin("Man up global: [key_name(usr)] told everybody to man up") + message_admins("[key_name_admin(usr)] told everybody to man up.") + SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up Global") diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 88d4105124..119c214d6b 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -22,7 +22,10 @@ if(!CheckAdminHref(href, href_list)) return - citaTopic(href, href_list) //CITADEL EDIT, MENTORS + if(href_list["makementor"]) + makeMentor(href_list["makementor"]) + else if(href_list["removementor"]) + removeMentor(href_list["removementor"]) if(href_list["ahelp"]) if(!check_rights(R_ADMIN, TRUE)) @@ -1715,6 +1718,16 @@ log_admin("[key_name(usr)] forced [key_name(M)] to say: [speech]") message_admins("[key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]") + else if(href_list["makeeligible"]) + if(!check_rights(R_ADMIN)) + return + var/mob/M = locate(href_list["eligible"]) + if(!ismob(M)) + to_chat(usr, "this can only be used on instances of type /mob.") + var/datum/element/ghost_role_eligibility/eli = SSdcs.GetElement(/datum/element/ghost_role_eligibility) + if(M.ckey in eli.timeouts) + eli.timeouts -= M.ckey + else if(href_list["sendtoprison"]) if(!check_rights(R_ADMIN)) return @@ -2846,3 +2859,57 @@ dat += {"Random (default)
"} dat += {"Now: [GLOB.secret_force_mode]"} usr << browse(dat, "window=f_secret") + +/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, "The client chosen is an admin! Cannot mentorize.") + 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, "[ckey] is already a mentor.") + 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, "Failed to establish database connection. The changes will last only for the current round.") + new /datum/mentors(ckey) + to_chat(usr, "New mentor added.") + +/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, "The client chosen is an admin, not a mentor! Cannot de-mentorize.") + 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, "Failed to establish database connection. The changes will last only for the current round.") + to_chat(usr, "Mentor removed.") diff --git a/modular_citadel/code/modules/admin/admin.dm b/modular_citadel/code/modules/admin/admin.dm deleted file mode 100644 index 529d0c79ec..0000000000 --- a/modular_citadel/code/modules/admin/admin.dm +++ /dev/null @@ -1,39 +0,0 @@ -/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 = "
" - if(M.client) - body += "Make mentor | " - body += "Remove mentor" - return body - -/client/proc/cmd_admin_man_up(mob/M in GLOB.mob_list) - set category = "Special Verbs" - set name = "Man Up" - - if(!M) - return - if(!check_rights(R_ADMIN)) - return - - to_chat(M, "Man up, and deal with it.
Move on.") - M.playsound_local(M, 'sound/voice/manup.ogg', 50, FALSE, pressure_affected = FALSE) - - log_admin("Man up: [key_name(usr)] told [key_name(M)] to man up") - var/message = "[key_name_admin(usr)] told [key_name_admin(M)] to man up." - message_admins(message) - admin_ticket_log(M, message) - SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up") - -/client/proc/cmd_admin_man_up_global() - set category = "Special Verbs" - set name = "Man Up Global" - - if(!check_rights(R_ADMIN)) - return - - to_chat(world, "Man up, and deal with it.
Move on.") - for(var/mob/M in GLOB.player_list) - M.playsound_local(M, 'sound/voice/manup.ogg', 50, FALSE, pressure_affected = FALSE) - - log_admin("Man up global: [key_name(usr)] told everybody to man up") - message_admins("[key_name_admin(usr)] told everybody to man up.") - SSblackbox.record_feedback("tally", "admin_verb", 1, "Man Up Global") diff --git a/modular_citadel/code/modules/admin/topic.dm b/modular_citadel/code/modules/admin/topic.dm deleted file mode 100644 index 26bc902bef..0000000000 --- a/modular_citadel/code/modules/admin/topic.dm +++ /dev/null @@ -1,59 +0,0 @@ -/datum/admins/proc/citaTopic(href, href_list) - if(href_list["makementor"]) - makeMentor(href_list["makementor"]) - else if(href_list["removementor"]) - removeMentor(href_list["removementor"]) - -/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, "The client chosen is an admin! Cannot mentorize.") - 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, "[ckey] is already a mentor.") - 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, "Failed to establish database connection. The changes will last only for the current round.") - new /datum/mentors(ckey) - to_chat(usr, "New mentor added.") - -/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, "The client chosen is an admin, not a mentor! Cannot de-mentorize.") - 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, "Failed to establish database connection. The changes will last only for the current round.") - to_chat(usr, "Mentor removed.") \ No newline at end of file diff --git a/tgstation.dme b/tgstation.dme index 1893edc33d..f90156d466 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -3091,11 +3091,9 @@ #include "modular_citadel\code\game\machinery\wishgranter.dm" #include "modular_citadel\code\game\objects\cit_screenshake.dm" #include "modular_citadel\code\game\objects\effects\temporary_visuals\souldeath.dm" -#include "modular_citadel\code\modules\admin\admin.dm" #include "modular_citadel\code\modules\admin\chat_commands.dm" #include "modular_citadel\code\modules\admin\holder2.dm" #include "modular_citadel\code\modules\admin\secrets.dm" -#include "modular_citadel\code\modules\admin\topic.dm" #include "modular_citadel\code\modules\arousal\arousal.dm" #include "modular_citadel\code\modules\arousal\genitals.dm" #include "modular_citadel\code\modules\arousal\genitals_sprite_accessories.dm"