Files
Bubberstation/code/modules/modular_computers/file_system/programs/jobmanagement.dm
MrMelbert 5df4de3f71 [MDB Ignore] Re-add hop console second ID slot (#92157)
## About The Pull Request

<img width="491" height="301" alt="image"
src="https://github.com/user-attachments/assets/a3b5b19f-edf5-4de9-9201-9cbfab9e8827"
/>

Mod computers with the access changing software installed have a
secondary ID slot once again. This ID slot doesn't contribute to access.
You can insert IDs into the slot with right click and remove them with
alt-right click.

Also removes the "New IDs and you" memo paper. 

Also tweaks PDA on_deconstruct so contents are dropped on when they're
deconstructed with assembly.

Fixes #92151

## Why It's Good For The Game

Changing IDs is very unnecessarily clunky with the one slot. Insert hop
id, log in, remove hop id, insert crew id, change access, remove crew
id, log out.

We had it right back when we had two slots. Insert hop ID, insert crew
id, log in. It just works.

This also allows for mobile HoPs to change access without necessitating
removing their ID from their PDA.

Other changes: 

The "New IDs and you" memo is very old. They haven't been new for 4
years now. I don't think anyone reads it and they served their purpose.

I found it odd that, if your PDA was melted or blown up, it would delete
your ID. If this is a hold-over from old PDA behavior feel free to let
me know but otherwise it seems sensible that it'd spit out the contents
as you would expect.

## Changelog

🆑 Melbert
qol: The access changing software (the HoP console) now has ID two slots
again (one for the HoP's id and one for the ID being changed). You can
insert IDs in the secondary slot via the UI or right click, and remove
them via the UI or alt-right click.
qol: If your PDA is destroyed via acid or bombs, your ID (and similar
contents such as disks) are spit out instead of being deleted
del: Deletes the "New IDs and you" memo in the HoP's office. They
haven't been new for 4 years.
fix: Engineering sub-tab in the access changing software no longer looks
messed up
fix: Fix reversed alt-click logic for mod pcs
/🆑
2025-08-11 19:08:18 +00:00

136 lines
4.8 KiB
Plaintext

/// The time since the last job opening was created
GLOBAL_VAR_INIT(time_last_changed_position, 0)
/datum/computer_file/program/job_management
filename = "plexagoncore"
filedesc = "Plexagon HR Core"
downloader_category = PROGRAM_CATEGORY_EQUIPMENT
program_open_overlay = "id"
extended_desc = "Program for viewing and changing job slot availability."
download_access = list(ACCESS_COMMAND)
program_flags = PROGRAM_ON_NTNET_STORE | PROGRAM_REQUIRES_NTNET
size = 4
tgui_id = "NtosJobManager"
program_icon = "address-book"
var/change_position_cooldown = 30
//The scaling factor of max total positions in relation to the total amount of people on board the station in %
var/max_relative_positions = 30 //30%: Seems reasonable, limit of 6 @ 20 players
//This is used to keep track of opened positions for jobs to allow instant closing
//Assoc array: "JobName" = (int)<Opened Positions>
var/list/opened_positions = list()
/datum/computer_file/program/job_management/New()
. = ..()
change_position_cooldown = CONFIG_GET(number/id_console_jobslot_delay)
/datum/computer_file/program/job_management/proc/can_edit_job(datum/job/job)
if(!istype(job))
return FALSE
if(!(job.job_flags & JOB_CREW_MEMBER))
return FALSE
if(job.job_flags & JOB_CANNOT_OPEN_SLOTS)
return FALSE
return TRUE
/datum/computer_file/program/job_management/proc/can_open_job(datum/job/job)
if((job.total_positions <= length(GLOB.player_list) * (max_relative_positions / 100)))
var/delta = (world.time / 10) - GLOB.time_last_changed_position
if((change_position_cooldown < delta) || (opened_positions[job.title] < 0))
return TRUE
return FALSE
/datum/computer_file/program/job_management/proc/can_close_job(datum/job/job)
if(job.total_positions > length(GLOB.player_list) * (max_relative_positions / 100))
var/delta = (world.time / 10) - GLOB.time_last_changed_position
if((change_position_cooldown < delta) || (opened_positions[job.title] > 0))
return TRUE
return FALSE
/datum/computer_file/program/job_management/ui_act(action, params, datum/tgui/ui, datum/ui_state/state)
. = ..()
var/obj/item/card/id/user_id = computer.stored_id
if(!user_id || !(ACCESS_CHANGE_IDS in user_id.access))
return TRUE
switch(action)
if("PRG_open_job")
var/edit_job_target = params["target"]
var/datum/job/j = SSjob.get_job(edit_job_target)
if(!can_edit_job(j) || !can_open_job(j))
return TRUE
if(opened_positions[edit_job_target] >= 0)
GLOB.time_last_changed_position = world.time / 10
j.total_positions++
opened_positions[edit_job_target]++
log_job_debug("[key_name(usr)] opened a [j.title] job position, for a total of [j.total_positions] open job slots.")
playsound(computer, 'sound/machines/terminal/terminal_prompt_confirm.ogg', 50, FALSE)
return TRUE
if("PRG_close_job")
var/edit_job_target = params["target"]
var/datum/job/j = SSjob.get_job(edit_job_target)
if(!can_edit_job(j) || !can_close_job(j))
return TRUE
//Allow instant closing without cooldown if a position has been opened before
if(opened_positions[edit_job_target] <= 0)
GLOB.time_last_changed_position = world.time / 10
j.total_positions--
opened_positions[edit_job_target]--
log_job_debug("[key_name(usr)] closed a [j.title] job position, leaving [j.total_positions] open job slots.")
playsound(computer, 'sound/machines/terminal/terminal_prompt_confirm.ogg', 50, FALSE)
return TRUE
if("PRG_priority")
var/priority_target = params["target"]
var/datum/job/j = SSjob.get_job(priority_target)
if(!can_edit_job(j))
return TRUE
if(j.total_positions <= j.current_positions)
return TRUE
if(j in SSjob.prioritized_jobs)
SSjob.prioritized_jobs -= j
else
if(length(SSjob.prioritized_jobs) < 5)
SSjob.prioritized_jobs += j
else
computer.say("Error: CentCom employment protocols restrict prioritising more than 5 jobs.")
playsound(computer, 'sound/machines/terminal/terminal_prompt_confirm.ogg', 50, FALSE)
return TRUE
/datum/computer_file/program/job_management/ui_data(mob/user)
var/list/data = list()
var/authed = FALSE
var/obj/item/card/id/user_id = computer.stored_id
if(user_id && (ACCESS_CHANGE_IDS in user_id.access))
authed = TRUE
data["authed"] = authed
var/list/pos = list()
var/list/priority = list()
for(var/datum/job/job as anything in SSjob.joinable_occupations)
if(!can_edit_job(job))
continue
if(job in SSjob.prioritized_jobs)
priority += job.title
pos += list(list(
"title" = job.title,
"current" = job.current_positions,
"total" = job.total_positions,
"status_open" = authed ? can_open_job(job) : FALSE,
"status_close" = authed ? can_close_job(job) : FALSE,
))
data["slots"] = pos
data["prioritized"] = priority
var/delta = round(change_position_cooldown - ((world.time / 10) - GLOB.time_last_changed_position), 1)
data["cooldown"] = delta < 0 ? 0 : delta
return data