mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Switch nanomap computers over to using get_sensor_levels()
* Added a proc to the map datum which returns what zlevels a nanomap capable computer should display. * Updated the atmos control, power monitoring, crew monitoring, and camera consoles to use it. * Changed templates to not show the map button if no map levels are available.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
/datum/nano_module/atmos_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/master_ui = null, var/datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
var/alarms[0]
|
||||
var/turf/T = get_turf(nano_host())
|
||||
|
||||
// TODO: Move these to a cache, similar to cameras
|
||||
for(var/obj/machinery/alarm/alarm in (monitored_alarms.len ? monitored_alarms : machines))
|
||||
@@ -43,7 +44,7 @@
|
||||
"y" = alarm.y,
|
||||
"z" = alarm.z)
|
||||
data["alarms"] = alarms
|
||||
data["station_levels"] = using_map.station_levels
|
||||
data["map_levels"] = using_map.get_map_levels(T.z)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
|
||||
@@ -20,12 +20,10 @@
|
||||
var/turf/T = get_turf(nano_host())
|
||||
|
||||
data["isAI"] = isAI(user)
|
||||
|
||||
data["station_levels"] = get_z_levels(T)
|
||||
var/list/crewmembers = list()
|
||||
for(var/z in data["station_levels"])
|
||||
crewmembers += crew_repository.health_data(z)
|
||||
data["crewmembers"] = crewmembers
|
||||
data["map_levels"] = using_map.get_map_levels(T.z, FALSE)
|
||||
data["crewmembers"] = list()
|
||||
for(var/z in (data["map_levels"] | T.z)) // Always show crew from the current Z even if we can't show a map
|
||||
data["crewmembers"] += crew_repository.health_data(z)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
@@ -35,8 +33,6 @@
|
||||
ui.add_template("mapContent", "crew_monitor_map_content.tmpl")
|
||||
// adding a template with the key "mapHeader" replaces the map header content
|
||||
ui.add_template("mapHeader", "crew_monitor_map_header.tmpl")
|
||||
if(!(ui.map_z_level in data["station_levels"]))
|
||||
ui.set_map_z_level(data["station_levels"][1])
|
||||
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
@@ -44,9 +40,6 @@
|
||||
// should make the UI auto-update; doesn't seem to?
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/datum/nano_module/crew_monitor/proc/get_z_levels(var/turf/T)
|
||||
return list(T.z)
|
||||
|
||||
/*/datum/nano_module/crew_monitor/proc/scan()
|
||||
for(var/mob/living/carbon/human/H in mob_list)
|
||||
if(istype(H.w_uniform, /obj/item/clothing/under))
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
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 = null
|
||||
var/turf/T = get_turf(nano_host())
|
||||
|
||||
// Build list of data from sensor readings.
|
||||
for(var/obj/machinery/power/sensor/S in grid_sensors)
|
||||
@@ -25,7 +26,7 @@
|
||||
data["all_sensors"] = sensors
|
||||
if(focus)
|
||||
data["focus"] = focus.return_reading_data()
|
||||
data["station_levels"] = using_map.station_levels
|
||||
data["map_levels"] = using_map.get_map_levels(T.z)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
|
||||
Reference in New Issue
Block a user