diff --git a/code/__defines/_lists.dm b/code/__defines/_lists.dm index 348aafccef..2a570f6f42 100644 --- a/code/__defines/_lists.dm +++ b/code/__defines/_lists.dm @@ -3,26 +3,38 @@ //Picks from the list, with some safeties, and returns the "default" arg if it fails #define DEFAULTPICK(L, default) ((istype(L, /list) && L:len) ? pick(L) : default) + // Ensures L is initailized after this point #define LAZYINITLIST(L) if (!L) L = list() + // Sets a L back to null iff it is empty #define UNSETEMPTY(L) if (L && !length(L)) L = null + // Removes I from list L, and sets I to null if it is now empty #define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } } -// Adds I to L, initalizing I if necessary + +// Adds I to L, initalizing L if necessary #define LAZYADD(L, I) if(!L) { L = list(); } L += I; + #define LAZYOR(L, I) if(!L) { L = list(); } L |= I; + #define LAZYFIND(L, V) L ? L.Find(V) : 0 + // Reads I from L safely - Works with both associative and traditional lists. #define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= length(L) ? L[I] : null) : L[I]) : null) + // Turns LAZYINITLIST(L) L[K] = V into ... for associated lists #define LAZYSET(L, K, V) if(!L) { L = list(); } L[K] = V; + // Reads the length of L, returning 0 if null #define LAZYLEN(L) length(L) + // Null-safe L.Cut() #define LAZYCLEARLIST(L) if(L) L.Cut() + // Reads L or an empty list if L is not a list. Note: Does NOT assign, L may be an expression. #define SANITIZE_LIST(L) ( islist(L) ? L : list() ) + #define reverseList(L) reverseRange(L.Copy()) // binary search sorted insert diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index a8e77c0a3c..1a49b938ff 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -237,17 +237,20 @@ #define ANTAG_SHARED "Shared" #define ANTAG_KNOWN "Known" -// Job groups -#define ROLE_COMMAND "command" -#define ROLE_SECURITY "security" -#define ROLE_ENGINEERING "engineering" -#define ROLE_MEDICAL "medical" -#define ROLE_RESEARCH "research" -#define ROLE_CARGO "cargo" -#define ROLE_CIVILIAN "civilian" -#define ROLE_SYNTHETIC "synthetic" -#define ROLE_UNKNOWN "unknown" -#define ROLE_EVERYONE "everyone" +// Departments. +#define DEPARTMENT_COMMAND "Command" +#define DEPARTMENT_SECURITY "Security" +#define DEPARTMENT_ENGINEERING "Engineering" +#define DEPARTMENT_MEDICAL "Medical" +#define DEPARTMENT_RESEARCH "Research" +#define DEPARTMENT_CARGO "Cargo" +#define DEPARTMENT_CIVILIAN "Civilian" +#define DEPARTMENT_PLANET "Planetside" // I hate having this be here and not in a SC file. Hopefully someday the manifest can be rewritten to be map-agnostic. +#define DEPARTMENT_SYNTHETIC "Synthetic" + +// These are mostly for the department guessing code and event system. +#define DEPARTMENT_UNKNOWN "Unknown" +#define DEPARTMENT_EVERYONE "Everyone" // Canonical spellings of TSCs, so typos never have to happen again due to human error. #define TSC_NT "NanoTrasen" diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm index 140f10a716..68dd834b66 100644 --- a/code/__defines/subsystems.dm +++ b/code/__defines/subsystems.dm @@ -70,7 +70,11 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G #define INIT_ORDER_XENOARCH -20 #define INIT_ORDER_CIRCUIT -21 #define INIT_ORDER_AI -22 +<<<<<<< HEAD #define INIT_ORDER_CHAT -100 //Should be last to ensure chat remains smooth during init. +======= +#define INIT_ORDER_JOB -23 +>>>>>>> 24fbd0b... Half-Refactors Jobs (#6762) // Subsystem fire priority, from lowest to highest priority diff --git a/code/_helpers/sorts/comparators.dm b/code/_helpers/sorts/comparators.dm index 73ad3d847c..a9ca5748b7 100644 --- a/code/_helpers/sorts/comparators.dm +++ b/code/_helpers/sorts/comparators.dm @@ -34,12 +34,23 @@ // Sorts jobs by department, and then by flag within department /proc/cmp_job_datums(var/datum/job/a, var/datum/job/b) - . = sorttext(b.department, a.department) - if (. == 0) //Same department, push up if they're a head - . = b.head_position - a.head_position - if (. == 0) //Already in head/nothead spot, sort by name + . = 0 + if( LAZYLEN(a.departments) && LAZYLEN(b.departments) ) + var/list/common_departments = a.departments & b.departments // Makes a list that contains only departments that were in both. + if(!common_departments.len) + . = sorttext(b.departments[1], a.departments[1]) + + if(. == 0) //Same department, push up if they're a head + . = b.sorting_order - a.sorting_order + + if(. == 0) //Already in same sorting order, sort by name . = sorttext(b.title, a.title) +/proc/cmp_department_datums(var/datum/department/a, var/datum/department/b) + . = b.sorting_order - a.sorting_order // First, sort by the sorting order vars. + if(. == 0) // If they have the same var, then sort by name. + . = sorttext(b.name, a.name) + // Sorts entries in a performance stats list. /proc/cmp_generic_stat_item_time(list/A, list/B) . = B[STAT_ENTRY_TIME] - A[STAT_ENTRY_TIME] diff --git a/code/controllers/subsystems/job.dm b/code/controllers/subsystems/job.dm new file mode 100644 index 0000000000..97af46fa34 --- /dev/null +++ b/code/controllers/subsystems/job.dm @@ -0,0 +1,108 @@ +SUBSYSTEM_DEF(job) + name = "Job" + init_order = INIT_ORDER_JOB + flags = SS_NO_FIRE + + var/list/occupations = list() //List of all jobs + var/list/datum/job/name_occupations = list() //Dict of all jobs, keys are titles + var/list/type_occupations = list() //Dict of all jobs, keys are types + + var/list/department_datums = list() + var/debug_messages = FALSE + + +/datum/controller/subsystem/job/Initialize(timeofday) + if(!department_datums.len) + setup_departments() + if(!occupations.len) + setup_occupations() + return ..() + +/datum/controller/subsystem/job/proc/setup_occupations(faction = "Station") + occupations = list() + var/list/all_jobs = subtypesof(/datum/job) + if(!all_jobs.len) + to_chat(world, span("warning", "Error setting up jobs, no job datums found")) + return FALSE + + for(var/J in all_jobs) + var/datum/job/job = new J() + if(!job) + continue + if(job.faction != faction) + continue + occupations += job + name_occupations[job.title] = job + type_occupations[J] = job + if(LAZYLEN(job.departments)) + add_to_departments(job) + + sortTim(occupations, /proc/cmp_job_datums) + for(var/D in department_datums) + var/datum/department/dept = department_datums[D] + sortTim(dept.jobs, /proc/cmp_job_datums, TRUE) + + return TRUE + +/datum/controller/subsystem/job/proc/add_to_departments(datum/job/J) + for(var/D in J.departments) + var/datum/department/dept = LAZYACCESS(department_datums, D) + if(!istype(dept)) + job_debug_message("Job '[J.title]' is defined as being inside department '[D]', but it does not exist.") + continue + dept.jobs[J.title] = J + +/datum/controller/subsystem/job/proc/setup_departments() + for(var/t in subtypesof(/datum/department)) + var/datum/department/D = new t() + department_datums[D.name] = D + + sortTim(department_datums, /proc/cmp_department_datums, TRUE) + +/datum/controller/subsystem/job/proc/get_all_department_datums() + var/list/dept_datums = list() + for(var/D in department_datums) + dept_datums += department_datums[D] + return dept_datums + +/datum/controller/subsystem/job/proc/get_job(rank) + if(!occupations.len) + setup_occupations() + return name_occupations[rank] + +/datum/controller/subsystem/job/proc/get_job_type(jobtype) + if(!occupations.len) + setup_occupations() + return type_occupations[jobtype] + +// Determines if a job title is inside of a specific department. +// Useful to replace the old `if(job_title in command_positions)` code. +/datum/controller/subsystem/job/proc/is_job_in_department(rank, target_department_name) + var/datum/department/D = LAZYACCESS(department_datums, target_department_name) + if(istype(D)) + return LAZYFIND(D.jobs, rank) ? TRUE : FALSE + return FALSE + +// Returns a list of all job names in a specific department. +/datum/controller/subsystem/job/proc/get_job_titles_in_department(target_department_name) + var/datum/department/D = LAZYACCESS(department_datums, target_department_name) + if(istype(D)) + var/list/job_titles = list() + for(var/J in D.jobs) + job_titles += J + return job_titles + + job_debug_message("Was asked to get job titles for a non-existant department '[target_department_name]'.") + return list() + + + +// Someday it might be good to port code/game/jobs/job_controller.dm to here and clean it up. + + + + + +/datum/controller/subsystem/job/proc/job_debug_message(message) + if(debug_messages) + log_debug("JOB DEBUG: [message]") \ No newline at end of file diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index aed9cd9245..7a8b46aaf1 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -55,30 +55,34 @@ //to_world("[name]: [rank]") //cael - to prevent multiple appearances of a player/job combination, add a continue after each line var/department = 0 - if(real_rank in command_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_COMMAND)) heads[name] = rank department = 1 - if(real_rank in security_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_SECURITY)) sec[name] = rank department = 1 - if(real_rank in engineering_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_ENGINEERING)) eng[name] = rank department = 1 - if(real_rank in medical_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_MEDICAL)) med[name] = rank department = 1 - if(real_rank in science_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_RESEARCH)) sci[name] = rank department = 1 - if(real_rank in cargo_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_CARGO)) car[name] = rank department = 1 +<<<<<<< HEAD //VOREStation Edit Begin if(real_rank in planet_positions) pla[name] = rank department = 1 //VOREStation Edit End if(real_rank in civilian_positions) +======= + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_CIVILIAN)) +>>>>>>> 24fbd0b... Half-Refactors Jobs (#6762) civ[name] = rank department = 1 if(!department && !(name in heads)) diff --git a/code/defines/obj.dm b/code/defines/obj.dm index ee2ddea1c0..116f239c41 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -83,54 +83,54 @@ var/global/list/PDA_Manifest = list() var/isactive = t.fields["p_stat"] var/department = 0 var/depthead = 0 // Department Heads will be placed at the top of their lists. - if(real_rank in command_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_COMMAND)) heads[++heads.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 depthead = 1 if(rank=="Colony Director" && heads.len != 1) heads.Swap(1,heads.len) - if(real_rank in security_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_SECURITY)) sec[++sec.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 if(depthead && sec.len != 1) sec.Swap(1,sec.len) - if(real_rank in engineering_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_ENGINEERING)) eng[++eng.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 if(depthead && eng.len != 1) eng.Swap(1,eng.len) - if(real_rank in medical_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_MEDICAL)) med[++med.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 if(depthead && med.len != 1) med.Swap(1,med.len) - if(real_rank in science_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_RESEARCH)) sci[++sci.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 if(depthead && sci.len != 1) sci.Swap(1,sci.len) - if(real_rank in planet_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_PLANET)) pla[++pla.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 - if(real_rank in cargo_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_CARGO)) car[++car.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 if(depthead && car.len != 1) car.Swap(1,car.len) - if(real_rank in civilian_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_CARGO)) civ[++civ.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 if(depthead && civ.len != 1) civ.Swap(1,civ.len) - if(real_rank in nonhuman_positions) + if(SSjob.is_job_in_department(real_rank, DEPARTMENT_SYNTHETIC)) bot[++bot.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 diff --git a/code/game/antagonist/station/loyalist.dm b/code/game/antagonist/station/loyalist.dm index fddf0c3796..54e9fa4d4e 100644 --- a/code/game/antagonist/station/loyalist.dm +++ b/code/game/antagonist/station/loyalist.dm @@ -39,7 +39,7 @@ var/datum/antagonist/loyalists/loyalists return global_objectives = list() for(var/mob/living/carbon/human/player in mob_list) - if(!player.mind || player.stat==2 || !(player.mind.assigned_role in command_positions)) + if(!player.mind || player.stat==2 || !(SSjob.is_job_in_department(player.mind.assigned_role, DEPARTMENT_COMMAND))) continue var/datum/objective/protect/loyal_obj = new loyal_obj.target = player.mind diff --git a/code/game/antagonist/station/revolutionary.dm b/code/game/antagonist/station/revolutionary.dm index 9e6100c8af..17c519b7a0 100644 --- a/code/game/antagonist/station/revolutionary.dm +++ b/code/game/antagonist/station/revolutionary.dm @@ -42,7 +42,7 @@ var/datum/antagonist/revolutionary/revs return global_objectives = list() for(var/mob/living/carbon/human/player in mob_list) - if(!player.mind || player.stat==2 || !(player.mind.assigned_role in command_positions)) + if(!player.mind || player.stat==2 || !(SSjob.is_job_in_department(player.mind.assigned_role, DEPARTMENT_COMMAND))) continue var/datum/objective/rev/rev_obj = new rev_obj.target = player.mind diff --git a/code/game/jobs/job/assistant.dm b/code/game/jobs/job/assistant.dm index d20e392599..e84d69a8db 100644 --- a/code/game/jobs/job/assistant.dm +++ b/code/game/jobs/job/assistant.dm @@ -1,7 +1,8 @@ /datum/job/assistant title = "Assistant" flag = ASSISTANT - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) + sorting_order = -1 department_flag = CIVILIAN faction = "Station" total_positions = -1 diff --git a/code/game/jobs/job/captain.dm b/code/game/jobs/job/captain.dm index f98ab11928..ede7fec465 100644 --- a/code/game/jobs/job/captain.dm +++ b/code/game/jobs/job/captain.dm @@ -3,7 +3,8 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) /datum/job/captain title = "Colony Director" flag = CAPTAIN - department = "Command" + departments = list(DEPARTMENT_COMMAND) + sorting_order = 3 // Above everyone. head_position = 1 department_flag = ENGSEC faction = "Station" @@ -35,7 +36,8 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) /datum/job/hop title = "Head of Personnel" flag = HOP - department = "Command" + departments = list(DEPARTMENT_CIVILIAN, DEPARTMENT_CARGO, DEPARTMENT_COMMAND) + sorting_order = 2 // Above the QM, below captain. head_position = 1 department_flag = CIVILIAN faction = "Station" @@ -69,7 +71,7 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) /datum/job/secretary title = "Command Secretary" flag = BRIDGE - department = "Command" + departments = list(DEPARTMENT_COMMAND) head_position = 1 department_flag = CIVILIAN faction = "Station" diff --git a/code/game/jobs/job/civilian.dm b/code/game/jobs/job/civilian.dm index d5a099af8c..b5e50cd443 100644 --- a/code/game/jobs/job/civilian.dm +++ b/code/game/jobs/job/civilian.dm @@ -2,7 +2,7 @@ /datum/job/bartender title = "Bartender" flag = BARTENDER - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -19,7 +19,7 @@ /datum/job/chef title = "Chef" flag = CHEF - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -35,7 +35,7 @@ /datum/job/hydro title = "Botanist" flag = BOTANIST - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -52,7 +52,8 @@ /datum/job/qm title = "Quartermaster" flag = QUARTERMASTER - department = "Cargo" + departments = list(DEPARTMENT_CARGO) + sorting_order = 1 // QM is above the cargo techs, but below the HoP. head_position = 1 department_flag = CIVILIAN faction = "Station" @@ -72,7 +73,7 @@ /datum/job/cargo_tech title = "Cargo Technician" flag = CARGOTECH - department = "Cargo" + departments = list(DEPARTMENT_CARGO) department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -87,7 +88,7 @@ /datum/job/mining title = "Shaft Miner" flag = MINER - department = "Cargo" + departments = list(DEPARTMENT_CARGO) department_flag = CIVILIAN faction = "Station" total_positions = 3 @@ -105,7 +106,7 @@ /datum/job/janitor title = "Janitor" flag = JANITOR - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -122,7 +123,7 @@ /datum/job/librarian title = "Librarian" flag = LIBRARIAN - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) department_flag = CIVILIAN faction = "Station" total_positions = 1 @@ -139,7 +140,7 @@ /datum/job/lawyer title = "Internal Affairs Agent" flag = LAWYER - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) department_flag = CIVILIAN faction = "Station" total_positions = 2 diff --git a/code/game/jobs/job/civilian_chaplain.dm b/code/game/jobs/job/civilian_chaplain.dm index 12c2c9419d..b6430fef6b 100644 --- a/code/game/jobs/job/civilian_chaplain.dm +++ b/code/game/jobs/job/civilian_chaplain.dm @@ -2,7 +2,7 @@ /datum/job/chaplain title = "Chaplain" flag = CHAPLAIN - department = "Civilian" + departments = list(DEPARTMENT_CIVILIAN) department_flag = CIVILIAN faction = "Station" total_positions = 1 diff --git a/code/game/jobs/job/department.dm b/code/game/jobs/job/department.dm new file mode 100644 index 0000000000..914f8e5a03 --- /dev/null +++ b/code/game/jobs/job/department.dm @@ -0,0 +1,79 @@ +// A datum that holds information about a specific department. +// It is held inside, and managed by, the SSjob subsystem automatically, +// just define a department, and put that department's name in one or more job datums' departments list. + +/datum/department + var/name = "NOPE" // Name used in UIs, and the index for the department assoc list in SSjob. + var/short_name = "NO" // Shorter name, used for things like external Topic() responses. + var/color = "#000000" // Color to use in UIs to represent this department. + var/list/jobs = list() // Assoc list. Key is the job title, and the value is a reference to the job datum. Populated by SSjob subsystem. + var/sorting_order = 0 // Used to sort departments, e.g. Command always being on top. + var/visible = TRUE // If false, it should not show up on things like the manifest or ID computer. + var/assignable = TRUE // Similar for above, but only for ID computers and such. Used for silicon department. + var/centcom_only = FALSE + +/datum/department/command + name = DEPARTMENT_COMMAND + short_name = "Heads" + color = "#3333FF" + sorting_order = 10 + +/datum/department/security + name = DEPARTMENT_SECURITY + short_name = "Sec" + color = "#8E0000" + sorting_order = 6 + +/datum/department/engineering + name = DEPARTMENT_ENGINEERING + short_name = "Eng" + color = "#B27300" + sorting_order = 5 + +/datum/department/medical + name = DEPARTMENT_MEDICAL + short_name = "Med" + color = "#006600" + sorting_order = 4 + +/datum/department/research + name = DEPARTMENT_RESEARCH + short_name = "Sci" + color = "#A65BA6" + sorting_order = 3 + +/datum/department/cargo + name = DEPARTMENT_CARGO + short_name = "Car" + color = "#BB9040" + sorting_order = 2 + +/datum/department/civilian + name = DEPARTMENT_CIVILIAN + short_name = "Civ" + color = "#A32800" + sorting_order = 1 + +// Mostly for if someone wanted to rewrite manifest code to be map-agnostic. +/datum/department/misc + name = "Miscellaneous" + short_name = "Misc" + color = "#666666" + sorting_order = 0 + assignable = FALSE + +/datum/department/synthetic + name = DEPARTMENT_SYNTHETIC + short_name = "Bot" + color = "#222222" + sorting_order = -1 + assignable = FALSE + +// This one isn't very useful since no real centcom jobs exist yet. +// Instead the jobs like ERT are hardcoded in. +/datum/department/centcom + name = "Central Command" + short_name = "Centcom" + color = "#A52A2A" + sorting_order = 20 // Above Command. + centcom_only = TRUE \ No newline at end of file diff --git a/code/game/jobs/job/engineering.dm b/code/game/jobs/job/engineering.dm index cfa79ffc25..db6fc07cb6 100644 --- a/code/game/jobs/job/engineering.dm +++ b/code/game/jobs/job/engineering.dm @@ -2,7 +2,8 @@ title = "Chief Engineer" flag = CHIEF head_position = 1 - department = "Engineering" + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_COMMAND) + sorting_order = 2 department_flag = ENGSEC faction = "Station" total_positions = 1 @@ -31,7 +32,7 @@ /datum/job/engineer title = "Station Engineer" flag = ENGINEER - department = "Engineering" + departments = list(DEPARTMENT_ENGINEERING) department_flag = ENGSEC faction = "Station" total_positions = 5 @@ -50,7 +51,7 @@ /datum/job/atmos title = "Atmospheric Technician" flag = ATMOSTECH - department = "Engineering" + departments = list(DEPARTMENT_ENGINEERING) department_flag = ENGSEC faction = "Station" total_positions = 3 diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index e22bb9030c..85c51dadec 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -16,8 +16,10 @@ var/list/alt_titles // List of alternate titles, if any var/req_admin_notify // If this is set to 1, a text is printed to the player when jobs are assigned, telling him that he should let admins know that he has to disconnect. var/minimal_player_age = 0 // If you have use_age_restriction_for_jobs config option enabled and the database set up, this option will add a requirement for players to be at least minimal_player_age days old. (meaning they first signed in at least that many days before.) - var/department = null // Does this position have a department tag? + var/list/departments = list() // List of departments this job belongs to, if any. The first one on the list will be the 'primary' department. + var/sorting_order = 0 // Used for sorting jobs so boss jobs go above regular ones, and their boss's boss is above that. Higher numbers = higher in sorting. var/head_position = 0 // Is this position Command? + var/assignable = TRUE // Should it show up on things like the ID computer? var/minimum_character_age = 0 var/ideal_character_age = 30 var/has_headset = TRUE //Do people with this job need to be given headsets and told how to use them? E.g. Cyborgs don't. diff --git a/code/game/jobs/job/medical.dm b/code/game/jobs/job/medical.dm index c855411303..cb562b9c40 100644 --- a/code/game/jobs/job/medical.dm +++ b/code/game/jobs/job/medical.dm @@ -2,7 +2,8 @@ title = "Chief Medical Officer" flag = CMO head_position = 1 - department = "Medical" + departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_COMMAND) + sorting_order = 2 department_flag = MEDSCI faction = "Station" total_positions = 1 @@ -27,7 +28,7 @@ /datum/job/doctor title = "Medical Doctor" flag = DOCTOR - department = "Medical" + departments = list(DEPARTMENT_MEDICAL) department_flag = MEDSCI faction = "Station" total_positions = 5 @@ -48,7 +49,7 @@ /datum/job/chemist title = "Chemist" flag = CHEMIST - department = "Medical" + departments = list(DEPARTMENT_MEDICAL) department_flag = MEDSCI faction = "Station" total_positions = 2 @@ -68,7 +69,7 @@ /datum/job/geneticist title = "Geneticist" flag = GENETICIST - department = "Medical" + departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_RESEARCH) department_flag = MEDSCI faction = "Station" total_positions = 0 @@ -85,7 +86,7 @@ /datum/job/psychiatrist title = "Psychiatrist" flag = PSYCHIATRIST - department = "Medical" + departments = list(DEPARTMENT_MEDICAL) department_flag = MEDSCI faction = "Station" total_positions = 1 @@ -101,7 +102,7 @@ /datum/job/paramedic title = "Paramedic" flag = PARAMEDIC - department = "Medical" + departments = list(DEPARTMENT_MEDICAL) department_flag = MEDSCI faction = "Station" total_positions = 2 diff --git a/code/game/jobs/job/science.dm b/code/game/jobs/job/science.dm index 10f8e855ed..a751636477 100644 --- a/code/game/jobs/job/science.dm +++ b/code/game/jobs/job/science.dm @@ -2,7 +2,8 @@ title = "Research Director" flag = RD head_position = 1 - department = "Science" + departments = list(DEPARTMENT_RESEARCH, DEPARTMENT_COMMAND) + sorting_order = 2 department_flag = MEDSCI faction = "Station" total_positions = 1 @@ -31,7 +32,7 @@ /datum/job/scientist title = "Scientist" flag = SCIENTIST - department = "Science" + departments = list(DEPARTMENT_RESEARCH) department_flag = MEDSCI faction = "Station" total_positions = 5 @@ -50,7 +51,7 @@ /datum/job/xenobiologist title = "Xenobiologist" flag = XENOBIOLOGIST - department = "Science" + departments = list(DEPARTMENT_RESEARCH) department_flag = MEDSCI faction = "Station" total_positions = 3 @@ -69,7 +70,7 @@ /datum/job/roboticist title = "Roboticist" flag = ROBOTICIST - department = "Science" + departments = list(DEPARTMENT_RESEARCH) department_flag = MEDSCI faction = "Station" total_positions = 2 diff --git a/code/game/jobs/job/security.dm b/code/game/jobs/job/security.dm index fccac1a4af..d53cd567ab 100644 --- a/code/game/jobs/job/security.dm +++ b/code/game/jobs/job/security.dm @@ -2,7 +2,8 @@ title = "Head of Security" flag = HOS head_position = 1 - department = "Security" + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_COMMAND) + sorting_order = 2 department_flag = ENGSEC faction = "Station" total_positions = 1 @@ -28,7 +29,8 @@ /datum/job/warden title = "Warden" flag = WARDEN - department = "Security" + departments = list(DEPARTMENT_SECURITY) + sorting_order = 1 department_flag = ENGSEC faction = "Station" total_positions = 1 @@ -44,7 +46,7 @@ /datum/job/detective title = "Detective" flag = DETECTIVE - department = "Security" + departments = list(DEPARTMENT_SECURITY) department_flag = ENGSEC faction = "Station" total_positions = 2 @@ -61,7 +63,7 @@ /datum/job/officer title = "Security Officer" flag = OFFICER - department = "Security" + departments = list(DEPARTMENT_SECURITY) department_flag = ENGSEC faction = "Station" total_positions = 4 diff --git a/code/game/jobs/job/silicon.dm b/code/game/jobs/job/silicon.dm index 9aed52c023..e5ed9b2dc4 100644 --- a/code/game/jobs/job/silicon.dm +++ b/code/game/jobs/job/silicon.dm @@ -1,6 +1,8 @@ /datum/job/ai title = "AI" flag = AI + departments = list(DEPARTMENT_SYNTHETIC) + sorting_order = 1 // Be above their borgs. department_flag = ENGSEC faction = "Station" total_positions = 0 // Not used for AI, see is_position_available below and modules/mob/living/silicon/ai/latejoin.dm @@ -12,6 +14,7 @@ account_allowed = 0 economic_modifier = 0 has_headset = FALSE + assignable = FALSE /datum/job/ai/equip(var/mob/living/carbon/human/H) if(!H) return 0 @@ -28,6 +31,7 @@ /datum/job/cyborg title = "Cyborg" flag = CYBORG + departments = list(DEPARTMENT_SYNTHETIC) department_flag = ENGSEC faction = "Station" total_positions = 2 @@ -39,6 +43,7 @@ account_allowed = 0 economic_modifier = 0 has_headset = FALSE + assignable = FALSE /datum/job/cyborg/equip(var/mob/living/carbon/human/H) if(!H) return 0 diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index f729bb1bc9..b1402290c0 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -120,7 +120,7 @@ var/global/datum/controller/occupations/job_master if(istype(job, GetJob(USELESS_JOB))) // We don't want to give him assistant, that's boring! //VOREStation Edit - Visitor not Assistant continue - if(job.title in command_positions) //If you want a command position, select it! + if(SSjob.is_job_in_department(job.title, DEPARTMENT_COMMAND)) //If you want a command position, select it! continue if(jobban_isbanned(player, job.title)) @@ -156,7 +156,7 @@ var/global/datum/controller/occupations/job_master ///This proc is called before the level loop of DivideOccupations() and will try to select a head, ignoring ALL non-head preferences for every level until it locates a head or runs out of levels to check proc/FillHeadPosition() for(var/level = 1 to 3) - for(var/command_position in command_positions) + for(var/command_position in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND)) var/datum/job/job = GetJob(command_position) if(!job) continue var/list/candidates = FindOccupationCandidates(job, level) @@ -196,7 +196,7 @@ var/global/datum/controller/occupations/job_master ///This proc is called at the start of the level loop of DivideOccupations() and will cause head jobs to be checked before any other jobs of the same level proc/CheckHeadPositions(var/level) - for(var/command_position in command_positions) + for(var/command_position in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND)) var/datum/job/job = GetJob(command_position) if(!job) continue var/list/candidates = FindOccupationCandidates(job, level) @@ -435,9 +435,9 @@ var/global/datum/controller/occupations/job_master log_game("SPECIES [key_name(H)] is a: \"[H.species.name]\"") //VOREStation Add // If they're head, give them the account info for their department - if(H.mind && job.head_position) + if(H.mind && job.head_position && LAZYLEN(job.departments)) var/remembered_info = "" - var/datum/money_account/department_account = department_accounts[job.department] + var/datum/money_account/department_account = department_accounts[job.departments[1]] if(department_account) remembered_info += "Your department's account number is: #[department_account.account_number]
" diff --git a/code/game/jobs/jobs.dm b/code/game/jobs/jobs.dm index 086003a479..8c4dbfd2e6 100644 --- a/code/game/jobs/jobs.dm +++ b/code/game/jobs/jobs.dm @@ -42,6 +42,7 @@ var/const/LAWYER =(1<<9) var/const/CHAPLAIN =(1<<10) var/const/ASSISTANT =(1<<11) var/const/BRIDGE =(1<<12) +<<<<<<< HEAD var/const/CLOWN =(1<<13) //VOREStation Add var/const/MIME =(1<<14) //VOREStation Add @@ -128,9 +129,11 @@ var/list/nonhuman_positions = list( "pAI" ) +======= +>>>>>>> 24fbd0b... Half-Refactors Jobs (#6762) /proc/guest_jobbans(var/job) - return ((job in command_positions) || (job in nonhuman_positions) || (job in security_positions)) + return ( (job in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND)) || (job in SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC)) || (job in SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY)) ) /proc/get_job_datums() var/list/occupations = list() diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index eb78d41e26..34ab946b2a 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -101,7 +101,9 @@ data["centcom_access"] = is_centcom() data["all_centcom_access"] = null data["regions"] = null + data["id_rank"] = modify && modify.assignment ? modify.assignment : "Unassigned" +<<<<<<< HEAD data["jobs"] = list( list("cat" = "Engineering", "jobs" = format_jobs(engineering_positions)), list("cat" = "Medical", "jobs" = format_jobs(medical_positions)), @@ -112,6 +114,18 @@ list("cat" = "Civilian", "jobs" = format_jobs(civilian_positions)), list("cat" = "CentCom", "jobs" = format_jobs(get_all_centcom_jobs())) ) +======= + var/list/departments = list() + for(var/D in SSjob.get_all_department_datums()) + var/datum/department/dept = D + if(!dept.assignable) // No AI ID cards for you. + continue + if(dept.centcom_only && !is_centcom()) + continue + departments[++departments.len] = list("department_name" = dept.name, "jobs" = format_jobs(SSjob.get_job_titles_in_department(dept.name)) ) + + data["departments"] = departments +>>>>>>> 24fbd0b... Half-Refactors Jobs (#6762) if (modify && is_centcom()) var/list/all_centcom_access = list() @@ -208,16 +222,10 @@ if(is_centcom()) access = get_centcom_access(t1) else - var/datum/job/jobdatum - for(var/jobtype in typesof(/datum/job)) - var/datum/job/J = new jobtype - if(ckey(J.title) == ckey(t1)) - jobdatum = J - break + var/datum/job/jobdatum = SSjob.get_job(t1) if(!jobdatum) to_chat(usr, "No log exists for this job: [t1]") return - access = jobdatum.get_access() modify.access = access diff --git a/code/game/world.dm b/code/game/world.dm index 47a0153cf4..6e8a866742 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -154,6 +154,7 @@ var/world_topic_spam_protect_time = world.timeofday else if(T == "manifest") var/list/positions = list() var/list/set_names = list( +<<<<<<< HEAD "heads" = command_positions, "sec" = security_positions, "eng" = engineering_positions, @@ -163,6 +164,16 @@ var/world_topic_spam_protect_time = world.timeofday "pla" = planet_positions, //VOREStation Edit, "civ" = civilian_positions, "bot" = nonhuman_positions +======= + "heads" = SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND), + "sec" = SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY), + "eng" = SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING), + "med" = SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL), + "sci" = SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH), + "car" = SSjob.get_job_titles_in_department(DEPARTMENT_CARGO), + "civ" = SSjob.get_job_titles_in_department(DEPARTMENT_CIVILIAN), + "bot" = SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC) +>>>>>>> 24fbd0b... Half-Refactors Jobs (#6762) ) for(var/datum/data/record/t in data_core.general) diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index c7aa816014..fc1a8e05ca 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -301,7 +301,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" for(var/j in get_all_jobs()) output += "" - for(var/j in nonhuman_positions) + for(var/j in SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC)) output += "" var/list/bantypes = list("traitor","changeling","operative","revolutionary","cultist","wizard") //For legacy bans. for(var/antag_type in all_antag_types) // Grab other bans. diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index a66cf17fe2..8be3094d99 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -394,8 +394,8 @@ //Regular jobs //Command (Blue) jobs += "" - jobs += "" - for(var/jobPos in command_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -415,8 +415,8 @@ //Security (Red) counter = 0 jobs += "
Command Positions
Command Positions
" - jobs += "" - for(var/jobPos in security_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -436,8 +436,8 @@ //Engineering (Yellow) counter = 0 jobs += "
Security Positions
Security Positions
" - jobs += "" - for(var/jobPos in engineering_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -457,8 +457,8 @@ //Cargo (Yellow) counter = 0 jobs += "
Engineering Positions
Engineering Positions
" - jobs += "" - for(var/jobPos in cargo_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CARGO)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -478,8 +478,8 @@ //Medical (White) counter = 0 jobs += "
Cargo Positions
Cargo Positions
" - jobs += "" - for(var/jobPos in medical_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -499,8 +499,8 @@ //Science (Purple) counter = 0 jobs += "
Medical Positions
Medical Positions
" - jobs += "" - for(var/jobPos in science_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -541,8 +541,8 @@ //Civilian (Grey) counter = 0 jobs += "
Science Positions
Science Positions
" - jobs += "" - for(var/jobPos in civilian_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CIVILIAN)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -568,8 +568,8 @@ //Non-Human (Green) counter = 0 jobs += "
Civilian Positions
Civilian Positions
" - jobs += "" - for(var/jobPos in nonhuman_positions) + jobs += "" + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC)) if(!jobPos) continue var/datum/job/job = job_master.GetJob(jobPos) if(!job) continue @@ -656,37 +656,37 @@ var/list/joblist = list() switch(href_list["jobban3"]) if("commanddept") - for(var/jobPos in command_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue joblist += temp.title if("securitydept") - for(var/jobPos in security_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue joblist += temp.title if("engineeringdept") - for(var/jobPos in engineering_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue joblist += temp.title if("cargodept") - for(var/jobPos in cargo_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CARGO)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue joblist += temp.title if("medicaldept") - for(var/jobPos in medical_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue joblist += temp.title if("sciencedept") - for(var/jobPos in science_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue @@ -700,14 +700,14 @@ joblist += temp.title //VOREStation Edit End if("civiliandept") - for(var/jobPos in civilian_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CIVILIAN)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue joblist += temp.title if("nonhumandept") joblist += "pAI" - for(var/jobPos in nonhuman_positions) + for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC)) if(!jobPos) continue var/datum/job/temp = job_master.GetJob(jobPos) if(!temp) continue diff --git a/code/modules/client/preference_setup/occupation/occupation.dm b/code/modules/client/preference_setup/occupation/occupation.dm index ca2bc4d787..1035147ffa 100644 --- a/code/modules/client/preference_setup/occupation/occupation.dm +++ b/code/modules/client/preference_setup/occupation/occupation.dm @@ -97,7 +97,7 @@ if((pref.job_civilian_low & ASSISTANT) && job.type != /datum/job/assistant) . += "[rank]" continue - if((rank in command_positions) || (rank == "AI"))//Bold head jobs + if((rank in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND) ) || (rank == "AI"))//Bold head jobs . += "[rank]" else . += "[rank]" diff --git a/code/modules/events/event_dynamic.dm b/code/modules/events/event_dynamic.dm index 260e690924..c1b4472021 100644 --- a/code/modules/events/event_dynamic.dm +++ b/code/modules/events/event_dynamic.dm @@ -206,16 +206,16 @@ var/list/event_last_fired = list() else if(istype(R.module, /obj/item/weapon/robot_module/robot/research)) active_with_role["Scientist"]++ - if(M.mind.assigned_role in engineering_positions) + if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING)) active_with_role["Engineer"]++ - if(M.mind.assigned_role in medical_positions) + if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL)) active_with_role["Medical"]++ - if(M.mind.assigned_role in security_positions) + if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY)) active_with_role["Security"]++ - if(M.mind.assigned_role in science_positions) + if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH)) active_with_role["Scientist"]++ if(M.mind.assigned_role == "AI") diff --git a/code/modules/gamemaster/actions/atmos_leak.dm b/code/modules/gamemaster/actions/atmos_leak.dm index 34772bf1a8..e40ed48c37 100644 --- a/code/modules/gamemaster/actions/atmos_leak.dm +++ b/code/modules/gamemaster/actions/atmos_leak.dm @@ -1,6 +1,6 @@ /datum/gm_action/atmos_leak name = "atmospherics leak" - departments = list(ROLE_ENGINEERING, ROLE_SYNTHETIC) + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SYNTHETIC) var/area/target_area // Chosen target area var/area/target_turf // Chosen target turf in target_area var/gas_type // Chosen gas to release @@ -74,4 +74,4 @@ playsound(target_turf, 'sound/effects/smoke.ogg', 50, 1) /datum/gm_action/atmos_leak/get_weight() - return 15 + (metric.count_people_in_department(ROLE_ENGINEERING) * 10 + metric.count_people_in_department(ROLE_SYNTHETIC) * 30) // Synthetics are counted in higher value because they can wirelessly connect to alarms. + return 15 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 30) // Synthetics are counted in higher value because they can wirelessly connect to alarms. diff --git a/code/modules/gamemaster/actions/blob.dm b/code/modules/gamemaster/actions/blob.dm index 31a4518a69..dd9939a11d 100644 --- a/code/modules/gamemaster/actions/blob.dm +++ b/code/modules/gamemaster/actions/blob.dm @@ -1,6 +1,6 @@ /datum/gm_action/blob name = "blob infestation" - departments = list(ROLE_ENGINEERING, ROLE_SECURITY, ROLE_MEDICAL) + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL) chaotic = 25 var/list/area/excluded = list( @@ -62,9 +62,9 @@ command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg') /datum/gm_action/blob/get_weight() - var/engineers = metric.count_people_in_department(ROLE_ENGINEERING) - var/security = metric.count_people_in_department(ROLE_SECURITY) - var/medical = metric.count_people_in_department(ROLE_MEDICAL) + var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING) + var/security = metric.count_people_in_department(DEPARTMENT_SECURITY) + var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL) var/assigned_staff = engineers + security if(engineers || security) // Medical only counts if one of the other two exists, and even then they count as half. diff --git a/code/modules/gamemaster/actions/brand_intelligence.dm b/code/modules/gamemaster/actions/brand_intelligence.dm index 156e74f3fa..28ed6a9928 100644 --- a/code/modules/gamemaster/actions/brand_intelligence.dm +++ b/code/modules/gamemaster/actions/brand_intelligence.dm @@ -1,7 +1,7 @@ /datum/gm_action/brand_intelligence name = "rampant vending machines" length = 30 MINUTES - departments = list(ROLE_ENGINEERING, ROLE_EVERYONE) + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE) var/list/obj/machinery/vending/vendingMachines = list() var/list/obj/machinery/vending/infectedVendingMachines = list() @@ -66,4 +66,4 @@ infectedMachine.shoot_inventory = 0 /datum/gm_action/brand_intelligence/get_weight() - return 60 + (metric.count_people_in_department(ROLE_ENGINEERING) * 20) + return 60 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) diff --git a/code/modules/gamemaster/actions/camera_damage.dm b/code/modules/gamemaster/actions/camera_damage.dm index 583e57096b..10ccb510ce 100644 --- a/code/modules/gamemaster/actions/camera_damage.dm +++ b/code/modules/gamemaster/actions/camera_damage.dm @@ -1,7 +1,7 @@ /datum/gm_action/camera_damage name = "random camera damage" reusable = TRUE - departments = list(ROLE_SYNTHETIC, ROLE_ENGINEERING) + departments = list(DEPARTMENT_SYNTHETIC, DEPARTMENT_ENGINEERING) /datum/gm_action/camera_damage/start() var/obj/machinery/camera/C = acquire_random_camera() @@ -49,4 +49,4 @@ return T && C.can_use() && istype(C.loc, /turf) && (T.z in using_map.player_levels) /datum/gm_action/camera_damage/get_weight() - return 40 + (metric.count_people_in_department(ROLE_ENGINEERING) * 20) + (metric.count_people_in_department(ROLE_SYNTHETIC) * 40) + return 40 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 40) diff --git a/code/modules/gamemaster/actions/canister_leak.dm b/code/modules/gamemaster/actions/canister_leak.dm index a294f95736..670b65c9fc 100644 --- a/code/modules/gamemaster/actions/canister_leak.dm +++ b/code/modules/gamemaster/actions/canister_leak.dm @@ -4,11 +4,11 @@ /datum/gm_action/canister_leak name = "Canister Leak" - departments = list(ROLE_ENGINEERING) + departments = list(DEPARTMENT_ENGINEERING) chaotic = 20 /datum/gm_action/canister_leak/get_weight() - return metric.count_people_in_department(ROLE_ENGINEERING) * 30 + return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30 /datum/gm_action/canister_leak/start() ..() diff --git a/code/modules/gamemaster/actions/carp_migration.dm b/code/modules/gamemaster/actions/carp_migration.dm index eabb2ce79a..137c2cccb9 100644 --- a/code/modules/gamemaster/actions/carp_migration.dm +++ b/code/modules/gamemaster/actions/carp_migration.dm @@ -1,14 +1,14 @@ //carp_migration /datum/gm_action/carp_migration name = "carp migration" - departments = list(ROLE_SECURITY, ROLE_EVERYONE) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE) chaotic = 50 var/list/spawned_carp = list() var/carp_amount = 0 length = 20 MINUTES /datum/gm_action/carp_migration/get_weight() - return 50 + (metric.count_people_in_department(ROLE_SECURITY) * 10) + (metric.count_all_space_mobs() * 20) + return 50 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_all_space_mobs() * 20) /datum/gm_action/carp_migration/announce() var/announcement = "Unknown biological entities have been detected near [station_name()], please stand-by." @@ -17,12 +17,12 @@ /datum/gm_action/carp_migration/set_up() // Higher filled roles means more groups of fish. var/station_strength = 0 - station_strength += (metric.count_people_in_department(ROLE_SECURITY) * 3) - station_strength += (metric.count_people_in_department(ROLE_ENGINEERING) * 2) - station_strength += metric.count_people_in_department(ROLE_MEDICAL) + station_strength += (metric.count_people_in_department(DEPARTMENT_SECURITY) * 3) + station_strength += (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 2) + station_strength += metric.count_people_in_department(DEPARTMENT_MEDICAL) // Less active emergency response departments tones the event down. - var/activeness = ((metric.assess_department(ROLE_SECURITY) + metric.assess_department(ROLE_ENGINEERING) + metric.assess_department(ROLE_MEDICAL)) / 3) + var/activeness = ((metric.assess_department(DEPARTMENT_SECURITY) + metric.assess_department(DEPARTMENT_ENGINEERING) + metric.assess_department(DEPARTMENT_MEDICAL)) / 3) activeness = max(activeness, 20) carp_amount = CEILING(station_strength * (activeness / 100) + 1, 1) diff --git a/code/modules/gamemaster/actions/comms_blackout.dm b/code/modules/gamemaster/actions/comms_blackout.dm index a85ca8d73e..353a3bd92b 100644 --- a/code/modules/gamemaster/actions/comms_blackout.dm +++ b/code/modules/gamemaster/actions/comms_blackout.dm @@ -1,10 +1,10 @@ /datum/gm_action/comms_blackout name = "communications blackout" - departments = list(ROLE_ENGINEERING, ROLE_EVERYONE) + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE) chaotic = 35 /datum/gm_action/comms_blackout/get_weight() - return 50 + (metric.count_people_in_department(ROLE_ENGINEERING) * 40) + return 50 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 40) /datum/gm_action/comms_blackout/announce() if(prob(33)) diff --git a/code/modules/gamemaster/actions/drill_announcement.dm b/code/modules/gamemaster/actions/drill_announcement.dm index 978d5a4ffd..47f44e2caf 100644 --- a/code/modules/gamemaster/actions/drill_announcement.dm +++ b/code/modules/gamemaster/actions/drill_announcement.dm @@ -1,10 +1,10 @@ /datum/gm_action/security_drill name = "security drills" - departments = list(ROLE_SECURITY, ROLE_EVERYONE) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE) /datum/gm_action/security_drill/announce() spawn(rand(1 MINUTE, 2 MINUTES)) command_announcement.Announce("[pick("A NanoTrasen security director", "A Vir-Gov correspondant", "Local Sif authoritiy")] has advised the enactment of [pick("a rampant wildlife", "a fire", "a hostile boarding", "a nonstandard", "a bomb", "an emergent intelligence")] drill with the personnel onboard \the [station_name()].", "Security Advisement") /datum/gm_action/security_drill/get_weight() - return max(-20, 10 + gm.staleness - (gm.danger * 2)) + (metric.count_people_in_department(ROLE_SECURITY) * 5) + (metric.count_people_in_department(ROLE_EVERYONE) * 1.5) + return max(-20, 10 + gm.staleness - (gm.danger * 2)) + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 5) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1.5) diff --git a/code/modules/gamemaster/actions/dust.dm b/code/modules/gamemaster/actions/dust.dm index da08dc4f4c..49d0a33b95 100644 --- a/code/modules/gamemaster/actions/dust.dm +++ b/code/modules/gamemaster/actions/dust.dm @@ -1,6 +1,6 @@ /datum/gm_action/dust name = "dust" - departments = list(ROLE_ENGINEERING) + departments = list(DEPARTMENT_ENGINEERING) chaotic = 10 reusable = TRUE @@ -8,7 +8,7 @@ command_announcement.Announce("Debris resulting from activity on another nearby asteroid is approaching your colony.", "Dust Alert") /datum/gm_action/dust/get_weight() - var/engineers = metric.count_people_in_department(ROLE_ENGINEERING) + var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING) var/weight = 30 + (engineers * 25) return weight diff --git a/code/modules/gamemaster/actions/electrical_storm.dm b/code/modules/gamemaster/actions/electrical_storm.dm index 008a345a44..4cd4c39df6 100644 --- a/code/modules/gamemaster/actions/electrical_storm.dm +++ b/code/modules/gamemaster/actions/electrical_storm.dm @@ -1,6 +1,6 @@ /datum/gm_action/electrical_storm name = "electrical storm" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) reusable = TRUE var/lightsoutAmount = 1 var/lightsoutRange = 25 @@ -30,4 +30,4 @@ apc.overload_lighting() /datum/gm_action/electrical_storm/get_weight() - return 30 + (metric.count_people_in_department(ROLE_ENGINEERING) * 15) + (metric.count_people_in_department(ROLE_EVERYONE) * 5) + return 30 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 15) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) diff --git a/code/modules/gamemaster/actions/electrified_door.dm b/code/modules/gamemaster/actions/electrified_door.dm index e11c72f345..213c0c0292 100644 --- a/code/modules/gamemaster/actions/electrified_door.dm +++ b/code/modules/gamemaster/actions/electrified_door.dm @@ -1,6 +1,6 @@ /datum/gm_action/electrified_door name = "airlock short-circuit" - departments = list(ROLE_ENGINEERING, ROLE_MEDICAL) + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_MEDICAL) chaotic = 10 var/obj/machinery/door/airlock/chosen_door var/area/target_area @@ -72,4 +72,4 @@ chosen_door.update_icon() /datum/gm_action/electrified_door/get_weight() - return 10 + (metric.count_people_in_department(ROLE_ENGINEERING) * 5 + metric.count_people_in_department(ROLE_MEDICAL) * 10) + return 10 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 5 + metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10) diff --git a/code/modules/gamemaster/actions/gravity.dm b/code/modules/gamemaster/actions/gravity.dm index e895ca2cfa..a3907f1aa8 100644 --- a/code/modules/gamemaster/actions/gravity.dm +++ b/code/modules/gamemaster/actions/gravity.dm @@ -1,6 +1,6 @@ /datum/gm_action/gravity name = "gravity failure" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) length = 600 var/list/zLevels @@ -33,4 +33,4 @@ command_announcement.Announce("Gravity generators are again functioning within normal parameters. Sorry for any inconvenience.", "Gravity Restored") /datum/gm_action/gravity/get_weight() - return 30 + (metric.count_people_in_department(ROLE_EVERYONE) * 20) + return 30 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20) diff --git a/code/modules/gamemaster/actions/grid_check.dm b/code/modules/gamemaster/actions/grid_check.dm index dcf35a230f..ddd0cd923e 100644 --- a/code/modules/gamemaster/actions/grid_check.dm +++ b/code/modules/gamemaster/actions/grid_check.dm @@ -6,11 +6,11 @@ /datum/gm_action/grid_check name = "grid check" - departments = list(ROLE_ENGINEERING, ROLE_EVERYONE) + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE) chaotic = 20 /datum/gm_action/grid_check/get_weight() - return 50 + (metric.count_people_in_department(ROLE_ENGINEERING) * 30) + return 50 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30) /datum/gm_action/grid_check/start() ..() diff --git a/code/modules/gamemaster/actions/infestation.dm b/code/modules/gamemaster/actions/infestation.dm index 2c8ddac566..a887a3b5d3 100644 --- a/code/modules/gamemaster/actions/infestation.dm +++ b/code/modules/gamemaster/actions/infestation.dm @@ -14,7 +14,7 @@ /datum/gm_action/infestation name = "animal infestation" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) var/location var/locstring var/vermin @@ -100,7 +100,7 @@ command_announcement.Announce("Bioscans indicate that [vermstring] have been breeding in [locstring]. Clear them out, before this starts to affect productivity.", "Vermin infestation") /datum/gm_action/infestation/get_weight() - return 5 + (metric.count_people_in_department(ROLE_EVERYONE) * 20) + return 5 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20) #undef LOC_KITCHEN #undef LOC_ATMOS diff --git a/code/modules/gamemaster/actions/ion_storm.dm b/code/modules/gamemaster/actions/ion_storm.dm index 245f414f13..5ff51ccbaa 100644 --- a/code/modules/gamemaster/actions/ion_storm.dm +++ b/code/modules/gamemaster/actions/ion_storm.dm @@ -1,6 +1,6 @@ /datum/gm_action/ionstorm name = "ion storm" - departments = list(ROLE_SYNTHETIC) + departments = list(DEPARTMENT_SYNTHETIC) var/botEmagChance = 0.5 var/list/players = list() var/active = FALSE @@ -45,6 +45,6 @@ ion_storm_announcement() /datum/gm_action/ionstorm/get_weight() - var/bots = metric.count_people_in_department(ROLE_SYNTHETIC) + var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC) var/weight = 5 + (bots * 20) return weight diff --git a/code/modules/gamemaster/actions/manifest_malfunction.dm b/code/modules/gamemaster/actions/manifest_malfunction.dm index 0ef9067671..2b924a4157 100644 --- a/code/modules/gamemaster/actions/manifest_malfunction.dm +++ b/code/modules/gamemaster/actions/manifest_malfunction.dm @@ -1,7 +1,7 @@ /datum/gm_action/manifest_malfunction name = "manifest malfunction" enabled = TRUE - departments = list(ROLE_SECURITY, ROLE_SYNTHETIC, ROLE_EVERYONE) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_SYNTHETIC, DEPARTMENT_EVERYONE) chaotic = 3 reusable = FALSE length = 0 @@ -21,10 +21,10 @@ /datum/gm_action/manifest_malfunction/get_weight() . = -10 - var/security = metric.count_people_in_department(ROLE_SECURITY) + var/security = metric.count_people_in_department(DEPARTMENT_SECURITY) if(security && data_core) - . += (metric.count_people_in_department(ROLE_EVERYONE) * 5) - (metric.count_people_in_department(ROLE_SYNTHETIC) * 5) + . += (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) - (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5) return . diff --git a/code/modules/gamemaster/actions/meteor_defense.dm b/code/modules/gamemaster/actions/meteor_defense.dm index d0a0d40a3f..dc92413a82 100644 --- a/code/modules/gamemaster/actions/meteor_defense.dm +++ b/code/modules/gamemaster/actions/meteor_defense.dm @@ -2,7 +2,7 @@ /datum/gm_action/meteor_defense name = "meteor defense" - departments = list(ROLE_ENGINEERING, ROLE_CARGO) + departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_CARGO) chaotic = 50 var/direction = null var/dir_text = null @@ -11,9 +11,9 @@ var/meteor_types /datum/gm_action/meteor_defense/get_weight() - var/engineers = metric.count_people_in_department(ROLE_ENGINEERING) - var/cargo = metric.count_people_in_department(ROLE_CARGO) - var/bots = metric.count_people_in_department(ROLE_SYNTHETIC) + var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING) + var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO) + var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC) var/weight = (max(engineers - 1, 0) * 20) // If only one engineer exists, no meteors for now. if(engineers >= 2) diff --git a/code/modules/gamemaster/actions/money_hacker.dm b/code/modules/gamemaster/actions/money_hacker.dm index 69c3e906c7..2705de450c 100644 --- a/code/modules/gamemaster/actions/money_hacker.dm +++ b/code/modules/gamemaster/actions/money_hacker.dm @@ -2,7 +2,7 @@ /datum/gm_action/money_hacker name = "bank account hacker" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) reusable = TRUE var/datum/money_account/affected_account var/active diff --git a/code/modules/gamemaster/actions/money_lotto.dm b/code/modules/gamemaster/actions/money_lotto.dm index 1cb7f92e1e..ea82510e57 100644 --- a/code/modules/gamemaster/actions/money_lotto.dm +++ b/code/modules/gamemaster/actions/money_lotto.dm @@ -1,6 +1,6 @@ /datum/gm_action/money_lotto name = "lottery win" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) var/winner_name = "John Smith" var/winner_sum = 0 var/deposit_success = 0 @@ -36,4 +36,4 @@ news_network.SubmitArticle(body, author, channel, null, 1) /datum/gm_action/money_lotto/get_weight() - return 25 * metric.count_people_in_department(ROLE_EVERYONE) + return 25 * metric.count_people_in_department(DEPARTMENT_EVERYONE) diff --git a/code/modules/gamemaster/actions/money_spam.dm b/code/modules/gamemaster/actions/money_spam.dm index 0a6e71f023..80b5fed808 100644 --- a/code/modules/gamemaster/actions/money_spam.dm +++ b/code/modules/gamemaster/actions/money_spam.dm @@ -1,6 +1,6 @@ /datum/gm_action/pda_spam name = "PDA spam" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) reusable = TRUE var/last_spam_time = 0 var/obj/machinery/message_server/useMS @@ -128,4 +128,4 @@ to_chat(L, "[bicon(P)] Message from [sender] (Unknown / spam?), \"[message]\" (Unable to Reply)") /datum/gm_action/pda_spam/get_weight() - return 25 * metric.count_people_in_department(ROLE_EVERYONE) + return 25 * metric.count_people_in_department(DEPARTMENT_EVERYONE) diff --git a/code/modules/gamemaster/actions/planet_weather_change.dm b/code/modules/gamemaster/actions/planet_weather_change.dm index 27583a9a6a..641244bf0a 100644 --- a/code/modules/gamemaster/actions/planet_weather_change.dm +++ b/code/modules/gamemaster/actions/planet_weather_change.dm @@ -1,7 +1,7 @@ /datum/gm_action/planet_weather_shift name = "sudden weather shift" enabled = TRUE - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) reusable = TRUE var/datum/planet/target_planet diff --git a/code/modules/gamemaster/actions/prison_break.dm b/code/modules/gamemaster/actions/prison_break.dm index f3bc28bb13..0111ea0ecd 100644 --- a/code/modules/gamemaster/actions/prison_break.dm +++ b/code/modules/gamemaster/actions/prison_break.dm @@ -1,6 +1,6 @@ /datum/gm_action/prison_break name = "prison break" - departments = list(ROLE_SECURITY, ROLE_SYNTHETIC) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_SYNTHETIC) var/start_time = 0 var/active = FALSE // Are we doing stuff? @@ -14,7 +14,7 @@ /datum/gm_action/prison_break/get_weight() var/afflicted_staff = 0 - var/assigned_staff = metric.count_people_in_department(ROLE_ENGINEERING) + var/assigned_staff = metric.count_people_in_department(DEPARTMENT_ENGINEERING) for(var/department in departments) afflicted_staff += round(metric.count_people_in_department(department) / 2) @@ -27,14 +27,14 @@ /datum/gm_action/prison_break/virology name = "virology breakout" - departments = list(ROLE_MEDICAL, ROLE_SYNTHETIC) + departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_SYNTHETIC) eventDept = "Medical" areaName = list("Virology") areaType = list(/area/medical/virology, /area/medical/virologyaccess) /datum/gm_action/prison_break/xenobiology name = "xenobiology breakout" - departments = list(ROLE_RESEARCH, ROLE_SYNTHETIC) + departments = list(DEPARTMENT_RESEARCH, DEPARTMENT_SYNTHETIC) eventDept = "Science" areaName = list("Xenobiology") areaType = list(/area/rnd/xenobiology) @@ -42,7 +42,7 @@ /datum/gm_action/prison_break/station name = "station-wide breakout" - departments = list(ROLE_SECURITY, ROLE_MEDICAL, ROLE_RESEARCH, ROLE_SYNTHETIC) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL, DEPARTMENT_RESEARCH, DEPARTMENT_SYNTHETIC) eventDept = "Station" areaName = list("Brig","Virology","Xenobiology") areaType = list(/area/security/prison, /area/security/brig, /area/medical/virology, /area/medical/virologyaccess, /area/rnd/xenobiology) diff --git a/code/modules/gamemaster/actions/radiation_storm.dm b/code/modules/gamemaster/actions/radiation_storm.dm index 678ad16ab6..e6a31a6da8 100644 --- a/code/modules/gamemaster/actions/radiation_storm.dm +++ b/code/modules/gamemaster/actions/radiation_storm.dm @@ -1,6 +1,6 @@ /datum/gm_action/radiation_storm name = "radiation storm" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) reusable = TRUE var/enterBelt = 30 @@ -64,4 +64,4 @@ revoke_maint_all_access() /datum/gm_action/radiation_storm/get_weight() - return 20 + (metric.count_people_in_department(ROLE_MEDICAL) * 10) + (metric.count_all_space_mobs() * 40) + (metric.count_people_in_department(ROLE_EVERYONE) * 20) + return 20 + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10) + (metric.count_all_space_mobs() * 40) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20) diff --git a/code/modules/gamemaster/actions/random_antagonist.dm b/code/modules/gamemaster/actions/random_antagonist.dm index b1cb7b01d8..bf1169bb73 100644 --- a/code/modules/gamemaster/actions/random_antagonist.dm +++ b/code/modules/gamemaster/actions/random_antagonist.dm @@ -1,7 +1,7 @@ // The random spawn proc on the antag datum will handle announcing the spawn and whatnot. /datum/gm_action/random_antag name = "random antagonist" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) chaotic = 30 reusable = TRUE @@ -19,5 +19,5 @@ /datum/gm_action/random_antag/get_weight() . = ..() if(gm) - var/weight = max(0, (metric.count_people_in_department(ROLE_SECURITY) * 20) + (metric.count_people_in_department(ROLE_EVERYONE) * 5) + gm.staleness) + var/weight = max(0, (metric.count_people_in_department(DEPARTMENT_SECURITY) * 20) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) + gm.staleness) return weight diff --git a/code/modules/gamemaster/actions/rogue_drones.dm b/code/modules/gamemaster/actions/rogue_drones.dm index 983aa87842..a1594fd370 100644 --- a/code/modules/gamemaster/actions/rogue_drones.dm +++ b/code/modules/gamemaster/actions/rogue_drones.dm @@ -1,6 +1,6 @@ /datum/gm_action/rogue_drone name = "rogue drones" - departments = list(ROLE_SECURITY) + departments = list(DEPARTMENT_SECURITY) chaotic = 60 length = 20 MINUTES var/list/drones_list = list() @@ -60,4 +60,4 @@ command_announcement.Announce("We're disappointed at the loss of the drones, but the survivors have been recovered.", "Rogue drone alert") /datum/gm_action/rogue_drone/get_weight() - return 20 + (metric.count_people_in_department(ROLE_SECURITY) * 10) + (metric.count_all_space_mobs() * 30) + return 20 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_all_space_mobs() * 30) diff --git a/code/modules/gamemaster/actions/security_advisement.dm b/code/modules/gamemaster/actions/security_advisement.dm index b5c8d82912..e98504df09 100644 --- a/code/modules/gamemaster/actions/security_advisement.dm +++ b/code/modules/gamemaster/actions/security_advisement.dm @@ -1,6 +1,6 @@ /datum/gm_action/security_screening name = "security screening" - departments = list(ROLE_SECURITY, ROLE_EVERYONE) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE) var/list/species_weights = list( SPECIES_SKRELL = 9, @@ -46,4 +46,4 @@ command_announcement.Announce("[pick("A nearby Navy vessel", "A Solar official", "A Vir-Gov official", "A NanoTrasen board director")] has requested the screening of [pick("every other", "every", "suspicious", "willing")] [pickweight(end_weights)] personnel onboard \the [station_name()].", "Security Advisement") /datum/gm_action/security_screening/get_weight() - return max(-20, 10 + round(gm.staleness * 1.5) - (gm.danger * 2)) + (metric.count_people_in_department(ROLE_SECURITY) * 10) + (metric.count_people_in_department(ROLE_EVERYONE) * 1.5) + return max(-20, 10 + round(gm.staleness * 1.5) - (gm.danger * 2)) + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1.5) diff --git a/code/modules/gamemaster/actions/shipping_error.dm b/code/modules/gamemaster/actions/shipping_error.dm index 33520f13a3..da9179cc96 100644 --- a/code/modules/gamemaster/actions/shipping_error.dm +++ b/code/modules/gamemaster/actions/shipping_error.dm @@ -1,10 +1,10 @@ /datum/gm_action/shipping_error name = "shipping error" - departments = list(ROLE_CARGO) + departments = list(DEPARTMENT_CARGO) reusable = TRUE /datum/gm_action/shipping_error/get_weight() - var/cargo = metric.count_people_in_department(ROLE_CARGO) + var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO) var/weight = (cargo * 40) return weight diff --git a/code/modules/gamemaster/actions/solar_storm.dm b/code/modules/gamemaster/actions/solar_storm.dm index 046b93639b..f468c024a9 100644 --- a/code/modules/gamemaster/actions/solar_storm.dm +++ b/code/modules/gamemaster/actions/solar_storm.dm @@ -35,7 +35,7 @@ radiate() /datum/gm_action/solar_storm/get_weight() - return 20 + (metric.count_people_in_department(ROLE_ENGINEERING) * 10) + (metric.count_all_space_mobs() * 30) + return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10) + (metric.count_all_space_mobs() * 30) /datum/gm_action/solar_storm/proc/radiate() // Note: Too complicated to be worth trying to use the radiation system for this. Its only in space anyway, so we make an exception in this case. diff --git a/code/modules/gamemaster/actions/spacevine.dm b/code/modules/gamemaster/actions/spacevine.dm index c9e5b4135e..759329dbbc 100644 --- a/code/modules/gamemaster/actions/spacevine.dm +++ b/code/modules/gamemaster/actions/spacevine.dm @@ -1,6 +1,6 @@ /datum/gm_action/spacevine name = "space-vine infestation" - departments = list(ROLE_ENGINEERING) + departments = list(DEPARTMENT_ENGINEERING) chaotic = 2 /datum/gm_action/spacevine/start() @@ -11,4 +11,4 @@ level_seven_announcement() /datum/gm_action/spacevine/get_weight() - return 20 + (metric.count_people_in_department(ROLE_ENGINEERING) * 20) + (metric.count_people_in_department(ROLE_EVERYONE) * 10) + return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 10) diff --git a/code/modules/gamemaster/actions/spider_infestation.dm b/code/modules/gamemaster/actions/spider_infestation.dm index c641c86167..4105a8e1d4 100644 --- a/code/modules/gamemaster/actions/spider_infestation.dm +++ b/code/modules/gamemaster/actions/spider_infestation.dm @@ -1,6 +1,6 @@ /datum/gm_action/spider_infestation name = "spider infestation" - departments = list(ROLE_SECURITY, ROLE_MEDICAL, ROLE_EVERYONE) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE) chaotic = 30 severity = 1 @@ -10,9 +10,9 @@ var/spawntype = /obj/effect/spider/spiderling /datum/gm_action/spider_infestation/set_up() - severity = pickweight(EVENT_LEVEL_MUNDANE = max(1,(12 - (3 * metric.count_people_in_department(ROLE_SECURITY)))), - EVENT_LEVEL_MODERATE = (7 + (2 * metric.count_people_in_department(ROLE_SECURITY))), - EVENT_LEVEL_MAJOR = (1 + (2 * metric.count_people_in_department(ROLE_SECURITY))) + severity = pickweight(EVENT_LEVEL_MUNDANE = max(1,(12 - (3 * metric.count_people_in_department(DEPARTMENT_SECURITY)))), + EVENT_LEVEL_MODERATE = (7 + (2 * metric.count_people_in_department(DEPARTMENT_SECURITY))), + EVENT_LEVEL_MAJOR = (1 + (2 * metric.count_people_in_department(DEPARTMENT_SECURITY))) ) switch(severity) @@ -47,9 +47,9 @@ spawncount-- /datum/gm_action/spider_infestation/get_weight() - var/security = metric.count_people_in_department(ROLE_SECURITY) - var/medical = metric.count_people_in_department(ROLE_MEDICAL) - var/engineering = metric.count_people_in_department(ROLE_ENGINEERING) + var/security = metric.count_people_in_department(DEPARTMENT_SECURITY) + var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL) + var/engineering = metric.count_people_in_department(DEPARTMENT_ENGINEERING) var/assigned_staff = security + round(medical / 2) + round(engineering / 2) diff --git a/code/modules/gamemaster/actions/spontaneous_appendicitis.dm b/code/modules/gamemaster/actions/spontaneous_appendicitis.dm index 1758709164..ef7efde26b 100644 --- a/code/modules/gamemaster/actions/spontaneous_appendicitis.dm +++ b/code/modules/gamemaster/actions/spontaneous_appendicitis.dm @@ -1,6 +1,6 @@ /datum/gm_action/spontaneous_appendicitis name = "appendicitis" - departments = list(ROLE_MEDICAL, ROLE_EVERYONE) + departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE) chaotic = 1 /datum/gm_action/spontaneous_appendicitis/start() @@ -10,4 +10,4 @@ break /datum/gm_action/spontaneous_appendicitis/get_weight() - return max(0, -5 + (metric.count_people_in_department(ROLE_MEDICAL) * 10)) + return max(0, -5 + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10)) diff --git a/code/modules/gamemaster/actions/station_fundraise.dm b/code/modules/gamemaster/actions/station_fundraise.dm index 2a516d178a..96d4299053 100644 --- a/code/modules/gamemaster/actions/station_fundraise.dm +++ b/code/modules/gamemaster/actions/station_fundraise.dm @@ -1,6 +1,6 @@ /datum/gm_action/station_fund_raise name = "local funding drive" - departments = list(ROLE_SECURITY, ROLE_CARGO, ROLE_EVERYONE) + departments = list(DEPARTMENT_SECURITY, DEPARTMENT_CARGO, DEPARTMENT_EVERYONE) /datum/gm_action/station_fund_raise/announce() spawn(rand(1 MINUTE, 2 MINUTES)) @@ -11,4 +11,4 @@ if(station_account.money <= 80000) weight_modifier = 1 - return (max(-20, 10 + gm.staleness) + ((metric.count_people_in_department(ROLE_SECURITY) + (metric.count_people_in_department(ROLE_CARGO))) * 5) + (metric.count_people_in_department(ROLE_EVERYONE) * 3)) * weight_modifier + return (max(-20, 10 + gm.staleness) + ((metric.count_people_in_department(DEPARTMENT_SECURITY) + (metric.count_people_in_department(DEPARTMENT_CARGO))) * 5) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 3)) * weight_modifier diff --git a/code/modules/gamemaster/actions/stowaway.dm b/code/modules/gamemaster/actions/stowaway.dm index c75df494e2..b7185e1ed4 100644 --- a/code/modules/gamemaster/actions/stowaway.dm +++ b/code/modules/gamemaster/actions/stowaway.dm @@ -1,6 +1,6 @@ /datum/gm_action/stowaway name = "stowaway pod" - departments = list(ROLE_EVERYONE, ROLE_SECURITY) + departments = list(DEPARTMENT_EVERYONE, DEPARTMENT_SECURITY) chaotic = 10 observers_used = TRUE var/area/target_area // Chosen target area @@ -72,7 +72,7 @@ say_dead_object("A [HP.occupant_type] pod is now available in \the [target_area].", HP) /datum/gm_action/stowaway/get_weight() - return -20 + (metric.count_people_in_department(ROLE_SECURITY) * 15 + metric.count_people_in_department(ROLE_SYNTHETIC) * 5 + metric.count_people_in_department(ROLE_EVERYONE) * 1) + return -20 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 15 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5 + metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1) /datum/gm_action/stowaway/announce() spawn(rand(15 MINUTES, 30 MINUTES)) diff --git a/code/modules/gamemaster/actions/supply_conversion.dm b/code/modules/gamemaster/actions/supply_conversion.dm index 40ed820462..dacd548dae 100644 --- a/code/modules/gamemaster/actions/supply_conversion.dm +++ b/code/modules/gamemaster/actions/supply_conversion.dm @@ -1,7 +1,7 @@ /datum/gm_action/nanotrasen_budget_allocation name = "supply point to cargo budget" enabled = TRUE - departments = list(ROLE_CARGO) + departments = list(DEPARTMENT_CARGO) chaotic = 0 reusable = TRUE @@ -22,8 +22,8 @@ /datum/gm_action/nanotrasen_budget_allocation/get_weight() . = round(SC.points / 15) - var/cargo = metric.count_people_in_department(ROLE_CARGO) - var/personnel = metric.count_people_in_department(ROLE_EVERYONE) + var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO) + var/personnel = metric.count_people_in_department(DEPARTMENT_EVERYONE) if(cargo) . = round(SC.points / (10 + personnel)) + cargo * 10 diff --git a/code/modules/gamemaster/actions/supplyrequest.dm b/code/modules/gamemaster/actions/supplyrequest.dm index ae2e597fcd..0ba9366542 100644 --- a/code/modules/gamemaster/actions/supplyrequest.dm +++ b/code/modules/gamemaster/actions/supplyrequest.dm @@ -1,11 +1,11 @@ /datum/gm_action/request name = "general request" - departments = list(ROLE_CARGO) + departments = list(DEPARTMENT_CARGO) /datum/gm_action/request/announce() spawn(rand(1 MINUTE, 2 MINUTES)) command_announcement.Announce("[pick("A nearby vessel", "A Solar contractor", "A Skrellian contractor", "A NanoTrasen board director")] has requested the delivery of [pick("one","two","three","several")] [pick("medical","engineering","research","civilian")] supply packages. The [station_name()] has been tasked with completing this request.", "Supply Request") /datum/gm_action/request/get_weight() - return max(15, 15 + round(gm.staleness / 2) - gm.danger) + (metric.count_people_in_department(ROLE_CARGO) * 10) + return max(15, 15 + round(gm.staleness / 2) - gm.danger) + (metric.count_people_in_department(DEPARTMENT_CARGO) * 10) diff --git a/code/modules/gamemaster/actions/surprise_carp_attack.dm b/code/modules/gamemaster/actions/surprise_carp_attack.dm index dce6121b61..eb7b61841c 100644 --- a/code/modules/gamemaster/actions/surprise_carp_attack.dm +++ b/code/modules/gamemaster/actions/surprise_carp_attack.dm @@ -2,7 +2,7 @@ /datum/gm_action/surprise_carp_attack name = "surprise carp attack" - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) reusable = TRUE chaotic = 10 var/mob/living/victim = null diff --git a/code/modules/gamemaster/actions/surprise_meteor.dm b/code/modules/gamemaster/actions/surprise_meteor.dm index 682a8287a6..9bdf894948 100644 --- a/code/modules/gamemaster/actions/surprise_meteor.dm +++ b/code/modules/gamemaster/actions/surprise_meteor.dm @@ -2,11 +2,11 @@ /datum/gm_action/surprise_meteors name = "surprise meteors" - departments = list(ROLE_ENGINEERING) + departments = list(DEPARTMENT_ENGINEERING) chaotic = 25 /datum/gm_action/surprise_meteors/get_weight() - var/engineers = metric.count_people_in_department(ROLE_ENGINEERING) + var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING) var/weight = (max(engineers - 1, 0) * 25) // If only one engineer exists, no meteors for now. return weight diff --git a/code/modules/gamemaster/actions/swarmboarder.dm b/code/modules/gamemaster/actions/swarmboarder.dm index 8a257b9d4b..fb98dc535e 100644 --- a/code/modules/gamemaster/actions/swarmboarder.dm +++ b/code/modules/gamemaster/actions/swarmboarder.dm @@ -1,6 +1,6 @@ /datum/gm_action/swarm_boarder name = "swarmer shell" - departments = list(ROLE_EVERYONE, ROLE_SECURITY, ROLE_ENGINEERING) + departments = list(DEPARTMENT_EVERYONE, DEPARTMENT_SECURITY, DEPARTMENT_ENGINEERING) chaotic = 60 observers_used = TRUE var/area/target_area // Chosen target area @@ -67,7 +67,7 @@ new swarmertype(target_turf) /datum/gm_action/swarm_boarder/get_weight() - return max(0, -60 + (metric.count_people_in_department(ROLE_SECURITY) * 10 + metric.count_people_in_department(ROLE_SYNTHETIC) * 5)) + return max(0, -60 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5)) /datum/gm_action/swarm_boarder/announce() spawn(rand(5 MINUTES, 15 MINUTES)) diff --git a/code/modules/gamemaster/actions/viral_infection.dm b/code/modules/gamemaster/actions/viral_infection.dm index 9b42e2df46..97a646e2a3 100644 --- a/code/modules/gamemaster/actions/viral_infection.dm +++ b/code/modules/gamemaster/actions/viral_infection.dm @@ -2,7 +2,7 @@ /datum/gm_action/viral_infection name = "viral infection" - departments = list(ROLE_MEDICAL) + departments = list(DEPARTMENT_MEDICAL) chaotic = 5 var/list/viruses = list() severity = 1 @@ -80,4 +80,4 @@ message_admins("Virus event affecting [english_list(used_candidates_links)] started; Viruses: [english_list(used_viruses_links)]") /datum/gm_action/viral_infection/get_weight() - return (metric.count_people_in_department(ROLE_MEDICAL) * 20) + return (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 20) diff --git a/code/modules/gamemaster/actions/viral_outbreak.dm b/code/modules/gamemaster/actions/viral_outbreak.dm index f0eb27b41a..352627bd24 100644 --- a/code/modules/gamemaster/actions/viral_outbreak.dm +++ b/code/modules/gamemaster/actions/viral_outbreak.dm @@ -1,6 +1,6 @@ /datum/gm_action/viral_outbreak name = "viral outbreak" - departments = list(ROLE_MEDICAL, ROLE_EVERYONE) + departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE) chaotic = 30 severity = 1 var/list/candidates = list() @@ -29,9 +29,9 @@ severity-- /datum/gm_action/viral_outbreak/get_weight() - var/medical = metric.count_people_in_department(ROLE_MEDICAL) - var/security = metric.count_people_in_department(ROLE_SECURITY) - var/everyone = metric.count_people_in_department(ROLE_EVERYONE) + var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL) + var/security = metric.count_people_in_department(DEPARTMENT_SECURITY) + var/everyone = metric.count_people_in_department(DEPARTMENT_EVERYONE) var/assigned_staff = medical + round(security / 2) diff --git a/code/modules/gamemaster/actions/wallrot.dm b/code/modules/gamemaster/actions/wallrot.dm index e2c05aed74..deabfbe34a 100644 --- a/code/modules/gamemaster/actions/wallrot.dm +++ b/code/modules/gamemaster/actions/wallrot.dm @@ -1,6 +1,6 @@ /datum/gm_action/wallrot name = "wall rot" - departments = list(ROLE_ENGINEERING) + departments = list(DEPARTMENT_ENGINEERING) reusable = TRUE var/turf/simulated/wall/center severity = 1 @@ -40,4 +40,4 @@ break /datum/gm_action/wallrot/get_weight() - return 60 + (metric.count_people_in_department(ROLE_ENGINEERING) * 35) + return 60 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 35) diff --git a/code/modules/gamemaster/actions/waste_disposal.dm b/code/modules/gamemaster/actions/waste_disposal.dm index e7ba856e78..e8412d7e95 100644 --- a/code/modules/gamemaster/actions/waste_disposal.dm +++ b/code/modules/gamemaster/actions/waste_disposal.dm @@ -2,8 +2,8 @@ /datum/gm_action/waste_disposal name = "waste disposal" - departments = list(ROLE_CARGO) + departments = list(DEPARTMENT_CARGO) chaotic = 0 /datum/gm_action/waste_disposal/get_weight() - return metric.count_people_in_department(ROLE_CARGO) * 50 \ No newline at end of file + return metric.count_people_in_department(DEPARTMENT_CARGO) * 50 \ No newline at end of file diff --git a/code/modules/gamemaster/actions/window_break.dm b/code/modules/gamemaster/actions/window_break.dm index 3cb16cba58..c409388c23 100644 --- a/code/modules/gamemaster/actions/window_break.dm +++ b/code/modules/gamemaster/actions/window_break.dm @@ -1,6 +1,6 @@ /datum/gm_action/window_break name = "window breach" - departments = list(ROLE_ENGINEERING) + departments = list(DEPARTMENT_ENGINEERING) chaotic = 5 var/obj/structure/window/chosen_window var/list/obj/structure/window/collateral_windows @@ -75,4 +75,4 @@ command_announcement.Announce("Structural integrity of windows at [chosen_location.loc.name] is failing. Immediate repair or replacement is advised.", "Structural Alert") /datum/gm_action/window_break/get_weight() - return 20 * metric.count_people_in_department(ROLE_ENGINEERING) + return 20 * metric.count_people_in_department(DEPARTMENT_ENGINEERING) diff --git a/code/modules/gamemaster/actions/wormholes.dm b/code/modules/gamemaster/actions/wormholes.dm index f2a90f5539..a7650713b3 100644 --- a/code/modules/gamemaster/actions/wormholes.dm +++ b/code/modules/gamemaster/actions/wormholes.dm @@ -2,7 +2,7 @@ name = "space-time anomalies" chaotic = 70 length = 12 MINUTES - departments = list(ROLE_EVERYONE) + departments = list(DEPARTMENT_EVERYONE) severity = 1 /datum/gm_action/wormholes/set_up() // 1 out of 5 will be full-duration wormholes, meaning up to a minute long. @@ -17,7 +17,7 @@ wormhole_event(length / 2, (severity / 3)) /datum/gm_action/wormholes/get_weight() - return 10 + max(0, -30 + (metric.count_people_in_department(ROLE_EVERYONE) * 5) + (metric.count_people_in_department(ROLE_ENGINEERING) + 10) + (metric.count_people_in_department(ROLE_MEDICAL) * 20)) + return 10 + max(0, -30 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) + 10) + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 20)) /datum/gm_action/wormholes/end() command_announcement.Announce("There are no more space-time anomalies detected on the station.", "Anomaly Alert") diff --git a/code/modules/gamemaster/game_master.dm b/code/modules/gamemaster/game_master.dm index 8814fb362e..7220cb11a9 100644 --- a/code/modules/gamemaster/game_master.dm +++ b/code/modules/gamemaster/game_master.dm @@ -138,7 +138,7 @@ for(var/datum/gm_action/action in available_actions) if(!action.enabled) continue - if(ROLE_EVERYONE in action.departments) + if(DEPARTMENT_EVERYONE in action.departments) best_actions.Add(action) log_debug("[action.name] is being considered because it involves everyone.") diff --git a/code/modules/metric/department.dm b/code/modules/metric/department.dm index b6996d229c..acb58101f1 100644 --- a/code/modules/metric/department.dm +++ b/code/modules/metric/department.dm @@ -2,7 +2,7 @@ // This proc tries to find the department of an arbitrary mob. /datum/metric/proc/guess_department(var/mob/M) var/list/found_roles = list() - . = ROLE_UNKNOWN + . = DEPARTMENT_UNKNOWN // Records are usually the most reliable way to get what job someone is. var/datum/data/record/R = find_general_record("name", M.real_name) @@ -10,7 +10,7 @@ var/recorded_rank = R.fields["real_rank"] found_roles = role_name_to_department(recorded_rank) . = found_roles[1] - if(. != ROLE_UNKNOWN) // We found the correct department, so we can stop now. + if(. != DEPARTMENT_UNKNOWN) // We found the correct department, so we can stop now. return // They have a custom title, aren't crew, or someone deleted their record, so we need a fallback method. @@ -18,16 +18,16 @@ if(M.mind) found_roles = role_name_to_department(M.mind.assigned_role) . = found_roles[1] - if(. != ROLE_UNKNOWN) + if(. != DEPARTMENT_UNKNOWN) return // At this point, they don't have a mind, or for some reason assigned_role didn't work. found_roles = role_name_to_department(M.job) . = found_roles[1] - if(. != ROLE_UNKNOWN) + if(. != DEPARTMENT_UNKNOWN) return - return ROLE_UNKNOWN // Welp. + return DEPARTMENT_UNKNOWN // Welp. // Feed this proc the name of a job, and it will try to figure out what department they are apart of. // Note that this returns a list, as some jobs are in more than one department, like Command. The 'primary' department is the first @@ -35,32 +35,32 @@ /datum/metric/proc/role_name_to_department(var/role_name) var/list/result = list() - if(role_name in security_positions) - result += ROLE_SECURITY + if(SSjob.is_job_in_department(role_name, DEPARTMENT_SECURITY)) + result += DEPARTMENT_SECURITY - if(role_name in engineering_positions) - result += ROLE_ENGINEERING + if(SSjob.is_job_in_department(role_name, DEPARTMENT_ENGINEERING)) + result += DEPARTMENT_ENGINEERING - if(role_name in medical_positions) - result += ROLE_MEDICAL + if(SSjob.is_job_in_department(role_name, DEPARTMENT_MEDICAL)) + result += DEPARTMENT_MEDICAL - if(role_name in science_positions) - result += ROLE_RESEARCH + if(SSjob.is_job_in_department(role_name, DEPARTMENT_RESEARCH)) + result += DEPARTMENT_RESEARCH - if(role_name in cargo_positions) - result += ROLE_CARGO + if(SSjob.is_job_in_department(role_name, DEPARTMENT_CARGO)) + result += DEPARTMENT_CARGO - if(role_name in civilian_positions) - result += ROLE_CIVILIAN + if(SSjob.is_job_in_department(role_name, DEPARTMENT_CIVILIAN)) + result += DEPARTMENT_CIVILIAN - if(role_name in nonhuman_positions) - result += ROLE_SYNTHETIC + if(SSjob.is_job_in_department(role_name, DEPARTMENT_SYNTHETIC)) + result += DEPARTMENT_SYNTHETIC - if(role_name in command_positions) // We do Command last, since we consider command to only be a primary department for hop/admin. - result += ROLE_COMMAND + if(SSjob.is_job_in_department(role_name, DEPARTMENT_COMMAND)) // We do Command last, since we consider command to only be a primary department for hop/admin. + result += DEPARTMENT_COMMAND if(!result.len) // No department was found. - result += ROLE_UNKNOWN + result += DEPARTMENT_UNKNOWN return result /datum/metric/proc/count_people_in_department(var/department) diff --git a/code/modules/metric/metric.dm b/code/modules/metric/metric.dm index 44ff59d284..4a9b6bf847 100644 --- a/code/modules/metric/metric.dm +++ b/code/modules/metric/metric.dm @@ -3,13 +3,13 @@ /datum/metric var/list/departments = list( - ROLE_COMMAND, - ROLE_SECURITY, - ROLE_ENGINEERING, - ROLE_MEDICAL, - ROLE_RESEARCH, - ROLE_CARGO, - ROLE_CIVILIAN, - ROLE_SYNTHETIC + DEPARTMENT_COMMAND, + DEPARTMENT_SECURITY, + DEPARTMENT_ENGINEERING, + DEPARTMENT_MEDICAL, + DEPARTMENT_RESEARCH, + DEPARTMENT_CARGO, + DEPARTMENT_CIVILIAN, + DEPARTMENT_SYNTHETIC ) 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 5bcac7adf8..aa122c0abf 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -44,14 +44,16 @@ data["id_owner"] = id_card && id_card.registered_name ? id_card.registered_name : "-----" data["id_name"] = id_card ? id_card.name : "-----" - data["command_jobs"] = format_jobs(command_positions) - data["engineering_jobs"] = format_jobs(engineering_positions) - data["medical_jobs"] = format_jobs(medical_positions) - data["science_jobs"] = format_jobs(science_positions) - data["security_jobs"] = format_jobs(security_positions) - data["cargo_jobs"] = format_jobs(cargo_positions) - data["civilian_jobs"] = format_jobs(civilian_positions) - data["centcom_jobs"] = format_jobs(get_all_centcom_jobs()) + var/list/departments = list() + for(var/D in SSjob.get_all_department_datums()) + var/datum/department/dept = D + if(!dept.assignable) // No AI ID cards for you. + continue + if(dept.centcom_only && !is_centcom) + continue + departments[++departments.len] = list("department_name" = dept.name, "jobs" = format_jobs(SSjob.get_job_titles_in_department(dept.name)) ) + + data["departments"] = departments data["all_centcom_access"] = is_centcom ? get_accesses(1) : null data["regions"] = get_accesses() diff --git a/maps/southern_cross/southern_cross_jobs.dm b/maps/southern_cross/southern_cross_jobs.dm index 17c4513443..06c651819e 100644 --- a/maps/southern_cross/southern_cross_jobs.dm +++ b/maps/southern_cross/southern_cross_jobs.dm @@ -50,10 +50,15 @@ var/const/access_explorer = 43 return get_all_station_access() */ +/datum/department/planetside + name = DEPARTMENT_PLANET + color = "#555555" + sorting_order = 2 // Same as cargo in importance. + /datum/job/pilot title = "Pilot" flag = PILOT - department = "Civilian" + departments = list(DEPARTMENT_PLANET) department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -68,12 +73,12 @@ var/const/access_explorer = 43 /datum/job/explorer title = "Explorer" flag = EXPLORER - department = "Civilian" + departments = list(DEPARTMENT_PLANET) department_flag = CIVILIAN faction = "Station" total_positions = 4 spawn_positions = 4 - supervisors = "the explorer leader and the head of personnel" + supervisors = "the head of personnel" selection_color = "#515151" economic_modifier = 4 access = list(access_explorer) @@ -88,7 +93,7 @@ var/const/access_explorer = 43 /datum/job/sar title = "Search and Rescue" flag = SAR - department = "Medical" + departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_PLANET) department_flag = MEDSCI faction = "Station" total_positions = 2 diff --git a/nano/templates/identification_computer.tmpl b/nano/templates/identification_computer.tmpl index 7f4fbdda70..2a9029059f 100644 --- a/nano/templates/identification_computer.tmpl +++ b/nano/templates/identification_computer.tmpl @@ -57,39 +57,8 @@
- + {{if data.authenticated}} - - {{if data.has_modify}}

