Merge pull request #380 from CydiaButt13/CydiaButt13

Adds custom job titles
This commit is contained in:
Dahlular
2020-08-05 21:29:59 -06:00
committed by GitHub
9 changed files with 134 additions and 10 deletions
+4 -1
View File
@@ -541,8 +541,11 @@
if((character.mind.assigned_role == "Cyborg") || (character.mind.assigned_role == character.mind.special_role))
return
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, rank, displayed_rank, list()) //make the list empty to make it announce it in common
/proc/lavaland_equipment_pressure_check(turf/T)
. = FALSE
+5 -2
View File
@@ -428,9 +428,12 @@ SUBSYSTEM_DEF(job)
SSpersistence.antag_rep_change[M.client.ckey] += job.GetAntagRep()
to_chat(M, "<b>You are the [rank].</b>")
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]
to_chat(M, "<b>You are the [display_rank].</b>")
if(job)
to_chat(M, "<b>As the [rank] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")
to_chat(M, "<b>As the [display_rank] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")
to_chat(M, "<b>To speak on your departments radio, use the :h button. To see others, look closely at your headset.</b>")
if(job.req_admin_notify)
to_chat(M, "<b>You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via adminhelp.</b>")
+2
View File
@@ -208,6 +208,8 @@
assignment = H.job
else
assignment = "Unassigned"
if(C && C.prefs && C.prefs.alt_titles_preferences[assignment])
assignment = C.prefs.alt_titles_preferences[assignment]
var/static/record_id_num = 1001
var/id = num2hex(record_id_num++,6)
+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
+11 -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
@@ -217,18 +219,25 @@
H.real_name = "[J.title] #[rand(10000, 99999)]"
var/obj/item/card/id/C = H.wear_id
var/client/preference_source = H.client
if(istype(C))
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
C.update_label()
if(preference_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,68 @@
//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", "Chef de partie")
/datum/job/hydro
alt_titles = list("Gardener", "Herbalist", "Botanical Researcher", "Hydroponicist", "Farmer", "Beekeeper")
/datum/job/curator
alt_titles = list("Journalist", "Librarian")
/datum/job/chaplain
alt_titles = list("Priest", "Priestess", "Bishop", "Prior", "Monk", "Nun", "Counselor")
/datum/job/janitor
alt_titles = list("Custodian", "Sanitation Technician", "Maid")
/datum/job/lawyer
alt_titles = list("Human Resources Agent", "Internal Affairs Agent", "Attorney")
/datum/job/clown
alt_titles = list("Jester", "Comedian")
/datum/job/mime
alt_titles = list("Performer")
//Science
/datum/job/scientist
alt_titles = list("Circuitry Designer", "Xenobiologist", "Xenobotanist", "Xenoarcheologist", "Chemical Researcher", "Researcher", "Pyrotechnician")
/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")
/datum/job/virologist
alt_titles = list("Microbiologist", "Biochemist", "Pathologist")
/datum/job/geneticist
alt_titles = list("Gene Therapist")
//Security
/datum/job/detective
alt_titles = list("Forensics Technician", "Private Investigator", "Gumshoe")
//Supply
/datum/job/qm
alt_titles = list("Supply Chief")
/datum/job/cargo_tech
alt_titles = list("Mail Man", "Mail Woman", "Mailroom Technician", "Deliveries Officer", "Logistics Technician")
/datum/job/mining
alt_titles = list("Exotic Ore Miner", "Fauna Hunter", "Explorer", "Digger") //Just because you're a hunter does not excuse you from rock collecting!!!!!!!!!!!!
@@ -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"])
@@ -13,7 +13,15 @@
features["mcolor3"] = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F")
features["mcolor2"] = sanitize_hexcolor(features["mcolor2"], 3, 0)
features["mcolor3"] = sanitize_hexcolor(features["mcolor3"], 3, 0)
S["alt_titles_preferences"] >> alt_titles_preferences
alt_titles_preferences = SANITIZE_LIST(alt_titles_preferences)
if(SSjob)
for(var/datum/job/job in SSjob.occupations)
if(alt_titles_preferences[job.title])
if(!(alt_titles_preferences[job.title] in job.alt_titles))
alt_titles_preferences.Remove(job.title)
//gear loadout
var/text_to_load
S["loadout"] >> text_to_load
@@ -76,6 +84,8 @@
WRITE_FILE(S["feature_can_get_preg"], features["can_get_preg"])
//flavor text
WRITE_FILE(S["feature_flavor_text"], features["flavor_text"])
//custom job titles
WRITE_FILE(S["alt_titles_preferences"], alt_titles_preferences)
//gear loadout
if(islist(chosen_gear))
+1
View File
@@ -1819,6 +1819,7 @@
#include "code\modules\jobs\job_types\civilian_chaplain.dm"
#include "code\modules\jobs\job_types\engineering.dm"
#include "code\modules\jobs\job_types\job.dm"
#include "code\modules\jobs\job_types\job_alt_titles.dm"
#include "code\modules\jobs\job_types\medical.dm"
#include "code\modules\jobs\job_types\science.dm"
#include "code\modules\jobs\job_types\security.dm"