Fix tgui states

This led to a few in-game exploits it seems
This commit is contained in:
Bjorn Neergaard
2016-01-04 00:02:28 -06:00
parent 1b5438851a
commit 453f149be5
4 changed files with 8 additions and 9 deletions
+1 -1
View File
@@ -7,6 +7,6 @@
/var/global/datum/ui_state/contained_state/contained_state = new()
/datum/ui_state/contained_state/can_use_topic(atom/movable/src_object, mob/user)
if(!src_object.contains(user))
if(!(user in src_object.contents))
return UI_CLOSE
return user.shared_ui_interaction(src_object)
+1 -1
View File
@@ -7,6 +7,6 @@
/var/global/datum/ui_state/deep_inventory_state/deep_inventory_state = new()
/datum/ui_state/deep_inventory_state/can_use_topic(atom/movable/src_object, mob/user)
if(!user.contains(src_object))
if(!(src_object in user.contents))
return UI_CLOSE
return user.shared_ui_interaction(src_object)
+1 -1
View File
@@ -15,7 +15,7 @@
return UI_CLOSE
/mob/living/notcontained_can_use_topic(atom/movable/src_object)
if(src_object.contains(src))
if(src in src_object.contents)
return UI_CLOSE // Close if we're inside it.
return default_can_use_topic(src_object)
+5 -6
View File
@@ -95,7 +95,7 @@
update_status(push = 0) // Update the window status.
if(status == UI_CLOSE)
return // Bail if we should close.
return // Bail if we're not supposed to open.
if(!initial_data)
if(!data) // If we don't have initial_data and data was not passed, get data from the src_object.
@@ -333,14 +333,13 @@
* 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/new_status = src_object.ui_state(user, state)
var/status = src_object.ui_state(user, state)
if(master_ui)
new_status = min(new_status, master_ui.status)
status = min(status, master_ui.status)
if(new_status == UI_CLOSE)
set_status(status, push)
if(status == UI_CLOSE)
close()
else
set_status(new_status, push)
/**
* private