mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 09:54:52 +00:00
Merge pull request #16038 from SandPoot/fix-lava+borgs
Deals with lava plus a lot of borg stuff
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Box, Button, LabeledList, ProgressBar, Section } from '../components';
|
||||
import { Box, Button, Icon, LabeledList, ProgressBar, Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const BorgPanel = (props, context) => {
|
||||
@@ -12,6 +12,9 @@ export const BorgPanel = (props, context) => {
|
||||
const upgrades = data.upgrades || [];
|
||||
const ais = data.ais || [];
|
||||
const laws = data.laws || [];
|
||||
|
||||
const active_upgrades = data.active_upgrades || [];
|
||||
const ka_remaining_capacity = data.ka_remaining_capacity || 0;
|
||||
return (
|
||||
<Window
|
||||
title="Borg Panel"
|
||||
@@ -97,17 +100,63 @@ export const BorgPanel = (props, context) => {
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Upgrades">
|
||||
{upgrades.map(upgrade => (
|
||||
<Button
|
||||
key={upgrade.type}
|
||||
icon={upgrade.installed ? 'check-square-o' : 'square-o'}
|
||||
content={upgrade.name}
|
||||
selected={upgrade.installed}
|
||||
onClick={() => act('toggle_upgrade', {
|
||||
upgrade: upgrade.type,
|
||||
})} />
|
||||
))}
|
||||
{upgrades.map(upgrade => {
|
||||
if (!upgrade.module_type
|
||||
|| (upgrade.module_type.includes(borg.active_module))) {
|
||||
const installedCount
|
||||
= active_upgrades.filter(installed_upgrade =>
|
||||
installed_upgrade.type === upgrade.type).length;
|
||||
const isInstalled = installedCount > 0;
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
key={upgrade.type}
|
||||
icon={isInstalled ? 'check-square-o' : 'square-o'}
|
||||
content={isInstalled ? `${upgrade.name} ${installedCount
|
||||
&& (!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
||||
&& upgrade.cost
|
||||
!== null ? `(${installedCount} installed)` : ''}`
|
||||
: upgrade.name}
|
||||
selected={isInstalled}
|
||||
onClick={() => act('toggle_upgrade', {
|
||||
upgrade: upgrade.type,
|
||||
})} />
|
||||
{
|
||||
(!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
||||
&& upgrade.cost !== null
|
||||
? (
|
||||
<>
|
||||
<Button
|
||||
content={<Icon name="plus" />}
|
||||
disabled={ka_remaining_capacity < upgrade.cost
|
||||
|| (upgrade.denied_type
|
||||
&& (installedCount === upgrade.maximum_of_type))}
|
||||
onClick={() => act('add_upgrade', {
|
||||
upgrade: upgrade.type,
|
||||
})}
|
||||
/>
|
||||
<Button
|
||||
content={<Icon name="minus" />}
|
||||
disabled={!isInstalled}
|
||||
onClick={() => act('remove_upgrade', {
|
||||
upgrade: upgrade.type,
|
||||
})}
|
||||
/>
|
||||
</>
|
||||
) : ""
|
||||
}
|
||||
</>
|
||||
);
|
||||
} })}
|
||||
</LabeledList.Item>
|
||||
{
|
||||
ka_remaining_capacity !== null
|
||||
&& (
|
||||
<LabeledList.Item label="Remaining ka capacity">
|
||||
{ka_remaining_capacity}
|
||||
</LabeledList.Item>
|
||||
)
|
||||
}
|
||||
<LabeledList.Item label="Master AI">
|
||||
{ais.map(ai => (
|
||||
<Button
|
||||
|
||||
@@ -213,13 +213,16 @@ export const NtosRobotactContent = (props, context) => {
|
||||
)}
|
||||
{tab_sub === 2 && (
|
||||
<Section>
|
||||
{borgUpgrades.map(upgrade => (
|
||||
<Box
|
||||
mb={1}
|
||||
key={upgrade}>
|
||||
{upgrade}
|
||||
</Box>
|
||||
))}
|
||||
{borgUpgrades.filter((upgrade, index, arr) =>
|
||||
arr.indexOf(upgrade) === index).map(upgrade => {
|
||||
const upgradeCount = borgUpgrades.filter(u =>
|
||||
u === upgrade).length;
|
||||
return (
|
||||
<Box mb={1} key={upgrade}>
|
||||
{upgrade} {upgradeCount > 1 ? `x${upgradeCount}` : ''}
|
||||
</Box>
|
||||
);
|
||||
})}
|
||||
</Section>
|
||||
)}
|
||||
{tab_sub === 3 && (
|
||||
|
||||
Reference in New Issue
Block a user