Files
GS13NG/tgui/src/interfaces/vr_sleeper.ract
T
2020-01-15 09:49:18 +02:00

57 lines
1.5 KiB
Plaintext

<script>
component.exports = {
data: {
healthState(health) {
let maxhealth = this.get('data.vr_avatar.maxhealth')
if(health > (maxhealth/1.5)) return 'good'
else if(health > (maxhealth/3)) return 'average'
else return 'bad'
}
}
}
</script>
<ui-display>
{{#if data.emagged}}
<ui-notice>
<span>Safety restraints disabled.</span>
</ui-notice>
{{/if}}
{{#if data.vr_avatar}}
<ui-display title='Virtual Avatar'>
<ui-section label='Name'>
{{data.vr_avatar.name}}
</ui-section>
{{#if data.isliving}}
<ui-section label='Status'>
{{data.vr_avatar.status}}
</ui-section>
<ui-section label='Health'>
<ui-bar min='0' max='{{adata.vr_avatar.maxhealth}}' value='{{adata.vr_avatar.health}}' state='{{healthState(adata.vr_avatar.health)}}'>{{Math.round(adata.vr_avatar.health)}}/{{adata.vr_avatar.maxhealth}}</ui-bar>
</ui-section>
{{/if}}
</ui-display>
{{else}}
<ui-display title='Virtual Avatar'>
No Virtual Avatar detected
</ui-display>
{{/if}}
<ui-display title='VR Commands'>
<ui-button icon='{{data.toggle_open ? "times" : "plus"}}' action='toggle_open'>
{{data.toggle_open ? "Close" : "Open"}} the VR Sleeper
</ui-button>
{{#if data.isoccupant}}
<ui-button icon='signal' action='vr_connect'>
Connect to VR
</ui-button>
{{/if}}
{{#if data.vr_avatar}}
<ui-button icon='ban' action='delete_avatar'>
Delete Virtual Avatar
</ui-button>
{{/if}}
</ui-display>
</ui-display>