SMES Power Storage Unit [n_tag? "([n_tag])" : null]
"
+ "inputAttempt" = input_attempt,
+ "inputting" = inputting,
+ "inputLevel" = input_level,
+ "inputAvailable" = input_available,
- t += "Stored capacity : [round(100.0*charge/capacity, 0.1)]%
"
-
- t += "Input: [charging ? "Charging" : "Not Charging"] [chargemode ? "Auto Off" : "Auto Off "]
"
-
-
- t += "Input level: M - - - [add_lspace(chargelevel,5)] + + + M
"
-
- t += "
"
-
- t += "Output: [online ? "Online Offline" : "Online Offline "]
"
-
- t += "Output level: M - - - [add_lspace(output,5)] + + + M
"
-
- t += "Output load: [round(loaddemand)] W
"
-
- t += "
Close"
-
- t += ""
- user << browse(t, "window=smes;size=460x300")
- onclose(user, "smes")
- return
+ "outputting" = outputting,
+ "outputLevel" = output_level,
+ "outputUsed" = output_used
+ )
+ // update the ui if it exists, returns null if no ui is passed/found
+ ui = nanomanager.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]", 540, 360)
+ // 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)
/obj/machinery/power/smes/Topic(href, href_list)
if(..())
@@ -216,82 +210,51 @@
//world << "[href] ; [href_list[href]]"
- if( href_list["close"] )
- usr << browse(null, "window=smes")
- usr.unset_machine()
- return
-
- else if( href_list["cmode"] )
- chargemode = !chargemode
- if(!chargemode)
- charging = 0
- investigate_log("input/output; [chargelevel>output?"