diff --git a/code/ATMOSPHERICS/components/unary/cold_sink.dm b/code/ATMOSPHERICS/components/unary/cold_sink.dm index 4f2aac5073f..d41af9717e2 100644 --- a/code/ATMOSPHERICS/components/unary/cold_sink.dm +++ b/code/ATMOSPHERICS/components/unary/cold_sink.dm @@ -71,9 +71,17 @@ /obj/machinery/atmospherics/unary/freezer/attack_hand(mob/user as mob) ui_interact(user) -/obj/machinery/atmospherics/unary/freezer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) - // this is the data which will be sent to the ui - var/data[0] +/obj/machinery/atmospherics/unary/freezer/ui_interact(mob/user) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) + if(!ui) + ui = new(user, src, "machinery-atmospherics-freezer", 440, 300, "Gas Cooling System") + ui.auto_update_content = TRUE + + ui.open() + +/obj/machinery/atmospherics/unary/freezer/vueui_data_change(list/data, mob/user, datum/vueui/ui) + data = list() + data["on"] = use_power ? 1 : 0 data["gasPressure"] = round(air_contents.return_pressure()) data["gasTemperature"] = round(air_contents.temperature) @@ -82,25 +90,12 @@ data["targetGasTemperature"] = round(set_temperature) data["powerSetting"] = power_setting - var/temp_class = "good" - if(air_contents.temperature > (T0C - 20)) - temp_class = "bad" - else if(air_contents.temperature < (T0C - 20) && air_contents.temperature > (T0C - 100)) - temp_class = "average" - data["gasTemperatureClass"] = temp_class + data["gasTemperatureBadTop"] = (T0C - 20) + data["gasTemperatureBadBottom"] = null + data["gasTemperatureAvgTop"] = (T0C - 20) + data["gasTemperatureAvgBottom"] = (T0C - 100) - // 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) - 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, "freezer.tmpl", "Gas Cooling System", 440, 300) - // 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/atmospherics/unary/freezer/Topic(href, href_list) if(..()) diff --git a/code/ATMOSPHERICS/components/unary/heat_source.dm b/code/ATMOSPHERICS/components/unary/heat_source.dm index 34556bab5b2..1cc08c2f70e 100644 --- a/code/ATMOSPHERICS/components/unary/heat_source.dm +++ b/code/ATMOSPHERICS/components/unary/heat_source.dm @@ -92,9 +92,17 @@ /obj/machinery/atmospherics/unary/heater/attack_hand(mob/user as mob) ui_interact(user) -/obj/machinery/atmospherics/unary/heater/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) - // this is the data which will be sent to the ui - var/data[0] +/obj/machinery/atmospherics/unary/heater/ui_interact(mob/user) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) + if(!ui) + ui = new(user, src, "machinery-atmospherics-freezer", 440, 300, "Gas Heating System") + ui.auto_update_content = TRUE + + ui.open() + +/obj/machinery/atmospherics/unary/heater/vueui_data_change(list/data, mob/user, datum/vueui/ui) + data = list() + data["on"] = use_power ? 1 : 0 data["gasPressure"] = round(air_contents.return_pressure()) data["gasTemperature"] = round(air_contents.temperature) @@ -103,23 +111,12 @@ data["targetGasTemperature"] = round(set_temperature) data["powerSetting"] = power_setting - var/temp_class = "normal" - if(air_contents.temperature > (T20C+40)) - temp_class = "bad" - data["gasTemperatureClass"] = temp_class + data["gasTemperatureBadTop"] = (T20C+40) + data["gasTemperatureBadBottom"] = null + data["gasTemperatureAvgTop"] = null + data["gasTemperatureAvgBottom"] = null - // 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) - 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, "freezer.tmpl", "Gas Heating System", 440, 300) - // 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/atmospherics/unary/heater/Topic(href, href_list) if(..()) diff --git a/code/game/machinery/kitchen/smartfridge.dm b/code/game/machinery/kitchen/smartfridge.dm index cdcca074c56..8891b5b8162 100644 --- a/code/game/machinery/kitchen/smartfridge.dm +++ b/code/game/machinery/kitchen/smartfridge.dm @@ -305,7 +305,7 @@ cut_overlays() if(panel_open) add_overlay(icon_panel) - SSnanoui.update_uis(src) + SSvueui.check_uis_for_change(src) return if(O.ismultitool()||O.iswirecutter()) @@ -362,7 +362,7 @@ item_quants[O.name] = 1 user.visible_message("[user] adds \a [O] to \the [src].", "You add \the [O] to \the [src].") - SSnanoui.update_uis(src) + SSvueui.check_uis_for_change(src) return if(istype(O, /obj/item/storage/bag) || istype(O, /obj/item/storage/box/produce)) @@ -386,7 +386,7 @@ if(P.contents.len > 0) to_chat(user, "Some items are refused.") - SSnanoui.update_uis(src) + SSvueui.check_uis_for_change(src) else to_chat(user, "\The [src] smartly refuses [O].") @@ -412,10 +412,20 @@ * SmartFridge Menu ********************/ -/obj/machinery/smartfridge/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) +/obj/machinery/smartfridge/ui_interact(mob/user) user.set_machine(src) - var/data[0] + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) + if(!ui) + ui = new(user, src, "machinery-smartfridge", 400, 500, name, state = interactive_state) + + ui.open() + +/obj/machinery/smartfridge/vueui_data_change(list/data, mob/user, datum/vueui/ui) + world << "Yoink." + + data = list() + data["contents"] = null data["electrified"] = seconds_electrified > 0 data["shoot_inventory"] = shoot_inventory @@ -432,22 +442,17 @@ if(items.len > 0) data["contents"] = items - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) - if(!ui) - ui = new(user, src, ui_key, "smartfridge.tmpl", src.name, 400, 500) - ui.set_initial_data(data) - ui.open() + return data /obj/machinery/smartfridge/Topic(href, href_list) - if(..()) return 0 + if(..()) + return 1 - var/mob/user = usr - var/datum/nanoui/ui = SSnanoui.get_open_ui(user, src, "main") - - src.add_fingerprint(user) + src.add_fingerprint(usr) if(href_list["close"]) - user.unset_machine() + var/datum/vueui/ui = SSvueui.get_open_ui(usr, src) + usr.unset_machine() ui.close() return 0 @@ -467,8 +472,9 @@ O.forceMove(loc) i-- if(i <= 0) - return 1 + break + SSvueui.check_uis_for_change(src) return 1 return 0 diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index aad250bfb49..ed6006f5f3b 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -31,46 +31,60 @@ to_chat(user, "ERROR ERROR ERROR") /obj/item/aicard/attack_self(mob/user) - ui_interact(user) -/obj/item/aicard/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = inventory_state) - var/data[0] +/obj/item/aicard/ui_interact(mob/user, datum/topic_state/state = inventory_state) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) + + if (!ui) + ui = new(user, src, "devices-aicard", 600, 400, "[name]", state = state) + ui.auto_update_content = TRUE + + ui.open() + +/obj/item/aicard/vueui_data_change(list/data, mob/user, datum/vueui/ui) + data = list( + "has_ai" = FALSE, + "name" = null, + "hardware_integrity" = null, + "backup_capacitor" = null, + "radio" = null, + "wireless" = null, + "operational" = null, + "flushing" = FALSE, + "laws" = null, + "has_laws" = null + ) + data["has_ai"] = carded_ai != null - if(carded_ai) + if (carded_ai) data["name"] = carded_ai.name data["hardware_integrity"] = carded_ai.hardware_integrity() data["backup_capacitor"] = carded_ai.backup_capacitor() - data["radio"] = !carded_ai.ai_radio.disabledAi + data["radio"] = !carded_ai.ai_radio?.disabledAi data["wireless"] = !carded_ai.control_disabled data["operational"] = carded_ai.stat != DEAD data["flushing"] = flush - var/laws[0] + var/list/laws = list() for(var/datum/ai_law/AL in carded_ai.laws.all_laws()) laws[++laws.len] = list("index" = AL.get_index(), "law" = sanitize(AL.law)) data["laws"] = laws - data["has_laws"] = laws.len + data["has_laws"] = !!laws.len - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "aicard.tmpl", "[name]", 600, 400, state = state) - ui.set_initial_data(data) - ui.open() - ui.set_auto_update(1) + return data /obj/item/aicard/Topic(href, href_list, state) - if(..()) + if (..()) return 1 - if(!carded_ai) + if (!carded_ai) return 1 - var/user = usr if (href_list["wipe"]) var/confirm = alert("Are you sure you want to wipe this card's memory? This cannot be undone once started.", "Confirm Wipe", "Yes", "No") - if(confirm == "Yes" && (CanUseTopic(user, state) == STATUS_INTERACTIVE)) - admin_attack_log(user, carded_ai, "Wiped using \the [src.name]", "Was wiped with \the [src.name]", "used \the [src.name] to wipe") + if(confirm == "Yes" && (CanUseTopic(usr, state) == STATUS_INTERACTIVE)) + admin_attack_log(usr, carded_ai, "Wiped using \the [src.name]", "Was wiped with \the [src.name]", "used \the [src.name] to wipe") flush = 1 to_chat(carded_ai, "Your core files are being wiped!") while (carded_ai && carded_ai.stat != DEAD) @@ -78,14 +92,14 @@ carded_ai.updatehealth() sleep(10) flush = 0 - if (href_list["radio"]) + if (!isnull(href_list["radio"])) carded_ai.ai_radio.disabledAi = text2num(href_list["radio"]) to_chat(carded_ai, "Your Subspace Transceiver has been [carded_ai.ai_radio.disabledAi ? "disabled" : "enabled"]!") - to_chat(user, "You [carded_ai.ai_radio.disabledAi ? "disable" : "enable"] the AI's Subspace Transceiver.") - if (href_list["wireless"]) + to_chat(usr, "You [carded_ai.ai_radio.disabledAi ? "disable" : "enable"] the AI's Subspace Transceiver.") + if (!isnull(href_list["wireless"])) carded_ai.control_disabled = text2num(href_list["wireless"]) to_chat(carded_ai, "Your wireless interface has been [carded_ai.control_disabled ? "disabled" : "enabled"]!") - to_chat(user, "You [carded_ai.control_disabled ? "disable" : "enable"] the AI's wireless interface.") + to_chat(usr, "You [carded_ai.control_disabled ? "disable" : "enable"] the AI's wireless interface.") update_icon() return 1 diff --git a/code/modules/vehicles/droppod.dm b/code/modules/vehicles/droppod.dm index d2f5ee598b6..283be48d49d 100644 --- a/code/modules/vehicles/droppod.dm +++ b/code/modules/vehicles/droppod.dm @@ -149,16 +149,20 @@ else if ((!humanload || !passenger) && status != USED) load(user) -/obj/vehicle/droppod/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state) - var/data[0] +/obj/vehicle/droppod/ui_interact(mob/user) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) + if (!ui) + ui = new(user, src, "vehicles-droppod", 400, 400, "Drop Pod", state = default_state) + ui.data = vueui_data_change(null, user, ui) + + ui.open() + +/obj/vehicle/droppod/vueui_data_change(list/data, mob/user, datum/vueui/ui) + data = list() + data["status"] = status - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "droppod.tmpl", "Drop Pod", 400, 400, state = state) - ui.set_initial_data(data) - ui.open() - ui.set_auto_update(1) + return data /obj/vehicle/droppod/Topic(href, href_list) if(..()) @@ -198,11 +202,13 @@ if(alert(user, "WARNING: You are not in the droppod! Are you sure you wish to launch?", "Launch Confirmation", "Yes", "No") == "No") return status = LAUNCHING - var/datum/nanoui/ui = SSnanoui.get_open_ui(user, src, "main") - if(ui) - ui.close() + + var/datum/vueui/ui = href_list["vueui"] + ui?.close() + if(connected_blastdoor) blastdoor_interact() + fire_at_area(A) /obj/vehicle/droppod/proc/fire_at_area(var/area/A) diff --git a/html/changelogs/skull132_vueui.yml b/html/changelogs/skull132_vueui.yml new file mode 100644 index 00000000000..a07efa6e991 --- /dev/null +++ b/html/changelogs/skull132_vueui.yml @@ -0,0 +1,5 @@ +author: Skull132 +delete-after: True + +changes: + - refactor: "Freezers, heaters, drop pods, intellicards, smartfridges are now VueUI. This may include minor changes in behaviour or looks." \ No newline at end of file diff --git a/nano/templates/aicard.tmpl b/nano/templates/aicard.tmpl deleted file mode 100644 index be860a52ac9..00000000000 --- a/nano/templates/aicard.tmpl +++ /dev/null @@ -1,103 +0,0 @@ - - - - -{{if data.has_ai}} -
-
- Hardware Integrity: -
-
- {{:data.hardware_integrity}}% -
-
- Backup Capacitor: -
-
- {{:data.backup_capacitor}}% -
-
- - {{if data.has_laws}} - - - -
- Laws: -
- {{for data.laws}} - - {{/for}} -
IndexLaw
{{:value.index}}.{{:value.law}}
- {{else}} - No laws found. - {{/if}} - - {{if data.operational}} - - - - - - - - - - - {{if data.flushing}} - - {{else}} - - - - - {{/if}} -
Radio Subspace Transceiver{{:helper.link("Enabled", null, {'radio' : 0}, data.radio ? 'selected' : null)}}{{:helper.link("Disabled", null, {'radio' : 1}, data.radio ? null : 'redButton' )}}
Wireless Interface{{:helper.link("Enabled", null, {'wireless' : 0}, data.wireless ? 'selected' : null)}}{{:helper.link("Disabled", null, {'wireless' : 1}, data.wireless ? null : 'redButton' )}}
AI wipe in progress...
Wipe AI{{:helper.link("Wipe", 'radiation', {'wipe' : 1}, null, 'redButton')}}
- {{/if}} -{{else}} - Stored AI: No AI detected. -{{/if}} diff --git a/nano/templates/droppod.tmpl b/nano/templates/droppod.tmpl deleted file mode 100644 index d3842786083..00000000000 --- a/nano/templates/droppod.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -

Welcome, Operative.

- -

Please select your launch target:

-{{if data.status}} - Pod Status: Nonoperational -{{else}} - Pod Status: Operational - {{:helper.link('Departures', 'gear', {'fire' : 'arrivals'})}}

- {{:helper.link('Cargo Surface', 'gear', {'fire' : 'cargo'})}}

- {{:helper.link('Command Surface', 'gear', {'fire' : 'commandescape'})}}

-{{/if}} - diff --git a/nano/templates/freezer.tmpl b/nano/templates/freezer.tmpl deleted file mode 100644 index fad41bad9fc..00000000000 --- a/nano/templates/freezer.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -
-
- Status: -
-
- {{:helper.link('On', 'power', {'toggleStatus' : 1}, data.on ? 'selected' : null)}}{{:helper.link('Off', 'close', {'toggleStatus' : 1}, data.on ? null : 'selected')}} -
-
- -
-
- Power Level: -
-
- {{:helper.link('1', null, {'setPower' : 20}, (data.powerSetting == 20)? 'selected' : null)}} - {{:helper.link('2', null, {'setPower' : 40}, (data.powerSetting == 40)? 'selected' : null)}} - {{:helper.link('3', null, {'setPower' : 60}, (data.powerSetting == 60)? 'selected' : null)}} - {{:helper.link('4', null, {'setPower' : 80}, (data.powerSetting == 80)? 'selected' : null)}} - {{:helper.link('5', null, {'setPower' : 100}, (data.powerSetting == 100)? 'selected' : null)}} -
-
- -
-
- Gas Pressure: -
-
- {{:data.gasPressure}} kPa -
-
- -