Details

@@ -137,38 +106,30 @@

Assignment

- +
- {{:data.target_rank}} -
-
-
Non-human Positions
Non-human Positions
+ {{for data.departments}} + + + + + {{/for}} - {{for data.jobs}} - {{if data.centcom_access || value.cat != "CentCom"}} - - - - - {{/if}} - {{/for}}
{{:value.department_name}} + {{for value.jobs :jobValue:jobIndex}} + {{:helper.link(jobValue.display_name, '', {'choice' : 'assign', 'assign_target' : jobValue.job}, data.id_rank == jobValue.job ? 'disabled' : null)}} + {{/for}} +
Special - {{:helper.link("Colony Director", '', {'choice' : 'assign', 'assign_target' : 'Colony Director'}, data.target_rank == 'Colony Director' ? 'disabled' : null)}} - {{:helper.link("Command Secretary", '', {'choice' : 'assign', 'assign_target' : 'Command Secretary'}, data.target_rank == 'Command Secretary' ? 'disabled' : null)}} - {{:helper.link("Internal Affairs Agent", '', {'choice' : 'assign', 'assign_target' : 'Internal Affairs Agent'}, data.target_rank == 'Internal Affairs Agent' ? 'disabled' : null)}} {{:helper.link("Custom", '', {'choice' : 'assign', 'assign_target' : 'Custom'})}}
{{:value.cat}} - {{for value.jobs :itemValue:itemIndex}} - {{:helper.link(itemValue.display_name, '', {'choice' : 'assign', 'assign_target' : itemValue.job}, data.target_rank == itemValue.job ? 'disabled' : null)}} - {{/for}} -
- + {{if data.centcom_access}}

