Fix NanoUI for admin ghosts.

Also, rename the base state file.
This commit is contained in:
Bjorn Neergaard
2015-12-02 10:31:04 -06:00
parent 75b21ebe27
commit 1d60873949
5 changed files with 13 additions and 11 deletions
+2 -1
View File
@@ -421,4 +421,5 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/canUseTopic()
if(check_rights(R_ADMIN, 0))
return
return 1
return
+7 -6
View File
@@ -475,9 +475,11 @@
* If the src_object's Topic() returns 1, update all UIs attacked to it.
**/
/datum/nanoui/Topic(href, href_list)
update_status(0) // update the status
if (status != NANO_INTERACTIVE || user != usr) // If UI is not interactive or usr calling Topic is not the UI user
return
update_status(push_update = 0) // Update the window state.
if (status != NANO_INTERACTIVE || user != usr)
return // If UI is not interactive or usr calling Topic is not the UI user.
var/update = src_object.Topic(href, href_list, 0, state) // Call Topic() on the src_object.
// Code to toggle/update the Map UI.
var/map_update = 0
@@ -488,9 +490,8 @@
set_map_z_level(text2num(href_list["mapZLevel"]))
map_update = 1
// If we have a src_object and its Topic() returns 1, update.
if ((src_object && src_object.Topic(href, href_list, 0, state)) || map_update)
SSnano.update_uis(src_object)
if ((src_object && update) || map_update)
SSnano.update_uis(src_object) // If we have a src_object and its Topic() told us to update.
/**
* private
+1 -1
View File
@@ -7,6 +7,6 @@
/var/global/datum/topic_state/admin_state/admin_state = new()
/datum/topic_state/admin_state/can_use_topic(atom/movable/src_object, mob/user)
if (check_rights(R_ADMIN, 0, user))
if (check_rights_for(user.client, R_ADMIN))
return NANO_INTERACTIVE
return NANO_CLOSE
@@ -1,5 +1,5 @@
/**
* NanoUI State
* NanoUI States
*
* Base state and helpers for states. Just does some sanity checks, implement a state for in-depth checks.
**/
@@ -68,7 +68,7 @@
return ..()
/mob/dead/observer/shared_nano_interaction(atom/movable/src_object)
if (check_rights(R_ADMIN, 0, src))
if (check_rights_for(client, R_ADMIN))
return NANO_INTERACTIVE // Admins can interact anyway.
if(!client || get_dist(src_object, src) > client.view)
return NANO_CLOSE // Keep ghosts from opening too many NanoUIs.