Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heads Count for Priority when Subordinate are Prioritized. #33550

Merged
merged 8 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions code/game/jobs/job_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,15 @@ var/global/datum/controller/occupations/job_master
if(job.priority)
job.priority = FALSE
priority_jobs_remaining++
if(!job.head_position)
DePrioritzeDeparmentHead(job)
else
if(priority_jobs_remaining < 1)
return 0
job.priority = TRUE
priority_jobs_remaining--
if(!job.head_position)
PrioritzeDeparmentHead(job)
if(user)
log_admin("[key_name(user)] has set the priority of the [rank] job to [job.priority].")
message_admins("[key_name_admin(user)] has set the priority of the [rank] job to [job.priority].")
Expand All @@ -153,6 +157,21 @@ var/global/datum/controller/occupations/job_master
return 1
return 0

/datum/controller/occupations/proc/PrioritzeDeparmentHead(var/datum/job/job)
if(job.department == "Civilian")
return
var/datum/job/head = locate(job.department_head) in job_master.occupations
head.department_prioritized = TRUE

/datum/controller/occupations/proc/DePrioritzeDeparmentHead(var/datum/job/job)
var/datum/job/head = locate(job.department_head) in job_master.occupations
var/list/remaining_prioritized_jobs = job_master.GetPrioritizedJobs()
for(var/datum/job/J in remaining_prioritized_jobs)
// If there is still a job from that department prioritized
if(J.department == job.department)
return
head.department_prioritized = FALSE

/datum/controller/occupations/proc/IsJobPrioritized(var/rank)
var/datum/job/job = GetJob(rank)
if(job)
Expand Down Expand Up @@ -497,6 +516,8 @@ var/global/datum/controller/occupations/job_master

if(job.priority)
to_chat(H, "<span class='notice'>You've been granted a little bonus for filling a high-priority job. Enjoy!</span>")
if(job.department_prioritized)
to_chat(H, "<span class='notice'>You've been granted a little bonus for because your department is prioritized. Enjoy!</span>")
return 1