Central Command

diff --git a/nano/templates/mod_identification_computer.tmpl b/nano/templates/mod_identification_computer.tmpl index 0dee1fdeac..cb1880cab3 100644 --- a/nano/templates/mod_identification_computer.tmpl +++ b/nano/templates/mod_identification_computer.tmpl @@ -1,59 +1,25 @@ -{{if data.have_id_slot}}{{:helper.link('Access Modification', 'home', {'action' : 'switchm', 'target' : 'mod'}, data.mmode ? 'disabled' : null)}}{{/if}} -{{:helper.link('Crew Manifest', 'folder-open', {'action' : 'switchm', 'target' : 'manifest'}, !data.mmode ? 'disabled' : null)}} -{{if data.have_printer}}{{:helper.link('Print', 'print', {'action' : 'print'}, (!data.mmode || data.has_id) ? null : 'disabled')}}{{/if}} - -{{if !data.mmode}} -
-

Crew Manifest

-
-
- {{:data.manifest}} -
-{{else}} -
-

Access Modification

-
- -{{if !data.has_id}} - Please insert the ID into the terminal to proceed.
+{{if data.have_id_slot}} + {{:helper.link('Access Modification', 'home', {'action' : 'switchm', 'target' : 'mod'}, data.mmode ? 'disabled' : null)}} {{/if}} -
-
- Target Identity: -
-
- {{:helper.link(data.id_name, 'eject', {'action' : 'eject'})}} -
-
-
+{{:helper.link('Crew Manifest', 'folder-open', {'action' : 'switchm', 'target' : 'manifest'}, !data.mmode ? 'disabled' : null)}} -{{if data.authenticated}} - {{if data.has_id}} -
-

