Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes UI navigation in engineering power-monitor program #19940

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
author: FabianK3

delete-after: True

changes:
- bugfix: "Fixed broken UI navigation in engineering power-monitor program."
Loading