Skip to content

Commit

Permalink
fusion core ui improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Atlas committed Sep 27, 2023
1 parent 6f6367a commit a460d06
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tgui/packages/tgui/interfaces/FusionCoreControl.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { round } from '../../common/math';
import { BooleanLike } from '../../common/react';
import { useBackend } from '../backend';
import { capitalize } from '../../common/string';
import { useBackend, useSharedState } from '../backend';
import { Box, Button, Dimmer, Divider, LabeledList, NoticeBox, NumberInput, ProgressBar, Section } from '../components';
import { Window } from '../layouts';

Expand Down Expand Up @@ -29,6 +31,11 @@ type Reactant = {

export const FusionCoreControl = (props, context) => {
const { act, data } = useBackend<FusionCoreData>(context);
const [override, setOverride] = useSharedState<boolean>(
context,
'override',
false
);

return (
<Window resizable theme={data.manufacturer}>
Expand All @@ -45,7 +52,7 @@ export const FusionCoreControl = (props, context) => {
color="red"
icon="radiation"
onClick={() => act('toggle_active', { machine: core.ref })}
disabled={!core.field || !core.shutdown_safe}
disabled={!core.field || (!core.shutdown_safe && !override)}
/>
) : (
<Button
Expand All @@ -65,7 +72,13 @@ export const FusionCoreControl = (props, context) => {
{!core.shutdown_safe ? (
<NoticeBox>
Fusion core shutdown locked for safety reasons.{' '}
<Button content="Override" color="red" icon="radiation" />
<Button
content="Override"
color="red"
icon="radiation"
disabled={override}
onClick={() => setOverride(!override)}
/>
</NoticeBox>
) : (
''
Expand Down Expand Up @@ -133,7 +146,8 @@ export const FusionCoreControl = (props, context) => {
core.reactants.map((reactant) => (
<Section key={reactant.name}>
<Dimmer>
{reactant.name}: {reactant.amount}
{capitalize(reactant.name)} (
{round(reactant.amount, 0.1)} cubic units)
</Dimmer>
</Section>
))
Expand Down

0 comments on commit a460d06

Please sign in to comment.