Details

-
+{{if data.have_printer}} + {{:helper.link('Print', 'print', {'action' : 'print'}, (!data.mmode || data.has_id) ? null : 'disabled')}} +{{/if}} +{{if !data.mmode}}
-
- Registered Name: -
-
- {{:helper.link(data.id_owner, 'pencil', {'action' : 'edit', 'name' : 1})}} -
-
- -
-
- Account Number: -
-
- {{:helper.link(data.id_account_number, 'pencil', {'action' : 'edit', 'account' : 1})}} -
+

Crew Manifest

-
+ {{:data.manifest}} +
+ +{{else}} +
+<<<<<<< HEAD
Dismissals: @@ -62,132 +28,126 @@ {{:helper.link('Dismiss ' + data.id_owner, 'gear', {'action' : 'terminate'}, data.id_rank == "Dismissed" ? 'disabled' : null, data.id_rank == "Dismissed" ? 'disabled' : 'linkDanger')}}
+======= +

Access Modification

+>>>>>>> 24fbd0b... Half-Refactors Jobs (#6762)
-
-

Assignment

-
- {{:helper.link(data.assignments ? "Hide assignments" : "Show assignments", 'gear', {'action' : 'togglea'})}} -
- - - -
-
- {{if data.assignments}} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{if data.centcom_access}} - - - - - {{/if}} -
Command
Special - {{:helper.link("Captain", '', {'action' : 'assign', 'assign_target' : 'Captain'}, data.id_rank == 'Captain' ? 'disabled' : null)}} - {{:helper.link("Custom", '', {'action' : 'assign', 'assign_target' : 'Custom'})}} -
Engineering - {{for data.engineering_jobs}} - {{:helper.link(value.display_name, '', {'action' : 'assign', 'assign_target' : value.job}, data.id_rank == value.job ? 'disabled' : null)}} - {{/for}} -
Medical - {{for data.medical_jobs}} - {{:helper.link(value.display_name, '', {'action' : 'assign', 'assign_target' : value.job}, data.id_rank == value.job ? 'disabled' : null)}} - {{/for}} -
Science - {{for data.science_jobs}} - {{:helper.link(value.display_name, '', {'action' : 'assign', 'assign_target' : value.job}, data.id_rank == value.job ? 'disabled' : null)}} - {{/for}} -
Security - {{for data.security_jobs}} - {{:helper.link(value.display_name, '', {'action' : 'assign', 'assign_target' : value.job}, data.id_rank == value.job ? 'disabled' : null)}} - {{/for}} -
Cargo - {{for data.cargo_jobs}} - {{if index && index % 6 === 0}} -
- {{/if}} - {{:helper.link(value.display_name, '', {'action' : 'assign', 'assign_target' : value.job}, data.id_rank == value.job ? 'disabled' : null)}} - {{/for}} -
Civilian - {{for data.civilian_jobs}} - {{if index && index % 6 === 0}} -
- {{/if}} - {{:helper.link(value.display_name, '', {'action' : 'assign', 'assign_target' : value.job}, data.id_rank == value.job ? 'disabled' : null)}} - {{/for}} -
CentCom - {{for data.centcom_jobs}} - {{if index % 6 === 0}} -
- {{/if}} - - {{:helper.link(value.display_name, '', {'action' : 'assign', 'assign_target' : value.job}, data.id_rank == value.job ? 'disabled' : null)}} - {{/for}} -
-
- {{/if}} -
- - {{if data.centcom_access}} -
-

