mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-09 16:07:40 +00:00
VrSleeper(WIP) and hypnochair
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
52
tgui/packages/tgui/interfaces/VrSleeper.js
Normal file
52
tgui/packages/tgui/interfaces/VrSleeper.js
Normal 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
Reference in New Issue
Block a user