/datum/controller/occupations/proc/LoadJobs(jobsfile) //ran during round setup, reads info from jobs.txt -- Urist
Expand Down
43 changes: 42 additions & 1 deletion code/modules/Economy/Job_Departments.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ var/list/station_departments = list("Command", "Medical", "Engineering", "Scienc
// Whether this is a head position
/datum/job/var/head_position = 0

// Whether the head of this department is prioritized, due to his subordinates being prioritized
/datum/job/var/department_prioritized

// Link to the department head
/datum/job/var/department_head

/datum/job/captain/department = "Command"
/datum/job/captain/head_position = 1

Expand Down Expand Up @@ -34,39 +40,74 @@ var/list/station_departments = list("Command", "Medical", "Engineering", "Scienc

/datum/job/qm/department = "Cargo"
/datum/job/qm/head_position = 1
/datum/job/qm/department_prioritized = FALSE

/datum/job/cargo_tech/department = "Cargo"
/datum/job/cargo_tech/department_head = /datum/job/qm

/datum/job/mining/department = "Cargo"
/datum/job/mining/department_head = /datum/job/qm

/datum/job/chief_engineer/department = "Engineering"
/datum/job/chief_engineer/head_position = 1
/datum/job/chief_engineer/department_prioritized = FALSE

/datum/job/engineer/department = "Engineering"
/datum/job/engineer/department_head = /datum/job/chief_engineer

/datum/job/atmos/department = "Engineering"
/datum/job/atmos/department_head = /datum/job/chief_engineer

/datum/job/mechanic/department = "Engineering"
/datum/job/mechanic/department_head = /datum/job/chief_engineer

/datum/job/cmo/department = "Medical"
/datum/job/cmo/head_position = 1
/datum/job/cmo/department_prioritized = FALSE

/datum/job/doctor/department = "Medical"
/datum/job/doctor/department_head = /datum/job/cmo

/datum/job/paramedic/department = "Medical"
/datum/job/paramedic/department_head = /datum/job/cmo

/datum/job/chemist/department = "Medical"
/datum/job/chemist/department_head = /datum/job/cmo

/datum/job/geneticist/department = "Medical"
/datum/job/geneticist/department_head = /datum/job/cmo

/datum/job/virologist/department = "Medical"
/datum/job/virologist/department_head = /datum/job/cmo

/datum/job/orderly/department = "Medical"
/datum/job/orderly/department_head = /datum/job/cmo

/datum/job/rd/department = "Science"
/datum/job/rd/head_position = 1
/datum/job/rd/department_prioritized = FALSE

/datum/job/scientist/department = "Science"
/datum/job/scientist/department_head = /datum/job/rd

/datum/job/roboticist/department = "Science"
/datum/job/roboticist/department_head = /datum/job/rd

/datum/job/xenobiologist/department = "Science"
/datum/job/xenobiologist/department_head = /datum/job/rd

/datum/job/xenoarchaeologist/department = "Science"
/datum/job/xenoarchaeologist/department_head = /datum/job/rd

/datum/job/hos/department = "Security"
/datum/job/hos/head_position = 1
/datum/job/hos/department_prioritized = FALSE

/datum/job/warden/department = "Security"
/datum/job/warden/department_head = /datum/job/hos

/datum/job/detective/department = "Security"
/datum/job/detective/department_head = /datum/job/hos

/datum/job/officer/department = "Security"
/datum/job/officer/department = "Security"
/datum/job/officer/department_head = /datum/job/hos
24 changes: 18 additions & 6 deletions code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
stat("[player.key]", (player.ready)?("(Playing)"):(null))
totalPlayers++
if(player.ready)
totalPlayersReady++
totalPlayersReady++
else
stat("Time To Start:", "LOADING...")

Expand Down Expand Up @@ -389,7 +389,10 @@

if(job && character.mind.assigned_role != "MODE")
job_master.PostJobSetup(character)
job.equip(character, job.priority) // Outfit datum.
if(job.department_prioritized) // If Department is Prioritized, equip them with priority equipment.
job.equip(character, TRUE)
else
job.equip(character, job.priority) // Outfit datum.

for(var/role in character.mind.antag_roles)
var/datum/role/R = character.mind.antag_roles[role]
Expand Down Expand Up @@ -507,6 +510,7 @@
.manifest tr.alt td {background-color: #DEF}
.manifest tr.striked td {background-color: #999}
.manifest tr.request td {background-color: #F99}
.manifest tr.requested_department td {background-color: #00FF00}
.manifest th.reqhead td {background-color: #844}
.manifest tr.reqalt td {background-color: #FCC}
</style></head><body><center>Round Duration: [round(hours)]h [round(mins)]m<br>"}
Expand Down Expand Up @@ -563,7 +567,11 @@
if((job.species_whitelist.len && !job.species_whitelist.Find(client.prefs.species)) || (job.species_blacklist.len && job.species_blacklist.Find(client.prefs.species)))
dat += "<tr class='striked'><td><s>[job.title]</s></td><td><s>[job.current_positions]</s></td><td><s>[highprior[job]]</s></td></tr>"
continue

if(job.department_prioritized)
to_chat(usr, "Activated")
to_chat(usr, job.title)
dat += "<tr class='requested_department'><td><a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title]</a></td><td>[job.current_positions]</td><td>[heads[job]]</td></tr>"
continue
dat += "<tr[color ? " class='alt'" : ""]><td><a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title]</a></td><td>[job.current_positions]</td><td>[heads[job]]</td></tr>"
color = !color

Expand Down Expand Up @@ -613,7 +621,11 @@
if((job.species_whitelist.len && !job.species_whitelist.Find(client.prefs.species)) || (job.species_blacklist.len && job.species_blacklist.Find(client.prefs.species)))
dat += "<tr class='striked'><td><s>[job.title]</s></td><td><s>[job.current_positions]</s></td><td><s>[highprior[job]]</s></td></tr>"
continue

if(job.department_prioritized)
to_chat(usr, "Activated")
to_chat(usr, job.title)
dat += "<tr class='requested_department'><td><a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title]</a></td><td>[job.current_positions]</td><td>[cgo[job]]</td></tr>"
continue
dat += "<tr[color ? " class='alt'" : ""]><td><a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title]</a></td><td>[job.current_positions]</td><td>[cgo[job]]</td></tr>"
color = !color

Expand Down Expand Up @@ -786,7 +798,7 @@
message_admins("WARNING! Couldn't find a spawn location for a [type]. They will spawn at the arrival shuttle.")

//Create the robot and move over prefs

if(type == "AI")
var/mob/living/silicon/new_character
new_character = AIize()
Expand All @@ -799,7 +811,7 @@
else
new_character = Robotize()
new_character.mmi.create_identity(prefs) //Uses prefs to create a brain mob

return new_character

/mob/new_player/proc/ViewPrediction()
Expand Down
2 changes: 1 addition & 1 deletion vgstation13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,7 @@
#include "maprendering\maprendering.dm"
#include "maps\_map.dm"
#include "maps\_map_override.dm"
#include "maps\line.dm"
#include "maps\tgstation.dm"
#include "maps\defficiency\areas.dm"
#include "maps\lampreystation\lamprey.dm"
#include "maps\packedstation\telecomms.dm"
Expand Down