mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 02:01:22 +00:00
## About The Pull Request Adds a Character Loadout Tab to the preference menu This tab lets you pick items to start the round with  This also has some additional mechanics, such as being able to recolor colorable items, rename certain items (such as plushies), set item skins (such as the pride pin)  ## Why It's Good For The Game This has been headcoder sanctioned for some time, just no one did it. So here we are. Allows players to add some additional customization to their characters. Keeps us from cluttering the quirks list with quirks that do nothing but grants items. ## Changelog 🆑 Melbert add: Character Loadouts del: Pride Pin quirk (it's in the Loadout menu now) /🆑
180 lines
4.5 KiB
TypeScript
180 lines
4.5 KiB
TypeScript
import { exhaustiveCheck } from 'common/exhaustive';
|
|
import { useState } from 'react';
|
|
|
|
import { useBackend } from '../../backend';
|
|
import { Button, Stack } from '../../components';
|
|
import { Window } from '../../layouts';
|
|
import { AntagsPage } from './AntagsPage';
|
|
import { PreferencesMenuData } from './data';
|
|
import { JobsPage } from './JobsPage';
|
|
import { LoadoutPage } from './loadout/index';
|
|
import { MainPage } from './MainPage';
|
|
import { PageButton } from './PageButton';
|
|
import { QuirksPage } from './QuirksPage';
|
|
import { SpeciesPage } from './SpeciesPage';
|
|
|
|
enum Page {
|
|
Antags,
|
|
Main,
|
|
Jobs,
|
|
Species,
|
|
Quirks,
|
|
Loadout,
|
|
}
|
|
|
|
const CharacterProfiles = (props: {
|
|
activeSlot: number;
|
|
onClick: (index: number) => void;
|
|
profiles: (string | null)[];
|
|
}) => {
|
|
const { profiles } = props;
|
|
|
|
return (
|
|
<Stack justify="center" wrap>
|
|
{profiles.map((profile, slot) => (
|
|
<Stack.Item key={slot}>
|
|
<Button
|
|
selected={slot === props.activeSlot}
|
|
onClick={() => {
|
|
props.onClick(slot);
|
|
}}
|
|
fluid
|
|
>
|
|
{profile ?? 'New Character'}
|
|
</Button>
|
|
</Stack.Item>
|
|
))}
|
|
</Stack>
|
|
);
|
|
};
|
|
|
|
export const CharacterPreferenceWindow = (props) => {
|
|
const { act, data } = useBackend<PreferencesMenuData>();
|
|
|
|
const [currentPage, setCurrentPage] = useState(Page.Main);
|
|
|
|
let pageContents;
|
|
|
|
switch (currentPage) {
|
|
case Page.Antags:
|
|
pageContents = <AntagsPage />;
|
|
break;
|
|
case Page.Jobs:
|
|
pageContents = <JobsPage />;
|
|
break;
|
|
case Page.Main:
|
|
pageContents = (
|
|
<MainPage openSpecies={() => setCurrentPage(Page.Species)} />
|
|
);
|
|
|
|
break;
|
|
case Page.Species:
|
|
pageContents = (
|
|
<SpeciesPage closeSpecies={() => setCurrentPage(Page.Main)} />
|
|
);
|
|
|
|
break;
|
|
case Page.Quirks:
|
|
pageContents = <QuirksPage />;
|
|
break;
|
|
|
|
case Page.Loadout:
|
|
pageContents = <LoadoutPage />;
|
|
break;
|
|
|
|
default:
|
|
exhaustiveCheck(currentPage);
|
|
}
|
|
|
|
return (
|
|
<Window title="Character Preferences" width={920} height={770}>
|
|
<Window.Content scrollable>
|
|
<Stack vertical fill>
|
|
<Stack.Item>
|
|
<CharacterProfiles
|
|
activeSlot={data.active_slot - 1}
|
|
onClick={(slot) => {
|
|
act('change_slot', {
|
|
slot: slot + 1,
|
|
});
|
|
}}
|
|
profiles={data.character_profiles}
|
|
/>
|
|
</Stack.Item>
|
|
|
|
{!data.content_unlocked && (
|
|
<Stack.Item align="center">
|
|
Buy BYOND premium for more slots!
|
|
</Stack.Item>
|
|
)}
|
|
|
|
<Stack.Divider />
|
|
|
|
<Stack.Item>
|
|
<Stack fill>
|
|
<Stack.Item grow>
|
|
<PageButton
|
|
currentPage={currentPage}
|
|
page={Page.Main}
|
|
setPage={setCurrentPage}
|
|
otherActivePages={[Page.Species]}
|
|
>
|
|
Character
|
|
</PageButton>
|
|
</Stack.Item>
|
|
|
|
<Stack.Item grow>
|
|
<PageButton
|
|
currentPage={currentPage}
|
|
page={Page.Loadout}
|
|
setPage={setCurrentPage}
|
|
>
|
|
Loadout
|
|
</PageButton>
|
|
</Stack.Item>
|
|
|
|
<Stack.Item grow>
|
|
<PageButton
|
|
currentPage={currentPage}
|
|
page={Page.Jobs}
|
|
setPage={setCurrentPage}
|
|
>
|
|
{/*
|
|
Fun fact: This isn't "Jobs" so that it intentionally
|
|
catches your eyes, because it's really important!
|
|
*/}
|
|
Occupations
|
|
</PageButton>
|
|
</Stack.Item>
|
|
|
|
<Stack.Item grow>
|
|
<PageButton
|
|
currentPage={currentPage}
|
|
page={Page.Antags}
|
|
setPage={setCurrentPage}
|
|
>
|
|
Antagonists
|
|
</PageButton>
|
|
</Stack.Item>
|
|
|
|
<Stack.Item grow>
|
|
<PageButton
|
|
currentPage={currentPage}
|
|
page={Page.Quirks}
|
|
setPage={setCurrentPage}
|
|
>
|
|
Quirks
|
|
</PageButton>
|
|
</Stack.Item>
|
|
</Stack>
|
|
</Stack.Item>
|
|
|
|
<Stack.Divider />
|
|
|
|
<Stack.Item>{pageContents}</Stack.Item>
|
|
</Stack>
|
|
</Window.Content>
|
|
</Window>
|
|
);
|
|
};
|