diff --git a/code/datums/repositories/crew.dm b/code/datums/repositories/crew.dm index 6fbe1863da7..ae73c98c8df 100644 --- a/code/datums/repositories/crew.dm +++ b/code/datums/repositories/crew.dm @@ -7,12 +7,12 @@ var/global/datum/repository/crew/crew_repository = new() cache_data = list() ..() -/datum/repository/crew/proc/health_data(var/turf/T) +/datum/repository/crew/proc/health_data(var/zLevel) var/list/crewmembers = list() - if(!T) + if(!zLevel) return crewmembers - var/z_level = "[T.z]" + var/z_level = "[zLevel]" var/datum/cache_entry/cache_entry = cache_data[z_level] if(!cache_entry) cache_entry = new/datum/cache_entry @@ -24,7 +24,7 @@ var/global/datum/repository/crew/crew_repository = new() var/tracked = scan() for(var/obj/item/clothing/under/C in tracked) var/turf/pos = get_turf(C) - if((C) && (C.has_sensor) && (pos) && (T && pos.z == T.z) && (C.sensor_mode != SUIT_SENSOR_OFF)) + if((C) && (C.has_sensor) && (pos) && (pos.z == zLevel) && (C.sensor_mode != SUIT_SENSOR_OFF)) if(istype(C.loc, /mob/living/carbon/human)) var/mob/living/carbon/human/H = C.loc if(H.w_uniform != C) @@ -51,6 +51,7 @@ var/global/datum/repository/crew/crew_repository = new() crewmemberData["area"] = sanitize(A.name) crewmemberData["x"] = pos.x crewmemberData["y"] = pos.y + crewmemberData["z"] = pos.z crewmembers[++crewmembers.len] = crewmemberData diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 244598ad09a..36974b159f9 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -35,7 +35,6 @@ return viewflag /obj/machinery/computer/security/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1) - if(src.z > 6) return if(stat & (NOPOWER|BROKEN)) return if(user.stat) return @@ -48,6 +47,7 @@ data["cameras"] = camera_repository.cameras_in_network(current_network) if(current_camera) switch_to_camera(user, current_camera) + data["map_levels"] = using_map.get_map_levels(src.z) ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) @@ -91,7 +91,7 @@ . = ..() /obj/machinery/computer/security/attack_hand(var/mob/user as mob) - if (src.z > 6) + if (using_map && !(src.z in using_map.contact_levels)) user << "Unable to establish a connection: You're too far away from the station!" return if(stat & (NOPOWER|BROKEN)) return diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 0703d9f7e1c..a8b6ee24241 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -52,7 +52,7 @@ /obj/machinery/computer/communications/Topic(href, href_list) if(..()) return 1 - if (using_map && !(src.z in using_map.station_levels)) + if (using_map && !(src.z in using_map.contact_levels)) usr << "\red Unable to establish a connection: \black You're too far away from the station!" return usr.set_machine(src) @@ -274,7 +274,7 @@ /obj/machinery/computer/communications/attack_hand(var/mob/user as mob) if(..()) return - if (src.z > 6) + if (using_map && !(src.z in using_map.contact_levels)) user << "\red Unable to establish a connection: \black You're too far away from the station!" return diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index abbf65b44ff..8def6db394a 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -26,7 +26,7 @@ attackby(obj/item/weapon/O as obj, mob/user as mob) - if (user.z > 6) + if (using_map && !(user.z in using_map.contact_levels)) user << "Unable to establish a connection: You're too far away from the station!" return if(istype(O, /obj/item/weapon/aiModule)) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 465884b2caa..1179d3a2b23 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -56,7 +56,7 @@ /obj/machinery/computer/secure_data/attack_hand(mob/user as mob) if(..()) return - if (src.z > 6) + if (using_map && !(src.z in using_map.contact_levels)) user << "Unable to establish a connection: You're too far away from the station!" return var/dat diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index bd9c66dbaed..fb92e700ff0 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -39,7 +39,7 @@ /obj/machinery/computer/skills/attack_hand(mob/user as mob) if(..()) return - if (src.z > 6) + if (using_map && !(src.z in using_map.contact_levels)) user << "Unable to establish a connection: You're too far away from the station!" return var/dat diff --git a/code/modules/nano/modules/atmos_control.dm b/code/modules/nano/modules/atmos_control.dm index b84cacad0a1..742696396b8 100644 --- a/code/modules/nano/modules/atmos_control.dm +++ b/code/modules/nano/modules/atmos_control.dm @@ -32,15 +32,27 @@ /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)) - alarms[++alarms.len] = list("name" = sanitize(alarm.name), "ref"= "\ref[alarm]", "danger" = max(alarm.danger_level, alarm.alarm_area.atmosalm)) + alarms[++alarms.len] = list( + "name" = sanitize(alarm.name), + "ref"= "\ref[alarm]", + "danger" = max(alarm.danger_level, alarm.alarm_area.atmosalm), + "x" = alarm.x, + "y" = alarm.y, + "z" = alarm.z) data["alarms"] = alarms + 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) ui = new(user, src, ui_key, "atmos_control.tmpl", src.name, 625, 625, state = state) + // adding a template with the key "mapContent" enables the map ui functionality + ui.add_template("mapContent", "atmos_control_map_content.tmpl") + // adding a template with the key "mapHeader" replaces the map header content + ui.add_template("mapHeader", "atmos_control_map_header.tmpl") ui.set_initial_data(data) ui.open() ui.set_auto_update(1) diff --git a/code/modules/nano/modules/crew_monitor.dm b/code/modules/nano/modules/crew_monitor.dm index e71dc5ac7ea..8a6ef7624eb 100644 --- a/code/modules/nano/modules/crew_monitor.dm +++ b/code/modules/nano/modules/crew_monitor.dm @@ -20,7 +20,10 @@ var/turf/T = get_turf(nano_host()) data["isAI"] = isAI(user) - data["crewmembers"] = crew_repository.health_data(T) + 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) @@ -30,6 +33,8 @@ 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["map_levels"])) + ui.set_map_z_level(data["map_levels"][1]) ui.set_initial_data(data) ui.open() diff --git a/code/modules/nano/modules/power_monitor.dm b/code/modules/nano/modules/power_monitor.dm index 94223fc4eff..89e1dbda62f 100644 --- a/code/modules/nano/modules/power_monitor.dm +++ b/code/modules/nano/modules/power_monitor.dm @@ -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,10 +26,15 @@ data["all_sensors"] = sensors if(focus) data["focus"] = focus.return_reading_data() + 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) ui = new(user, src, ui_key, "power_monitor.tmpl", "Power Monitoring Console", 800, 500, state = state) + // adding a template with the key "mapContent" enables the map ui functionality + ui.add_template("mapContent", "power_monitor_map_content.tmpl") + // adding a template with the key "mapHeader" replaces the map header content + ui.add_template("mapHeader", "power_monitor_map_header.tmpl") ui.set_initial_data(data) ui.open() ui.set_auto_update(1) diff --git a/code/modules/power/sensors/powernet_sensor.dm b/code/modules/power/sensors/powernet_sensor.dm index 27e434b562f..bfc89591394 100644 --- a/code/modules/power/sensors/powernet_sensor.dm +++ b/code/modules/power/sensors/powernet_sensor.dm @@ -163,6 +163,10 @@ // Cell Status APC_entry["cell_charge"] = A.cell ? round(A.cell.percent()) : "NO CELL" APC_entry["cell_status"] = A.cell ? chg[A.charging+1] : "N" + // Location + APC_entry["x"] = A.x + APC_entry["y"] = A.y + APC_entry["z"] = A.z // Other info APC_entry["total_load"] = reading_to_text(A.lastused_total) // Hopefully removes those goddamn \improper s which are screwing up the UI diff --git a/html/changelogs/Leshana-multiz-consoles.yml b/html/changelogs/Leshana-multiz-consoles.yml new file mode 100644 index 00000000000..55e771e4d23 --- /dev/null +++ b/html/changelogs/Leshana-multiz-consoles.yml @@ -0,0 +1,32 @@ +################################ +# 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 +################################# + +author: Leshana +delete-after: True +changes: + - rscadd: "Added nanomap capability to the Power Monitoring Computer" + - rscadd: "Added nanomap capability to the Atmos Control Computer" + - tweak: "Expanded nanomap on Camera Console to all station z-levels by default." + - tweak: "Crew Monitoring nanomap will support crew monitors built on other station map z levels." + - imageadd: "Updated z1 nanomap for Northern Star" + - imageadd: "Generated z5 nanomap for Northern Star" diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index 67307102ddf..1a575b3578b 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -119,6 +119,17 @@ var/list/all_maps = list() empty_levels = list(world.maxz) return pick(empty_levels) +// Get the list of zlevels that a computer on srcz can see maps of (for power/crew monitor, cameras, etc) +// The long_range parameter expands the coverage. Default is to return map_levels for long range otherwise just srcz. +// zLevels outside station_levels will return an empty list. +/datum/map/proc/get_map_levels(var/srcz, var/long_range = TRUE) + if (long_range && (srcz in map_levels)) + return map_levels + else if (srcz in station_levels) + return list(srcz) + else + return list() + // Another way to setup the map datum that can be convenient. Just declare all your zlevels as subtypes of a common // subtype of /datum/map_z_level and set zlevel_datum_type on /datum/map to have the lists auto-initialized. diff --git a/nano/images/nanomap_z1.png b/nano/images/nanomap_z1.png index e4a045bf82f..4a8d9d492f7 100644 Binary files a/nano/images/nanomap_z1.png and b/nano/images/nanomap_z1.png differ diff --git a/nano/images/nanomap_z5.png b/nano/images/nanomap_z5.png new file mode 100644 index 00000000000..32ebfb01983 Binary files /dev/null and b/nano/images/nanomap_z5.png differ diff --git a/nano/templates/atmos_control.tmpl b/nano/templates/atmos_control.tmpl index 5e9a1acfe47..3d2a1203f71 100644 --- a/nano/templates/atmos_control.tmpl +++ b/nano/templates/atmos_control.tmpl @@ -1,3 +1,8 @@ +{{if data.map_levels.length}} +