|
|
|
@@ -52,18 +52,16 @@
|
|
|
|
|
flags_1 = NODECONSTRUCT_1
|
|
|
|
|
only_current_user_can_interact = TRUE
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/hugbox/emag_act(mob/user)
|
|
|
|
|
return SEND_SIGNAL(src, COMSIG_ATOM_EMAG_ACT)
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/emag_act(mob/user)
|
|
|
|
|
. = ..()
|
|
|
|
|
if(!(obj_flags & EMAGGED))
|
|
|
|
|
return
|
|
|
|
|
obj_flags |= EMAGGED
|
|
|
|
|
you_die_in_the_game_you_die_for_real = TRUE
|
|
|
|
|
sparks.start()
|
|
|
|
|
addtimer(CALLBACK(src, .proc/emagNotify), 150)
|
|
|
|
|
return TRUE
|
|
|
|
|
if(!only_current_user_can_interact)
|
|
|
|
|
obj_flags |= EMAGGED
|
|
|
|
|
you_die_in_the_game_you_die_for_real = TRUE
|
|
|
|
|
sparks.start()
|
|
|
|
|
addtimer(CALLBACK(src, .proc/emagNotify), 150)
|
|
|
|
|
return TRUE
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/update_icon()
|
|
|
|
|
icon_state = "[initial(icon_state)][state_open ? "-open" : ""]"
|
|
|
|
@@ -76,7 +74,7 @@
|
|
|
|
|
return ..()
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/MouseDrop_T(mob/target, mob/user)
|
|
|
|
|
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
|
|
|
|
|
if(user.lying || !iscarbon(target) || !Adjacent(target) || user.canUseTopic(src, BE_CLOSE, TRUE, NO_TK))
|
|
|
|
|
return
|
|
|
|
|
close_machine(target)
|
|
|
|
|
|
|
|
|
@@ -91,22 +89,19 @@
|
|
|
|
|
return
|
|
|
|
|
switch(action)
|
|
|
|
|
if("vr_connect")
|
|
|
|
|
var/mob/living/carbon/human/human_occupant = occupant
|
|
|
|
|
if(human_occupant && human_occupant.mind && usr == occupant)
|
|
|
|
|
|
|
|
|
|
to_chat(occupant, "<span class='warning'>Transferring to virtual reality...</span>")
|
|
|
|
|
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, "<span class='notice'>Transfer successful! You are now playing as [vr_mob] in VR!</span>")
|
|
|
|
|
else
|
|
|
|
|
var/mob/M = occupant
|
|
|
|
|
if(M?.mind && M == usr)
|
|
|
|
|
to_chat(M, "<span class='warning'>Transferring to virtual reality...</span>")
|
|
|
|
|
var/datum/component/virtual_reality/VR
|
|
|
|
|
if(vr_mob)
|
|
|
|
|
VR = vr_mob.GetComponent(/datum/component/virtual_reality)
|
|
|
|
|
if(!(VR?.connect(M)))
|
|
|
|
|
if(allow_creating_vr_mobs)
|
|
|
|
|
to_chat(occupant, "<span class='warning'>Virtual avatar not found, attempting to create one...</span>")
|
|
|
|
|
var/obj/effect/landmark/vr_spawn/V = get_vr_spawnpoint()
|
|
|
|
|
var/turf/T = get_turf(V)
|
|
|
|
|
if(T)
|
|
|
|
|
SStgui.close_user_uis(occupant, src)
|
|
|
|
|
new_player(occupant, T, V.vr_outfit)
|
|
|
|
|
to_chat(vr_mob, "<span class='notice'>Transfer successful! You are now playing as [vr_mob] in VR!</span>")
|
|
|
|
|
else
|
|
|
|
|
to_chat(occupant, "<span class='warning'>Virtual world misconfigured, aborting transfer</span>")
|
|
|
|
|
else
|
|
|
|
@@ -157,17 +152,29 @@
|
|
|
|
|
for(var/obj/effect/landmark/vr_spawn/V in GLOB.landmarks_list)
|
|
|
|
|
GLOB.vr_spawnpoints[V.vr_category] = V
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/proc/new_player(mob/living/carbon/human/H, location, datum/outfit/outfit, transfer = TRUE)
|
|
|
|
|
if(!H)
|
|
|
|
|
/obj/machinery/vr_sleeper/proc/new_player(mob/M, location, datum/outfit/outfit, transfer = TRUE)
|
|
|
|
|
if(!M)
|
|
|
|
|
return
|
|
|
|
|
cleanup_vr_mob()
|
|
|
|
|
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)
|
|
|
|
|
if(!transfer || !H.mind)
|
|
|
|
|
return
|
|
|
|
|
vr_mob.AddComponent(/datum/component/virtual_reality, H, src, you_die_in_the_game_you_die_for_real)
|
|
|
|
|
if(vr_mob.build_virtual_character(M, outfit) && iscarbon(vr_mob))
|
|
|
|
|
var/mob/living/carbon/C = vr_mob
|
|
|
|
|
C.updateappearance(TRUE, TRUE, TRUE)
|
|
|
|
|
var/datum/component/virtual_reality/VR = vr_mob.AddComponent(/datum/component/virtual_reality, you_die_in_the_game_you_die_for_real)
|
|
|
|
|
if(VR.connect(M))
|
|
|
|
|
RegisterSignal(VR, COMSIG_COMPONENT_UNREGISTER_PARENT, .proc/unset_vr_mob)
|
|
|
|
|
RegisterSignal(VR, COMSIG_COMPONENT_REGISTER_PARENT, .proc/set_vr_mob)
|
|
|
|
|
if(!only_current_user_can_interact)
|
|
|
|
|
VR.RegisterSignal(src, COMSIG_ATOM_EMAG_ACT, /datum/component/virtual_reality.proc/you_only_live_once)
|
|
|
|
|
VR.RegisterSignal(src, COMSIG_MACHINE_EJECT_OCCUPANT, /datum/component/virtual_reality.proc/revert_to_reality)
|
|
|
|
|
VR.RegisterSignal(src, COMSIG_PARENT_QDELETING, /datum/component/virtual_reality.proc/machine_destroyed)
|
|
|
|
|
to_chat(vr_mob, "<span class='notice'>Transfer successful! You are now playing as [vr_mob] in VR!</span>")
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/proc/unset_vr_mob(datum/component/virtual_reality/VR)
|
|
|
|
|
vr_mob = null
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/proc/set_vr_mob(datum/component/virtual_reality/VR)
|
|
|
|
|
vr_mob = VR.parent
|
|
|
|
|
|
|
|
|
|
/obj/machinery/vr_sleeper/proc/cleanup_vr_mob()
|
|
|
|
|
if(vr_mob)
|
|
|
|
@@ -222,6 +229,7 @@
|
|
|
|
|
qdel(C)
|
|
|
|
|
for (var/A in corpse_party)
|
|
|
|
|
var/mob/M = A
|
|
|
|
|
if(get_area(M) == vr_area && M.stat == DEAD)
|
|
|
|
|
if(M && M.stat == DEAD && get_area(M) == vr_area)
|
|
|
|
|
qdel(M)
|
|
|
|
|
corpse_party -= M
|
|
|
|
|
addtimer(CALLBACK(src, .proc/clean_up), 3 MINUTES)
|
|
|
|
|