mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
* Initial commit * 0 * shuttle and maps * Equipping * Minor fixes, gyrojet removed, elite suits removed * E * reviews * Update base_alarm.dm * nnfghghg * more fix * Update dynamic_rulsesets_roundstart.dm * Update modular_skyrat/modules/assault_operatives/code/assault_operatives.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update modular_skyrat/modules/assault_operatives/code/vending_machine.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * fyux * Update assault_operatives_outfits.dm * E * Update modular_skyrat/modules/assault_operatives/code/goldeneye.dm Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> * Update modular_skyrat/modules/assault_operatives/code/interrogator.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update modular_skyrat/modules/assault_operatives/code/interrogator.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * more review * E * uber update * Update AntagInfoAssaultops.tsx * Update AntagInfoAssaultops.tsx * nyooom * E * ICARUS SUNBEAM * fioxes * Update sunbeam.dm * Update goldeneye.dm * Update vending_machine.dm * Update assault_operatives_outfits.dm * Update goldeneye.dm * e * eee * Update assault_operatives_outfits.dm * Update assault_operatives.dm * Update assault_operatives.dm * Update goldeneye_cruiser.dmm * fix * 0 * haha funneee * armament system * more updates * f * e * 0 * e * more based * 0 * e * CQC PLUS CAN SUCK MY COCK * Update __armament_bodyarmor.dm * Update assault_operatives.dm * e * MG9 balance * Update armament_utility.dm * Update sunbeam.dm * fixes * Update CentCom_skyrat_z2.dmm * Update armament_station.dm * Update modular_skyrat/modules/armaments/code/armament_entries.dm Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> * Update modular_skyrat/modules/armaments/code/armament_entries.dm Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> * Update modular_skyrat/modules/assault_operatives/code/assault_operatives.dm Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> * e * Update modular_skyrat/modules/assault_operatives/code/assault_operatives.dm Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> * Update assaultops_armament_station.dm * reviuew * Update misc_items.dm * Update vending_machine.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
161 lines
6.4 KiB
JavaScript
161 lines
6.4 KiB
JavaScript
import { useBackend, useLocalState } from '../backend';
|
|
import { Section, Stack, Box, Divider, Button, NoticeBox } from '../components';
|
|
import { Window } from '../layouts';
|
|
|
|
export const ArmamentStation = (props, context) => {
|
|
const [category, setCategory] = useLocalState(context, 'category', '');
|
|
const [weapon, setArmament] = useLocalState(context, 'weapon');
|
|
const { act, data } = useBackend(context);
|
|
const {
|
|
armaments_list = [],
|
|
card_inserted,
|
|
card_points,
|
|
card_name,
|
|
} = data;
|
|
return (
|
|
<Window
|
|
theme="armament"
|
|
title="Armament Station"
|
|
width={1000}
|
|
height={600}>
|
|
<Window.Content>
|
|
<Section grow height="100%" title="Armaments Station">
|
|
{card_inserted ? (
|
|
<Stack>
|
|
<Stack.Item grow fill>
|
|
<Box>
|
|
<b>Inserted Card:</b> {card_name}
|
|
</Box>
|
|
<Box>
|
|
<b>Remaining Points:</b> {card_points}
|
|
</Box>
|
|
</Stack.Item>
|
|
<Stack.Item>
|
|
<Button
|
|
icon="eject"
|
|
fontSize="20px"
|
|
content="Eject Card"
|
|
onClick={() => act('eject_card')} />
|
|
</Stack.Item>
|
|
</Stack>
|
|
) : (
|
|
<NoticeBox color="bad">
|
|
No card inserted.
|
|
</NoticeBox>
|
|
)}
|
|
<Divider />
|
|
<Stack fill grow>
|
|
<Stack.Item mr={1}>
|
|
<Section title="Categories">
|
|
<Stack vertical>
|
|
{armaments_list.map(armament_category => (
|
|
<Stack.Item key={armament_category.category}>
|
|
<Button
|
|
width="100%"
|
|
content={armament_category.category + ' (Pick ' + armament_category.category_limit + ')'}
|
|
selected={category === armament_category.category}
|
|
onClick={() =>
|
|
setCategory(armament_category.category)} />
|
|
</Stack.Item>
|
|
))}
|
|
</Stack>
|
|
</Section>
|
|
</Stack.Item>
|
|
<Divider vertical />
|
|
<Stack.Item grow mr={1}>
|
|
<Section title={category} scrollable fill height="480px">
|
|
{armaments_list.map(armament_category => (
|
|
armament_category.category === category && (
|
|
armament_category.subcategories.map(subcat => (
|
|
<Section
|
|
key={subcat.subcategory}
|
|
title={subcat.subcategory}>
|
|
<Stack vertical>
|
|
{subcat.items.map(item => (
|
|
<Stack.Item key={item.ref}>
|
|
<Button
|
|
fontSize="15px"
|
|
textAlign="center"
|
|
selected={weapon === item.ref}
|
|
disabled={item.purchased >= item.quantity
|
|
|| item.purchased >= item.quantity}
|
|
width="100%"
|
|
key={item.ref}
|
|
onClick={() =>
|
|
setArmament(item.ref)}>
|
|
<img
|
|
src={`data:image/jpeg;base64,${item.icon}`}
|
|
style={{
|
|
'vertical-align': 'middle',
|
|
'horizontal-align': 'middle',
|
|
}}
|
|
/>
|
|
{item.name}
|
|
</Button>
|
|
</Stack.Item>
|
|
))}
|
|
</Stack>
|
|
</Section>
|
|
))
|
|
)
|
|
))}
|
|
</Section>
|
|
</Stack.Item>
|
|
<Divider vertical />
|
|
<Stack.Item width="20%">
|
|
<Section title="Selected Armament">
|
|
{armaments_list.map(armament_category => (
|
|
armament_category.subcategories.map(subcat => (
|
|
subcat.items.map(item => (
|
|
item.ref === weapon && (
|
|
<Stack vertical>
|
|
<Stack.Item>
|
|
<Box key={item.ref}>
|
|
<img
|
|
height="100%"
|
|
width="100%"
|
|
src={`data:image/jpeg;base64,${item.icon}`}
|
|
style={{
|
|
'vertical-align': 'middle',
|
|
'horizontal-align': 'middle',
|
|
'-ms-interpolation-mode': 'nearest-neighbor',
|
|
}}
|
|
/>
|
|
</Box>
|
|
</Stack.Item>
|
|
<Stack.Item>
|
|
{item.description}
|
|
</Stack.Item>
|
|
<Stack.Item
|
|
textColor={(item.quantity - item.purchased) <= 0 ? "red" : "green"}>
|
|
{'Quantity Remaining: ' + (item.quantity - item.purchased)}
|
|
</Stack.Item>
|
|
<Stack.Item
|
|
textColor={(item.cost > card_points || !card_inserted) ? "red" : "green"}>
|
|
{'Cost: ' + item.cost}
|
|
</Stack.Item>
|
|
<Stack.Item>
|
|
<Button
|
|
content="Buy"
|
|
textAlign="center"
|
|
width="100%"
|
|
disabled={item.cost > card_points
|
|
|| item.purchased >= item.quantity}
|
|
onClick={() => act('equip_item', {
|
|
armament_ref: item.ref })}
|
|
/>
|
|
</Stack.Item>
|
|
</Stack>
|
|
)
|
|
))
|
|
))
|
|
))}
|
|
</Section>
|
|
</Stack.Item>
|
|
</Stack>
|
|
</Section>
|
|
</Window.Content>
|
|
</Window>
|
|
);
|
|
};
|