-
Notifications
You must be signed in to change notification settings - Fork 220
/
nanoexternal.dm
71 lines (62 loc) · 2.5 KB
/
nanoexternal.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// This file contains all Nano procs/definitions for external classes/objects
/**
* A "panic button" verb to close all UIs on current mob.
* Use it when the bug with UI not opening (because the server still considers it open despite it being closed on client) pops up.
* Feel free to remove it once the bug is confirmed to be fixed.
*
* @return nothing
*/
/client/verb/resetnano()
set name = "Reset NanoUI"
set category = "OOC"
var/ui_amt = length(mob.open_uis)
SSnano.close_user_uis(mob)
to_chat(src, "[ui_amt] UI windows reset.")
/**
* Called when a Nano UI window is closed
* This is how Nano handles closed windows
* It must be a verb so that it can be called using winset
*
* @return nothing
*/
/client/verb/nanoclose(var/uiref as text)
set hidden = 1 // hide this verb from the user's panel
set name = "nanoclose"
var/datum/nanoui/ui = locate(uiref)
if (istype(ui))
ui.close()
if(ui.ref)
var/href = "close=1"
src.Topic(href, params2list(href), ui.ref) // this will direct to the datum's Topic() proc via client.Topic()
else if (ui.on_close_logic)
// no atomref specified (or not found)
// so just reset the user mob's machine var
if(src && src.mob)
src.mob.unset_machine()
/**
* The ui_interact proc is used to open and update Nano UIs
* If ui_interact is not used then the UI will not update correctly
* ui_interact is currently defined for /atom/movable
*
* @param user /mob The mob who is interacting with this UI
* @param ui_key string A string key to use for this UI. Allows for multiple unique UIs on one obj/mob (defaut value "main")
* @param ui /datum/nanoui This parameter is passed by the nanoui process() proc when updating an open UI
* @param force_open boolean Force the UI to (re)open, even if it's already open
*
* @return nothing
*/
/datum/proc/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, datum/nanoui/master_ui = null, datum/topic_state/state = global.default_topic_state)
return
/**
* Data to be sent to the UI.
* This must be implemented for a UI to work.
*
* @param user /mob The mob who interacting with the UI
* @param ui_key string A string key to use for this UI. Allows for multiple unique UIs on one obj/mob (defaut value "main")
*
* @return data /list Data to be sent to the UI
**/
/datum/proc/ui_data(mob/user, ui_key = "main")
return list() // Not implemented.
// Used by SSnano (/datum/controller/subsystem/processing/nano) to track UIs opened by this mob
/mob/var/list/open_uis