Gas Temperature

-
-
- Current: -
-
- {{:helper.displayBar(data.gasTemperature, data.minGasTemperature, data.maxGasTemperature, data.gasTemperatureClass)}} -
- {{:data.gasTemperature}} K -
-
-
- -
-
- Target: -
-
- {{:helper.displayBar(data.targetGasTemperature, data.minGasTemperature, data.maxGasTemperature)}} -
- {{:helper.link('-', null, {'temp' : -100}, (data.targetGasTemperature > data.minGasTemperature) ? null : 'disabled')}} - {{:helper.link('-', null, {'temp' : -10}, (data.targetGasTemperature > data.minGasTemperature) ? null : 'disabled')}} - {{:helper.link('-', null, {'temp' : -1}, (data.targetGasTemperature > data.minGasTemperature) ? null : 'disabled')}} -
 {{:data.targetGasTemperature}} K 
- {{:helper.link('+', null, {'temp' : 1}, (data.targetGasTemperature < data.maxGasTemperature) ? null : 'disabled')}} - {{:helper.link('+', null, {'temp' : 10}, (data.targetGasTemperature < data.maxGasTemperature) ? null : 'disabled')}} - {{:helper.link('+', null, {'temp' : 100}, (data.targetGasTemperature < data.maxGasTemperature) ? null : 'disabled')}} -
-
-
- diff --git a/nano/templates/smartfridge.tmpl b/nano/templates/smartfridge.tmpl deleted file mode 100644 index af1ceb50dda..00000000000 --- a/nano/templates/smartfridge.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -
- {{:helper.link('Close', 'gear', {'close' : 1}, null, 'fixedLeft')}} -
- -
-

