diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
index a3172a3b4af..3ac13f56b51 100644
--- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
@@ -92,24 +92,18 @@ Passive gate is similar to the regular pump except:
return 1
-/obj/machinery/atmospherics/binary/passive_gate/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/atmospherics/binary/passive_gate/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(stat & (BROKEN|NOPOWER))
return
- var/data = list()
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_gas_pump.tmpl", name, 400, 120, 0)
+/obj/machinery/atmospherics/binary/passive_gate/get_ui_data()
+ var/data = list()
data["on"] = on
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
data["max_pressure"] = MAX_OUTPUT_PRESSURE
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "atmos_gas_pump.tmpl", name, 400, 120)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
+ return data
/obj/machinery/atmospherics/binary/passive_gate/atmosinit()
..()
diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm
index 85c5f1cf903..8f25e7d242b 100644
--- a/code/ATMOSPHERICS/components/binary_devices/pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm
@@ -97,24 +97,18 @@ Thus, the two variables affect pump operation are set in New():
return 1
-/obj/machinery/atmospherics/binary/pump/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/atmospherics/binary/pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(stat & (BROKEN|NOPOWER))
return
- var/data = list()
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_gas_pump.tmpl", name, 400, 120, 0)
+/obj/machinery/atmospherics/binary/pump/get_ui_data()
+ var/data = list()
data["on"] = on
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
data["max_pressure"] = MAX_OUTPUT_PRESSURE
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "atmos_gas_pump.tmpl", name, 400, 120)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
+ return data
/obj/machinery/atmospherics/binary/pump/atmosinit()
..()
diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
index be8fbdc6ab0..4b920407ce8 100644
--- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
@@ -93,24 +93,18 @@ Thus, the two variables affect pump operation are set in New():
return 1
-/obj/machinery/atmospherics/binary/volume_pump/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/atmospherics/binary/volume_pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(stat & (BROKEN|NOPOWER))
return
- var/data = list()
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_gas_pump.tmpl", name, 400, 120, 0)
+/obj/machinery/atmospherics/binary/volume_pump/get_ui_data()
+ var/data = list()
data["on"] = on
data["transfer_rate"] = round(transfer_rate*100) //Nano UI can't handle rounded non-integers, apparently.
data["max_rate"] = MAX_TRANSFER_RATE
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "atmos_gas_pump.tmpl", name, 400, 120)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
+ return data
/obj/machinery/atmospherics/binary/volume_pump/atmosinit()
..()
diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
index e988e113c08..cedd26af4b2 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
@@ -152,25 +152,19 @@ Filter types:
ui_interact(user)
-/obj/machinery/atmospherics/trinary/filter/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/atmospherics/trinary/filter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(stat & (BROKEN|NOPOWER))
return
- var/data = list()
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_filter.tmpl", name, 400, 320, 0)
+/obj/machinery/atmospherics/trinary/filter/get_ui_data()
+ var/data = list()
data["on"] = on
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
data["max_pressure"] = MAX_OUTPUT_PRESSURE
data["filter_type"] = filter_type
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "atmos_filter.tmpl", name, 400, 320)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
+ return data
/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list)
if(..())
diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
index e80c0c7654b..53b1d1b27f9 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
@@ -108,26 +108,20 @@
ui_interact(user)
-/obj/machinery/atmospherics/trinary/mixer/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/atmospherics/trinary/mixer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(stat & (BROKEN|NOPOWER))
return
- var/data = list()
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_mixer.tmpl", name, 400, 320, 0)
+/obj/machinery/atmospherics/trinary/mixer/get_ui_data()
+ var/data = list()
data["on"] = on
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
data["max_pressure"] = MAX_OUTPUT_PRESSURE
data["node1_concentration"] = round(node1_concentration*100)
data["node2_concentration"] = round(node2_concentration*100)
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "atmos_mixer.tmpl", name, 400, 320)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
+ return data
/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
if(..()) return
diff --git a/code/controllers/subsystem/nanoUI.dm b/code/controllers/subsystem/nanoUI.dm
index 017556248b5..feb60fce007 100644
--- a/code/controllers/subsystem/nanoUI.dm
+++ b/code/controllers/subsystem/nanoUI.dm
@@ -3,7 +3,7 @@ var/datum/subsystem/nano/SSnano
/datum/subsystem/nano
name = "NanoUI"
can_fire = 1
- wait = 5
+ wait = 10
priority = 16
var/list/open_uis = list() //a list of current open /nanoui UIs, grouped by src_object and ui_key
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm
index 7be7a95a65b..16172fbed61 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/alarm.dm
@@ -185,13 +185,6 @@
return
if(!shorted)
- //user << browse(return_text(),"window=air_alarm")
- //onclose(user, "air_alarm")
- /*var/datum/browser/popup = new(user, "air_alarm", "[alarm_area.name] Air Alarm", 500, 400)
- popup.set_content(return_text())
- popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
- popup.open()
- refresh_all()*/
ui_interact(user)
if(panel_open && (!istype(user, /mob/living/silicon/ai)))
@@ -199,29 +192,22 @@
return
-/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(stat & (BROKEN|NOPOWER))
return
- var/data = list()
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "air_alarm.tmpl", "Air Alarm", 350, 500, 1)
+/obj/machinery/alarm/get_ui_data(mob/user)
+ var/data = list()
data["locked"] = locked
data["siliconUser"] = user.has_unlimited_silicon_privilege
data["screen"] = screen
data["dangerous"] = emagged
-
populate_status(data)
if (!locked || user.has_unlimited_silicon_privilege)
populate_controls(data)
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "air_alarm.tmpl", "Air Alarm", 350, 500)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
+ return data
/obj/machinery/alarm/proc/shock(mob/user, prb)
if((stat & (NOPOWER))) // unpowered, no shock
@@ -424,7 +410,7 @@
return 1
if("reset_external_pressure")
- send_signal(device_id, list(href_list["command"] = ONE_ATMOSPHERE))
+ send_signal(device_id, list("set_external_pressure" = ONE_ATMOSPHERE))
return 1
if(
"power",
diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm
index a9e36371783..41f22184808 100644
--- a/code/game/machinery/atmoalter/canister.dm
+++ b/code/game/machinery/atmoalter/canister.dm
@@ -176,6 +176,7 @@ update_flag
can_label = 1
else
can_label = 0
+
/obj/machinery/portable_atmospherics/canister/process()
src.updateDialog()
return ..()
@@ -258,13 +259,25 @@ update_flag
/obj/machinery/portable_atmospherics/canister/attack_paw(var/mob/user as mob)
return src.attack_hand(user)
+/obj/machinery/portable_atmospherics/canister/attack_tk(var/mob/user as mob)
+ return src.attack_hand(user)
+
/obj/machinery/portable_atmospherics/canister/attack_hand(var/mob/user as mob)
return src.ui_interact(user)
-/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/portable_atmospherics/canister/interact(mob/user, ui_key = "main")
+ if (src.destroyed || !user)
+ return
+
+ SSnano.try_update_ui(user, src, ui_key, null, src.get_ui_data())
+
+/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if (src.destroyed)
return
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "canister.tmpl", "Canister", 480, 400, 0)
+
+/obj/machinery/portable_atmospherics/canister/get_ui_data()
var/data = list()
data["name"] = src.name
data["canLabel"] = src.can_label ? 1 : 0
@@ -278,15 +291,7 @@ update_flag
data["hasHoldingTank"] = src.holding ? 1 : 0
if (holding)
data["holdingTank"] = list("name" = src.holding.name, "tankPressure" = round(src.holding.air_contents.return_pressure()))
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "canister.tmpl", "Canister", 480, 400)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
+ return data
/obj/machinery/portable_atmospherics/canister/Topic(href, href_list)
@@ -324,6 +329,8 @@ update_flag
if (href_list["remove_tank"])
if(holding)
+ if (valve_open)
+ investigate_log("[key_name(usr)] removed the [holding], leaving the valve open and transfering into the air
", "atmos")
holding.loc = loc
holding = null
diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm
index 26eb0c3cce5..a0c17f6a556 100644
--- a/code/game/machinery/cryo.dm
+++ b/code/game/machinery/cryo.dm
@@ -135,16 +135,20 @@
*
* @return nothing
*/
-/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(user == occupant || user.stat || panel_open)
return
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "cryo.tmpl", "Cryo Cell Control System", 520, 410, 1)
+ //user.set_machine(src)
+
+/obj/machinery/atmospherics/unary/cryo_cell/get_ui_data()
// this is the data which will be sent to the ui
- var/data[0]
+ var/data = list()
data["isOperating"] = on
data["hasOccupant"] = occupant ? 1 : 0
- var/occupantData[0]
+ var/occupantData = list()
if (!occupant)
occupantData["name"] = null
occupantData["stat"] = null
@@ -167,7 +171,7 @@
occupantData["toxLoss"] = occupant.getToxLoss()
occupantData["fireLoss"] = occupant.getFireLoss()
occupantData["bodyTemperature"] = occupant.bodytemperature
- data["occupant"] = occupantData;
+ data["occupant"] = occupantData
data["isOpen"] = state_open
data["cellTemperature"] = round(air_contents.temperature)
@@ -183,21 +187,7 @@
for(var/datum/reagent/R in beaker:reagents.reagent_list)
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
data["beakerContents"] = beakerContents
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- // the ui does not exist, so we'll create a new one
- ui = new(user, src, ui_key, "cryo.tmpl", "Cryo Cell Control System", 520, 410)
- // When the UI is first opened this is the data it will use
- ui.set_initial_data(data)
- ui.open()
- // Auto update every Master Controller tick
- ui.set_auto_update(1)
- else
- // The UI is already open so push the new data to it
- ui.push_data(data)
- return
- //user.set_machine(src)
+ return data
/obj/machinery/atmospherics/unary/cryo_cell/Topic(href, href_list)
if(usr == occupant || panel_open)
diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm
index 76ce25a17ba..08e3c4ad173 100644
--- a/code/game/objects/items/weapons/tanks/tanks.dm
+++ b/code/game/objects/items/weapons/tanks/tanks.dm
@@ -96,7 +96,13 @@
ui_interact(user)
-/obj/item/weapon/tank/ui_interact(mob/user, ui_key = "main")
+/obj/item/weapon/tank/interact(mob/user, ui_key = "main")
+ SSnano.try_update_ui(user, src, ui_key, null, src.get_ui_data())
+
+/obj/item/weapon/tank/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "tanks.tmpl", "Tank", 500, 300, 0)
+
+/obj/item/weapon/tank/get_ui_data()
var/mob/living/carbon/location = null
if(istype(loc, /mob/living/carbon))
@@ -104,19 +110,12 @@
else if(istype(loc.loc, /mob/living/carbon))
location = loc.loc
- var/using_internal
- if(istype(location))
- if(location.internal==src)
- using_internal = 1
-
- // this is the data which will be sent to the ui
var/data = list()
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
- data["valveOpen"] = using_internal ? 1 : 0
-
+ data["valveOpen"] = 0
data["maskConnected"] = 0
if(istype(location))
@@ -124,6 +123,7 @@
if(location.internal == src) // if tank is current internal
mask_check = 1
+ data["valveOpen"] = 1
else if(src in location) // or if tank is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
@@ -131,16 +131,7 @@
if(mask_check)
if(location.wear_mask && (location.wear_mask.flags & MASKINTERNALS))
data["maskConnected"] = 1
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new /datum/nanoui(user, src, ui_key, "tanks.tmpl", "Tank", 500, 300)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
-
+ return data
/obj/item/weapon/tank/Topic(href, href_list)
..()
diff --git a/code/modules/nano/nanoexternal.dm b/code/modules/nano/nanoexternal.dm
index d6d2833e1e3..265629ec4df 100644
--- a/code/modules/nano/nanoexternal.dm
+++ b/code/modules/nano/nanoexternal.dm
@@ -39,5 +39,8 @@
/atom/movable/proc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
return
+/atom/movable/proc/get_ui_data(mob/user)
+ return list()
+
// Used by the Nano UI SubSystem (/datum/subsystem/nano) to track UIs opened by this mob
/mob/var/list/open_uis = list()
diff --git a/code/modules/nano/nanomanager.dm b/code/modules/nano/nanomanager.dm
index 09b8a4796be..5f47c8da5ca 100644
--- a/code/modules/nano/nanomanager.dm
+++ b/code/modules/nano/nanomanager.dm
@@ -1,3 +1,27 @@
+ /**
+ * Get an open /nanoui ui for the current user, or create a new one.
+ *
+ * @param user /mob The mob who opened/owns the ui
+ * @param src_object /obj|/mob The obj or mob which the ui belongs to
+ * @param ui_key string A string key used for the ui
+ * @param ui /datum/nanoui An existing instance of the ui (can be null)
+ * @param data list The data to be passed to the ui, if it exists
+ *
+ * @return /nanoui Returns the new or found ui
+ */
+/datum/subsystem/nano/proc/push_open_or_new_ui(var/mob/user, var/atom/movable/src_object, ui_key, var/datum/nanoui/ui, template, title, width, height, auto_update)
+ var/list/data = src_object.get_ui_data(user)
+ if (!data)
+ data = list()
+
+ ui = try_update_ui(user, src_object, ui_key, ui, data)
+
+ if (isnull(ui))
+ ui = new /datum/nanoui(user, src_object, ui_key, template, title, width, height)
+ ui.set_initial_data(data)
+ ui.open()
+ ui.set_auto_update(auto_update)
+
/**
* Get an open /nanoui ui for the current user, src_object and ui_key and try to update it with data
*
@@ -11,9 +35,8 @@
*/
/datum/subsystem/nano/proc/try_update_ui(var/mob/user, src_object, ui_key, var/datum/nanoui/ui, data)
if (isnull(ui)) // no ui has been passed, so we'll search for one
- {
ui = get_open_ui(user, src_object, ui_key)
- }
+
if (!isnull(ui))
// The UI is already open so push the data to it
ui.push_data(data)
@@ -186,4 +209,4 @@
//Send all needed nano ui files to the client
/datum/subsystem/nano/proc/send_resources(client)
for(var/file in asset_files)
- client << browse_rsc(file)
+ client << browse_rsc(file)
\ No newline at end of file
diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm
index 5bebfcb8682..729f0327a4b 100644
--- a/code/modules/nano/nanoui.dm
+++ b/code/modules/nano/nanoui.dm
@@ -131,8 +131,13 @@ nanoui is used to open and update nano browser uis
set_status(STATUS_DISABLED, push_update) // no updates, completely disabled (red visibility)
else
var/dist = get_dist(src_object, user)
+ var/isTK = 0
- if (dist > 4)
+ if(ishuman(user))
+ var/mob/living/carbon/human/H = user
+ isTK = H.dna.check_mutation(TK)
+
+ if (dist > 4 && !isTK)
close()
return
@@ -141,10 +146,10 @@ nanoui is used to open and update nano browser uis
else if (user.restrained() || user.lying)
set_status(STATUS_UPDATE, push_update) // update only (orange visibility)
else if (!(src_object in view(4, user))) // If the src object is not in visable, set status to 0
- set_status(STATUS_DISABLED, push_update) // interactive (green visibility)
+ set_status(STATUS_DISABLED, push_update) // no updates, completely disabled (red visibility)
else if (dist <= 1)
set_status(STATUS_INTERACTIVE, push_update) // interactive (green visibility)
- else if (dist <= 2)
+ else if (dist <= 2 || isTK)
set_status(STATUS_UPDATE, push_update) // update only (orange visibility)
else if (dist <= 4)
set_status(STATUS_DISABLED, push_update) // no updates, completely disabled (red visibility)
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index c57cd9b9875..4f9dbe520be 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -664,6 +664,9 @@
if(!user)
return
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "apc.tmpl", "[area.name] - APC", 520, user.has_unlimited_silicon_privilege ? 465 : 420, 1)
+
+/obj/machinery/power/apc/get_ui_data(mob/user)
var/list/data = list(
"locked" = locked,
"isOperating" = operating,
@@ -709,19 +712,7 @@
)
)
)
-
- // update the ui if it exists, returns null if no ui is passed/found
- ui = SSnano.try_update_ui(user, src, ui_key, ui, data)
- 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, "apc.tmpl", "[area.name] - APC", 520, data["siliconUser"] ? 465 : 420)
- // when the ui is first opened this is the data it will use
- ui.set_initial_data(data)
- // open the new ui window
- ui.open()
- // auto update every Master Controller tick
- ui.set_auto_update(1)
+ return data
/obj/machinery/power/apc/proc/report()
return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_equip+lastused_light+lastused_environ]) : [cell? cell.percent() : "N/C"] ([charging])"
diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm
index e97f5462d7d..f5c64014ddf 100644
--- a/code/modules/power/smes.dm
+++ b/code/modules/power/smes.dm
@@ -326,6 +326,10 @@
if(!user)
return
+ // update the ui if it exists, create a new one if it doesn't
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "smes.tmpl", "SMES - [name]", 350, 560, 1)
+
+/obj/machinery/power/smes/get_ui_data()
var/list/data = list(
"capacityPercent" = round(100.0*charge/capacity, 0.1),
"capacity" = capacity,
@@ -343,19 +347,7 @@
"outputLevelMax" = output_level_max,
"outputUsed" = output_used
)
-
- // update the ui if it exists, returns null if no ui is passed/found
- ui = SSnano.try_update_ui(user, src, ui_key, ui, data)
- 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, "smes.tmpl", "SMES - [name]", 350, 560)
- // when the ui is first opened this is the data it will use
- ui.set_initial_data(data)
- // open the new ui window
- ui.open()
- // auto update every Master Controller tick
- ui.set_auto_update(1)
+ return data
/obj/machinery/power/smes/Topic(href, href_list)
// world << "[href] ; [href_list[href]]"
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index 38bf1d6c869..16a5f58588e 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -370,8 +370,10 @@
if(!..())
ui_interact(user)
-/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main")
+/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "solar_control.tmpl", name, 490, 420, 1)
+/obj/machinery/power/solar_control/get_ui_data()
var/data = list()
data["generated"] = round(lastgen)
@@ -384,16 +386,7 @@
data["connected_panels"] = connected_panels.len
data["connected_tracker"] = (connected_tracker ? 1 : 0)
-
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, ui_key)
- if (!ui)
- ui = new(user, src, ui_key, "solar_control.tmpl", name, 490, 420)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
- else
- ui.push_data(data)
- return
+ return data
/obj/machinery/power/solar_control/attackby(I as obj, user as mob, params)
if(istype(I, /obj/item/weapon/screwdriver))
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index 0fbb8ee12b3..5c79572d938 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -75,8 +75,10 @@
if(stat & (BROKEN)) return
if(user.stat || user.restrained()) return
- // this is the data which will be sent to the ui
- var/data[0]
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "chem_dispenser.tmpl", "[uiname]", 490, 710, 0)
+
+/obj/machinery/chem_dispenser/get_ui_data()
+ var/data = list()
data["amount"] = amount
data["energy"] = energy
data["maxEnergy"] = max_energy
@@ -103,17 +105,7 @@
if(temp)
chemicals.Add(list(list("title" = temp.name, "id" = temp.id, "commands" = list("dispense" = temp.id)))) // list in a list because Byond merges the first list...
data["chemicals"] = chemicals
-
- // update the ui if it exists, returns null if no ui is passed/found
- ui = SSnano.try_update_ui(user, src, ui_key, ui, data)
- 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, "chem_dispenser.tmpl", "[uiname]", 490, 710)
- // when the ui is first opened this is the data it will use
- ui.set_initial_data(data)
- // open the new ui window
- ui.open()
+ return data
/obj/machinery/chem_dispenser/Topic(href, href_list)
if(stat & (BROKEN))
@@ -1510,7 +1502,10 @@
/obj/machinery/chem_heater/ui_interact(var/mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(user.stat || user.restrained()) return
- var/data[0]
+ ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "chem_heater.tmpl", "ChemHeater", 350, 270, 0)
+
+/obj/machinery/chem_heater/get_ui_data()
+ var/data = list()
data["targetTemp"] = desired_temp
data["isActive"] = on
data["isBeakerLoaded"] = beaker ? 1 : 0
@@ -1525,13 +1520,7 @@
for(var/datum/reagent/R in beaker.reagents.reagent_list)
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
data["beakerContents"] = beakerContents
-
- // update the ui if it exists, returns null if no ui is passed/found
- ui = SSnano.try_update_ui(user, src, ui_key, ui, data)
- if (!ui)
- ui = new(user, src, ui_key, "chem_heater.tmpl", "ChemHeater", 350, 270)
- ui.set_initial_data(data)
- ui.open()
+ return data
///////////////////////////////////////////////////////////////////////////
diff --git a/html/changelogs/Fayrik-TheNanoingFixes.yml b/html/changelogs/Fayrik-TheNanoingFixes.yml
new file mode 100644
index 00000000000..ee0cc06c287
--- /dev/null
+++ b/html/changelogs/Fayrik-TheNanoingFixes.yml
@@ -0,0 +1,10 @@
+author: Fayrik
+
+delete-after: True
+
+changes:
+- rscadd: "NanoUI is now Telekenesis aware, but due to other constraints, NanoUI interfaces are read only at a distance."
+- tweak: "Refactored all NanoUI interfaces to use a more universal proc."
+- tweak: "Adjusted the refresh time of the NanoUI SubSystem. All interfaces will update less, but register mouse clicks faster."
+- bugfix: "Removed automatic updates on atmospheric pumps, canisters and tanks, making them respond to button clicks much faster."
+- bugfix: "Atmos alarm reset buttons work now. Probably."
\ No newline at end of file
diff --git a/nano/templates/air_alarm.tmpl b/nano/templates/air_alarm.tmpl
index f3a64d9efd8..a5556180308 100644
--- a/nano/templates/air_alarm.tmpl
+++ b/nano/templates/air_alarm.tmpl
@@ -91,7 +91,7 @@ Used In File(s): \code\game\machinery\alarm.dm