From 99326d630381b1fbad265c9822c6197e4a2f14ea Mon Sep 17 00:00:00 2001 From: JaySparrow Date: Fri, 7 Aug 2020 20:28:48 -0500 Subject: [PATCH] Alternate Job Titles fix Speak up announcer bot, please. --- code/datums/datacore.dm | 5 +++++ code/game/machinery/announcement_system.dm | 15 ++++++++------- code/modules/jobs/job_types/captain.dm | 8 ++++++-- code/modules/jobs/job_types/job.dm | 2 +- modular_citadel/code/game/machinery/cryopod.dm | 4 +++- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 44aed30a..c3cfda7c 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -202,6 +202,7 @@ var/static/list/show_directions = list(SOUTH, WEST) if(H.mind && (H.mind.assigned_role != H.mind.special_role)) var/assignment + var/displayed_rank if(H.mind.assigned_role) assignment = H.mind.assigned_role else if(H.job) @@ -210,6 +211,8 @@ assignment = "Unassigned" if(C && C.prefs && C.prefs.alt_titles_preferences[assignment]) assignment = C.prefs.alt_titles_preferences[assignment] + if(assignment) + displayed_rank = H.client.prefs.alt_titles_preferences[assignment] var/static/record_id_num = 1001 var/id = num2hex(record_id_num++,6) @@ -233,6 +236,7 @@ G.fields["id"] = id G.fields["name"] = H.real_name G.fields["rank"] = assignment + G.fields["job_title"] = displayed_rank G.fields["age"] = H.age G.fields["species"] = H.dna.species.name G.fields["fingerprint"] = md5(H.dna.uni_identity) @@ -275,6 +279,7 @@ L.fields["id"] = md5("[H.real_name][H.mind.assigned_role]") //surely this should just be id, like the others? L.fields["name"] = H.real_name L.fields["rank"] = H.mind.assigned_role + L.fields["job_title"] = displayed_rank L.fields["age"] = H.age L.fields["sex"] = H.gender L.fields["blood_type"] = H.dna.blood_type diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index 884b818f..47e8386a 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -17,9 +17,9 @@ GLOBAL_LIST_EMPTY(announcement_systems) circuit = /obj/item/circuitboard/machine/announcement_system var/obj/item/radio/headset/radio - var/arrival = "%PERSON has signed up as %RANK" + var/arrival = "%PERSON has signed up as %DISP_RANK (%RANK)" var/arrivalToggle = 1 - var/newhead = "%PERSON, %RANK, is the department head." + var/newhead = "%PERSON, %DISP_RANK (%RANK), is the department head." var/newheadToggle = 1 var/greenlight = "Light_Green" @@ -73,24 +73,25 @@ GLOBAL_LIST_EMPTY(announcement_systems) else return ..() -/obj/machinery/announcement_system/proc/CompileText(str, user, rank) //replaces user-given variables with actual thingies. +/obj/machinery/announcement_system/proc/CompileText(str, user, rank, displayed_rank) //replaces user-given variables with actual thingies. str = replacetext(str, "%PERSON", "[user]") str = replacetext(str, "%RANK", "[rank]") + str = replacetext(str, "%DISP_RANK", "[displayed_rank]") return str -/obj/machinery/announcement_system/proc/announce(message_type, user, rank, list/channels) +/obj/machinery/announcement_system/proc/announce(message_type, user, rank, displayed_rank, list/channels) if(!is_operational()) return var/message if(message_type == "ARRIVAL" && arrivalToggle) - message = CompileText(arrival, user, rank) + message = CompileText(arrival, user, rank, displayed_rank) else if(message_type == "NEWHEAD" && newheadToggle) - message = CompileText(newhead, user, rank) + message = CompileText(newhead, user, rank, displayed_rank) //CITADEL EDIT for cryopods else if(message_type == "CRYOSTORAGE") - message = CompileText("%PERSON, %RANK has been moved to cryo storage.", user, rank) + message = CompileText("%PERSON, %DISP_RANK (%RANK) has been moved to cryo storage.", user, rank, displayed_rank) //END EDIT else if(message_type == "ARRIVALS_BROKEN") message = "The arrivals shuttle has been damaged. Docking for repairs..." diff --git a/code/modules/jobs/job_types/captain.dm b/code/modules/jobs/job_types/captain.dm index ebef17ab..4a9bfd34 100644 --- a/code/modules/jobs/job_types/captain.dm +++ b/code/modules/jobs/job_types/captain.dm @@ -27,8 +27,12 @@ Captain return get_all_accesses() /datum/job/captain/announce(mob/living/carbon/human/H) - ..() - SSticker.OnRoundstart(CALLBACK(GLOBAL_PROC, .proc/minor_announce, "Captain [H.nameless ? "" : "[H.real_name] "]on deck!")) + ..() + var/displayed_rank = H.client.prefs.alt_titles_preferences[title] + if(!displayed_rank) + displayed_rank = "Captain" + SSticker.OnRoundstart(CALLBACK(GLOBAL_PROC, .proc/minor_announce, "[displayed_rank] [H.nameless ? "" : "[H.real_name] "]on deck!")) + /datum/outfit/job/captain name = "Captain" diff --git a/code/modules/jobs/job_types/job.dm b/code/modules/jobs/job_types/job.dm index da718e0e..50989934 100644 --- a/code/modules/jobs/job_types/job.dm +++ b/code/modules/jobs/job_types/job.dm @@ -122,7 +122,7 @@ /datum/job/proc/announce_head(var/mob/living/carbon/human/H, var/channels) //tells the given channel that the given mob is the new department head. See communications.dm for valid channels. if(H && GLOB.announcement_systems.len) //timer because these should come after the captain announcement - SSticker.OnRoundstart(CALLBACK(GLOBAL_PROC, .proc/addtimer, CALLBACK(pick(GLOB.announcement_systems), /obj/machinery/announcement_system/proc/announce, "NEWHEAD", H.real_name, H.job, channels), 1)) + SSticker.OnRoundstart(CALLBACK(GLOBAL_PROC, .proc/addtimer, CALLBACK(pick(GLOB.announcement_systems), /obj/machinery/announcement_system/proc/announce, "NEWHEAD", H.real_name, H.job, H.client.prefs.alt_titles_preferences[H.job], channels), 1)) //If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1 /datum/job/proc/player_old_enough(client/C) diff --git a/modular_citadel/code/game/machinery/cryopod.dm b/modular_citadel/code/game/machinery/cryopod.dm index 15e7d34c..363067cc 100644 --- a/modular_citadel/code/game/machinery/cryopod.dm +++ b/modular_citadel/code/game/machinery/cryopod.dm @@ -277,6 +277,7 @@ // Delete them from datacore. var/announce_rank = null + var/announce_job_title = null for(var/datum/data/record/R in GLOB.data_core.medical) if((R.fields["name"] == mob_occupant.real_name)) qdel(R) @@ -286,6 +287,7 @@ for(var/datum/data/record/G in GLOB.data_core.general) if((G.fields["name"] == mob_occupant.real_name)) announce_rank = G.fields["rank"] + announce_job_title = G.fields["job_title"] qdel(G) for(var/obj/machinery/computer/cloning/cloner in world) @@ -299,7 +301,7 @@ if(GLOB.announcement_systems.len) var/obj/machinery/announcement_system/announcer = pick(GLOB.announcement_systems) - announcer.announce("CRYOSTORAGE", mob_occupant.real_name, announce_rank, list()) + announcer.announce("CRYOSTORAGE", mob_occupant.real_name, announce_rank, announce_job_title, list()) visible_message("\The [src] hums and hisses as it moves [mob_occupant.real_name] into storage.")