Adds custom job titles

Adds alternate choosable job titles to fit your niches

Co-Authored-By: Azarak <azarak@users.noreply.github.com>
This commit is contained in:
Cydia
2020-08-05 01:37:19 -05:00
parent d8b3888b02
commit 47cacb8c30
8 changed files with 107 additions and 10 deletions
+26 -2
View File
@@ -65,6 +65,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/pda_style = MONO
var/pda_color = "#808000"
var/pda_skin = PDA_SKIN_ALT
var/list/alt_titles_preferences = list()
var/uses_glasses_colour = 0
@@ -1095,6 +1097,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
HTML += "<tr bgcolor='[job.selection_color]'><td width='60%' align='right'>"
var/rank = job.title
var/displayed_rank = rank
if(job.alt_titles.len && (rank in alt_titles_preferences))
displayed_rank = alt_titles_preferences[rank]
lastJob = job
if(jobban_isbanned(user, rank))
HTML += "<font color=red>[rank]</font></td><td><a href='?_src_=prefs;jobbancheck=[rank]'> BANNED</a></td></tr>"
@@ -1110,10 +1115,14 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if((job_civilian_low & overflow.flag) && (rank != SSjob.overflow_role) && !jobban_isbanned(user, SSjob.overflow_role))
HTML += "<font color=orange>[rank]</font></td><td></td></tr>"
continue
var/rank_title_line = "[displayed_rank]"
if((rank in GLOB.command_positions) || (rank == "AI"))//Bold head jobs
HTML += "<b><span class='dark'>[rank]</span></b>"
rank_title_line = "<b>[rank_title_line]</b>"
if(job.alt_titles.len)
rank_title_line = "<a href='?_src_=prefs;preference=job;task=alt_title;job_title=[job.title]'>[rank_title_line]</a>"
else
HTML += "<span class='dark'>[rank]</span>"
rank_title_line = "<span class='dark'>[rank_title_line]</span>" //Make it dark if we're not adding a button for alt titles
HTML += rank_title_line
HTML += "</td><td width='40%'>"
@@ -1427,6 +1436,21 @@ GLOBAL_LIST_EMPTY(preferences_datums)
SetChoices(user)
if("setJobLevel")
UpdateJobPreference(user, href_list["text"], text2num(href_list["level"]))
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)
else
SetChoices(user)
return 1
+10 -2
View File
@@ -57,6 +57,8 @@
var/list/mind_traits // Traits added to the mind of the mob assigned this job
var/list/blacklisted_quirks //list of quirk typepaths blacklisted.
var/list/alt_titles = list()
//Only override this proc
//H is usually a human unless an /equip override transformed it
@@ -222,13 +224,19 @@
shuffle_inplace(C.access) // Shuffle access list to make NTNet passkeys less predictable
C.registered_name = H.real_name
C.assignment = J.title
C.update_label()
if(preferences_source && preference_source.prefs && preference_source.prefs.alt_titles_preferences[J.title])
C.update_label(C.registered_name, preference_source.prefs.alt_titles_preferences[J.title])
else
C.update_label()
H.sec_hud_set_ID()
var/obj/item/pda/PDA = H.get_item_by_slot(pda_slot)
if(istype(PDA))
PDA.owner = H.real_name
PDA.ownjob = J.title
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
PDA.update_label()
/datum/outfit/job/get_chameleon_disguise_info()
@@ -0,0 +1,43 @@
//Engineering
/datum/job/engineer
alt_titles = list("Maintenance Technician", "Engine Technician", "Electrician")
/datum/job/atmos
alt_titles = list("Firefighter", "Life Support Specialist")
//Service
/datum/job/assistant
alt_titles = list("Civilian", "Visitor", "Businessman", "Trader", "Entertainer", "Tourist")
/datum/job/cook
alt_titles = list("Cook", "Culinary Artist", "Butcher")
/datum/job/botanist
alt_titles = list("Gardener", "Herbalist", "Botanical Researcher", "Hydroponicist")
/datum/job/curator
alt_titles = list("Journalist", "Librarian")
/datum/job/janitor
alt_titles = list("Custodian", "Sanitation Technician")
/datum/job/lawyer
alt_titles = list("Human Resources Agent", "Internal Affairs Agent")
//Science
/datum/job/scientist
alt_titles = list("Circuitry Designer", "Xenobiologist", "Xenobotanist", "Xenoarcheologist", "Chemical Researcher", "Researcher")
/datum/job/roboticist
alt_titles = list("Biomechanical Engineer", "Mechatronic Engineer", "Mechanic")
//Medical
/datum/job/doctor
alt_titles = list("Nurse", "Surgeon", "Physician")
/datum/job/chemist
alt_titles = list("Pharmacist", "Pharmacologist")
//Security
/datum/job/detective
alt_titles = list("Forensics Technician", "Private Investigator", "Gumshoe")
@@ -531,10 +531,14 @@
var/position_class = "otherPosition"
if(job.title in GLOB.command_positions)
position_class = "commandPosition"
var/jobline = ""
if(job in SSjob.prioritized_jobs)
dat += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job.title]'><font color='lime'><b>[job.title] ([job.current_positions])</b></font></a>"
jobline += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job.title]'><font color='lime'><b>[job.title] ([job.current_positions])</b></font></a>"
else
dat += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job.title]'>[job.title] ([job.current_positions])</a>"
jobline += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job.title]'>[job.title] ([job.current_positions])</a>"
if(client && client.prefs && client.prefs.alt_titles_preferences[job.title])
jobline += "<br><span style='color:#BBBBBB; font-style: italic;'>(as [client.prefs.alt_titles_preferences[job.title]])</span>"
dat += jobline
categorizedJobs[jobcat]["jobs"] -= job
for(var/spawner in categorizedJobs[jobcat]["jobs"])