mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 05:23:22 +01:00
Better factions and contractors (#6493)
Intent of this PR: make factions actually matter. How we're going to do this: Make factions limit job choices. Make factions have alternative loadouts that override job uniforms Make factions be visible in the employment records. Revert existing faction loadout options or put them behind a preference, in favour of new shit.
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
S["gen_record"] >> pref.gen_record
|
||||
S["home_system"] >> pref.home_system
|
||||
S["citizenship"] >> pref.citizenship
|
||||
S["faction"] >> pref.faction
|
||||
S["religion"] >> pref.religion
|
||||
S["nanotrasen_relation"] >> pref.nanotrasen_relation
|
||||
|
||||
@@ -18,7 +17,6 @@
|
||||
S["gen_record"] << pref.gen_record
|
||||
S["home_system"] << pref.home_system
|
||||
S["citizenship"] << pref.citizenship
|
||||
S["faction"] << pref.faction
|
||||
S["religion"] << pref.religion
|
||||
S["nanotrasen_relation"] << pref.nanotrasen_relation
|
||||
|
||||
@@ -38,7 +36,6 @@
|
||||
"nt_relation" = "nanotrasen_relation",
|
||||
"home_system",
|
||||
"citizenship",
|
||||
"faction",
|
||||
"religion"
|
||||
),
|
||||
"args" = list("id")
|
||||
@@ -63,7 +60,6 @@
|
||||
"nt_relation",
|
||||
"home_system",
|
||||
"citizenship",
|
||||
"faction",
|
||||
"religion","id" = 1,
|
||||
"ckey" = 1
|
||||
)
|
||||
@@ -78,7 +74,6 @@
|
||||
"nt_relation" = pref.nanotrasen_relation,
|
||||
"home_system" = pref.home_system,
|
||||
"citizenship" = pref.citizenship,
|
||||
"faction" = pref.faction,
|
||||
"religion" = pref.religion,
|
||||
"id" = pref.current_character,
|
||||
"ckey" = PREF_CLIENT_CKEY
|
||||
@@ -89,8 +84,6 @@
|
||||
pref.home_system = "Unset"
|
||||
if(!pref.citizenship)
|
||||
pref.citizenship = "None"
|
||||
if(!pref.faction)
|
||||
pref.faction = "None"
|
||||
if(!pref.religion)
|
||||
pref.religion = "None"
|
||||
|
||||
@@ -102,7 +95,6 @@
|
||||
"[current_map.company_name] Relation: <a href='?src=\ref[src];nt_relation=1'>[pref.nanotrasen_relation]</a><br/>",
|
||||
"Home System: <a href='?src=\ref[src];home_system=1'>[pref.home_system]</a><br/>",
|
||||
"Citizenship: <a href='?src=\ref[src];citizenship=1'>[pref.citizenship]</a><br/>",
|
||||
"Faction: <a href='?src=\ref[src];faction=1'>[pref.faction]</a><br/>",
|
||||
"Religion: <a href='?src=\ref[src];religion=1'>[pref.religion]</a><br/>",
|
||||
"<br/><b>Records</b>:<br/>"
|
||||
)
|
||||
@@ -150,18 +142,6 @@
|
||||
pref.citizenship = choice
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["faction"])
|
||||
var/choice = input(user, "Please choose a faction to work for.", "Character Preference", pref.faction) as null|anything in faction_choices + list("None","Other")
|
||||
if(!choice || !CanUseTopic(user))
|
||||
return TOPIC_NOACTION
|
||||
if(choice == "Other")
|
||||
var/raw_choice = sanitize(input(user, "Please enter a faction.", "Character Preference") as text|null, MAX_NAME_LEN)
|
||||
if(raw_choice)
|
||||
pref.faction = raw_choice
|
||||
else
|
||||
pref.faction = choice
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["religion"])
|
||||
var/choice = input(user, "Please choose a religion.", "Character Preference", pref.religion) as null|anything in religion_choices + list("None","Other")
|
||||
if(!choice || !CanUseTopic(user))
|
||||
|
||||
@@ -243,21 +243,6 @@
|
||||
display_name = "green formal uniform"
|
||||
path = /obj/item/clothing/under/gov
|
||||
|
||||
/datum/gear/uniform/contractors
|
||||
display_name = "contractor uniform selection"
|
||||
description = "A selection of contractor uniforms."
|
||||
path = /obj/item/clothing/under/rank/hephaestus
|
||||
|
||||
/datum/gear/uniform/contractors/New()
|
||||
..()
|
||||
var/uniform = list()
|
||||
uniform["Hephaestus Industries uniform"] = /obj/item/clothing/under/rank/hephaestus
|
||||
uniform["Necropolis Industries uniform"] = /obj/item/clothing/under/rank/necropolis
|
||||
uniform["Idris Incorporated uniform"] = /obj/item/clothing/under/rank/idris
|
||||
uniform["Einstein Engines uniform"] = /obj/item/clothing/under/rank/einstein_engines
|
||||
uniform["Zeng-Hu Pharmaceuticals uniform"] = /obj/item/clothing/under/rank/zeng
|
||||
gear_tweaks += new/datum/gear_tweak/path(uniform)
|
||||
|
||||
/datum/gear/uniform/officer
|
||||
display_name = "uniforms, (Security Officer)"
|
||||
description = "A selection of officer uniforms."
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
S["job_engsec_med"] >> pref.job_engsec_med
|
||||
S["job_engsec_low"] >> pref.job_engsec_low
|
||||
S["player_alt_titles"] >> pref.player_alt_titles
|
||||
S["faction"] >> pref.faction
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/save_character(var/savefile/S)
|
||||
S["alternate_option"] << pref.alternate_option
|
||||
@@ -32,6 +33,7 @@
|
||||
S["job_engsec_med"] << pref.job_engsec_med
|
||||
S["job_engsec_low"] << pref.job_engsec_low
|
||||
S["player_alt_titles"] << pref.player_alt_titles
|
||||
S["faction"] << pref.faction
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/gather_load_query()
|
||||
return list(
|
||||
@@ -39,7 +41,8 @@
|
||||
"vars" = list(
|
||||
"jobs" = "unsanitized_jobs",
|
||||
"alternate_option",
|
||||
"alternate_titles" = "player_alt_titles"
|
||||
"alternate_titles" = "player_alt_titles",
|
||||
"faction"
|
||||
),
|
||||
"args" = list("id")
|
||||
)
|
||||
@@ -54,6 +57,7 @@
|
||||
"jobs",
|
||||
"alternate_option",
|
||||
"alternate_titles",
|
||||
"faction",
|
||||
"id" = 1,
|
||||
"ckey" = 1
|
||||
)
|
||||
@@ -77,6 +81,7 @@
|
||||
"alternate_option" = pref.alternate_option,
|
||||
"alternate_titles" = list2params(pref.player_alt_titles),
|
||||
"id" = pref.current_character,
|
||||
"faction" = pref.faction,
|
||||
"ckey" = PREF_CLIENT_CKEY
|
||||
)
|
||||
|
||||
@@ -121,13 +126,31 @@
|
||||
if (!pref.player_alt_titles)
|
||||
pref.player_alt_titles = new()
|
||||
|
||||
for(var/datum/job/job in SSjobs.occupations)
|
||||
if (!SSjobs.safe_to_sanitize)
|
||||
if (!SSjobs.deferred_preference_sanitizations[src])
|
||||
SSjobs.deferred_preference_sanitizations[src] = CALLBACK(src, .proc/late_sanitize, sql_load)
|
||||
else
|
||||
late_sanitize(sql_load)
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/proc/late_sanitize(sql_load)
|
||||
for (var/datum/job/job in SSjobs.occupations)
|
||||
var/alt_title = pref.player_alt_titles[job.title]
|
||||
if(alt_title && !(alt_title in job.alt_titles))
|
||||
pref.player_alt_titles -= job.title
|
||||
|
||||
sanitize_faction()
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/content(mob/user, limit = 16, list/splitJobs = list("Chief Engineer", "Head of Security"))
|
||||
if (SSjobs.init_state != SS_INITSTATE_DONE)
|
||||
return "<center><large>Jobs controller not initialized yet. Please wait a bit and reload this section.</large></center>"
|
||||
|
||||
var/list/dat = list(
|
||||
"<center><b>Character faction</b><br>",
|
||||
"<small>This will influence the jobs you can select from, and the starting equipment.</small><br>",
|
||||
"<b><a href='?src=\ref[src];faction_preview=[html_encode(pref.faction)]'>[pref.faction]</a></b></center><br><hr>"
|
||||
)
|
||||
|
||||
dat += list(
|
||||
"<tt><center>",
|
||||
"<b>Choose occupation chances</b><br>Unavailable occupations are crossed out.<br>",
|
||||
"<table width='100%' cellpadding='1' cellspacing='0'><tr><td width='20%'>", // Table within a table for alignment, also allows you to easily add more colomns.
|
||||
@@ -137,7 +160,10 @@
|
||||
|
||||
//The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows.
|
||||
var/datum/job/lastJob
|
||||
for(var/datum/job/job in SSjobs.occupations)
|
||||
|
||||
var/datum/faction/faction = SSjobs.name_factions[pref.faction] || SSjobs.default_faction
|
||||
|
||||
for(var/datum/job/job in faction.get_occupations())
|
||||
index += 1
|
||||
if((index >= limit) || (job.title in splitJobs))
|
||||
if((index < limit) && (lastJob != null))
|
||||
@@ -235,10 +261,28 @@
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["set_job"])
|
||||
if(SetJob(user, href_list["set_job"])) return TOPIC_REFRESH
|
||||
if(SetJob(user, href_list["set_job"]))
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["faction_preview"])
|
||||
show_faction_menu(user, html_decode(href_list["faction_preview"]))
|
||||
return TOPIC_NOACTION
|
||||
|
||||
else if(href_list["faction_select"])
|
||||
validate_and_set_faction(html_decode(href_list["faction_select"]))
|
||||
show_faction_menu(user, html_decode(href_list["faction_select"]))
|
||||
return TOPIC_REFRESH
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/proc/sanitize_faction()
|
||||
if (!SSjobs.name_factions[pref.faction])
|
||||
pref.faction = SSjobs.default_faction.name
|
||||
|
||||
to_client_chat("<span class='danger'>Your faction selection has been reset to [pref.faction].</span>")
|
||||
to_client_chat("<span class='danger'>Your jobs have been reset due to this!</span>")
|
||||
ResetJobs()
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/proc/SetPlayerAltTitle(datum/job/job, new_title)
|
||||
// remove existing entry
|
||||
pref.player_alt_titles -= job.title
|
||||
@@ -270,7 +314,8 @@
|
||||
return 1
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/proc/SetJobDepartment(var/datum/job/job, var/level)
|
||||
if(!job || !level) return 0
|
||||
if(!job || !level)
|
||||
return 0
|
||||
switch(level)
|
||||
if(1)//Only one of these should ever be active at once so clear them all here
|
||||
pref.job_civilian_high = 0
|
||||
@@ -333,8 +378,51 @@
|
||||
|
||||
pref.player_alt_titles.Cut()
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/proc/show_faction_menu(user, selected_faction)
|
||||
simple_asset_ensure_is_sent(user, /datum/asset/simple/faction_icons)
|
||||
|
||||
var/list/dat = list("<center>")
|
||||
|
||||
for (var/datum/faction/faction in SSjobs.factions)
|
||||
if (faction.name == selected_faction)
|
||||
dat += " [faction.name] "
|
||||
else
|
||||
dat += " <a href='?src=\ref[src];faction_preview=[html_encode(faction.name)]'>[faction.name]</a> "
|
||||
|
||||
var/datum/faction/faction = SSjobs.name_factions[selected_faction]
|
||||
|
||||
if (selected_faction == pref.faction)
|
||||
dat += "<br>\[Faction already selected\]"
|
||||
else if (faction.can_select(pref))
|
||||
dat += "<br>\[<a href='?src=\ref[src];faction_select=[html_encode(selected_faction)]'>Select faction</a>\]"
|
||||
else
|
||||
dat += "<br><span class='warning'>[faction.get_selection_error(pref)]</span>"
|
||||
|
||||
dat += "</center><hr><center><large><u>[faction.name]</u></large>"
|
||||
dat += {"<br><img style="height:100px;" src="[faction.get_logo_name()]"></center>"}
|
||||
|
||||
if (faction.is_default)
|
||||
dat += "<br><center><small>This faction is the default faction aboard this installation.</small></center>"
|
||||
|
||||
dat += "<br><br>[faction.description]"
|
||||
|
||||
show_browser(user, dat.Join(), "window=factionpreview")
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/proc/validate_and_set_faction(selected_faction)
|
||||
var/datum/faction/faction = SSjobs.name_factions[selected_faction]
|
||||
|
||||
if (!faction)
|
||||
to_client_chat("<span class='danger'>Invalid faction chosen. Resetting to default.</span>")
|
||||
selected_faction = SSjobs.default_faction.name
|
||||
|
||||
ResetJobs() // How to be horribly lazy.
|
||||
|
||||
pref.faction = selected_faction
|
||||
|
||||
to_client_chat("<span class='notice'>New faction chosen. Job preferences reset.</span>")
|
||||
|
||||
/datum/preferences/proc/GetPlayerAltTitle(datum/job/job)
|
||||
return (job.title in player_alt_titles) ? player_alt_titles[job.title] : job.title
|
||||
return player_alt_titles[job.title] || job.title
|
||||
|
||||
/datum/preferences/proc/GetJobDepartment(var/datum/job/job, var/level)
|
||||
if(!job || !level) return 0
|
||||
|
||||
@@ -220,6 +220,10 @@
|
||||
pref = null
|
||||
return ..()
|
||||
|
||||
/datum/category_item/player_setup_item/proc/to_client_chat(str)
|
||||
if (pref && pref.client)
|
||||
to_chat(pref.client, str)
|
||||
|
||||
/*
|
||||
* Called when the item is asked to load per character settings - Only called when sql saves are disabled or unavailable
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user