mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +00:00
Fixes APC and makes sleeper work again
This commit is contained in:
@@ -854,7 +854,7 @@
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "Apc", name, 450, 460, master_ui, state)
|
||||
ui = new(user, src, ui_key, "Apc", name, 480, 460, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/apc/ui_data(mob/user)
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
import { Fragment } from 'inferno';
|
||||
import { useBackend } from '../backend';
|
||||
import { Box, Button, LabeledList, NoticeBox, ProgressBar, Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
import { InterfaceLockNoticeBox } from './common/InterfaceLockNoticeBox';
|
||||
|
||||
export const Apc = props => {
|
||||
const { act, data } = useBackend(props);
|
||||
const locked = data.locked && !data.siliconUser;
|
||||
export const Apc = (props, context) => {
|
||||
return (
|
||||
<Window resizable>
|
||||
<Window.Content scrollable>
|
||||
<ApcContent />
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
|
||||
const powerStatusMap = {
|
||||
2: {
|
||||
color: 'good',
|
||||
@@ -23,6 +31,7 @@ export const Apc = props => {
|
||||
chargingText: 'Not Charging',
|
||||
},
|
||||
};
|
||||
|
||||
const malfMap = {
|
||||
1: {
|
||||
icon: 'terminal',
|
||||
@@ -45,6 +54,10 @@ export const Apc = props => {
|
||||
action: 'occupy',
|
||||
},
|
||||
};
|
||||
|
||||
const ApcContent = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const locked = data.locked && !data.siliconUser;
|
||||
const externalPowerStatus = powerStatusMap[data.externalPower]
|
||||
|| powerStatusMap[0];
|
||||
const chargingStatus = powerStatusMap[data.chargingStatus]
|
||||
@@ -52,7 +65,6 @@ export const Apc = props => {
|
||||
const channelArray = data.powerChannels || [];
|
||||
const malfStatus = malfMap[data.malfStatus] || malfMap[0];
|
||||
const adjustedCellChange = data.powerCellStatus / 100;
|
||||
|
||||
if (data.failTime > 0) {
|
||||
return (
|
||||
<NoticeBox>
|
||||
@@ -73,10 +85,7 @@ export const Apc = props => {
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<InterfaceLockNoticeBox
|
||||
siliconUser={data.siliconUser}
|
||||
locked={data.locked}
|
||||
onLockStatusChange={() => act('lock')} />
|
||||
<InterfaceLockNoticeBox />
|
||||
<Section title="Power Status">
|
||||
<LabeledList>
|
||||
<LabeledList.Item
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Box, Section, LabeledList, Button, ProgressBar, AnimatedNumber } from '../components';
|
||||
import { Fragment } from 'inferno';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const Sleeper = props => {
|
||||
const { act, data } = useBackend(props);
|
||||
export const Sleeper = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
occupied,
|
||||
open,
|
||||
occupant = [],
|
||||
occupant = {},
|
||||
occupied,
|
||||
} = data;
|
||||
|
||||
const preSortChems = data.chems || [];
|
||||
@@ -69,7 +71,7 @@ export const Sleeper = props => {
|
||||
</Box>
|
||||
)}>
|
||||
{!!occupied && (
|
||||
<Window>
|
||||
<Fragment>
|
||||
<ProgressBar
|
||||
value={occupant.health}
|
||||
minValue={occupant.minHealth}
|
||||
@@ -112,7 +114,7 @@ export const Sleeper = props => {
|
||||
{occupant.brainLoss ? 'Abnormal' : 'Healthy'}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Window>
|
||||
</Fragment>
|
||||
)}
|
||||
</Section>
|
||||
<Section title="Chemical Analysis">
|
||||
@@ -178,6 +180,5 @@ export const Sleeper = props => {
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user