From ccbd37c88200574e66e9c6d48287035e0eb1a074 Mon Sep 17 00:00:00 2001 From: Shadow-Quill <44811257+Shadow-Quill@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:11:26 -0600 Subject: [PATCH 1/2] Sorts the ready panel further --- modular_zubbers/code/modules/mob/dead/dead.dm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modular_zubbers/code/modules/mob/dead/dead.dm b/modular_zubbers/code/modules/mob/dead/dead.dm index 62b4f2d17be16..ba7ca55fa74bb 100644 --- a/modular_zubbers/code/modules/mob/dead/dead.dm +++ b/modular_zubbers/code/modules/mob/dead/dead.dm @@ -13,6 +13,7 @@ sortTim(players, GLOBAL_PROC_REF(cmp_text_asc)) + var/list/entry = list() //Assoc list for sorting - display name is the key, job value from crewmonitor is the value for(var/ckey in players) var/mob/dead/new_player/player = players[ckey] var/datum/preferences/prefs = player.client?.prefs @@ -37,15 +38,17 @@ else display = prefs.read_preference(/datum/preference/name/real_name) - var/title = J.title if(player.ready == PLAYER_READY_TO_PLAY && J.title != JOB_ASSISTANT||JOB_PRISONER) - if(J.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND | DEPARTMENT_BITFLAG_SILICON) - player_ready_data.Insert(1, "[display] as [title]") - else - player_ready_data += "* [display] as [title]" + entry[display] = list(GLOB.crewmonitor.jobs[J.title], J.title) + + entry = sort_list(entry, GLOBAL_PROC_REF(cmp_numeric_asc)) // Sort list by job ID. + + for(var/character_name in entry) + var/job_title = entry[character_name][2] + player_ready_data += "* [character_name] as [job_title]" if(length(player_ready_data)) - player_ready_data.Insert(1, "------------------") - player_ready_data.Insert(1, "Job Estimation:") player_ready_data.Insert(1, "") + player_ready_data.Insert(2, "Job Estimation:") + player_ready_data.Insert(3, "------------------") return player_ready_data From 5b484b6459578612fb0049f7679bb478773c4dd3 Mon Sep 17 00:00:00 2001 From: Shadow-Quill <44811257+Shadow-Quill@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:04:58 -0600 Subject: [PATCH 2/2] Further work! --- code/__HELPERS/cmp.dm | 3 +++ modular_zubbers/code/modules/mob/dead/dead.dm | 22 ++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/code/__HELPERS/cmp.dm b/code/__HELPERS/cmp.dm index 0210c44ee57ba..71c04b16ac2c1 100644 --- a/code/__HELPERS/cmp.dm +++ b/code/__HELPERS/cmp.dm @@ -147,6 +147,9 @@ /proc/cmp_pdajob_asc(datum/computer_file/program/messenger/A, datum/computer_file/program/messenger/B) return sorttext(B?.computer?.saved_job, A?.computer?.saved_job) +/proc/cmp_jobestimate_asc(list/A, list/B) // TODO: Move this to a modular file. + return B["estimate"] - A["estimate"] + /proc/cmp_num_string_asc(A, B) return text2num(A) - text2num(B) diff --git a/modular_zubbers/code/modules/mob/dead/dead.dm b/modular_zubbers/code/modules/mob/dead/dead.dm index ba7ca55fa74bb..e8d724ab5e579 100644 --- a/modular_zubbers/code/modules/mob/dead/dead.dm +++ b/modular_zubbers/code/modules/mob/dead/dead.dm @@ -13,7 +13,7 @@ sortTim(players, GLOBAL_PROC_REF(cmp_text_asc)) - var/list/entry = list() //Assoc list for sorting - display name is the key, job value from crewmonitor is the value + var/list/collected_players = list() //Assoc list for sorting - display name is the key, job value from crewmonitor is the value for(var/ckey in players) var/mob/dead/new_player/player = players[ckey] var/datum/preferences/prefs = player.client?.prefs @@ -39,13 +39,19 @@ display = prefs.read_preference(/datum/preference/name/real_name) if(player.ready == PLAYER_READY_TO_PLAY && J.title != JOB_ASSISTANT||JOB_PRISONER) - entry[display] = list(GLOB.crewmonitor.jobs[J.title], J.title) - - entry = sort_list(entry, GLOBAL_PROC_REF(cmp_numeric_asc)) // Sort list by job ID. - - for(var/character_name in entry) - var/job_title = entry[character_name][2] - player_ready_data += "* [character_name] as [job_title]" + var/list/entry + entry["character_name"] = display + entry["job_title"] = J.title + entry["job_title_id"] = GLOB.crewmonitor.jobs[J.title] + OUT << entry + collected_players[++collected_players.len] = entry + // TODO: This ^ isn't working, no entries are being added to it. Need to debug. + // TODO: Also need to see if I have to add exceptions for AI/Cyborg for sorting purposes. + + collected_players = sort_list(collected_players, GLOBAL_PROC_REF(cmp_jobestimate_asc)) // Sort list by job ID. + + for(var/entry in collected_players) + player_ready_data += "* [entry["character_name"]] as [entry["job_title"]]" if(length(player_ready_data)) player_ready_data.Insert(1, "")