Central Command

-
-
- {{for data.all_centcom_access}} -
- {{:helper.link(value.desc, '', {'action' : 'access', 'access_target' : value.ref, 'allowed' : value.allowed}, null, value.allowed ? 'selected' : null)}} -
- {{/for}} -
- {{else}} -
-

{{:data.station_name}}

-
-
- {{for data.regions}} -
-
{{:value.name}}
- {{for value.accesses :accessValue:accessKey}} -
- {{:helper.link(accessValue.desc, '', {'action' : 'access', 'access_target' : accessValue.ref, 'allowed' : accessValue.allowed}, null, accessValue.allowed ? 'selected' : null)}} -
- {{/for}} -
- {{/for}} -
+ {{if !data.has_id}} + Please insert the ID into the terminal to proceed.
+ {{/if}} + +
+
+ Target Identity: +
+
+ {{:helper.link(data.id_name, 'eject', {'action' : 'eject'})}} +
+
+
+ + {{if data.authenticated}} + {{if data.has_id}} +
+

Details

+
+ +
+
+ Registered Name: +
+ +
+ {{:helper.link(data.id_owner, 'pencil', {'action' : 'edit', 'name' : 1})}} +
+
+ +
+
+ Account Number: +
+ +
+ {{:helper.link(data.id_account_number, 'pencil', {'action' : 'edit', 'account' : 1})}} +
+
+ +
+
+ Terminations: +
+ +
+ {{:helper.link('Terminate ' + data.id_owner, 'gear', {'action' : 'terminate'}, data.id_rank == "Terminated" ? 'disabled' : null, data.id_rank == "Terminated" ? 'disabled' : 'linkDanger')}} +
+
+ +
+

