mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-26 21:49:11 +01:00
Merge pull request #467 from Neerti/12/7/2015_nanoUI_ports
Ports NanoUI fixes and changes from Bay
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
/datum/proc/nano_host()
|
||||
return src
|
||||
|
||||
/datum/proc/nano_container()
|
||||
return src
|
||||
|
||||
/datum/proc/CanUseTopic(var/mob/user, var/datum/topic_state/state)
|
||||
var/src_object = nano_host()
|
||||
return state.can_use_topic(src_object, user)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
This state always returns STATUS_INTERACTIVE
|
||||
*/
|
||||
/var/global/datum/topic_state/interactive/interactive_state = new()
|
||||
|
||||
/datum/topic_state/interactive/can_use_topic(var/src_object, var/mob/user)
|
||||
return STATUS_INTERACTIVE
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
This state checks that user is capable, within range of the remoter, etc. and that src_object meets the basic requirements for interaction (being powered, non-broken, etc.
|
||||
Whoever initializes this state is also responsible for deleting it properly.
|
||||
*/
|
||||
/datum/topic_state/remote
|
||||
var/datum/remoter
|
||||
var/datum/remote_target
|
||||
var/datum/topic_state/remoter_state
|
||||
|
||||
/datum/topic_state/remote/New(var/remoter, var/remote_target, var/datum/topic_state/remoter_state = default_state)
|
||||
src.remoter = remoter
|
||||
src.remote_target = remote_target
|
||||
src.remoter_state = remoter_state
|
||||
..()
|
||||
|
||||
/datum/topic_state/remote/Destroy()
|
||||
src.remoter = null
|
||||
src.remoter_state = null
|
||||
|
||||
// Force an UI update before we go, ensuring that any windows we may have opened for the remote target closes.
|
||||
nanomanager.update_uis(remote_target.nano_container())
|
||||
remote_target = null
|
||||
return ..()
|
||||
|
||||
/datum/topic_state/remote/can_use_topic(var/datum/src_object, var/mob/user)
|
||||
if(!(remoter && remoter_state)) // The remoter is gone, let us leave
|
||||
return STATUS_CLOSE
|
||||
|
||||
if(src_object != remote_target)
|
||||
error("remote - Unexpected src_object: Expected '[remote_target]'/[remote_target.type], was '[src_object]'/[src_object.type]")
|
||||
|
||||
// This checks if src_object is powered, etc.
|
||||
// The interactive state is otherwise simplistic and only returns STATUS_INTERACTIVE and never checks distances, etc.
|
||||
. = src_object.CanUseTopic(user, interactive_state)
|
||||
if(. == STATUS_CLOSE)
|
||||
return
|
||||
|
||||
// This is the (generally) heavy checking, making sure the user is capable, within range of the remoter source, etc.
|
||||
return min(., remoter.CanUseTopic(user, remoter_state))
|
||||
@@ -47,7 +47,7 @@
|
||||
// Allows us to process UI clicks, which are relayed in form of hrefs.
|
||||
/datum/nano_module/power_monitor/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
return 1
|
||||
if( href_list["clear"] )
|
||||
active_sensor = null
|
||||
if( href_list["refresh"] )
|
||||
|
||||
@@ -140,7 +140,8 @@ nanoui is used to open and update nano browser uis
|
||||
* @return nothing
|
||||
*/
|
||||
/datum/nanoui/proc/update_status(var/push_update = 0)
|
||||
var/new_status = src_object.CanUseTopic(user, state)
|
||||
var/obj/host = src_object.nano_host()
|
||||
var/new_status = host.CanUseTopic(user, state)
|
||||
if(master_ui)
|
||||
new_status = min(new_status, master_ui.status)
|
||||
|
||||
@@ -428,6 +429,9 @@ nanoui is used to open and update nano browser uis
|
||||
user << browse(null, "window=[window_id]")
|
||||
for(var/datum/nanoui/child in children)
|
||||
child.close()
|
||||
children.Cut()
|
||||
state = null
|
||||
master_ui = null
|
||||
|
||||
/**
|
||||
* Set the UI window to call the nanoclose verb when the window is closed
|
||||
|
||||
@@ -1499,10 +1499,12 @@
|
||||
#include "code\modules\nano\interaction\conscious.dm"
|
||||
#include "code\modules\nano\interaction\contained.dm"
|
||||
#include "code\modules\nano\interaction\default.dm"
|
||||
#include "code\modules\nano\interaction\interactive.dm"
|
||||
#include "code\modules\nano\interaction\inventory.dm"
|
||||
#include "code\modules\nano\interaction\inventory_deep.dm"
|
||||
#include "code\modules\nano\interaction\outside.dm"
|
||||
#include "code\modules\nano\interaction\physical.dm"
|
||||
#include "code\modules\nano\interaction\remote.dm"
|
||||
#include "code\modules\nano\interaction\self.dm"
|
||||
#include "code\modules\nano\interaction\zlevel.dm"
|
||||
#include "code\modules\nano\modules\alarm_monitor.dm"
|
||||
|
||||
Reference in New Issue
Block a user