Job assign at roundstart now favors empty positions first

This commit is contained in:
CitadelStationBot
2017-05-14 07:34:50 -05:00
parent 155f1d3ad0
commit 7b0532089f
+15 -5
View File
@@ -287,6 +287,8 @@ SUBSYSTEM_DEF(job)
if(PopcapReached())
RejectPlayer(player)
var/datum/job/validjob
// Loop through all jobs
for(var/datum/job/job in shuffledoccupations) // SHUFFLE ME BABY
if(!job)
@@ -308,16 +310,24 @@ SUBSYSTEM_DEF(job)
Debug("DO non-human failed, Player: [player], Job:[job.title]")
continue
// If the player wants that job on this level, then try give it to him.
if(player.client.prefs.GetJobDepartment(job, level) & job.flag)
// If the job isn't filled
if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1)
Debug("DO pass, Player: [player], Level:[level], Job:[job.title]")
AssignRole(player, job.title)
unassigned -= player
break
validjob = job
//Is the Job empty? Stop Looking Then!
if (!job.current_positions)
break
//Assign us the last job we found
if (validjob)
Debug("DO pass, Player: [player], Level:[level], Job:[validjob.title]")
AssignRole(player, validjob.title)
unassigned -= player
break
// Hand out random jobs to the people who didn't get any in the last check
// Also makes sure that they got their preference correct