From 051e7755d85409195ef8ba723bb72f3cbcfb2847 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 3 Apr 2018 01:27:22 -0700 Subject: [PATCH] darn modular computers --- .../file_system/programs/command/card.dm | 47 ++++++++++++++++++- nano/templates/card_prog.tmpl | 1 + nano/templates/identification_computer.tmpl | 2 +- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/code/modules/modular_computers/file_system/programs/command/card.dm b/code/modules/modular_computers/file_system/programs/command/card.dm index e96d5ec343c..ef97f68a4f3 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -79,7 +79,9 @@ "current_positions" = job.current_positions, "total_positions" = job.total_positions, "can_open" = can_open_job(job), - "can_close" = can_close_job(job)))) + "can_close" = can_close_job(job), + "can_prioritize" = can_prioritize_job(job) + ))) return formatted @@ -121,6 +123,19 @@ return -1 return 0 +/datum/computer_file/program/card_mod/proc/can_prioritize_job(datum/job/job) + if(job) + if(!job_blacklisted(job)) + if(job in job_master.prioritized_jobs) + return 2 + else + if(job_master.prioritized_jobs.len >= 3) + return 0 + if(job.total_positions <= job.current_positions) + return 0 + return 1 + return -1 + /datum/computer_file/program/card_mod/proc/format_jobs(list/jobs) var/obj/item/weapon/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD] if(!card_slot || !card_slot.stored_card) @@ -210,6 +225,7 @@ //let custom jobs function as an impromptu alt title, mainly for sechuds if(temp_t && modify) modify.assignment = temp_t + log_game("[key_name(usr)] has given \"[modify.registered_name]\" the custom job title \"[temp_t]\".") else var/list/access = list() if(is_centcom) @@ -227,6 +243,11 @@ access = jobdatum.get_access() + var/jobnamedata = modify.getRankAndAssignment() + log_game("[key_name(usr)] has reassigned \"[modify.registered_name]\" from \"[jobnamedata]\" to \"[t1]\".") + if(t1 == "Civilian") + message_admins("[key_name_admin(usr)] has reassigned \"[modify.registered_name]\" from \"[jobnamedata]\" to \"[t1]\".") + modify.access = access modify.assignment = t1 modify.rank = t1 @@ -287,9 +308,11 @@ if("PRG_terminate") if(is_authenticated(usr)) + var/jobnamedata = modify.getRankAndAssignment() + log_game("[key_name(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".") + message_admins("[key_name_admin(usr)] has terminated the employment of \"[modify.registered_name]\" the \"[jobnamedata]\".") modify.assignment = "Terminated" modify.access = list() - callHook("terminate_employee", list(modify)) if("PRG_make_job_available") @@ -323,6 +346,26 @@ opened_positions[edit_job_target]-- log_game("[key_name(usr)] has closed a job slot for job \"[j]\".") + + if("PRG_prioritize_job") + // TOGGLE WHETHER JOB APPEARS AS PRIORITIZED IN THE LOBBY + if(is_authenticated(usr)) + var/priority_target = href_list["job"] + var/datum/job/j = job_master.GetJob(priority_target) + if(!j) + return 0 + // Unlike the proper ID computer, this does not check job_in_department + var/priority = TRUE + if(j in job_master.prioritized_jobs) + job_master.prioritized_jobs -= j + priority = FALSE + else if(job_master.prioritized_jobs.len < 3) + job_master.prioritized_jobs += j + else + return 0 + log_game("[key_name(usr)] [priority ? "prioritized" : "unprioritized"] the job \"[j.title]\".") + playsound(computer.loc, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0) + if(modify) modify.name = text("[modify.registered_name]'s ID Card ([modify.assignment])") diff --git a/nano/templates/card_prog.tmpl b/nano/templates/card_prog.tmpl index 56c913a9de9..478c8f6b400 100644 --- a/nano/templates/card_prog.tmpl +++ b/nano/templates/card_prog.tmpl @@ -41,6 +41,7 @@ {{:value.title}}: {{:value.current_positions}}/{{:value.total_positions}} {{:helper.link('-', null, {'action' : 'PRG_make_job_unavailable', 'job' : value.title}, value.can_close == 1 && data.authenticated ? null : 'disabled')}} {{:helper.link('+', null, {'action' : 'PRG_make_job_available', 'job' : value.title}, value.can_open == 1 && data.authenticated ? null : 'disabled')}} + {{:helper.link('Pri', null, {'action' : 'PRG_prioritize_job', 'job' : value.title}, value.can_prioritize > 0 && data.authenticated ? null : 'disabled')}} {{if value.can_prioritize == 2}}Priority Job {{/if}} {{/for}} diff --git a/nano/templates/identification_computer.tmpl b/nano/templates/identification_computer.tmpl index d7696b8630e..ad2779f7864 100644 --- a/nano/templates/identification_computer.tmpl +++ b/nano/templates/identification_computer.tmpl @@ -41,7 +41,7 @@ {{:value.title}}: {{:value.current_positions}}/{{:value.total_positions}} {{:helper.link('-', null, {'choice' : 'make_job_unavailable', 'job' : value.title}, value.can_close == 1 && data.authenticated ? null : 'disabled')}} {{:helper.link('+', null, {'choice' : 'make_job_available', 'job' : value.title}, value.can_open == 1 && data.authenticated ? null : 'disabled')}} - {{:helper.link('*', null, {'choice' : 'prioritize_job', 'job' : value.title}, value.can_prioritize > 0 && data.authenticated ? null : 'disabled')}} {{if value.can_prioritize == 2}}Priority Job {{/if}} + {{:helper.link('Pri', null, {'choice' : 'prioritize_job', 'job' : value.title}, value.can_prioritize > 0 && data.authenticated ? null : 'disabled')}} {{if value.can_prioritize == 2}}Priority Job {{/if}} {{/for}}