Fucking vr sleeper aaa

This commit is contained in:
Artur
2020-06-16 01:18:59 +03:00
parent 48c1ae36d3
commit 86331912e7
3 changed files with 41 additions and 30 deletions

View File

@@ -71,12 +71,6 @@
/obj/machinery/vr_sleeper/update_icon_state()
icon_state = "[initial(icon_state)][state_open ? "-open" : ""]"
/obj/machinery/vr_sleeper/open_machine()
if(state_open)
return
if(occupant)
SStgui.close_user_uis(occupant, src)
return ..()
/obj/machinery/vr_sleeper/MouseDrop_T(mob/target, mob/user)
if(user.lying || !iscarbon(target) || !Adjacent(target) || !user.canUseTopic(src, BE_CLOSE, TRUE, NO_TK))
@@ -119,7 +113,6 @@
if(!occupant || usr == occupant)
if(vr_mob)
cleanup_vr_mob()
SStgui.update_user_uis(occupant, src)
else
to_chat(usr, "<span class='warning'>The VR Sleeper's safeties prevent you from doing that.</span>")
. = TRUE
@@ -132,11 +125,13 @@
/obj/machinery/vr_sleeper/ui_data(mob/user)
var/list/data = list()
var/is_living
if(vr_mob && !QDELETED(vr_mob))
is_living = isliving(vr_mob)
data["can_delete_avatar"] = TRUE
data["vr_avatar"] = list("name" = vr_mob.name)
data["isliving"] = istype(vr_mob)
if(data["isliving"])
data["isliving"] = is_living
if(is_living)
var/status
switch(vr_mob.stat)
if(CONSCIOUS)
@@ -148,6 +143,11 @@
if(SOFT_CRIT)
status = "Barely Conscious"
data["vr_avatar"] += list("status" = status, "health" = vr_mob.health, "maxhealth" = vr_mob.maxHealth)
else
data["can_delete_avatar"] = FALSE
data["vr_avatar"] = FALSE
data["isliving"] = FALSE
data["toggle_open"] = state_open
data["emagged"] = you_die_in_the_game_you_die_for_real
data["isoccupant"] = (user == occupant)

View File

@@ -1,5 +1,5 @@
import { useBackend } from '../backend';
import { Button, ProgressBar, Section, Box } from '../components';
import { Button, ProgressBar, Section, Box, LabeledList } from '../components';
import { Window } from '../layouts';
export const VrSleeper = (props, context) => {
@@ -14,24 +14,36 @@ export const VrSleeper = (props, context) => {
</Box>
</Section>
)}
{!!data.vr_avatar && (
<Section title={"Virtual Avatar"}>
<ProgressBar
title={"Avatar Status: "}
value={data.vr_avatar.maxhealth / 100}
ranges={{
good: [90, Infinity],
average: [70, 89],
bad: [-Infinity, 69],
}} />
</Section>
) && (
<Section>
<Box>
No Avatar detected
</Box>
</Section>
)}
<Section title={"Virtual Avatar"}>
{!!data.vr_avatar && (
<LabeledList>
<LabeledList.Item
label={"Name"} >
{data.vr_avatar.name}
</LabeledList.Item>
<LabeledList.Item
label={"Status"} >
{data.vr_avatar.status}
</LabeledList.Item>
{!!data.vr_avatar && (
<LabeledList.Item
label={"Health"} >
{<ProgressBar
value={data.vr_avatar.health / data.vr_avatar.maxhealth}
ranges={{
good: [0.9, Infinity],
average: [0.7, 0.8],
bad: [-Infinity, 0.5],
}} />}
</LabeledList.Item>
)}
</LabeledList>
) || (
"No Virtual Avatar detected"
)}
</Section>
<Section title="VR Commands">
<Button
content={data.toggle_open
@@ -59,7 +71,6 @@ export const VrSleeper = (props, context) => {
icon={'recycle'}
onClick={() => {
act('delete_avatar');
act('tgui:update');
}} />
)}
</Section>

File diff suppressed because one or more lines are too long