Files
Bubberstation/code/modules/modular_computers/file_system/programs/jobmanagement.dm
Gr33d-y a7d1f1ab34 Blacksmithing! (#13)
* Blacksmithing!

THIS SHOULD, SHOULD BEING THE KEY WORD, add blacksmithing as a job along with their workstations on our 4 maps. Their workstations are in beta and currently they share access with curators.

* wood added

forgot to add wood

* Working Blacksmith

Blacksmith.Dm moved to modular_zubber/jobs/job_types/
landmarks.dm for blacksmith moved to modular/zubber/game/object/landmarks

temporary ID_Trim added to /modular_zubber/datum/id_trim/jobs.dm

Blacksmith now spawns in the correct location. But is lacking relvant apperal. Also didn't touch plasmamen.

* Move Blacksmith to Cargo instead of Service and Give plasmamen the right suit

Blacksmith should now be considered Cargo. Starting with pants and boots instead of shorts and shoes.

* undoes map changes

* Update VoidRaptor.dmm

* Update VoidRaptor.dmm

* Update IceBoxStation.dmm

* Update IceBoxStation.dmm

* Update IceBoxStation.dmm

* fuck this shit so fucking hard holy shit who MADE AUTO MAPPING I WANT THEM DEAD

* all but tram trimmed up and smithed

* should be final mapping changes, hopefully, also fully removes automapping and adds skyrats auto mapped stuff to the default maps, besides barbers, for now.

* its back,,,,

* automap test yay

* fixes what i assume is a typo

* automapper gone?>!!?!?!?!

* ITS BACK

* *sobbing and crying sounds*

* is the nightmare over?

* test

* test over

* NO MORE HAIRCUTS!!!! for now

* gdsfYEASLGHJKF FUCK EAH

* CATPAWAS

* KILL

* heg,,h,,m

* kills my hopes and dreams

* Update _basemap.dm

* typofix

* it donut exist

* Give the blacksmith a more appropriate Mail list.

* fixes a small mapping error with the zlevels

* fixes another weird mapping error.

* Adds blacksmith area, new blacksmith heirlooms

Adds the new area to be placed on maps.
Adds appropriate heirlooms.

* Adds the new areas to the DME.

* Update IceBoxStation_bubber.dmm

* Update IceBoxStation_bubber.dmm

* Update IceBoxStation_bubber.dmm

* Repaths modular stuff into the right folders, let's bite the bullet now.

Also adds access for barbers.

* Blacksmith access mapping helper

* Update tgstation.dme

* New blacksmith shop for Deltastation!

* NT Consultant returned to Delta

* Delta Update (bones & sinew)

* Unit test fixes

* Tramstation Blacksmith

* Tramstation Barber

* Update tramstation_bubber.dmm

* super crazy icebox changes

* icebox fixes

* fixes

* Final blacksmith area change

* icebox pipenet fix

* .dme out of order fix

---------

Co-authored-by: JimmyDrop <85446983+ShamanSliph@users.noreply.github.com>
Co-authored-by: KathrinBailey <kat892@outlook.com>
Co-authored-by: KathrinBailey <53862927+KathrinBailey@users.noreply.github.com>
2023-03-02 02:23:28 +00:00

155 lines
5.1 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"
category = PROGRAM_CATEGORY_CREW
program_icon_state = "id"
extended_desc = "Program for viewing and changing job slot availability."
transfer_access = list(ACCESS_COMMAND)
requires_ntnet = TRUE
size = 4
tgui_id = "NtosJobManager"
program_icon = "address-book"
var/change_position_cooldown = 30
///Jobs blacklisted from having their slots edited.
var/list/blacklisted = list(
JOB_CAPTAIN,
JOB_HEAD_OF_PERSONNEL,
JOB_HEAD_OF_SECURITY,
JOB_RESEARCH_DIRECTOR,
JOB_SECURITY_MEDIC, // SKYRAT EDIT ADD START
JOB_BLUESHIELD,
JOB_NT_REP, // SKYRAT EDIT ADD END
JOB_CHIEF_ENGINEER,
JOB_CHIEF_MEDICAL_OFFICER,
JOB_AI,
JOB_CYBORG,
JOB_ASSISTANT,
)
//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(!job || !(job.job_flags & JOB_CREW_MEMBER) || (job.title in blacklisted) || job.veteran_only) //SKYRAT EDIT CHAGNE
return FALSE
return TRUE
/datum/computer_file/program/job_management/proc/can_open_job(datum/job/job)
if(!can_edit_job(job))
return FALSE
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(!can_edit_job(job))
return FALSE
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)
. = ..()
if(.)
return
var/obj/item/card/id/user_id = computer.computer_id_slot
if(!user_id || !(ACCESS_CHANGE_IDS in user_id.access))
return
switch(action)
if("PRG_open_job")
var/edit_job_target = params["target"]
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j || !can_open_job(j))
return
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_prompt_confirm.ogg', 50, FALSE)
return TRUE
if("PRG_close_job")
var/edit_job_target = params["target"]
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j || !can_close_job(j))
return
//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_prompt_confirm.ogg', 50, FALSE)
return TRUE
if("PRG_priority")
var/priority_target = params["target"]
var/datum/job/j = SSjob.GetJob(priority_target)
if(!j || !can_edit_job(j))
return
if(j.total_positions <= j.current_positions)
return
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_prompt_confirm.ogg', 50, FALSE)
return TRUE
/datum/computer_file/program/job_management/ui_data(mob/user)
var/list/data = get_header_data()
var/authed = FALSE
var/obj/item/card/id/user_id = computer.computer_id_slot
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(job.title in blacklisted)
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