From 9d60cd6df57894594eb18de6770c5dce2ff25c7e Mon Sep 17 00:00:00 2001 From: SandPoot <43283559+SandPoot@users.noreply.github.com> Date: Thu, 18 Mar 2021 14:12:00 -0300 Subject: [PATCH] Alternative job titles (#146) * upload files * more titles + fix hydro --- code/__HELPERS/game.dm | 7 +- code/controllers/subsystem/job.dm | 9 +- code/datums/datacore.dm | 4 + code/modules/client/preferences.dm | 33 ++++++- code/modules/jobs/job_types/_job.dm | 14 ++- .../modules/mob/dead/new_player/new_player.dm | 11 ++- .../modules/client/preferences_savefile.dm | 10 ++ .../code/modules/jobs/job_types/_job.dm | 2 + .../modules/jobs/job_types/_job_alt_titles.dm | 97 +++++++++++++++++++ tgstation.dme | 2 + 10 files changed, 179 insertions(+), 10 deletions(-) create mode 100644 modular_sand/code/modules/jobs/job_types/_job.dm create mode 100644 modular_sand/code/modules/jobs/job_types/_job_alt_titles.dm diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index b9f180ac4a..2b1e8dedbe 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -562,8 +562,13 @@ if((character.mind.assigned_role == "Cyborg") || (character.mind.assigned_role == character.mind.special_role)) return + //Skyrat changes + var/displayed_rank = rank + if(character.client && character.client.prefs && character.client.prefs.alt_titles_preferences[rank]) + displayed_rank = character.client.prefs.alt_titles_preferences[rank] var/obj/machinery/announcement_system/announcer = pick(GLOB.announcement_systems) - announcer.announce("ARRIVAL", character.real_name, rank, list()) //make the list empty to make it announce it in common + announcer.announce("ARRIVAL", character.real_name, displayed_rank, list()) //make the list empty to make it announce it in common + //End of skyrat changes /proc/lavaland_equipment_pressure_check(turf/T) . = FALSE diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index c090d7367c..fd48e4fcbb 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -470,9 +470,14 @@ SUBSYSTEM_DEF(job) else handle_auto_deadmin_roles(M.client, rank) */ - to_chat(M, "You are the [rank].") + //Skyrat changes + var/display_rank = rank + if(M.client && M.client.prefs && M.client.prefs.alt_titles_preferences[rank]) + display_rank = M.client.prefs.alt_titles_preferences[rank] + //End of skyrat changes + to_chat(M, "You are the [display_rank].") //Skyrat change if(job) - to_chat(M, "As the [rank] you answer directly to [job.supervisors]. Special circumstances may change this.") + to_chat(M, "As the [display_rank] you answer directly to [job.supervisors]. Special circumstances may change this.") //Skyrat change job.radio_help_message(M) if(job.req_admin_notify) to_chat(M, "You are playing a job that is important for Game Progression. If you have to disconnect immediately, please notify the admins via adminhelp. Otherwise put your locker gear back into the locker and cryo out.") diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 5aeb7626f6..0f97cd1394 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -246,6 +246,10 @@ assignment = H.job else assignment = "Unassigned" + //Skyrat changes + if(C && C.prefs && C.prefs.alt_titles_preferences[assignment]) + assignment = C.prefs.alt_titles_preferences[assignment] + //End of skyrat changes var/static/record_id_num = 1001 var/id = num2hex(record_id_num++,6) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index ce7b792f75..7f5b8701fc 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -116,6 +116,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/see_chat_emotes = TRUE var/enable_personal_chat_color = FALSE var/personal_chat_color = "#ffffff" + var/list/alt_titles_preferences = list() //SKYRAT CHANGES END var/underwear = "Nude" //underwear type var/undie_color = "FFFFFF" @@ -1211,6 +1212,11 @@ GLOBAL_LIST_EMPTY(preferences_datums) HTML += "" var/rank = job.title + //Skyrat changes + var/displayed_rank = rank + if(job.alt_titles.len && (rank in alt_titles_preferences)) + displayed_rank = alt_titles_preferences[rank] + //End of skyrat changes lastJob = job if(jobban_isbanned(user, rank)) HTML += "[rank] BANNED" @@ -1232,10 +1238,16 @@ GLOBAL_LIST_EMPTY(preferences_datums) if((job_preferences["[SSjob.overflow_role]"] == JP_LOW) && (rank != SSjob.overflow_role) && !jobban_isbanned(user, SSjob.overflow_role)) HTML += "[rank]" continue + //Skyrat changes + var/rank_title_line = "[displayed_rank]" if((rank in GLOB.command_positions) || (rank == "AI"))//Bold head jobs - HTML += "[rank]" + rank_title_line = "[rank_title_line]" + if(job.alt_titles.len) + rank_title_line = "[rank_title_line]" else - HTML += "[rank]" + rank_title_line = "[rank_title_line]" //Make it dark if we're not adding a button for alt titles + HTML += rank_title_line + //End of skyrat changes HTML += "" @@ -1481,6 +1493,23 @@ GLOBAL_LIST_EMPTY(preferences_datums) SetChoices(user) if("setJobLevel") UpdateJobPreference(user, href_list["text"], text2num(href_list["level"])) + //SKYRAT CHANGES + if("alt_title") + var/job_title = href_list["job_title"] + var/titles_list = list(job_title) + var/datum/job/J = SSjob.GetJob(job_title) + for(var/i in J.alt_titles) + titles_list += i + var/chosen_title + chosen_title = input(user, "Choose your job's title:", "Job Preference") as null|anything in titles_list + if(chosen_title) + if(chosen_title == job_title) + if(alt_titles_preferences[job_title]) + alt_titles_preferences.Remove(job_title) + else + alt_titles_preferences[job_title] = chosen_title + SetChoices(user) + //END OF SKYRAT CHANGES else SetChoices(user) return 1 diff --git a/code/modules/jobs/job_types/_job.dm b/code/modules/jobs/job_types/_job.dm index 855e2ccbd7..7b40034d8e 100644 --- a/code/modules/jobs/job_types/_job.dm +++ b/code/modules/jobs/job_types/_job.dm @@ -289,7 +289,12 @@ C.access = J.get_access() shuffle_inplace(C.access) // Shuffle access list to make NTNet passkeys less predictable C.registered_name = H.real_name - C.assignment = J.title + //Skyrat change + if(preference_source && preference_source.prefs && preference_source.prefs.alt_titles_preferences[J.title]) + C.assignment = preference_source.prefs.alt_titles_preferences[J.title] + else + C.assignment = J.title + //End of skyrat change C.update_label() for(var/A in SSeconomy.bank_accounts) var/datum/bank_account/B = A @@ -302,7 +307,12 @@ var/obj/item/pda/PDA = H.get_item_by_slot(pda_slot) if(istype(PDA)) PDA.owner = H.real_name - PDA.ownjob = J.title + //Skyrat change + if(preference_source && preference_source.prefs && preference_source.prefs.alt_titles_preferences[J.title]) + PDA.ownjob = preference_source.prefs.alt_titles_preferences[J.title] + else + PDA.ownjob = J.title + //End of skyrat change PDA.update_label() if(preference_source && !PDA.equipped) //PDA's screen color, font style and look depend on client preferences. PDA.update_style(preference_source) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index cd685af615..87bc2c6653 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -673,10 +673,15 @@ var/command_bold = "" if(job in GLOB.command_positions) command_bold = " command" + //SKYRAT CHANGES + var/jobline = "[job_datum.title] ([job_datum.current_positions])" if(job_datum in SSjob.prioritized_jobs) - dept_dat += "[job_datum.title] ([job_datum.current_positions])" - else - dept_dat += "[job_datum.title] ([job_datum.current_positions])" + jobline = "[jobline]" + if(client && client.prefs && client.prefs.alt_titles_preferences[job_datum.title]) + jobline = "[jobline]
(as [client.prefs.alt_titles_preferences[job_datum.title]])" + jobline = "[jobline]" + dept_dat += jobline + //END OF SKYRAT CHANGES if(!dept_dat.len) dept_dat += "No positions open." dat += jointext(dept_dat, "") diff --git a/modular_citadel/code/modules/client/preferences_savefile.dm b/modular_citadel/code/modules/client/preferences_savefile.dm index 7b304dd113..587703a2de 100644 --- a/modular_citadel/code/modules/client/preferences_savefile.dm +++ b/modular_citadel/code/modules/client/preferences_savefile.dm @@ -17,6 +17,15 @@ // SKYRAT CHANGE START S["enable_personal_chat_color"] >> enable_personal_chat_color S["personal_chat_color"] >> personal_chat_color + + S["alt_titles_preferences"] >> alt_titles_preferences + alt_titles_preferences = SANITIZE_LIST(alt_titles_preferences) + if(SSjob) + for(var/datum/job/job in sortList(SSjob.occupations, /proc/cmp_job_display_asc)) + if(alt_titles_preferences[job.title]) + if(!(alt_titles_preferences[job.title] in job.alt_titles)) + alt_titles_preferences.Remove(job.title) + skyrat_ooc_notes = sanitize_text(S["skyrat_ooc_notes"]) skyrat_ooc_notes = strip_html_simple(skyrat_ooc_notes, MAX_FLAVOR_LEN, TRUE) erppref = sanitize_text(S["erp_pref"], "Ask") @@ -70,3 +79,4 @@ WRITE_FILE(S["extremeharm"], extremeharm) WRITE_FILE(S["enable_personal_chat_color"], enable_personal_chat_color) WRITE_FILE(S["personal_chat_color"], personal_chat_color) + WRITE_FILE(S["alt_titles_preferences"], alt_titles_preferences) diff --git a/modular_sand/code/modules/jobs/job_types/_job.dm b/modular_sand/code/modules/jobs/job_types/_job.dm new file mode 100644 index 0000000000..cfb86b7072 --- /dev/null +++ b/modular_sand/code/modules/jobs/job_types/_job.dm @@ -0,0 +1,2 @@ +/datum/job + var/list/alt_titles = list() diff --git a/modular_sand/code/modules/jobs/job_types/_job_alt_titles.dm b/modular_sand/code/modules/jobs/job_types/_job_alt_titles.dm new file mode 100644 index 0000000000..a84e0d534d --- /dev/null +++ b/modular_sand/code/modules/jobs/job_types/_job_alt_titles.dm @@ -0,0 +1,97 @@ +//Command +/datum/job/captain + alt_titles = list("Colony Overseer") + +/datum/job/chief_engineer + alt_titles = list("Senior Engineer") + +/datum/job/hop + alt_titles = list("Crew Resource Officer", "Executive Officer") + +/datum/job/hos + alt_titles = list("Chief of Security", "Sheriff") + +/datum/job/qm + alt_titles = list("Resource Manager", "Logistics Supervisor") + +/datum/job/rd + alt_titles = list("Chief Science Officer", "Research Overseer") + +//Engineering +/datum/job/atmos + alt_titles = list("Firefighter", "Life Support Specialist") + +/datum/job/engineer + alt_titles = list("Maintenance Technician", "Engine Technician", "Electrician") + +//Service +/datum/job/assistant + alt_titles = list("Civilian", "Visitor", "Businessman", "Trader", "Entertainer", "Intern") + +/datum/job/bartender + alt_titles = list("Barista") + +/datum/job/chaplain + alt_titles = list("Priest", "Cult Leader", "Pope", "Bichop") + +/datum/job/clown //The most useless role in the game, delet this + alt_titles = list("Entertainer") + +/datum/job/cook + alt_titles = list("Culinary Artist", "Butcher", "Chef", "Nutritionist") + +/datum/job/curator + alt_titles = list("Journalist", "Librarian") + +/datum/job/hydro + alt_titles = list("Gardener", "Herbalist", "Botanical Researcher", "Florist") + +/datum/job/janitor + alt_titles = list("Custodian", "Sanitation Technician", "Maid") + +/datum/job/lawyer + alt_titles = list("Human Resources Agent", "Internal Affairs Agent") + +/datum/job/mime + alt_titles = list("Performer") + +//Science +/datum/job/roboticist + alt_titles = list("Biomechanical Engineer", "Mechatronic Engineer", "Mechanic", "Robotics Operator") + +/datum/job/scientist + alt_titles = list("Circuitry Designer", "Xenobiologist", "Xenobotanist", "Chemical Researcher") + +//Medical +/datum/job/chemist + alt_titles = list("Pharmacist", "Pharmacologist") + +/datum/job/doctor + alt_titles = list("Nurse", "Surgeon", "Medical Secretary") + +/datum/job/geneticist + alt_titles = list("Genetic Therapist") + +/datum/job/paramedic + alt_titles = list("Emergency Medical Technician") + +/datum/job/virologist + alt_titles = list("Pathologist") + +//Security +/datum/job/detective + alt_titles = list("Forensics Technician", "Private Investigator") + +/datum/job/officer + alt_titles = list("Security Cadet", "Security Guard", "Peacekeeper", "Enforcer") + +/datum/job/warden + alt_titles = list("Brig Chief") + +//Cargo + +/datum/job/cargo_tech + alt_titles = list("Shipping Specialist", "Delivery Manager") + +/datum/job/mining + alt_titles = list("Explorer") diff --git a/tgstation.dme b/tgstation.dme index c9bf3b3981..265eeed6f6 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3831,6 +3831,8 @@ #include "modular_sand\code\modules\integrated_electronics\subtypes\input.dm" #include "modular_sand\code\modules\integrated_electronics\subtypes\manipulation.dm" #include "modular_sand\code\modules\integrated_electronics\subtypes\output.dm" +#include "modular_sand\code\modules\jobs\job_types\_job.dm" +#include "modular_sand\code\modules\jobs\job_types\_job_alt_titles.dm" #include "modular_sand\code\modules\keybindings\keybind\carbon.dm" #include "modular_sand\code\modules\language\dragon.dm" #include "modular_sand\code\modules\language\language.dm"