mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
tgui-next: Point Claim Console (#48390)
* First draft, basic convert, routes * Polish, fixes and tweaks * Review changes * Small gravgen fix
This commit is contained in:
@@ -8,8 +8,8 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
ui_x = 450
|
||||
ui_y = 475
|
||||
ui_x = 315
|
||||
ui_y = 430
|
||||
|
||||
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
|
||||
var/machinedir = SOUTH
|
||||
@@ -50,7 +50,6 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
if(obj_flags & EMAGGED)
|
||||
can_go_home = TRUE
|
||||
|
||||
data["status_info"] = "No Prisoner ID detected."
|
||||
var/obj/item/card/id/I = user.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
@@ -60,6 +59,9 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
data["status_info"] = "Goal met!"
|
||||
else
|
||||
data["status_info"] = "You are [(P.goal - P.points)] points away."
|
||||
else
|
||||
data["status_info"] = "No Prisoner ID detected."
|
||||
data["id_points"] = 0
|
||||
|
||||
if(stacking_machine)
|
||||
data["unclaimed_points"] = stacking_machine.points
|
||||
@@ -81,6 +83,7 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
P.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "<span class='notice'>Points transferred.</span>")
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(usr, "<span class='alert'>No valid id for point transfer detected.</span>")
|
||||
if("move_shuttle")
|
||||
@@ -99,6 +102,7 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
Radio.set_frequency(FREQ_SECURITY)
|
||||
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
|
||||
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
|
||||
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
|
||||
@@ -15,7 +15,9 @@ export const GravityGenerator = props => {
|
||||
<Fragment>
|
||||
<Section>
|
||||
{!operational && (
|
||||
<NoticeBox>No data available</NoticeBox>
|
||||
<NoticeBox textAlign="center">
|
||||
No data available
|
||||
</NoticeBox>
|
||||
) || (
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Breaker">
|
||||
@@ -64,7 +66,8 @@ export const GravityGenerator = props => {
|
||||
<NoticeBox textAlign="center">
|
||||
WARNING - Radiation detected
|
||||
</NoticeBox>
|
||||
) || (
|
||||
)}
|
||||
{operational && charging_state === 0 && (
|
||||
<NoticeBox textAlign="center">
|
||||
No radiation detected
|
||||
</NoticeBox>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { toTitleCase } from 'common/string';
|
||||
import { Fragment } from 'inferno';
|
||||
import { useBackend } from '../backend';
|
||||
import { Box, Button, LabeledList, Section, Table } from '../components';
|
||||
|
||||
export const LaborClaimConsole = props => {
|
||||
const { act, data } = useBackend(props);
|
||||
const {
|
||||
can_go_home,
|
||||
id_points,
|
||||
ores,
|
||||
status_info,
|
||||
unclaimed_points,
|
||||
} = data;
|
||||
return (
|
||||
<Fragment>
|
||||
<Section>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Status">
|
||||
{status_info}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Shuttle controls">
|
||||
<Button
|
||||
content="Move shuttle"
|
||||
disabled={!can_go_home}
|
||||
onClick={() => act('move_shuttle')} />
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Points">
|
||||
{id_points}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item
|
||||
label="Unclaimed points"
|
||||
buttons={(
|
||||
<Button
|
||||
content="Claim points"
|
||||
disabled={!unclaimed_points}
|
||||
onClick={() => act('claim_points')} />
|
||||
)}>
|
||||
{unclaimed_points}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
<Section title="Material values">
|
||||
<Table>
|
||||
<Table.Row header>
|
||||
<Table.Cell>
|
||||
Material
|
||||
</Table.Cell>
|
||||
<Table.Cell collapsing textAlign="right">
|
||||
Value
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
{ores.map(ore => (
|
||||
<Table.Row key={ore.ore}>
|
||||
<Table.Cell>
|
||||
{toTitleCase(ore.ore)}
|
||||
</Table.Cell>
|
||||
<Table.Cell collapsing textAlign="right">
|
||||
<Box color="label" inline>
|
||||
{ore.value}
|
||||
</Box>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
</Section>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -42,6 +42,7 @@ import { GulagItemReclaimer } from './interfaces/GulagItemReclaimer';
|
||||
import { Holodeck } from './interfaces/Holodeck';
|
||||
import { ImplantChair } from './interfaces/ImplantChair';
|
||||
import { KeycardAuth } from './interfaces/KeycardAuth';
|
||||
import { LaborClaimConsole } from './interfaces/LaborClaimConsole';
|
||||
import { LanguageMenu } from './interfaces/LanguageMenu';
|
||||
import { MechBayPowerConsole } from './interfaces/MechBayPowerConsole';
|
||||
import { MedicalKiosk } from './interfaces/MedicalKiosk';
|
||||
@@ -268,6 +269,10 @@ const ROUTES = {
|
||||
component: () => KeycardAuth,
|
||||
scrollable: false,
|
||||
},
|
||||
labor_claim_console: {
|
||||
component: () => LaborClaimConsole,
|
||||
scrollable: false,
|
||||
},
|
||||
language_menu: {
|
||||
component: () => LanguageMenu,
|
||||
scrollable: true,
|
||||
|
||||
Reference in New Issue
Block a user