Fix tgui machine interactions status checks

This commit is contained in:
Bjorn Neergaard
2016-01-25 12:03:02 -06:00
parent 8c0c27a803
commit 014e83fec6
7 changed files with 40 additions and 59 deletions
-13
View File
@@ -1,13 +0,0 @@
/**
* tgui state: wire_state
*
* Checks specifically designed for wire datums.
**/
/var/global/datum/ui_state/wire_state/wire_state = new()
/datum/ui_state/wire_state/can_use_topic(atom/src_object, mob/user)
var/datum/wires/W = src_object.wires
if(istype(W) && user.Adjacent(W.holder) && W.interactable(user))
return UI_INTERACTIVE
return UI_CLOSE
+2 -4
View File
@@ -316,14 +316,13 @@
/datum/tgui/proc/push_data(data, force = 0)
update_status(push = 0) // Update the window state.
if(!initialized)
return // Cannot upadte UI if it is not set up yet.
return // Cannot update UI if it is not set up yet.
if(status <= UI_DISABLED && !force)
return // Cannot update UI, we have no visibility.
// Send the new JSON to the update() Javascript function.
user << output(url_encode(get_json(data)), "[window_id].browser:update")
/**
* private
*
@@ -343,8 +342,7 @@
* optional push bool Push an update to the UI (an update is always sent for UI_DISABLED).
**/
/datum/tgui/proc/update_status(push = 0)
var/datum/host = src_object.ui_host()
var/status = host.ui_status(user, state)
var/status = src_object.ui_status(user, state)
if(master_ui)
status = min(status, master_ui.status)