diff --git a/code/modules/client/preference_setup/occupation/occupation.dm b/code/modules/client/preference_setup/occupation/occupation.dm
index 61d0229ce59..a963a250b73 100644
--- a/code/modules/client/preference_setup/occupation/occupation.dm
+++ b/code/modules/client/preference_setup/occupation/occupation.dm
@@ -243,7 +243,6 @@
if(JOB_PRIORITY_HIGH)
pref.job_high = null
if(JOB_PRIORITY_MIDDLE)
- pref.job_medium |= pref.job_high
pref.job_high = switched_job.title
pref.job_medium -= switched_job.title
if(JOB_PRIORITY_LOW)
diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm
index 7a084e5a01b..e2882f8b350 100644
--- a/code/modules/mob/new_player/new_player.dm
+++ b/code/modules/mob/new_player/new_player.dm
@@ -42,6 +42,7 @@
output += "
"
+ dat += manifest_prediction()
+ var/datum/browser/popup = new(src, "Crew Manifest Prediction", "Crew Manifest Prediction", 370, 420, src)
+ popup.set_content(dat)
+ popup.open()
+
/mob/new_player/Move()
return 0
diff --git a/code/modules/modular_computers/file_system/manifest.dm b/code/modules/modular_computers/file_system/manifest.dm
index 4eaa7eed259..3afcb90426c 100644
--- a/code/modules/modular_computers/file_system/manifest.dm
+++ b/code/modules/modular_computers/file_system/manifest.dm
@@ -1,28 +1,23 @@
-// Generates a simple HTML crew manifest for use in various places
-/proc/html_crew_manifest(monochrome, OOC)
- var/list/dept_data = list(
- list("names" = list(), "header" = "Heads of Staff", "flag" = COM),
- list("names" = list(), "header" = "Command Support", "flag" = SPT),
- list("names" = list(), "header" = "Research", "flag" = SCI),
- list("names" = list(), "header" = "Security", "flag" = SEC),
- list("names" = list(), "header" = "Medical", "flag" = MED),
- list("names" = list(), "header" = "Engineering", "flag" = ENG),
- list("names" = list(), "header" = "Supply", "flag" = SUP),
- list("names" = list(), "header" = "Exploration", "flag" = EXP),
- list("names" = list(), "header" = "Service", "flag" = SRV),
- list("names" = list(), "header" = "Civilian", "flag" = CIV),
- list("names" = list(), "header" = "Miscellaneous", "flag" = MSC),
- list("names" = list(), "header" = "Silicon")
+GLOBAL_LIST_EMPTY(dept_data)
+
+/proc/manifest_data_initialization(monochrome = FALSE, OOC = FALSE, prediction = FALSE)
+ var/key = prediction ? "all_jobs_in_dept" : "names"
+
+ GLOB.dept_data = list(
+ list("[key]" = list(), "header" = "Heads of Staff", "flag" = COM),
+ list("[key]" = list(), "header" = "Command Support", "flag" = SPT),
+ list("[key]" = list(), "header" = "Research", "flag" = SCI),
+ list("[key]" = list(), "header" = "Security", "flag" = SEC),
+ list("[key]" = list(), "header" = "Medical", "flag" = MED),
+ list("[key]" = list(), "header" = "Engineering", "flag" = ENG),
+ list("[key]" = list(), "header" = "Supply", "flag" = SUP),
+ list("[key]" = list(), "header" = "Exploration", "flag" = EXP),
+ list("[key]" = list(), "header" = "Service", "flag" = SRV),
+ list("[key]" = list(), "header" = "Civilian", "flag" = CIV),
+ list("[key]" = list(), "header" = "Miscellaneous", "flag" = MSC),
+ list("[key]" = list(), "header" = "Silicon")
)
- var/list/misc //Special departments for easier access
- var/list/bot
- for(var/list/department in dept_data)
- if(department["flag"] == MSC)
- misc = department["names"]
- if(isnull(department["flag"]))
- bot = department["names"]
- var/list/isactive = new()
var/dat = {"
- Name | Position | Activity |
+ Name | Position | [prediction?"Chances":"Activity"] |
"}
+
+ return dat
+
+// Generates a simple HTML crew manifest for use in various places
+/proc/html_crew_manifest(monochrome, OOC)
+ var/dat = manifest_data_initialization(monochrome, OOC)
+ var/list/misc //Special departments for easier access
+ var/list/bot
+
+ for(var/list/department in GLOB.dept_data)
+ if(department["flag"] == MSC)
+ misc = department["names"]
+ if(isnull(department["flag"]))
+ bot = department["names"]
+
+ var/list/isactive = list()
+
// sort mobs
for(var/datum/computer_file/crew_record/CR in GLOB.all_crew_records)
var/name = CR.get_name()
@@ -51,7 +63,7 @@
isactive[name] = CR.get_status_physical()
var/found_place = FALSE
- for(var/list/department in dept_data)
+ for(var/list/department in GLOB.dept_data)
var/list/names = department["names"]
//if(CR.get_department() && (GLOB.text_to_department_flags[CR.get_department()] & department["flag"]))
if(department["flag"] in CR.assigned_deparment_flags)
@@ -71,9 +83,9 @@
bot[robot.name] = "[robot.modtype] [robot.braintype]"
- for(var/list/department in dept_data)
+ for(var/list/department in GLOB.dept_data)
var/list/names = department["names"]
- if(names.len > 0)
+ if(length(names))
dat += "[department["header"]] |
"
for(var/name in names)
dat += "[name] | [names[name]] | [isactive[name]] |
"
@@ -83,6 +95,127 @@
dat = replacetext(dat, "\t", "")
return dat
+/proc/manifest_prediction()
+ var/dat = manifest_data_initialization(monochrome = FALSE, OOC = TRUE, prediction = TRUE)
+ var/list/empty_command_positions = GLOB.command_positions.Copy()
+ var/list/command_positions_with_candidates = list()
+ var/list/command_candidates = list()
+
+ //searching for heads positions
+ for(var/mob/new_player/player in GLOB.player_list)
+ if(!player.ready || ("Assistant" in player.client.prefs.job_low))
+ continue
+
+ var/datum/preferences/player_prefs = player.client.prefs
+ var/player_name = player_prefs.real_name
+ for(var/command_position in GLOB.command_positions)
+ var/datum/job/job = job_master.GetJob(command_position)
+ for(var/priority = JOB_PRIORITY_HIGH to JOB_PRIORITY_LOW)
+ if(player_prefs.IsJobPriority(job, priority))
+ if(!command_positions_with_candidates[command_position])
+ command_positions_with_candidates[command_position] = list(
+ JOB_PRIORITY_HIGH = list(),
+ JOB_PRIORITY_MIDDLE = list(),
+ JOB_PRIORITY_LOW = list()
+ )
+ command_positions_with_candidates[command_position][priority] += list("[player_name]" = player.client.ckey)
+
+ //sorting head positions
+ var/list/command_positions_by_ckey = list()
+ for(var/CP in command_positions_with_candidates)
+ var/command_position = CP
+ var/list/candidates = command_positions_with_candidates[command_position]
+ for(var/priority = JOB_PRIORITY_HIGH to JOB_PRIORITY_LOW)
+ if(!(command_position in empty_command_positions))
+ break
+ for(var/candidate in candidates[priority])
+ empty_command_positions -= command_position
+ var/ckey = candidates[priority][candidate]
+ if(!command_positions_by_ckey[ckey])
+ command_positions_by_ckey[ckey] = list(
+ "positions" = list(
+ JOB_PRIORITY_HIGH = list(),
+ JOB_PRIORITY_MIDDLE = list(),
+ JOB_PRIORITY_LOW = list()
+ ),
+ "player_name" = "[candidate]"
+ )
+ command_positions_by_ckey[ckey]["positions"][priority] += command_position
+ command_candidates |= ckey
+
+ //inserting choosen heads in GLOB.dept_data
+ for(var/ckey in command_positions_by_ckey)
+ var/command_position
+ for(var/priority = JOB_PRIORITY_HIGH to JOB_PRIORITY_LOW)
+ if(length(command_positions_by_ckey[ckey]["positions"][priority]))
+ command_position = pick(command_positions_by_ckey[ckey]["positions"][priority])
+ break
+ var/player_name = command_positions_by_ckey[ckey]["player_name"]
+ for(var/list/department in GLOB.dept_data)
+ var/flag = job_master.occupations_by_title[command_position].department_flag
+ if(department["flag"]&flag)
+ department["all_jobs_in_dept"][command_position] += list("[player_name]" = command_position)
+ break
+
+ //searching for rest non-heads positions
+ for(var/mob/new_player/player in GLOB.player_list)
+ if(!player.ready || (player.client.ckey in command_candidates))
+ continue
+
+ var/datum/preferences/player_prefs = player.client.prefs
+ var/player_name = player_prefs.real_name
+ var/silicon = FALSE
+
+ var/list/preferenced_jobs
+ if("Assistant" in player_prefs.job_low)
+ preferenced_jobs = list(
+ list("Assistant")
+ )
+ else
+ preferenced_jobs = list(
+ player_prefs.job_high ? list(player_prefs.job_high) : list(),
+ player_prefs.job_medium,
+ player_prefs.job_low
+ )
+
+ //inserting non-head positions in GLOB.dept_data
+ for(var/list/J in preferenced_jobs)
+ var/list/jobs = J - GLOB.command_positions
+ if(!length(jobs))
+ continue
+
+ var/job = pick(jobs)
+
+ if(job in list("AI", "Cyborg"))
+ silicon = TRUE
+
+ for(var/list/department in GLOB.dept_data)
+ var/flag = job_master.occupations_by_title[job].department_flag
+
+ if(!silicon ? department["flag"]&flag : department["header"] == "Silicon")
+ department["all_jobs_in_dept"][job] += list(!silicon ? "[player_name]" : "\[Unknown\]" = player_prefs.player_alt_titles[job] ? player_prefs.player_alt_titles[job] : job)
+ break
+ break
+
+ //building manifest page
+ for(var/list/department in GLOB.dept_data)
+ var/list/all_jobs = department["all_jobs_in_dept"]
+ if(!length(all_jobs))
+ continue
+
+ dat += "[department["header"]] |
"
+ for(var/J in all_jobs)
+ var/list/job = all_jobs[J]
+ for(var/name in job)
+ var/job_slots = job_master.occupations_by_title[job[name]].spawn_positions
+ var/chance = job_slots == -1 ? 100 : clamp(job_slots/length(job)*100, 0, 100)
+ dat += "[name] | [job[name]] | [chance]% |
"
+
+ dat += "
"
+ dat = replacetext(dat, "\n", "") // so it can be placed on paper correctly
+ dat = replacetext(dat, "\t", "")
+ return dat
+
/proc/silicon_nano_crew_manifest(list/filter)
var/list/filtered_entries = list()