Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Metis
2024-11-17 16:55:40 -05:00
11 changed files with 179 additions and 17 deletions

View File

@@ -102,6 +102,7 @@ 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
@@ -1588,6 +1589,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;bancheck=[rank]'> BANNED</a></td></tr>"
@@ -1609,10 +1613,15 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if((job_preferences["[SSjob.overflow_role]"] == JP_LOW) && (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%'>"
@@ -1866,6 +1875,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 TRUE

View File

@@ -954,7 +954,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["object_tf"] >> object_tf
S["blueberry_inflation"] >> blueberry_inflation
S["feature_breasts_fluid"] >> features["breasts_fluid"]
S["alt_titles_preferences"] >> alt_titles_preferences
//gear loadout
if(istext(S["loadout"]))
loadout_data = safe_json_decode(S["loadout"])
@@ -1145,6 +1145,13 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
loadout_slot = sanitize_num_clamp(loadout_slot, 1, MAXIMUM_LOADOUT_SAVES, 1, TRUE)
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)
cit_character_pref_load(S)
return TRUE
@@ -1303,6 +1310,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["feature_belly_color"], features["belly_color"])
WRITE_FILE(S["feature_hide_belly"], features["hide_belly"])
WRITE_FILE(S["feature_inflatable_belly"], features["inflatable_belly"])
WRITE_FILE(S["alt_titles_preferences"], alt_titles_preferences)
WRITE_FILE(S["feature_ooc_notes"], features["ooc_notes"])