Storage

- {{if data.secure}} - - {{:data.locked == -1 ? "Sec.re ACC_** //):securi_nt.diag=>##'or 1=1'%($..." : "Secure Access: Please have your identification ready."}} - - {{/if}} -
-
- {{if data.contents}} - {{for data.contents}} -
- {{:value.display_name}} ({{:value.quantity}} available) -
Vend: 
{{:helper.link('x1', 'circle-arrow-s', { "vendItem" : value.vend, "amount" : 1 }, null, 'statusValue')}} - {{if value.quantity >= 5}} - {{:helper.link('x5', 'circle-arrow-s', { "vendItem" : value.vend, "amount" : 5 }, null, 'statusValue')}} - {{/if}} - {{if value.quantity >= 10}} - {{:helper.link('x10', 'circle-arrow-s', { "vendItem" : value.vend, "amount" : 10 }, null, 'statusValue')}} - {{/if}} - {{if value.quantity >= 25}} - {{:helper.link('x25', 'circle-arrow-s', { "vendItem" : value.vend, "amount" : 25 }, null, 'statusValue')}} - {{/if}} - {{if value.quantity > 1}} - {{:helper.link('All', 'circle-arrow-s', { "vendItem" : value.vend, "amount" : value.quantity }, null, 'statusValue')}} - {{/if}} -
- {{/for}} - {{else}} - No products loaded. - {{/if}} -
diff --git a/vueui/src/components/view/devices/aicard.vue b/vueui/src/components/view/devices/aicard.vue new file mode 100644 index 00000000000..e7f5c7ce515 --- /dev/null +++ b/vueui/src/components/view/devices/aicard.vue @@ -0,0 +1,55 @@ + + + diff --git a/vueui/src/components/view/machinery/atmospherics/freezer.vue b/vueui/src/components/view/machinery/atmospherics/freezer.vue new file mode 100644 index 00000000000..ba6c6ff384f --- /dev/null +++ b/vueui/src/components/view/machinery/atmospherics/freezer.vue @@ -0,0 +1,69 @@ + + + \ No newline at end of file diff --git a/vueui/src/components/view/machinery/smartfridge.vue b/vueui/src/components/view/machinery/smartfridge.vue new file mode 100644 index 00000000000..8f21274b47f --- /dev/null +++ b/vueui/src/components/view/machinery/smartfridge.vue @@ -0,0 +1,51 @@ + + + \ No newline at end of file diff --git a/vueui/src/components/view/vehicles/droppod.vue b/vueui/src/components/view/vehicles/droppod.vue new file mode 100644 index 00000000000..6a0b85e2060 --- /dev/null +++ b/vueui/src/components/view/vehicles/droppod.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file