diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm index b4be9385a0..c145648c99 100644 --- a/code/game/jobs/role_authority.dm +++ b/code/game/jobs/role_authority.dm @@ -246,40 +246,16 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou if(!length(roles_to_assign) || !length(unassigned_players)) return - //for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players)) - // var/wanted_jobs_by_name = shuffle(cycled_unassigned.client?.prefs?.get_jobs_by_priority(PRIME_PRIORITY)) - // Set up prime priority first rolls, probably put line 257 in a new function and then pass priority through manually - Morrow + log_debug("ASSIGNMENT: Starting prime priority assignments.") + for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players)) + assign_role_to_player_by_priority(cycled_unassigned, roles_to_assign, unassigned_players, PRIME_PRIORITY) + log_debug("ASSIGNMENT: Starting regular priority assignments.") for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players)) var/player_assigned_job = FALSE - log_debug("ASSIGNMENT: We have started assigning for [cycled_unassigned].") for(var/priority in HIGH_PRIORITY to LOW_PRIORITY) - var/wanted_jobs_by_name = shuffle(cycled_unassigned.client?.prefs?.get_jobs_by_priority(priority)) - log_debug("ASSIGNMENT: We have started cycled through priority [priority] for [cycled_unassigned].") - - for(var/job_name in wanted_jobs_by_name) - log_debug("ASSIGNMENT: We are cycling through wanted jobs and are at [job_name] for [cycled_unassigned].") - if(job_name in roles_to_assign) - log_debug("ASSIGNMENT: We have found [job_name] in roles to assign for [cycled_unassigned].") - var/datum/job/actual_job = roles_to_assign[job_name] - - if(assign_role(cycled_unassigned, actual_job)) - log_debug("ASSIGNMENT: We have assigned [job_name] to [cycled_unassigned].") - unassigned_players -= cycled_unassigned - - if(actual_job.spawn_positions != -1 && actual_job.current_positions >= actual_job.spawn_positions) - roles_to_assign -= job_name - log_debug("ASSIGNMENT: We have ran out of slots for [job_name] and it has been removed from roles to assign.") - - player_assigned_job = TRUE - break - - if(player_assigned_job) - log_debug("ASSIGNMENT: [cycled_unassigned] has been assigned a job and we are breaking.") - break - - log_debug("ASSIGNMENT: [cycled_unassigned] did not get a job at priority [priority], moving to next priority level.") + player_assigned_job = assign_role_to_player_by_priority(cycled_unassigned, roles_to_assign, unassigned_players, priority) if(!length(roles_to_assign)) log_debug("ASSIGNMENT: No more roles to assign, breaking.") @@ -326,10 +302,39 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou log_debug("ASSIGNMENT: [cycled_unassigned] has opted for return to lobby alternate option.") cycled_unassigned.ready = 0 - log_debug("ASSIGNMENT: Assigning complete. Players unassigned: [length(unassigned_players)] Jobs unassigned: [length(roles_to_assign)]") + log_debug("ASSIGNMENT: Assignment complete. Players unassigned: [length(unassigned_players)] Jobs unassigned: [length(roles_to_assign)]") return roles_to_assign +/datum/authority/branch/role/proc/assign_role_to_player_by_priority(mob/new_player/cycled_unassigned, list/roles_to_assign, list/unassigned_players, priority) + log_debug("ASSIGNMENT: We have started cycled through priority [priority] for [cycled_unassigned].") + var/wanted_jobs_by_name = shuffle(cycled_unassigned.client?.prefs?.get_jobs_by_priority(priority)) + var/player_assigned_job = FALSE + + for(var/job_name in wanted_jobs_by_name) + log_debug("ASSIGNMENT: We are cycling through wanted jobs and are at [job_name] for [cycled_unassigned].") + if(job_name in roles_to_assign) + log_debug("ASSIGNMENT: We have found [job_name] in roles to assign for [cycled_unassigned].") + var/datum/job/actual_job = roles_to_assign[job_name] + + if(assign_role(cycled_unassigned, actual_job)) + log_debug("ASSIGNMENT: We have assigned [job_name] to [cycled_unassigned].") + unassigned_players -= cycled_unassigned + + if(actual_job.spawn_positions != -1 && actual_job.current_positions >= actual_job.spawn_positions) + roles_to_assign -= job_name + log_debug("ASSIGNMENT: We have ran out of slots for [job_name] and it has been removed from roles to assign.") + + player_assigned_job = TRUE + break + + if(player_assigned_job) + log_debug("ASSIGNMENT: [cycled_unassigned] has been assigned a job.") + return player_assigned_job + + log_debug("ASSIGNMENT: [cycled_unassigned] did not get a job at priority [priority].") + return player_assigned_job + /** * Calculate role balance weight for one person joining as that role. This weight is used * when calculating the number of xenos both roundstart and burrowed larva they get for diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index c72e8a0885..262ae11219 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -648,7 +648,7 @@ var/const/MAX_SAVE_SLOTS = 10 //splitJobs - Allows you split the table by job. You can make different tables for each department by including their heads. Defaults to CE to make it look nice. //width - Screen' width. //height - Screen's height. -/datum/preferences/proc/SetChoices(mob/user, limit = 19, list/splitJobs = list(JOB_CHIEF_REQUISITION), width = 450, height = 450) +/datum/preferences/proc/SetChoices(mob/user, limit = 19, list/splitJobs = list(JOB_CHIEF_REQUISITION), width = 480, height = 450) if(!RoleAuthority) return @@ -680,7 +680,7 @@ var/const/MAX_SAVE_SLOTS = 10 HTML += "" index = 0 - HTML += "" @@ -731,7 +731,7 @@ var/const/MAX_SAVE_SLOTS = 10 b_color = "orange" priority_text = "LOW" - if(j == PRIME_PRIORITY && !host_bypass && (!job.prime_priority || !user.client?.player_data?.discord_link_id)) + if(j == PRIME_PRIORITY && !host_bypass && (!job.prime_priority || !user.client?.player_data?.discord_link_id || user.client?.get_total_human_playtime() < JOB_PLAYTIME_TIER_1)) continue HTML += "[priority_text]" diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 58a154e073..291a138c46 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -216,16 +216,17 @@ rotate_right.screen_loc = "preview:1:-16,0" /datum/preferences/proc/job_pref_to_gear_preset() - var/highest_priority + var/highest_priority_job + var/highest_priority = LOW_PRIORITY + for(var/job in job_preference_list) - if(job_preference_list[job] == HIGH_PRIORITY) - highest_priority = job + if(job_preference_list[job] == NEVER_PRIORITY) + continue - if(job_preference_list[job] == PRIME_PRIORITY) - highest_priority = job - break + if(job_preference_list[job] < highest_priority) + highest_priority_job = job - switch(highest_priority) + switch(highest_priority_job) if(JOB_SQUAD_MARINE) return /datum/equipment_preset/uscm/private_equipped if(JOB_SQUAD_ENGI)
" + HTML += "
" if(jobban_isbanned(user, job.title)) HTML += "[job.disp_title]BANNED