From 54106349e16b083b52cae7332614345fecdb9438 Mon Sep 17 00:00:00 2001 From: Incoming Date: Tue, 14 Oct 2014 20:30:14 -0400 Subject: [PATCH 1/2] Manage Free Slots Converts the nearly useless List Free Slots command to Manage Free Slots From here you can painlessly add and remove job slots to your hearts content because the HoP is Dead/Shit/AFK/In Hiding It can't be used before round start to make rounds with only clowns because of jobs.txt being applied at round start. Alas. --- code/modules/admin/admin.dm | 21 +++++++++++++++++---- code/modules/admin/topic.dm | 24 ++++++++++++++++++++++++ code/modules/admin/verbs/randomverbs.dm | 2 +- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 7412a768e39..c7ab39ecc5c 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -797,23 +797,36 @@ var/global/floorIsLava = 0 /datum/admins/proc/list_free_slots() if(!check_rights()) return - var/dat = "List Free Slots" + var/dat = "Manage Free Slots" var/count = 0 + if(ticker && !ticker.mode) + alert(usr, "You cannot manage jobs before the round starts!") + return + if(job_master) for(var/datum/job/job in job_master.occupations) count++ var/J_title = html_encode(job.title) + var/J_opPos = html_encode(job.total_positions - (job.total_positions - job.current_positions)) var/J_totPos = html_encode(job.total_positions) - dat += "[J_title]: [J_totPos]
" + if(job.total_positions <= 0) + dat += "[J_title]: [J_opPos]" + else + dat += "[J_title]: [J_opPos]/[J_totPos]" + if(initial(job.total_positions) > 0) + dat += " Add | " + if(job.total_positions > job.current_positions) + dat += "Remove" + else + dat += "Remove" + dat += "
" dat += "" var/winheight = 100 + (count * 20) winheight = min(winheight, 690) usr << browse(dat, "window=players;size=316x[winheight]") - - // // //ALL DONE diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index f188e1f34ff..3aa2c6f7a15 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1324,6 +1324,30 @@ src.owner << "[special_role_description]" src.owner << "(PM) (PP) (VV) (SM) (JMP) (CA)" + else if(href_list["addjobslot"]) + if(!check_rights(R_ADMIN)) return + + var/Add = href_list["addjobslot"] + + for(var/datum/job/job in job_master.occupations) + if(job.title == Add) + job.total_positions += 1 + break + + src.list_free_slots() + + else if(href_list["removejobslot"]) + if(!check_rights(R_ADMIN)) return + + var/Remove = href_list["removejobslot"] + + for(var/datum/job/job in job_master.occupations) + if(job.title == Remove && job.total_positions - job.current_positions > 0) + job.total_positions -= 1 + break + + src.list_free_slots() + else if(href_list["adminspawncookie"]) if(!check_rights(R_ADMIN|R_FUN)) return diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 1e63312b6f2..31f6ab9d670 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -449,7 +449,7 @@ Traitors and the like can also be revived with the previous role mostly intact. /client/proc/cmd_admin_list_open_jobs() set category = "Admin" - set name = "List free slots" + set name = "Manage Job Slots" if (!holder) src << "Only administrators may use this command." From 31099161d9cec6c89a8d83e2473a58877ac4ebdd Mon Sep 17 00:00:00 2001 From: Incoming Date: Wed, 15 Oct 2014 16:38:41 -0400 Subject: [PATCH 2/2] Renames the proc --- code/modules/admin/admin.dm | 2 +- code/modules/admin/topic.dm | 4 ++-- code/modules/admin/verbs/randomverbs.dm | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index c7ab39ecc5c..95ec12426c6 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -794,7 +794,7 @@ var/global/floorIsLava = 0 if(!ai_number) usr << "No AIs located" //Just so you know the thing is actually working and not just ignoring you. -/datum/admins/proc/list_free_slots() +/datum/admins/proc/manage_free_slots() if(!check_rights()) return var/dat = "Manage Free Slots" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 3aa2c6f7a15..d40e4a1a1d3 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1334,7 +1334,7 @@ job.total_positions += 1 break - src.list_free_slots() + src.manage_free_slots() else if(href_list["removejobslot"]) if(!check_rights(R_ADMIN)) return @@ -1346,7 +1346,7 @@ job.total_positions -= 1 break - src.list_free_slots() + src.manage_free_slots() else if(href_list["adminspawncookie"]) if(!check_rights(R_ADMIN|R_FUN)) return diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 31f6ab9d670..67d8d55ff8a 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -454,8 +454,8 @@ Traitors and the like can also be revived with the previous role mostly intact. if (!holder) src << "Only administrators may use this command." return - holder.list_free_slots() - feedback_add_details("admin_verb","LFS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + holder.manage_free_slots() + feedback_add_details("admin_verb","MFS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_admin_explosion(atom/O as obj|mob|turf in world) set category = "Special Verbs"