More vr sleeper work and map fix

This commit is contained in:
Artur
2020-06-09 11:06:16 +03:00
parent 19949b842b
commit 094a1b6f62
6 changed files with 32 additions and 14 deletions
+3 -1
View File
@@ -82,8 +82,9 @@
if(user.lying || !iscarbon(target) || !Adjacent(target) || !user.canUseTopic(src, BE_CLOSE, TRUE, NO_TK))
return
close_machine(target)
ui_interact(user)
/obj/machinery/vr_sleeper/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
/obj/machinery/vr_sleeper/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_contained_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "VrSleeper", "VR Sleeper", 475, 340, master_ui, state)
@@ -118,6 +119,7 @@
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
@@ -0,0 +1,13 @@
/**
* tgui state: default_contained
*
* Basically default and contained combined, allowing for both
*/
GLOBAL_DATUM_INIT(default_contained_state, /datum/ui_state/default/contained, new)
/datum/ui_state/default/contained/can_use_topic(atom/src_object, mob/user)
if(src_object.contains(user))
return UI_INTERACTIVE
return ..()