Assignment

+
+ + {{:helper.link(data.assignments ? "Hide assignments" : "Show assignments", 'gear', {'action' : 'togglea'})}} + +
+ + + +
+ +
+ {{if data.assignments}} +
+ + {{for data.departments}} + + + + + {{/for}} + + + + +
{{:value.department_name}} + {{for value.jobs :jobValue:jobIndex}} + {{:helper.link(jobValue.display_name, '', {'action' : 'assign', 'assign_target' : jobValue.job}, data.id_rank == jobValue.job ? 'disabled' : null)}} + {{/for}} +
Special + {{:helper.link("Custom", '', {'action' : 'assign', 'assign_target' : 'Custom'})}} +
+
+ {{/if}} +
+ + {{if data.centcom_access}} +
+

Central Command

+
+
+ {{for data.all_centcom_access}} +
+ {{:helper.link(value.desc, '', {'action' : 'access', 'access_target' : value.ref, 'allowed' : value.allowed}, null, value.allowed ? 'selected' : null)}} +
+ {{/for}} +
+ {{else}} +
+

{{:data.station_name}}

+
+
+ {{for data.regions}} +
+
{{:value.name}}
+ {{for value.accesses :accessValue:accessKey}} +
+ {{:helper.link(accessValue.desc, '', {'action' : 'access', 'access_target' : accessValue.ref, 'allowed' : accessValue.allowed}, null, accessValue.allowed ? 'selected' : null)}} +
+ {{/for}} +
+ {{/for}} +
+ {{/if}} + {{/if}} {{/if}} - {{/if}} {{/if}} -{{/if}} \ No newline at end of file diff --git a/vorestation.dme b/vorestation.dme index c725bd7fcc..74bbcb84eb 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -239,6 +239,7 @@ #include "code\controllers\subsystems\garbage.dm" #include "code\controllers\subsystems\holomaps.dm" #include "code\controllers\subsystems\inactivity.dm" +#include "code\controllers\subsystems\job.dm" #include "code\controllers\subsystems\lighting.dm" #include "code\controllers\subsystems\machines.dm" #include "code\controllers\subsystems\mapping_vr.dm" @@ -705,7 +706,11 @@ #include "code\game\jobs\job\captain_vr.dm" #include "code\game\jobs\job\civilian.dm" #include "code\game\jobs\job\civilian_chaplain.dm" +<<<<<<< HEAD:vorestation.dme #include "code\game\jobs\job\civilian_vr.dm" +======= +#include "code\game\jobs\job\department.dm" +>>>>>>> 24fbd0b... Half-Refactors Jobs (#6762):polaris.dme #include "code\game\jobs\job\engineering.dm" #include "code\game\jobs\job\engineering_vr.dm" #include "code\game\jobs\job\job.dm"