VrSleeper(WIP) and hypnochair

This commit is contained in:
Artur
2020-06-01 12:47:37 +03:00
parent 40e54650c7
commit 85a1d0f957
4 changed files with 56 additions and 4 deletions

View File

@@ -37,7 +37,7 @@
/obj/machinery/hypnochair/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "hypnochair", name, ui_x, ui_y, master_ui, state)
ui = new(user, src, ui_key, "HypnoChair", name, ui_x, ui_y, master_ui, state)
ui.open()
/obj/machinery/hypnochair/ui_data()

View File

@@ -86,7 +86,7 @@
/obj/machinery/vr_sleeper/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "vr_sleeper", "VR Sleeper", 475, 340, master_ui, state)
ui = new(user, src, ui_key, "VrSleeper", "VR Sleeper", 475, 340, master_ui, state)
ui.open()
/obj/machinery/vr_sleeper/ui_act(action, params)

View File

@@ -0,0 +1,52 @@
import { useBackend } from '../backend';
import { Button, ProgressBar, Section } from '../components';
import { Window } from '../layouts';
export const VrSleeper = context => {
const { act, data } = useBackend(context);
return (
<Window>
<Window.Content>
{!!data.emagged === 1 && (
<span>Safety restraints disabled.</span>
)}
{!!data.vr_avatar && (
<ProgressBar
title={"Avatar Health: "}
value={data.vr_avatar.maxhealth / 100}
ranges={{
good: [90, Infinity],
average: [70, 89],
bad: [-Infinity, 69],
}} />
)}
<Section
title="VR Commands">
buttons={(
<Button
content={data.toggle_open
? 'Open VR Sleeper'
: 'Close VR Sleeper'}
icon={data.toggle_open ? 'lock' : 'unlock'}
disabled={data.stored < data.max}
onClick={() => act('toggle_open')} />
)}
{!!data.isoccupant && (
<Button
content={'Connect to VR'}
onClick={() => act('vr_connect')}
icon={'unlock'} />
) || ("You need to be inside the VR sleeper to connect to VR"
)}
{!!data.vr_avatar && (
<Button
content={"Delete VR avatar"}
icon={'recycle'}
onClick={() => act('delete_avatar')} />
) || ("VR avatar not detected."
)}
</Section>
</Window.Content>
</Window>
);
};

File diff suppressed because one or more lines are too long