Skip to content

Commit

Permalink
Fix ru jobs (#367)
Browse files Browse the repository at this point in the history
## About The Pull Request
fixes #363
fixes #362
  • Loading branch information
larentoun authored Jul 13, 2024
1 parent 2178ddd commit 4a1ac25
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
7 changes: 7 additions & 0 deletions code/__DEFINES/bandastation/ru_jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,10 @@ GLOBAL_LIST_INIT(job_titles_ru, list(
if(job_ru_title)
return job_ru_title
return title

/proc/job_title_ru_to_en(title)
GLOB.job_titles_ru.Find("")
for(var/en_title in GLOB.job_titles_ru)
if(GLOB.job_titles_ru[en_title] == title)
return en_title
return title
2 changes: 1 addition & 1 deletion code/game/machinery/computer/crew.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new)
if (id_card)
entry["name"] = id_card.registered_name
entry["assignment"] = id_card.assignment
var/trim_assignment = id_card.get_trim_assignment()
var/trim_assignment = job_title_ru_to_en(id_card.get_trim_assignment())
if (jobs[trim_assignment] != null)
entry["ijob"] = jobs[trim_assignment]

Expand Down
5 changes: 5 additions & 0 deletions tgui/packages/tgui/bandastation/ru_jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export const JOBS_RU = {
Psychologist: 'Психолог',
};

export function ReverseJobsRu(value: string) {
let keys = Object.keys(JOBS_RU).filter((x) => JOBS_RU[x] === value);
return keys[0] || value;
}

export const DEPARTMENTS_RU = {
Command: 'Командование',
Security: 'Безопасность',
Expand Down
3 changes: 2 additions & 1 deletion tgui/packages/tgui/interfaces/Orbit/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReverseJobsRu } from '../../bandastation/ru_jobs'; // BANDASTATION EDIT
import { DEPARTMENT2COLOR, HEALTH, THREAT, VIEWMODE } from './constants';
import { AntagGroup, Antagonist, Observable, ViewMode } from './types';

Expand Down Expand Up @@ -46,7 +47,7 @@ export function getDisplayName(full_name: string, nickname?: string): string {

/** Returns the department the player is in */
export function getDepartmentByJob(job: string): string | undefined {
const withoutParenthesis = job.replace(/ \(.*\)/, '');
const withoutParenthesis = ReverseJobsRu(job).replace(/ \(.*\)/, '');

for (const department in DEPARTMENT2COLOR) {
if (DEPARTMENT2COLOR[department].trims.includes(withoutParenthesis)) {
Expand Down
3 changes: 2 additions & 1 deletion tgui/packages/tgui/interfaces/SecurityRecords/RecordTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Tabs,
} from 'tgui/components';

import { ReverseJobsRu } from '../../bandastation/ru_jobs'; // BANDASTATION EDIT
import { JOB2ICON } from '../common/JobToIcon';
import { CRIMESTATUS2COLOR } from './constants';
import { isRecordMatch } from './helpers';
Expand Down Expand Up @@ -111,7 +112,7 @@ const CrewTab = (props: { record: SecurityRecord }) => {
selected={isSelected}
>
<Box bold={isSelected} color={CRIMESTATUS2COLOR[wanted_status]}>
<Icon name={JOB2ICON[trim] || 'question'} /> {name}
<Icon name={JOB2ICON[ReverseJobsRu(trim)] || 'question'} /> {name}
</Box>
</Tabs.Tab>
);
Expand Down

0 comments on commit 4a1ac25

Please sign in to comment.