Refactors NanoUI interaction (again)

Takes NanoUI interaction code and splits it into more manageable modules.

The default handler that checks distances, camera coverage, etc., etc.
Admin NanoUI windows now only check for admin rights, ignoring sight, distance, and anything else.
ERT/mercenary appearance changer now remains open for as long as the mob remains on the admin Z-level.
PDAs and uplinks now require that you keep the item somewhere in your main inventory (or contents to be precise). Hands or ears are fine, inside bags are not.
Rig suits also check that they are in the operator's inventory or that the synthetic operator is somewhere within the suit's contents (recursively).
This commit is contained in:
PsiOmega
2015-04-10 11:19:38 +02:00
parent 71a8ddf50e
commit e37c5c22d4
25 changed files with 146 additions and 105 deletions
+1 -1
View File
@@ -542,7 +542,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "pda.tmpl", title, 520, 400)
ui = new(user, src, ui_key, "pda.tmpl", title, 520, 400, state = inventory_state)
// when the ui is first opened this is the data it will use
ui.load_cached_data(ManifestJSON)
+4 -1
View File
@@ -53,6 +53,9 @@ datum/nano_item_lists
var/uplink_owner = null//text-only
var/used_TC = 0
/obj/item/device/uplink/nano_host()
return loc
/obj/item/device/uplink/New()
..()
welcome = ticker.mode.uplink_welcome
@@ -219,7 +222,7 @@ datum/nano_item_lists
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "uplink.tmpl", title, 450, 600)
ui = new(user, src, ui_key, "uplink.tmpl", title, 450, 600, state = inventory_state)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
+2 -3
View File
@@ -16,15 +16,14 @@
var/damtype = "brute"
var/force = 0
/obj/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/custom_state = default_state)
/obj/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/state = default_state)
// Calling Topic without a corresponding window open causes runtime errors
if(!nowindow && ..())
return 1
// In the far future no checks are made in an overriding Topic() beyond if(..()) return
// Instead any such checks are made in CanUseTopic()
var/obj/host = nano_host()
if(host.CanUseTopic(usr, href_list, custom_state) == STATUS_INTERACTIVE)
if(CanUseTopic(usr, state, href_list) == STATUS_INTERACTIVE)
CouldUseTopic(usr)
return 0