diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm
index a64f98acd90..63b1935cfee 100644
--- a/code/modules/mining/mint.dm
+++ b/code/modules/mining/mint.dm
@@ -87,19 +87,18 @@
/obj/machinery/mineral/mint/ui_data()
var/list/data = list()
- var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
+ data["inserted_materials"] = list()
+ data["chosen_material"] = null
+ var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/datum/material/inserted_material in materials.materials)
var/amount = materials.get_material_amount(inserted_material)
-
if(!amount)
continue
-
data["inserted_materials"] += list(list(
"material" = inserted_material.name,
- "amount" = amount
+ "amount" = amount,
))
-
if(chosen == inserted_material)
data["chosen_material"] = inserted_material.name
@@ -109,25 +108,25 @@
return data;
/obj/machinery/mineral/mint/ui_act(action, params, datum/tgui/ui)
-
. = ..()
if(.)
return
-
- switch(action)
- if ("startpress")
- if (!processing)
- produced_coins = 0
- processing = TRUE
- begin_processing()
- if ("stoppress")
- processing = FALSE
- end_processing()
- if ("changematerial")
- var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
- for(var/datum/material/mat in materials.materials)
- if (params["material_name"] == mat.name)
- chosen = mat
+ if(action == "startpress")
+ if (!processing)
+ produced_coins = 0
+ processing = TRUE
+ begin_processing()
+ return TRUE
+ if (action == "stoppress")
+ processing = FALSE
+ end_processing()
+ return TRUE
+ if (action == "changematerial")
+ var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
+ for(var/datum/material/mat in materials.materials)
+ if (params["material_name"] == mat.name)
+ chosen = mat
+ return TRUE
/obj/machinery/mineral/mint/proc/create_coins()
var/turf/T = get_step(src,output_dir)
diff --git a/tgui/packages/tgui/interfaces/AirAlarm.js b/tgui/packages/tgui/interfaces/AirAlarm.js
index c451c81166a..5d5755ba067 100644
--- a/tgui/packages/tgui/interfaces/AirAlarm.js
+++ b/tgui/packages/tgui/interfaces/AirAlarm.js
@@ -13,10 +13,7 @@ export const AirAlarm = (props, context) => {
return (
- act('lock')} />
+
{!locked && (
diff --git a/tgui/packages/tgui/interfaces/Apc.js b/tgui/packages/tgui/interfaces/Apc.js
index 0c5df54f2b0..72cee0bf83e 100644
--- a/tgui/packages/tgui/interfaces/Apc.js
+++ b/tgui/packages/tgui/interfaces/Apc.js
@@ -85,10 +85,7 @@ const ApcContent = (props, context) => {
return (
- act('lock')} />
+
{
act('lock')}
accessText="a QM-level ID card" />
{!data.locked && (
diff --git a/tgui/packages/tgui/interfaces/MechBayPowerConsole.js b/tgui/packages/tgui/interfaces/MechBayPowerConsole.js
index 11c4d2ec110..bed15d261e0 100644
--- a/tgui/packages/tgui/interfaces/MechBayPowerConsole.js
+++ b/tgui/packages/tgui/interfaces/MechBayPowerConsole.js
@@ -1,58 +1,73 @@
import { useBackend } from '../backend';
import { AnimatedNumber, Button, LabeledList, NoticeBox, ProgressBar, Section } from '../components';
+import { Window } from '../layouts';
-export const MechBayPowerConsole = props => {
- const { act, data } = useBackend(props);
+export const MechBayPowerConsole = (props, context) => {
+ const { act, data } = useBackend(context);
const { recharge_port } = data;
const mech = recharge_port && recharge_port.mech;
const cell = mech && mech.cell;
return (
- act('reconnect')} />
- )}>
-
-
- {!recharge_port && (
- No power port detected. Please re-sync.
- ) || !mech && (
- No mech detected.
- ) || (
-
- )}
-
-
- {!recharge_port && (
- No power port detected. Please re-sync.
- ) || !mech && (
- No mech detected.
- ) || !cell && (
- No cell is installed.
- ) || (
-
-
- {' / ' + cell.maxcharge}
-
- )}
-
-
-
+
+
+ act('reconnect')} />
+ )}>
+
+
+ {!recharge_port && (
+
+ No power port detected. Please re-sync.
+
+ ) || !mech && (
+
+ No mech detected.
+
+ ) || (
+
+ )}
+
+
+ {!recharge_port && (
+
+ No power port detected. Please re-sync.
+
+ ) || !mech && (
+
+ No mech detected.
+
+ ) || !cell && (
+
+ No cell is installed.
+
+ ) || (
+
+
+ {' / ' + cell.maxcharge}
+
+ )}
+
+
+
+
+
);
};
diff --git a/tgui/packages/tgui/interfaces/MiningVendor.js b/tgui/packages/tgui/interfaces/MiningVendor.js
index f8984aae33a..950deb196ba 100644
--- a/tgui/packages/tgui/interfaces/MiningVendor.js
+++ b/tgui/packages/tgui/interfaces/MiningVendor.js
@@ -1,64 +1,64 @@
-import { Fragment } from 'inferno';
-import { act } from '../byond';
-import { Section, Box, Button, Table } from '../components';
import { classes } from 'common/react';
+import { useBackend } from '../backend';
+import { Box, Button, Section, Table } from '../components';
+import { Window } from '../layouts';
-export const MiningVendor = props => {
- const { state } = props;
- const { config, data } = state;
- const { ref } = config;
+export const MiningVendor = (props, context) => {
+ const { act, data } = useBackend(context);
let inventory = [
...data.product_records,
];
return (
-
-
- {data.user && (
-
- Welcome, {data.user.name || "Unknown"},
- {' '}
- {data.user.job || "Unemployed"}!
-
- Your balance is {data.user.points} mining points.
-
- ) || (
-
- No registered ID card!
- Please contact your local HoP!
-
- )}
-
-
-
- {inventory.map((product => {
- return (
-
-
-
- {' '}{product.name}
-
-
-
-
- );
- }))}
-
-
-
+
+
+
+ {data.user && (
+
+ Welcome, {data.user.name || "Unknown"},
+ {' '}
+ {data.user.job || "Unemployed"}!
+
+ Your balance is {data.user.points} mining points.
+
+ ) || (
+
+ No registered ID card!
+ Please contact your local HoP!
+
+ )}
+
+
+
+ {inventory.map((product => {
+ return (
+
+
+
+ {' '}{product.name}
+
+
+
+
+ );
+ }))}
+
+
+
+
);
};
diff --git a/tgui/packages/tgui/interfaces/Mint.js b/tgui/packages/tgui/interfaces/Mint.js
index 6c715bc5da2..8120f25642a 100644
--- a/tgui/packages/tgui/interfaces/Mint.js
+++ b/tgui/packages/tgui/interfaces/Mint.js
@@ -1,47 +1,45 @@
-import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Button, LabeledList, Section } from '../components';
+import { Window } from '../layouts';
-export const Mint = props => {
- const { act, data } = useBackend(props);
+export const Mint = (props, context) => {
+ const { act, data } = useBackend(context);
const inserted_materials = data.inserted_materials || [];
return (
-
- act(data.processing
- ? 'stoppress'
- : 'startpress')}
- />
- }>
-
- {inserted_materials.map(material => (
- act('changematerial', {
- material_name: material.material,
- })} />
- )}>
- {material.amount} cm³
-
- ))}
-
-
-
- Pressed {data.produced_coins} coins this cycle.
-
-
+
+
+ act(data.processing
+ ? 'stoppress'
+ : 'startpress')} />
+ }>
+
+ {inserted_materials.map(material => (
+ act('changematerial', {
+ material_name: material.material,
+ })} />
+ )}>
+ {material.amount} cm³
+
+ ))}
+
+
+
+ Pressed {data.produced_coins} coins this cycle.
+
+
+
);
};
diff --git a/tgui/packages/tgui/interfaces/Mule.js b/tgui/packages/tgui/interfaces/Mule.js
index d4dfddd40e4..b6ae6c1f244 100644
--- a/tgui/packages/tgui/interfaces/Mule.js
+++ b/tgui/packages/tgui/interfaces/Mule.js
@@ -1,15 +1,12 @@
-import { useBackend } from '../backend';
-import { Section, LabeledList, Button, NumberInput, ProgressBar, Grid, Input, Dropdown } from '../components';
import { Fragment } from 'inferno';
+import { useBackend } from '../backend';
+import { Button, Dropdown, Grid, Input, LabeledList, ProgressBar, Section, Flex } from '../components';
+import { Window } from '../layouts';
import { InterfaceLockNoticeBox } from './common/InterfaceLockNoticeBox';
-export const Mule = props => {
- const { act, data } = useBackend(props);
-
- const locked = data.locked && !data.siliconUser;
-
+export const Mule = (props, context) => {
+ const { act, data } = useBackend(context);
const {
- siliconUser,
on,
cell,
cellPercent,
@@ -25,123 +22,116 @@ export const Mule = props => {
id,
destinations = [],
} = data;
-
+ const locked = data.locked && !data.siliconUser;
return (
-
-
- act('power')}
- />
- )} >
-
-
-
-
-
- {mode}
-
-
-
-
-
-
- {load || 'None'}
-
-
-
-
-
- {!locked && (
+
+
+
- {!!load && (
-
+ title="Status"
+ minHeight="110px"
+ buttons={!locked && (
+ act('power')} />
)}>
-
-
- act('setid', { value: value })}
- />
-
-
- act('destination', { value: val })}
- />
- act('stop')} />
- act('go')} />
-
-
- act('destination', { value: val })} />
- act('home')} />
-
-
- act('autored')} />
-
- act('autopick')}
- />
-
- act('report')}
- />
-
-
+
+
+
+
+
+ {mode}
+
+
+
+
+
+
+ {load || 'None'}
+
+
+
+
- )}
-
+ {!locked && (
+
+ )}
+
+
);
};
diff --git a/tgui/packages/tgui/interfaces/ScannerGate.js b/tgui/packages/tgui/interfaces/ScannerGate.js
index 082d287a5ff..e390284d574 100644
--- a/tgui/packages/tgui/interfaces/ScannerGate.js
+++ b/tgui/packages/tgui/interfaces/ScannerGate.js
@@ -74,7 +74,6 @@ export const ScannerGate = (props, context) => {
act('toggle_lock')} />
{!data.locked && (
diff --git a/tgui/packages/tgui/interfaces/Vending.js b/tgui/packages/tgui/interfaces/Vending.js
index 5b51af0cda5..0a90e8a7370 100644
--- a/tgui/packages/tgui/interfaces/Vending.js
+++ b/tgui/packages/tgui/interfaces/Vending.js
@@ -60,12 +60,14 @@ const VendingRow = (props, context) => {
{custom && (
act('dispense', {
'item': product.name,
})} />
) || (
{
+/**
+ * This component by expects the following fields to be returned
+ * from ui_data:
+ *
+ * - siliconUser: boolean
+ * - locked: boolean
+ *
+ * And expects the following ui_act action to be implemented:
+ *
+ * - lock - for toggling the lock as a silicon user.
+ *
+ * All props can be redefined if you want custom behavior, but
+ * it's preferred to stick to defaults.
+ */
+export const InterfaceLockNoticeBox = (props, context) => {
+ const { act, data } = useBackend(context);
const {
- siliconUser,
- locked,
- onLockStatusChange,
- accessText,
+ siliconUser = data.siliconUser,
+ locked = data.locked,
+ onLockStatusChange = () => act('lock'),
+ accessText = 'an ID card',
} = props;
// For silicon users
if (siliconUser) {
@@ -35,7 +51,7 @@ export const InterfaceLockNoticeBox = props => {
// For everyone else
return (
- Swipe {accessText || 'an ID card'}{' '}
+ Swipe {accessText}{' '}
to {locked ? 'unlock' : 'lock'} this interface.
);
diff --git a/tgui/packages/tgui/routes.js b/tgui/packages/tgui/routes.js
index df5d789b414..3d9207fcf55 100644
--- a/tgui/packages/tgui/routes.js
+++ b/tgui/packages/tgui/routes.js
@@ -40,22 +40,3 @@ export const getRoutedComponent = state => {
}
return Component;
};
-
-// const ROUTES = {
-// mech_bay_power_console: {
-// component: () => MechBayPowerConsole,
-// scrollable: false,
-// },
-// mining_vendor: {
-// component: () => MiningVendor,
-// scrollable: true,
-// },
-// mint: {
-// component: () => Mint,
-// scrollable: false,
-// },
-// mulebot: {
-// component: () => Mule,
-// scrollable: false,
-// },
-// };