mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-17 11:05:16 +01:00
Alternative job titles in the Occupations screen actually used in-game (#9420)
* Added alt jobs names actually doing something. * Also add late join announcements. * Fix custom roles showing up first in crew monitor * Cleanup to match upstream changes * Updates from review, also improve both tgui manifests * Compromise for Skyrat edit notes vs JSX vs linter * Compromise for optimization vs not making a horrible mess of passing client around * Follow module rules * Revert no longer true changed to customization readme * Update dme * Fixed comments for alt titles
This commit is contained in:
@@ -516,17 +516,22 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
//Gives the player the stuff he should have with his rank
|
||||
/datum/controller/subsystem/job/proc/EquipRank(mob/living/equipping, datum/job/job, client/player_client)
|
||||
// SKYRAT EDIT ADDITION BEGIN - ALTERNATIVE_JOB_TITLES
|
||||
// The alt job title, if user picked one, or the default
|
||||
var/chosen_title = player_client?.prefs.alt_job_titles[job.title] || job.title
|
||||
// SKYRAT EDIT ADDITION END - ALTERNATIVE_JOB_TITLES
|
||||
|
||||
equipping.job = job.title
|
||||
|
||||
SEND_SIGNAL(equipping, COMSIG_JOB_RECEIVED, job)
|
||||
|
||||
equipping.mind?.set_assigned_role(job)
|
||||
if(player_client)
|
||||
to_chat(player_client, span_infoplain("You are the [job.title]."))
|
||||
to_chat(player_client, span_infoplain("You are the [chosen_title].")) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: to_chat(player_client, span_infoplain("You are the [job.title]."))
|
||||
|
||||
equipping.on_job_equipping(job, player_client?.prefs) //SKYRAT EDIT CHANGE
|
||||
|
||||
job.announce_job(equipping)
|
||||
job.announce_job(equipping, chosen_title) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: job.announce_job(equipping)
|
||||
|
||||
if(player_client?.holder)
|
||||
if(CONFIG_GET(flag/auto_deadmin_players) || (player_client.prefs?.toggles & DEADMIN_ALWAYS))
|
||||
@@ -536,7 +541,7 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
|
||||
if(player_client)
|
||||
to_chat(player_client, span_infoplain("As the [job.title] you answer directly to [job.supervisors]. Special circumstances may change this.")) // SKYRAT EDIT ORIGINAL
|
||||
to_chat(player_client, span_infoplain("As the [chosen_title == job.title ? chosen_title : "[chosen_title] ([job.title])"] you answer directly to [job.supervisors]. Special circumstances may change this.")) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: to_chat(player_client, span_infoplain("As the [job.title] you answer directly to [job.supervisors]. Special circumstances may change this."))
|
||||
|
||||
job.radio_help_message(equipping)
|
||||
|
||||
@@ -554,6 +559,7 @@ SUBSYSTEM_DEF(job)
|
||||
var/mob/living/carbon/human/wageslave = equipping
|
||||
wageslave.mind.add_memory(MEMORY_ACCOUNT, list(DETAIL_ACCOUNT_ID = wageslave.account_id), story_value = STORY_VALUE_SHIT, memory_flags = MEMORY_FLAG_NOLOCATION)
|
||||
|
||||
setup_alt_job_items(wageslave, job, player_client) // SKYRAT EDIT ADDITION - ALTERNATIVE_JOB_TITLES
|
||||
|
||||
job.after_spawn(equipping, player_client)
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
|
||||
misc_list[++misc_list.len] = list(
|
||||
"name" = name,
|
||||
"rank" = rank,
|
||||
"trim" = trim, // SKYRAT CHANGE ADDITION - ALTERNATIVE_JOB_TITLES
|
||||
)
|
||||
continue
|
||||
for(var/department_type as anything in job.departments_list)
|
||||
@@ -172,6 +173,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
|
||||
var/list/entry = list(
|
||||
"name" = name,
|
||||
"rank" = rank,
|
||||
"trim" = trim, // SKYRAT CHANGE ADDITION - ALTERNATIVE_JOB_TITLES
|
||||
)
|
||||
var/list/department_list = manifest_out[department.department_name]
|
||||
if(istype(job, department.department_head))
|
||||
@@ -208,7 +210,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
|
||||
var/even = FALSE
|
||||
for(var/entry in entries)
|
||||
var/list/entry_list = entry
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[entry_list["name"]]</td><td>[entry_list["rank"]]</td></tr>"
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[entry_list["name"]]</td><td>[entry_list["rank"] == entry_list["trim"] ? entry_list["rank"] : "[entry_list["rank"]] ([entry_list["trim"]])"]</td></tr>" // SKYRAT CHANGE EDIT - ALTERNATIVE_JOB_TITLES - Original: dat += "<tr[even ? " class='alt'" : ""]><td>[entry_list["name"]]</td><td>[entry_list["rank"]]</td></tr>"
|
||||
even = !even
|
||||
|
||||
dat += "</table>"
|
||||
@@ -222,6 +224,10 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
|
||||
var/static/list/show_directions = list(SOUTH, WEST)
|
||||
if(H.mind?.assigned_role.job_flags & JOB_CREW_MANIFEST)
|
||||
var/assignment = H.mind.assigned_role.title
|
||||
// SKYRAT EDIT ADDITION BEGIN - ALTERNATIVE_JOB_TITLES
|
||||
// The alt job title, if user picked one, or the default
|
||||
var/chosen_assignment = C?.prefs.alt_job_titles[assignment] || assignment
|
||||
// SKYRAT EDIT ADDITION END - ALTERNATIVE_JOB_TITLES
|
||||
|
||||
var/static/record_id_num = 1001
|
||||
var/id = num2hex(record_id_num++,6)
|
||||
@@ -244,7 +250,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
|
||||
var/datum/data/record/G = new()
|
||||
G.fields["id"] = id
|
||||
G.fields["name"] = H.real_name
|
||||
G.fields["rank"] = assignment
|
||||
G.fields["rank"] = chosen_assignment // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: G.fields["rank"] = assignment
|
||||
G.fields["trim"] = assignment
|
||||
G.fields["initial_rank"] = assignment
|
||||
G.fields["age"] = H.age
|
||||
@@ -315,7 +321,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new)
|
||||
var/datum/data/record/L = new()
|
||||
L.fields["id"] = md5("[H.real_name][assignment]") //surely this should just be id, like the others?
|
||||
L.fields["name"] = H.real_name
|
||||
L.fields["rank"] = assignment
|
||||
L.fields["rank"] = chosen_assignment // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: L.fields["rank"] = assignment
|
||||
L.fields["trim"] = assignment
|
||||
G.fields["initial_rank"] = assignment
|
||||
L.fields["age"] = H.age
|
||||
|
||||
@@ -315,7 +315,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
if(!record_found && (new_character.mind.assigned_role.job_flags & JOB_CREW_MEMBER))
|
||||
//Power to the user!
|
||||
if(tgui_alert(new_character,"Warning: No data core entry detected. Would you like to announce the arrival of this character by adding them to various databases, such as medical records?",,list("No","Yes"))=="Yes")
|
||||
GLOB.data_core.manifest_inject(new_character)
|
||||
GLOB.data_core.manifest_inject(new_character, src) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: GLOB.data_core.manifest_inject(new_character)
|
||||
|
||||
if(tgui_alert(new_character,"Would you like an active AI to announce this character?",,list("No","Yes"))=="Yes")
|
||||
announce_arrival(new_character, new_character.mind.assigned_role.title)
|
||||
|
||||
@@ -169,9 +169,9 @@
|
||||
experiencer.mind.adjust_experience(i, roundstart_experience[i], TRUE)
|
||||
|
||||
|
||||
/datum/job/proc/announce_job(mob/living/joining_mob)
|
||||
/datum/job/proc/announce_job(mob/living/joining_mob, job_title) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: /datum/job/proc/announce_job(mob/living/joining_mob)
|
||||
if(head_announce)
|
||||
announce_head(joining_mob, head_announce)
|
||||
announce_head(joining_mob, head_announce, job_title) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: announce_head(joining_mob, head_announce)
|
||||
|
||||
|
||||
//Used for a special check of whether to allow a client to latejoin as this job.
|
||||
@@ -197,10 +197,11 @@
|
||||
dna.species.pre_equip_species_outfit(equipping, src, visual_only)
|
||||
equip_outfit_and_loadout(equipping.outfit, used_pref, visual_only, equipping) //SKYRAT EDIT CHANGE
|
||||
|
||||
/datum/job/proc/announce_head(mob/living/carbon/human/H, channels) //tells the given channel that the given mob is the new department head. See communications.dm for valid channels.
|
||||
/// tells the given channel that the given mob is the new department head. See communications.dm for valid channels.
|
||||
/datum/job/proc/announce_head(mob/living/carbon/human/H, channels, job_title) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: /datum/job/proc/announce_head(mob/living/carbon/human/H, 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, job_title, channels), 1)) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - Original: 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))
|
||||
|
||||
//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)
|
||||
|
||||
@@ -259,11 +259,14 @@
|
||||
humanc = character //Let's retypecast the var to be human,
|
||||
|
||||
if(humanc) //These procs all expect humans
|
||||
GLOB.data_core.manifest_inject(humanc)
|
||||
// BEGIN SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES
|
||||
var/chosen_rank = humanc.client?.prefs.alt_job_titles[rank] || rank
|
||||
GLOB.data_core.manifest_inject(humanc, humanc.client)
|
||||
if(SSshuttle.arrivals)
|
||||
SSshuttle.arrivals.QueueAnnounce(humanc, rank)
|
||||
SSshuttle.arrivals.QueueAnnounce(humanc, chosen_rank)
|
||||
else
|
||||
announce_arrival(humanc, rank)
|
||||
announce_arrival(humanc, chosen_rank)
|
||||
// END SKYRAT EDIT CHANGE - customization
|
||||
AddEmploymentContract(humanc)
|
||||
|
||||
humanc.increment_scar_slot()
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// ALTERNATIVE_JOB_TITLES
|
||||
|
||||
/**
|
||||
* Shows a list of all current and future polls and buttons to edit or delete them or create a new poll.
|
||||
*
|
||||
* All extra functionality to run on new player mobs, in a place where we actually have the client,
|
||||
* and haven't called COMSIG_GLOB_JOB_AFTER_SPAWN yet, so we are running before the wallet trait,
|
||||
* and other things that rely on items already being settled.
|
||||
*/
|
||||
/datum/controller/subsystem/job/proc/setup_alt_job_items(mob/living/carbon/human/equipping, datum/job/job, client/player_client)
|
||||
if(!player_client)
|
||||
return
|
||||
|
||||
var/chosen_title = player_client.prefs.alt_job_titles[job.title] || job.title
|
||||
|
||||
var/obj/item/card/id/card = equipping.wear_id
|
||||
if(istype(card))
|
||||
card.assignment = chosen_title
|
||||
card.update_label()
|
||||
|
||||
// Look for PDA in belt or L pocket
|
||||
var/obj/item/pda/pda = equipping.belt
|
||||
if(!istype(pda))
|
||||
pda = equipping.l_store
|
||||
if(istype(pda))
|
||||
pda.ownjob = chosen_title
|
||||
pda.update_label()
|
||||
@@ -0,0 +1,28 @@
|
||||
## Title: Alternative Job Titles
|
||||
|
||||
MODULE ID: ALTERNATIVE_JOB_TITLES
|
||||
|
||||
### Description:
|
||||
|
||||
Adds functionality to custom job titles, making them show up in manifests, ID's and announcements.
|
||||
Unfortunately, all 3 of the categories are not set up to be very modular, so this almost entirely consists of TG proc changes.
|
||||
|
||||
### TG Proc Changes:
|
||||
|
||||
- ./code/controllers/subsystem/job.dm > /datum/controller/subsystem/job/proc/EquipRank()
|
||||
- ./code/datums/datacore.dm > /datum/datacore/proc/get_manifest(), /datum/datacore/proc/get_manifest_html(), /datum/datacore/proc/manifest_inject()
|
||||
- ./code/modules/admin/verbs/admingame.dm > /client/proc/respawn_character()
|
||||
- ./code/modules/jobs/job_types/_job.dm > /datum/job/proc/announce_job(), /datum/job/proc/announce_head()
|
||||
- ./code/modules/mob/dead/new_player/new_player.dm > /mob/dead/new_player/proc/AttemptLateSpawn()
|
||||
|
||||
### Defines:
|
||||
|
||||
- N/A
|
||||
|
||||
### Included files that are not contained in this module:
|
||||
|
||||
- ./tgui/packages/tgui/interfaces/CrewManifest.js
|
||||
- ./tgui/packages/tgui/interfaces/NtosCrewManifest.js
|
||||
|
||||
### Credits:
|
||||
Tastyfish
|
||||
@@ -4305,6 +4305,7 @@
|
||||
#include "modular_skyrat\modules\altborgs\code\robot_modules.dm"
|
||||
#include "modular_skyrat\modules\altborgs\code\robot_upgrade.dm"
|
||||
#include "modular_skyrat\modules\altborgs\code\update_icons.dm"
|
||||
#include "modular_skyrat\modules\alternative_job_titles\code\job.dm"
|
||||
#include "modular_skyrat\modules\ambitions\code\ambition.dm"
|
||||
#include "modular_skyrat\modules\ambitions\code\ambition_templates.dm"
|
||||
#include "modular_skyrat\modules\ambitions\code\antag_datums.dm"
|
||||
|
||||
@@ -11,6 +11,8 @@ const commandJobs = [
|
||||
"Chief Medical Officer",
|
||||
];
|
||||
|
||||
// SKYRAT EDIT CHANGE BEGIN - ALTERNATIVE_JOB_TITLES
|
||||
// Any instance of crewMember.trim was originally crewMember.rank
|
||||
export const CrewManifest = (props, context) => {
|
||||
const { data: { manifest, positions } } = useBackend(context);
|
||||
|
||||
@@ -39,8 +41,7 @@ export const CrewManifest = (props, context) => {
|
||||
])}
|
||||
collapsing
|
||||
>
|
||||
{positions[dept].exceptions.includes(crewMember.rank) && (
|
||||
|
||||
{positions[dept].exceptions.includes(crewMember.trim) && (
|
||||
<Tooltip
|
||||
content="No position limit"
|
||||
position="bottom"
|
||||
@@ -48,7 +49,7 @@ export const CrewManifest = (props, context) => {
|
||||
<Icon className="CrewManifest__Icon" name="infinity" />
|
||||
</Tooltip>
|
||||
)}
|
||||
{crewMember.rank === "Captain" && (
|
||||
{crewMember.trim === "Captain" && (
|
||||
<Tooltip
|
||||
content="Captain"
|
||||
position="bottom"
|
||||
@@ -62,7 +63,7 @@ export const CrewManifest = (props, context) => {
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
{commandJobs.includes(crewMember.rank) && (
|
||||
{commandJobs.includes(crewMember.trim) && (
|
||||
<Tooltip
|
||||
content="Member of command"
|
||||
position="bottom"
|
||||
@@ -96,3 +97,4 @@ export const CrewManifest = (props, context) => {
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
// SKYRAT EDIT CHANGE END - ALTERNATIVE_JOB_TITLES
|
||||
|
||||
@@ -3,6 +3,12 @@ import { useBackend } from '../backend';
|
||||
import { Button, Section, Table } from '../components';
|
||||
import { NtosWindow } from '../layouts';
|
||||
|
||||
// SKYRAT EDIT BEGIN - ALTERNATIVE_JOB_TITLES
|
||||
//
|
||||
// width={500} - Original: width={400}
|
||||
//
|
||||
// {entry.rank === entry.trim ? entry.rank : <>{entry.rank} ({entry.trim})</>}
|
||||
// - Original: entry.rank
|
||||
export const NtosCrewManifest = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
@@ -11,7 +17,7 @@ export const NtosCrewManifest = (props, context) => {
|
||||
} = data;
|
||||
return (
|
||||
<NtosWindow
|
||||
width={400}
|
||||
width={500}
|
||||
height={480}>
|
||||
<NtosWindow.Content scrollable>
|
||||
<Section
|
||||
@@ -37,7 +43,9 @@ export const NtosCrewManifest = (props, context) => {
|
||||
{entry.name}
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
({entry.rank})
|
||||
{entry.rank === entry.trim
|
||||
? entry.rank
|
||||
: <>{entry.rank} ({entry.trim})</>}
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
@@ -49,3 +57,4 @@ export const NtosCrewManifest = (props, context) => {
|
||||
</NtosWindow>
|
||||
);
|
||||
};
|
||||
// SKYRAT EDIT END - ALTERNATIVE_JOB_TITLES
|
||||
|
||||
Reference in New Issue
Block a user