diff --git a/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm b/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm index 6965a77fe06..03f8660a7ba 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm @@ -20,12 +20,10 @@ /datum/computer_file/program/power_monitor/ui_data(mob/user) var/list/data = initial_data() - var/list/sensors = list() - // Focus: If it remains null if no sensor is selected and UI will display sensor list, otherwise it will display sensor reading. - var/obj/machinery/power/sensor/focus + var/obj/machinery/power/sensor/focus // Placeholder for selected sensor, if one has been selected from the UI list - // Build list of data from sensor readings. + // Prepare list of sensors (see refresh_sensors()) and set focus to sensor based of active_sensor (see ui_act()->setsensor) for(var/obj/machinery/power/sensor/S in grid_sensors) sensors.Add(list(list( "name" = S.name_tag, @@ -34,12 +32,18 @@ if(S.name_tag == active_sensor) focus = S - data["all_sensors"] = sensors + // Prepare return value: data["focus"] will dictate which view is visible (list or focused sensor) + data["all_sensors"] = sensors // Represents main menu list of all found sensors if(focus) - data["focus"] = focus.return_reading_data() - + data["focus"] = focus.return_reading_data() // Force view to selected sensor, include focused sensors data + else + data["focus"] = null // Force view to main menu return data +/datum/computer_file/program/power_monitor/kill_program(forced) + ..() + active_sensor = null // Reset UI navigation state + /datum/computer_file/program/power_monitor/proc/has_alarm() for(var/obj/machinery/power/sensor/S in grid_sensors) if(S.check_grid_warning()) diff --git a/html/changelogs/fabiank3-bugfix-powermonitor-program-navigation.yml b/html/changelogs/fabiank3-bugfix-powermonitor-program-navigation.yml new file mode 100644 index 00000000000..c6d63710b91 --- /dev/null +++ b/html/changelogs/fabiank3-bugfix-powermonitor-program-navigation.yml @@ -0,0 +1,6 @@ +author: FabianK3 + +delete-after: True + +changes: + - bugfix: "Fixed broken UI navigation in engineering power-monitor program."