Files
Bubberstation/code/modules/VR/vr_human.dm
Remie Richards 1bdbf16ea3 VR+tgui additions:
* Adds "VR Sleepers" which allow the user to enter a virtual body in a virtual world (it's basically a glorified teleporter)
* Allows tgui to process fontawesome icons in stacks, fontawesome icons can stack over each other to fake a new icon (eg a ban icon over a camera to mean "ban cameras")
* tgui buttons are now a MINIMUM of 20px high, as opposed to being permanently 20px high, this is so that large fontawesome icons don't look hideous.
2016-07-17 13:03:01 +01:00

56 lines
1.3 KiB
Plaintext

/mob/living/carbon/human/virtual_reality
var/mob/living/carbon/human/real_me //The human controlling us, can be any human (including virtual ones... inception...)
var/obj/machinery/vr_sleeper/vr_sleeper
var/datum/action/quit_vr/quit_action
/mob/living/carbon/human/virtual_reality/New()
..()
quit_action = new()
quit_action.Grant(src)
/mob/living/carbon/human/virtual_reality/death()
revert_to_reality()
..()
/mob/living/carbon/human/virtual_reality/Destroy()
revert_to_reality()
return ..()
/mob/living/carbon/human/virtual_reality/ghost()
set category = "OOC"
set name = "Ghost"
set desc = "Relinquish your life and enter the land of the dead."
var/mob/living/carbon/human/H = real_me
revert_to_reality(FALSE, FALSE)
if(H)
H.ghost()
/mob/living/carbon/human/virtual_reality/proc/revert_to_reality(refcleanup = TRUE, deathchecks = TRUE)
if(real_me && mind)
mind.transfer_to(real_me)
if(deathchecks && vr_sleeper && vr_sleeper.you_die_in_the_game_you_die_for_real)
real_me.death(0)
if(refcleanup)
vr_sleeper.vr_human = null
vr_sleeper = null
real_me = null
/datum/action/quit_vr
name = "Quit Virtual Reality"
/datum/action/quit_vr/Trigger()
if(..())
if(istype(owner, /mob/living/carbon/human/virtual_reality))
var/mob/living/carbon/human/virtual_reality/VR = owner
VR.revert_to_reality(FALSE, FALSE)
else
Remove(owner)