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)
|
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||||
|
|
||||||
if(!ui)
|
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()
|
ui.open()
|
||||||
|
|
||||||
/obj/machinery/power/apc/ui_data(mob/user)
|
/obj/machinery/power/apc/ui_data(mob/user)
|
||||||
|
|||||||
@@ -1,50 +1,63 @@
|
|||||||
import { Fragment } from 'inferno';
|
import { Fragment } from 'inferno';
|
||||||
import { useBackend } from '../backend';
|
import { useBackend } from '../backend';
|
||||||
import { Box, Button, LabeledList, NoticeBox, ProgressBar, Section } from '../components';
|
import { Box, Button, LabeledList, NoticeBox, ProgressBar, Section } from '../components';
|
||||||
|
import { Window } from '../layouts';
|
||||||
import { InterfaceLockNoticeBox } from './common/InterfaceLockNoticeBox';
|
import { InterfaceLockNoticeBox } from './common/InterfaceLockNoticeBox';
|
||||||
|
|
||||||
export const Apc = props => {
|
export const Apc = (props, context) => {
|
||||||
const { act, data } = useBackend(props);
|
return (
|
||||||
|
<Window resizable>
|
||||||
|
<Window.Content scrollable>
|
||||||
|
<ApcContent />
|
||||||
|
</Window.Content>
|
||||||
|
</Window>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const powerStatusMap = {
|
||||||
|
2: {
|
||||||
|
color: 'good',
|
||||||
|
externalPowerText: 'External Power',
|
||||||
|
chargingText: 'Fully Charged',
|
||||||
|
},
|
||||||
|
1: {
|
||||||
|
color: 'average',
|
||||||
|
externalPowerText: 'Low External Power',
|
||||||
|
chargingText: 'Charging',
|
||||||
|
},
|
||||||
|
0: {
|
||||||
|
color: 'bad',
|
||||||
|
externalPowerText: 'No External Power',
|
||||||
|
chargingText: 'Not Charging',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const malfMap = {
|
||||||
|
1: {
|
||||||
|
icon: 'terminal',
|
||||||
|
content: 'Override Programming',
|
||||||
|
action: 'hack',
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
icon: 'caret-square-down',
|
||||||
|
content: 'Shunt Core Process',
|
||||||
|
action: 'occupy',
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
icon: 'caret-square-left',
|
||||||
|
content: 'Return to Main Core',
|
||||||
|
action: 'deoccupy',
|
||||||
|
},
|
||||||
|
4: {
|
||||||
|
icon: 'caret-square-down',
|
||||||
|
content: 'Shunt Core Process',
|
||||||
|
action: 'occupy',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const ApcContent = (props, context) => {
|
||||||
|
const { act, data } = useBackend(context);
|
||||||
const locked = data.locked && !data.siliconUser;
|
const locked = data.locked && !data.siliconUser;
|
||||||
const powerStatusMap = {
|
|
||||||
2: {
|
|
||||||
color: 'good',
|
|
||||||
externalPowerText: 'External Power',
|
|
||||||
chargingText: 'Fully Charged',
|
|
||||||
},
|
|
||||||
1: {
|
|
||||||
color: 'average',
|
|
||||||
externalPowerText: 'Low External Power',
|
|
||||||
chargingText: 'Charging',
|
|
||||||
},
|
|
||||||
0: {
|
|
||||||
color: 'bad',
|
|
||||||
externalPowerText: 'No External Power',
|
|
||||||
chargingText: 'Not Charging',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const malfMap = {
|
|
||||||
1: {
|
|
||||||
icon: 'terminal',
|
|
||||||
content: 'Override Programming',
|
|
||||||
action: 'hack',
|
|
||||||
},
|
|
||||||
2: {
|
|
||||||
icon: 'caret-square-down',
|
|
||||||
content: 'Shunt Core Process',
|
|
||||||
action: 'occupy',
|
|
||||||
},
|
|
||||||
3: {
|
|
||||||
icon: 'caret-square-left',
|
|
||||||
content: 'Return to Main Core',
|
|
||||||
action: 'deoccupy',
|
|
||||||
},
|
|
||||||
4: {
|
|
||||||
icon: 'caret-square-down',
|
|
||||||
content: 'Shunt Core Process',
|
|
||||||
action: 'occupy',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const externalPowerStatus = powerStatusMap[data.externalPower]
|
const externalPowerStatus = powerStatusMap[data.externalPower]
|
||||||
|| powerStatusMap[0];
|
|| powerStatusMap[0];
|
||||||
const chargingStatus = powerStatusMap[data.chargingStatus]
|
const chargingStatus = powerStatusMap[data.chargingStatus]
|
||||||
@@ -52,7 +65,6 @@ export const Apc = props => {
|
|||||||
const channelArray = data.powerChannels || [];
|
const channelArray = data.powerChannels || [];
|
||||||
const malfStatus = malfMap[data.malfStatus] || malfMap[0];
|
const malfStatus = malfMap[data.malfStatus] || malfMap[0];
|
||||||
const adjustedCellChange = data.powerCellStatus / 100;
|
const adjustedCellChange = data.powerCellStatus / 100;
|
||||||
|
|
||||||
if (data.failTime > 0) {
|
if (data.failTime > 0) {
|
||||||
return (
|
return (
|
||||||
<NoticeBox>
|
<NoticeBox>
|
||||||
@@ -73,10 +85,7 @@ export const Apc = props => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<InterfaceLockNoticeBox
|
<InterfaceLockNoticeBox />
|
||||||
siliconUser={data.siliconUser}
|
|
||||||
locked={data.locked}
|
|
||||||
onLockStatusChange={() => act('lock')} />
|
|
||||||
<Section title="Power Status">
|
<Section title="Power Status">
|
||||||
<LabeledList>
|
<LabeledList>
|
||||||
<LabeledList.Item
|
<LabeledList.Item
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import { useBackend } from '../backend';
|
import { useBackend } from '../backend';
|
||||||
import { Box, Section, LabeledList, Button, ProgressBar, AnimatedNumber } from '../components';
|
import { Box, Section, LabeledList, Button, ProgressBar, AnimatedNumber } from '../components';
|
||||||
|
import { Fragment } from 'inferno';
|
||||||
import { Window } from '../layouts';
|
import { Window } from '../layouts';
|
||||||
|
|
||||||
export const Sleeper = props => {
|
export const Sleeper = (props, context) => {
|
||||||
const { act, data } = useBackend(props);
|
const { act, data } = useBackend(context);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
occupied,
|
|
||||||
open,
|
open,
|
||||||
occupant = [],
|
occupant = {},
|
||||||
|
occupied,
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
const preSortChems = data.chems || [];
|
const preSortChems = data.chems || [];
|
||||||
@@ -69,7 +71,7 @@ export const Sleeper = props => {
|
|||||||
</Box>
|
</Box>
|
||||||
)}>
|
)}>
|
||||||
{!!occupied && (
|
{!!occupied && (
|
||||||
<Window>
|
<Fragment>
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
value={occupant.health}
|
value={occupant.health}
|
||||||
minValue={occupant.minHealth}
|
minValue={occupant.minHealth}
|
||||||
@@ -112,7 +114,7 @@ export const Sleeper = props => {
|
|||||||
{occupant.brainLoss ? 'Abnormal' : 'Healthy'}
|
{occupant.brainLoss ? 'Abnormal' : 'Healthy'}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
</LabeledList>
|
</LabeledList>
|
||||||
</Window>
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
</Section>
|
</Section>
|
||||||
<Section title="Chemical Analysis">
|
<Section title="Chemical Analysis">
|
||||||
@@ -178,6 +180,5 @@ export const Sleeper = props => {
|
|||||||
</Section>
|
</Section>
|
||||||
</Window.Content>
|
</Window.Content>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user