From 8004165599aa14db2709c617f4d1042390e4722e Mon Sep 17 00:00:00 2001 From: Ghommie Date: Thu, 4 Jul 2019 00:30:28 +0200 Subject: [PATCH] The big part is done. --- code/datums/components/virtual_reality.dm | 2 ++ code/modules/VR/vr_sleeper.dm | 31 +++++++++++++---------- tgui/src/interfaces/vr_sleeper.ract | 14 +++++----- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/code/datums/components/virtual_reality.dm b/code/datums/components/virtual_reality.dm index 288a7e4223..36fae8313d 100644 --- a/code/datums/components/virtual_reality.dm +++ b/code/datums/components/virtual_reality.dm @@ -33,6 +33,8 @@ RegisterSignal(M, COMSIG_MOB_KEY_CHANGE, .proc/pass_me_the_remote) RegisterSignal(current_mind, COMSIG_MIND_TRANSFER, .proc/pass_me_the_remote) mastermind.current.audiovisual_redirect = M + if(vr_sleeper) + vr_sleeper.vr_mob = M /datum/component/virtual_reality/UnregisterFromParent() quit_action.Remove(parent) diff --git a/code/modules/VR/vr_sleeper.dm b/code/modules/VR/vr_sleeper.dm index 86816ba3cb..4eb1459045 100644 --- a/code/modules/VR/vr_sleeper.dm +++ b/code/modules/VR/vr_sleeper.dm @@ -11,6 +11,7 @@ var/you_die_in_the_game_you_die_for_real = FALSE var/datum/effect_system/spark_spread/sparks var/mob/living/vr_mob + var/virtual_mob_type = /mob/living/carbon/human var/vr_category = "default" //Specific category of spawn points to pick from var/allow_creating_vr_mobs = TRUE //So you can have vr_sleepers that always spawn you as a specific person or 1 life/chance vr games var/only_current_user_can_interact = FALSE @@ -91,8 +92,9 @@ if("vr_connect") var/mob/living/carbon/human/human_occupant = occupant if(human_occupant && human_occupant.mind && usr == occupant) + to_chat(occupant, "Transferring to virtual reality...") - if(vr_mob && vr_mob.stat == CONSCIOUS && !vr_mob.GetComponent(/datum/component/virtual_reality)) + if(vr_mob && (!istype(vr_mob) || !vr_mob.InCritical()) && !vr_mob.GetComponent(/datum/component/virtual_reality)) vr_mob.AddComponent(/datum/component/virtual_reality, human_occupant, src, you_die_in_the_game_you_die_for_real) to_chat(vr_mob, "Transfer successful! You are now playing as [vr_mob] in VR!") else @@ -127,17 +129,20 @@ var/list/data = list() if(vr_mob && !QDELETED(vr_mob)) data["can_delete_avatar"] = TRUE - var/status - switch(vr_mob.stat) - if(CONSCIOUS) - status = "Conscious" - if(DEAD) - status = "Dead" - if(UNCONSCIOUS) - status = "Unconscious" - if(SOFT_CRIT) - status = "Barely Conscious" - data["vr_avatar"] = list("name" = vr_mob.name, "status" = status, "health" = vr_mob.health, "maxhealth" = vr_mob.maxHealth) + data["vr_avatar"] = list("name" = vr_mob.name) + data["isliving"] = istype(vr_mob) + if(data["isliving"]) + var/status + switch(vr_mob.stat) + if(CONSCIOUS) + status = "Conscious" + if(DEAD) + status = "Dead" + if(UNCONSCIOUS) + status = "Unconscious" + if(SOFT_CRIT) + status = "Barely Conscious" + data["vr_avatar"] += list("status" = status, "health" = vr_mob.health, "maxhealth" = vr_mob.maxHealth) data["toggle_open"] = state_open data["emagged"] = you_die_in_the_game_you_die_for_real data["isoccupant"] = (user == occupant) @@ -155,7 +160,7 @@ if(!H) return cleanup_vr_mob() - vr_mob = new /mob/living/carbon/human(location) + vr_mob = new virtual_mob_type(location) if(vr_mob.build_virtual_character(H, outfit)) var/mob/living/carbon/human/vr_H = vr_mob vr_H.updateappearance(TRUE, TRUE, TRUE) diff --git a/tgui/src/interfaces/vr_sleeper.ract b/tgui/src/interfaces/vr_sleeper.ract index 32f3ab33b3..91074a9425 100644 --- a/tgui/src/interfaces/vr_sleeper.ract +++ b/tgui/src/interfaces/vr_sleeper.ract @@ -22,12 +22,14 @@ {{data.vr_avatar.name}} - - {{data.vr_avatar.status}} - - - {{Math.round(adata.vr_avatar.health)}}/{{adata.vr_avatar.maxhealth}} - + {{#if data.isliving}} + + {{data.vr_avatar.status}} + + + {{Math.round(adata.vr_avatar.health)}}/{{adata.vr_avatar.maxhealth}} + + {{/if}} {{else}}