mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
[TGUI] BotStatus.js for tidier TGUI code for bots (#21631)
* Cleanbot merge * botstatus update * TGUI Bundle * TGUI Bundle * bundle
This commit is contained in:
@@ -187,8 +187,10 @@
|
||||
do_sparks(3, 1, src)
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/bot/cleanbot/show_controls(mob/M)
|
||||
ui_interact(M)
|
||||
//TGUI
|
||||
|
||||
/mob/living/simple_animal/bot/cleanbot/show_controls(mob/user)
|
||||
ui_interact(user)
|
||||
|
||||
/mob/living/simple_animal/bot/cleanbot/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
@@ -238,7 +240,7 @@
|
||||
if("ejectpai")
|
||||
ejectpai()
|
||||
|
||||
|
||||
//END OF TGUI
|
||||
|
||||
/mob/living/simple_animal/bot/cleanbot/UnarmedAttack(atom/A)
|
||||
if(istype(A,/obj/effect/decal/cleanable))
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Fragment } from 'inferno';
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, LabeledList, NoticeBox, Section, Box } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
import { BotStatus } from './common/BotStatus';
|
||||
|
||||
export const BotClean = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
@@ -20,61 +21,7 @@ export const BotClean = (props, context) => {
|
||||
return (
|
||||
<Window>
|
||||
<Window.Content scrollable>
|
||||
<NoticeBox>
|
||||
Swipe an ID card to {locked ? 'unlock' : 'lock'} this interface.
|
||||
</NoticeBox>
|
||||
<Section title="General Settings">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Status">
|
||||
<Button
|
||||
icon={on ? 'power-off' : 'times'}
|
||||
content={on ? 'On' : 'Off'}
|
||||
selected={on}
|
||||
disabled={noaccess}
|
||||
onClick={() => act('power')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Patrol">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
checked={autopatrol}
|
||||
content="Auto Patrol"
|
||||
disabled={noaccess}
|
||||
onClick={() => act('autopatrol')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
{!!maintpanel && (
|
||||
<LabeledList.Item label="Maintenance Panel">
|
||||
<Box color="bad">Panel Open!</Box>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Safety System">
|
||||
<Box color={emagged ? 'bad' : 'good'}>
|
||||
{emagged ? 'DISABLED!' : 'Enabled'}
|
||||
</Box>
|
||||
</LabeledList.Item>
|
||||
{!!canhack && (
|
||||
<LabeledList.Item label="Hacking">
|
||||
<Button
|
||||
icon="terminal"
|
||||
content={emagged ? 'Restore Safties' : 'Hack'}
|
||||
disabled={noaccess}
|
||||
color="bad"
|
||||
onClick={() => act('hack')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Remote Access">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
checked={!remote_disabled}
|
||||
content="AI Remote Control"
|
||||
disabled={noaccess}
|
||||
onClick={() => act('disableremote')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
<BotStatus />
|
||||
<Section title="Cleaning Settings">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
|
||||
@@ -2,18 +2,12 @@ import { Fragment } from 'inferno';
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, LabeledList, NoticeBox, Section, Box } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
import { BotStatus } from './common/BotStatus';
|
||||
|
||||
export const BotSecurity = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
locked,
|
||||
noaccess,
|
||||
maintpanel,
|
||||
on,
|
||||
autopatrol,
|
||||
canhack,
|
||||
emagged,
|
||||
remote_disabled,
|
||||
painame,
|
||||
check_id,
|
||||
check_weapons,
|
||||
@@ -24,61 +18,7 @@ export const BotSecurity = (props, context) => {
|
||||
return (
|
||||
<Window>
|
||||
<Window.Content scrollable>
|
||||
<NoticeBox>
|
||||
Swipe an ID card to {locked ? 'unlock' : 'lock'} this interface.
|
||||
</NoticeBox>
|
||||
<Section title="General Settings">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Status">
|
||||
<Button
|
||||
icon={on ? 'power-off' : 'times'}
|
||||
content={on ? 'On' : 'Off'}
|
||||
selected={on}
|
||||
disabled={noaccess}
|
||||
onClick={() => act('power')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Patrol">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
checked={autopatrol}
|
||||
content="Auto Patrol"
|
||||
disabled={noaccess}
|
||||
onClick={() => act('autopatrol')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
{!!maintpanel && (
|
||||
<LabeledList.Item label="Maintenance Panel">
|
||||
<Box color="bad">Panel Open!</Box>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Safety System">
|
||||
<Box color={emagged ? 'bad' : 'good'}>
|
||||
{emagged ? 'DISABLED!' : 'Enabled'}
|
||||
</Box>
|
||||
</LabeledList.Item>
|
||||
{!!canhack && (
|
||||
<LabeledList.Item label="Hacking">
|
||||
<Button
|
||||
icon="terminal"
|
||||
content={emagged ? 'Restore Safties' : 'Hack'}
|
||||
disabled={noaccess}
|
||||
color="bad"
|
||||
onClick={() => act('hack')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Remote Access">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
checked={!remote_disabled}
|
||||
content="AI Remote Control"
|
||||
disabled={noaccess}
|
||||
onClick={() => act('disableremote')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
<BotStatus />
|
||||
<Section title="Who To Arrest">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// ********* COMMON STATUS - GENERAL SETTINGS PAGE FOR BOTS *********
|
||||
import { useBackend } from '../../backend';
|
||||
import {
|
||||
Button,
|
||||
LabeledList,
|
||||
NoticeBox,
|
||||
Section,
|
||||
Box,
|
||||
} from '../../components';
|
||||
|
||||
|
||||
export const BotStatus = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
locked,
|
||||
noaccess,
|
||||
maintpanel,
|
||||
on,
|
||||
autopatrol,
|
||||
canhack,
|
||||
emagged,
|
||||
remote_disabled,
|
||||
} = data;
|
||||
return (
|
||||
<>
|
||||
<NoticeBox>
|
||||
Swipe an ID card to {locked ? 'unlock' : 'lock'} this interface.
|
||||
</NoticeBox>
|
||||
<Section title="General Settings">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Status">
|
||||
<Button
|
||||
icon={on ? 'power-off' : 'times'}
|
||||
content={on ? 'On' : 'Off'}
|
||||
selected={on}
|
||||
disabled={noaccess}
|
||||
onClick={() => act('power')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
{autopatrol !== null &&
|
||||
<LabeledList.Item label="Patrol">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
checked={autopatrol}
|
||||
content="Auto Patrol"
|
||||
disabled={noaccess}
|
||||
onClick={() => act('autopatrol')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
}
|
||||
{!!maintpanel && (
|
||||
<LabeledList.Item label="Maintenance Panel">
|
||||
<Box color="bad">Panel Open!</Box>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Safety System">
|
||||
<Box color={emagged ? 'bad' : 'good'}>
|
||||
{emagged ? 'DISABLED!' : 'Enabled'}
|
||||
</Box>
|
||||
</LabeledList.Item>
|
||||
{!!canhack && (
|
||||
<LabeledList.Item label="Hacking">
|
||||
<Button
|
||||
icon="terminal"
|
||||
content={emagged ? 'Restore Safties' : 'Hack'}
|
||||
disabled={noaccess}
|
||||
color="bad"
|
||||
onClick={() => act('hack')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Remote Access">
|
||||
<Button.Checkbox
|
||||
fluid
|
||||
checked={!remote_disabled}
|
||||
content="AI Remote Control"
|
||||
disabled={noaccess}
|
||||
onClick={() => act('disableremote')}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
</>
|
||||
);
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user