diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 87e0dc99e4c..2e628452aa1 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -329,7 +329,7 @@ update_flag ..() update_icon() - SSnanoui.update_uis(src) // Update all NanoUIs attached to src + SSvueui.check_uis_for_change(src) // Update all VueUIs attached to src /obj/machinery/portable_atmospherics/canister/attack_ai(var/mob/user as mob) if(!ai_can_interact(user)) @@ -339,37 +339,36 @@ update_flag /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", var/datum/nanoui/ui = null, var/force_open = 1) - if (src.destroyed) +/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user) + if(src.destroyed) return - - // this is the data which will be sent to the ui - var/data[0] - data["name"] = name - data["canLabel"] = can_label ? 1 : 0 - data["portConnected"] = connected_port ? 1 : 0 - data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0) - data["releasePressure"] = round(release_pressure ? release_pressure : 0) - data["minReleasePressure"] = round(ONE_ATMOSPHERE/10) - data["maxReleasePressure"] = round(10*ONE_ATMOSPHERE) - data["valveOpen"] = valve_open ? 1 : 0 - - data["hasHoldingTank"] = holding ? 1 : 0 - if (holding) - data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.return_pressure())) - // update the ui if it exists, returns null if no ui is passed/found - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) 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, "canister.tmpl", "Canister", 480, 400) - // when the ui is first opened this is the data it will use - ui.set_initial_data(data) + ui = new(user, src, "machinery-atmospherics-canister", 480, 400, "Canister", state = interactive_state) // open the new ui window ui.open() // auto update every Master Controller tick - ui.set_auto_update(1) + ui.auto_update_content = TRUE + +/obj/machinery/portable_atmospherics/canister/vueui_data_change(list/data, mob/user, datum/vueui/ui) + data = ..() || list() + + // this is the data which will be sent to the ui + data["name"] = name + data["canLabel"] = can_label + data["portConnected"] = !!connected_port + data["tankPressure"] = round(air_contents.return_pressure() || 0) + data["releasePressure"] = round(release_pressure || 0) + data["minReleasePressure"] = round(ONE_ATMOSPHERE/10) + data["maxReleasePressure"] = round(10*ONE_ATMOSPHERE) + data["valveOpen"] = valve_open + + data["hasHoldingTank"] = !!holding + if (holding) + data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.return_pressure())) + return data /obj/machinery/portable_atmospherics/canister/Topic(href, href_list) @@ -379,19 +378,20 @@ update_flag return 0 if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr)) // exploit protection -walter0o - usr << browse(null, "window=canister") + var/datum/vueui/ui = href_list["vueui"] + ui?.close() onclose(usr, "canister") return if(href_list["toggle"]) if (valve_open) if (holding) - release_log += "Valve was closed by [usr] ([usr.ckey]), stopping the transfer into the [holding]
" + release_log += "Valve was closed by [usr] ([usr.ckey]), stopping the transfer into [holding]
" else release_log += "Valve was closed by [usr] ([usr.ckey]), stopping the transfer into the air
" else if (holding) - release_log += "Valve was opened by [usr] ([usr.ckey]), starting the transfer into the [holding]
" + release_log += "Valve was opened by [usr] ([usr.ckey]), starting the transfer into [holding]
" else release_log += "Valve was opened by [usr] ([usr.ckey]), starting the transfer into the air
" log_open() @@ -401,18 +401,14 @@ update_flag if(holding) if (valve_open) valve_open = 0 - release_log += "Valve was closed by [usr] ([usr.ckey]), stopping the transfer into the [holding]
" + release_log += "Valve was closed by [usr] ([usr.ckey]), stopping the transfer into [holding]
" if(istype(holding, /obj/item/tank)) holding.manipulated_by = usr.real_name usr.put_in_hands(holding) holding = null - if (href_list["pressure_adj"]) - var/diff = text2num(href_list["pressure_adj"]) - if(diff > 0) - release_pressure = min(10*ONE_ATMOSPHERE, release_pressure+diff) - else - release_pressure = max(ONE_ATMOSPHERE/10, release_pressure+diff) + if (href_list["pressure_set"]) + release_pressure = between(ONE_ATMOSPHERE/10, text2num(href_list["pressure_set"]), 10*ONE_ATMOSPHERE) if (href_list["relabel"]) if (can_label) diff --git a/html/changelogs/MDP-canwevueit.yml b/html/changelogs/MDP-canwevueit.yml new file mode 100644 index 00000000000..e08701580b5 --- /dev/null +++ b/html/changelogs/MDP-canwevueit.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MoondancerPony + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - refactor: "Makes canisters use VueUI." + - backend: "Makes labels on vui-item components optional." diff --git a/vueui/src/components/view/machinery/atmospherics/canister.vue b/vueui/src/components/view/machinery/atmospherics/canister.vue new file mode 100644 index 00000000000..b828c561f65 --- /dev/null +++ b/vueui/src/components/view/machinery/atmospherics/canister.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/vueui/src/components/vui/item.vue b/vueui/src/components/vui/item.vue index 0bb035ba811..23838209528 100644 --- a/vueui/src/components/vui/item.vue +++ b/vueui/src/components/vui/item.vue @@ -1,7 +1,7 @@