From 901c6591a98f5dc236fc28217e9923aba722b8ec Mon Sep 17 00:00:00 2001 From: Batrachophreno Date: Mon, 26 Jan 2026 09:11:52 -0500 Subject: [PATCH] Update Camera Monitor NanoUI to TGUI (#21734) As title; dedicated computer/security objs now launch the same Camera Monitoring app as modular computers do- same interface but in TGUI. Removes old NanoUI version. --- code/game/machinery/computer/camera.dm | 101 +++++++----------- .../circuitboards/computer/camera_monitor.dm | 16 +-- html/changelogs/Bat-CameraMonitor.yml | 14 +++ .../konyang/point_verdant/point_verdant.dmm | 2 +- .../scenarios/cryo_outpost/cryo_outpost_.dm | 2 +- .../enviro_testing_facility.dm | 2 +- maps/event/generic_dock/generic_dock-1.dmm | 2 +- maps/sccv_horizon/sccv_horizon.dmm | 33 ++---- nano/templates/sec_camera.tmpl | 35 ------ 9 files changed, 71 insertions(+), 136 deletions(-) create mode 100644 html/changelogs/Bat-CameraMonitor.yml delete mode 100644 nano/templates/sec_camera.tmpl diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 1c8d5142664..b401d613658 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -1,4 +1,3 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 /obj/machinery/computer/security name = "security camera monitor" desc = "Used to access the various cameras on the station." @@ -9,17 +8,21 @@ var/current_network = null var/obj/machinery/camera/current_camera = null var/last_pic = 1.0 - var/list/network - var/mapping = 0//For the overview file, interesting bit of code. + var/list/console_networks + var/mapping = 0 var/cache_id = 0 + /// A currently active program running on the computer. + var/datum/computer_file/program/camera_monitor/camera_monitor_program circuit = /obj/item/circuitboard/security /obj/machinery/computer/security/Initialize() - if(!network) - network = SSatlas.current_map.station_networks.Copy() + if(!console_networks) + console_networks = SSatlas.current_map.station_networks.Copy() . = ..() - if(network.len) - current_network = network[1] + if(console_networks.len) + current_network = console_networks[1] + + camera_monitor_program = new("Compless") /obj/machinery/computer/security/attack_ai(var/mob/user as mob) if(!ai_can_interact(user)) @@ -46,32 +49,6 @@ return FALSE return TRUE -/obj/machinery/computer/security/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1) - if(..()) - return - - var/data[0] - var/list/all_networks[0] - for(var/nw in network) - all_networks.Add(list(list( - "tag" = nw, - "has_access" = can_access_network(user, get_camera_access(nw)) - ))) - - data["networks"] = all_networks - - if(current_network) - data["cameras"] = GLOB.camera_repository.cameras_in_network(current_network) - data["current_camera"] = current_camera ? current_camera.nano_structure() : null - data["current_network"] = current_network - - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "sec_camera.tmpl", "Camera Console", 900, 800) - - ui.set_initial_data(data) - ui.open() - /obj/machinery/computer/security/proc/can_access_network(var/mob/user, var/network_access) // No access passed, or 0 which is considered no access requirement. Allow it. if(!network_access) @@ -79,34 +56,30 @@ return (check_camera_access(user, ACCESS_SECURITY) && GLOB.security_level >= SEC_LEVEL_BLUE) || check_camera_access(user, network_access) -/obj/machinery/computer/security/Topic(href, href_list) - if(..()) - return TRUE - if(href_list["switch_camera"]) - var/obj/machinery/camera/C = locate(href_list["switch_camera"]) in GLOB.cameranet.cameras - if(!C) - return - if(!(current_network in C.network)) +/obj/machinery/computer/security/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + if(camera_monitor_program) + ui = new(user, src, camera_monitor_program.tgui_id, camera_monitor_program.filedesc) + ui.autoupdate = camera_monitor_program.ui_auto_update + else + to_chat(usr, "Something has gone wrong; please report the circumstances in which you received this message to the GitHub issues tracker.") return + ui.open() - var/access_granted = FALSE - for(var/network in C.network) - if(can_access_network(usr, get_camera_access(network))) - access_granted = TRUE //We only need access to one of the networks. - if(!access_granted) - to_chat(usr, SPAN_WARNING("Access unauthorized.")) - return +/obj/machinery/computer/security/ui_data(mob/user) + var/list/data = list() + if(camera_monitor_program) + data += camera_monitor_program.ui_data(user) + return data - switch_to_camera(usr, C) - return 1 - else if(href_list["switch_network"]) - if(href_list["switch_network"] in network) - current_network = href_list["switch_network"] - return 1 - else if(href_list["reset"]) - reset_current() - usr.reset_view(current_camera) - return 1 +/obj/machinery/computer/security/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) + return + + if(camera_monitor_program) + . = camera_monitor_program.ui_act(action, params, ui, state) /obj/machinery/computer/security/attack_hand(var/mob/user as mob) if (!(src.z in GetConnectedZlevels(starting_z_level))) @@ -211,7 +184,7 @@ SSnanoui.update_uis(src) /obj/machinery/computer/security/proc/can_access_camera(var/obj/machinery/camera/C) - var/list/shared_networks = src.network & C.network + var/list/shared_networks = src.console_networks & C.network if(shared_networks.len) return 1 return 0 @@ -245,7 +218,7 @@ icon_state = "wallframe" icon_screen = null light_range_on = 0 - network = list(NETWORK_THUNDER) + console_networks = list(NETWORK_THUNDER) density = 0 circuit = null is_holographic = FALSE @@ -275,7 +248,7 @@ icon_keyboard = "purple_key" icon_keyboard_emis = "purple_key_mask" light_color = LIGHT_COLOR_PURPLE - network = list("MINE") + console_networks = list("MINE") circuit = /obj/item/circuitboard/security/mining /obj/machinery/computer/security/engineering @@ -299,8 +272,8 @@ light_power_on = 1 /obj/machinery/computer/security/engineering/Initialize() - if(!network) - network = GLOB.engineering_networks.Copy() + if(!console_networks) + console_networks = GLOB.engineering_networks.Copy() . = ..() /obj/machinery/computer/security/nuclear @@ -310,7 +283,7 @@ icon_keyboard = "red_key" icon_keyboard_emis = "red_key_mask" light_color = LIGHT_COLOR_RED - network = list(NETWORK_MERCENARY) + console_networks = list(NETWORK_MERCENARY) circuit = null /obj/machinery/computer/security/nuclear/Initialize() diff --git a/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm b/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm index 7a1585bbc10..e5093829d8f 100644 --- a/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm +++ b/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm @@ -2,13 +2,13 @@ name = T_BOARD("security camera monitor") build_path = /obj/machinery/computer/security req_access = list(ACCESS_SECURITY) - var/list/network + var/list/console_networks var/locked = 1 var/emagged = 0 /obj/item/circuitboard/security/Initialize() . = ..() - network = SSatlas.current_map.station_networks + console_networks = SSatlas.current_map.station_networks /obj/item/circuitboard/security/engineering name = T_BOARD("engineering camera monitor") @@ -17,21 +17,21 @@ /obj/item/circuitboard/security/engineering/New() ..() - network = GLOB.engineering_networks + console_networks = GLOB.engineering_networks /obj/item/circuitboard/security/mining name = T_BOARD("mining camera monitor") build_path = /obj/machinery/computer/security/mining - network = list("MINE") + console_networks = list("MINE") req_access = list() /obj/item/circuitboard/security/construct(var/obj/machinery/computer/security/C) if (..(C)) - C.network = network.Copy() + C.console_networks = console_networks.Copy() /obj/item/circuitboard/security/deconstruct(var/obj/machinery/computer/security/C) if (..(C)) - network = C.network.Copy() + console_networks = C.console_networks.Copy() /obj/item/circuitboard/security/emag_act(var/remaining_charges, var/mob/user) if(emagged) @@ -56,7 +56,7 @@ if(locked) to_chat(user, SPAN_WARNING("Circuit controls are locked.")) return - var/existing_networks = jointext(network,",") + var/existing_networks = jointext(console_networks,",") var/input = sanitize( tgui_input_text(user, "Which networks would you like to connect this camera console circuit to? Seperate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Multitool-Circuitboard interface", existing_networks) ) if(!input) @@ -67,5 +67,5 @@ if(tempnetwork.len < 1) to_chat(usr, "No network found please hang up and try your call again.") return - network = tempnetwork + console_networks = tempnetwork return diff --git a/html/changelogs/Bat-CameraMonitor.yml b/html/changelogs/Bat-CameraMonitor.yml new file mode 100644 index 00000000000..de6588652cd --- /dev/null +++ b/html/changelogs/Bat-CameraMonitor.yml @@ -0,0 +1,14 @@ +# Your name. +author: Batrachophrenoboocosmomachia + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - code_imp: "Updates telescreens/dedicated camera monitor consoles to use the Camera Monitor TGUI instead of the old NanoUI version (which has been deprecated and removed)." + - bugfix: "Removes duplicated telescreen from SCCV Horizon interrogation monitoring compartment." diff --git a/maps/away/away_site/konyang/point_verdant/point_verdant.dmm b/maps/away/away_site/konyang/point_verdant/point_verdant.dmm index 8a0a5d6c4b5..302fa907ba8 100644 --- a/maps/away/away_site/konyang/point_verdant/point_verdant.dmm +++ b/maps/away/away_site/konyang/point_verdant/point_verdant.dmm @@ -26338,7 +26338,7 @@ "oXt" = ( /obj/machinery/computer/security/telescreen{ name = "Spec. Ops. Monitor"; - network = list("ZeEmergencyResponseTeam"); + console_networks = list("ZeEmergencyResponseTeam"); pixel_x = -8; pixel_y = 24 }, diff --git a/maps/away/scenarios/cryo_outpost/cryo_outpost_.dm b/maps/away/scenarios/cryo_outpost/cryo_outpost_.dm index 20700d43de4..a2a4b99ebd4 100644 --- a/maps/away/scenarios/cryo_outpost/cryo_outpost_.dm +++ b/maps/away/scenarios/cryo_outpost/cryo_outpost_.dm @@ -132,7 +132,7 @@ network = list(NETWORK_CRYO_OUTPOST) /obj/machinery/computer/security/terminal/cryo_outpost - network = list(NETWORK_CRYO_OUTPOST) + console_networks = list(NETWORK_CRYO_OUTPOST) /obj/item/research_slip/cryo_outpost desc = "A small slip of plastic with an embedded chip. It is commonly used to store small amounts of research data. This one is covered in Zeng-Hu Pharmaceuticals logos." diff --git a/maps/away/scenarios/enviro_testing_facility/enviro_testing_facility.dm b/maps/away/scenarios/enviro_testing_facility/enviro_testing_facility.dm index ba6244f14bf..a26421381fb 100644 --- a/maps/away/scenarios/enviro_testing_facility/enviro_testing_facility.dm +++ b/maps/away/scenarios/enviro_testing_facility/enviro_testing_facility.dm @@ -95,7 +95,7 @@ // --------------------------------------------------- misc /obj/machinery/computer/security/terminal/enviro_testing_facility - network = list("Env-Test Facility Zoya") + console_networks = list("Env-Test Facility Zoya") /obj/machinery/camera/network/enviro_testing_facility network = list("Env-Test Facility Zoya") diff --git a/maps/event/generic_dock/generic_dock-1.dmm b/maps/event/generic_dock/generic_dock-1.dmm index 75b5ea164ca..f6946ff951c 100644 --- a/maps/event/generic_dock/generic_dock-1.dmm +++ b/maps/event/generic_dock/generic_dock-1.dmm @@ -11478,7 +11478,7 @@ }, /obj/machinery/computer/security/telescreen{ name = "Spec. Ops. Monitor"; - network = list("ZeEmergencyResponseTeam"); + console_networks = list("ZeEmergencyResponseTeam"); pixel_x = -8; pixel_y = 24 }, diff --git a/maps/sccv_horizon/sccv_horizon.dmm b/maps/sccv_horizon/sccv_horizon.dmm index 7aee7cdbf06..4eaf8c0a1ed 100644 --- a/maps/sccv_horizon/sccv_horizon.dmm +++ b/maps/sccv_horizon/sccv_horizon.dmm @@ -23920,7 +23920,7 @@ /obj/structure/table/standard, /obj/machinery/computer/security/telescreen{ name = "Access Monitor"; - network = list("Xeno_Bio") + console_networks = list("Xeno_Bio") }, /obj/machinery/atmospherics/unary/vent_scrubber/on{ dir = 1 @@ -26900,6 +26900,7 @@ /obj/machinery/light{ dir = 4 }, +/obj/machinery/light_switch/east, /turf/simulated/floor/tiled/dark, /area/horizon/security/interrogation/monitoring) "dyx" = ( @@ -40166,7 +40167,7 @@ /obj/structure/table/standard, /obj/machinery/computer/security/telescreen{ name = "Access Monitor"; - network = list("Xeno_Bio"); + console_networks = list("Xeno_Bio"); req_access = list(55) }, /obj/effect/floor_decal/corner/mauve{ @@ -82791,7 +82792,7 @@ /obj/machinery/computer/security/telescreen{ desc = "Connects to a station's emergency camera networks after the station sends out a distress signal."; name = "Emergency Dock Uplink"; - network = list("Emergency Dock","TCFL"); + console_networks = list("Emergency Dock","TCFL"); pixel_y = 28 }, /obj/structure/bed/stool/chair/office/bridge/pilot, @@ -97962,7 +97963,7 @@ }, /obj/machinery/computer/security/telescreen{ name = "Spec. Ops. Monitor"; - network = list("ZeEmergencyResponseTeam"); + console_networks = list("ZeEmergencyResponseTeam"); pixel_x = -8; pixel_y = 24 }, @@ -100169,18 +100170,6 @@ }, /turf/simulated/floor/tiled/white, /area/centcom/shared_dream) -"noN" = ( -/obj/machinery/computer/security/telescreen{ - name = "Observation Screen"; - network = list("Interrogation"); - pixel_y = -32 - }, -/obj/structure/bed/stool/chair, -/obj/effect/floor_decal/corner/dark_blue{ - dir = 10 - }, -/turf/simulated/floor/tiled/dark, -/area/horizon/security/interrogation/monitoring) "noO" = ( /obj/machinery/atmospherics/pipe/simple/hidden/aux{ dir = 9 @@ -115693,7 +115682,7 @@ }, /obj/machinery/computer/security/telescreen{ name = "Access Monitor"; - network = list("XO_Office"); + console_networks = list("XO_Office"); pixel_y = 24; pixel_x = -32 }, @@ -124560,16 +124549,10 @@ /turf/unsimulated/floor/wood, /area/antag/actor) "qEm" = ( -/obj/machinery/computer/security/telescreen{ - name = "Observation Screen"; - network = list("Interrogation"); - pixel_y = -32 - }, /obj/structure/bed/stool/chair, /obj/effect/floor_decal/corner/dark_blue/full{ dir = 4 }, -/obj/machinery/light_switch/east, /turf/simulated/floor/tiled/dark, /area/horizon/security/interrogation/monitoring) "qEo" = ( @@ -175995,7 +175978,7 @@ "xsv" = ( /obj/machinery/computer/security/telescreen{ name = "Telecommunications Cameras"; - network = list("Tcomsat"); + console_networks = list("Tcomsat"); pixel_x = 32; pixel_y = -4 }, @@ -353327,7 +353310,7 @@ pQA jnA cjW tMv -noN +lWO ixW aLB lpO diff --git a/nano/templates/sec_camera.tmpl b/nano/templates/sec_camera.tmpl deleted file mode 100644 index 440abf9309b..00000000000 --- a/nano/templates/sec_camera.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -
- {{:helper.link('Reset', 'refresh', {'reset' : 1})}} -
- -
-
Current Camera:
- {{if data.current_camera}} -
{{:data.current_camera.name}}
- {{else}} -
None
- {{/if}} -
- -
-
Networks:
-
-{{for data.networks}} - {{if value.has_access}} - {{:helper.link(value.tag, '', {'switch_network' : value.tag}, null, data.current_network == value.tag ? 'selected' : null)}} - {{else}} - {{:helper.link(value.tag, '', {}, null, data.current_network == value.tag ? 'selected' : 'redButton')}} - {{/if}} -{{/for}} -
-
Cameras:
-
-{{for data.cameras}} - {{if data.current_camera && value.name == data.current_camera.name}} - {{:helper.link(value.name, '', {'switch_camera' : value.camera}, 'selected')}} - {{else value.deact}} - {{:helper.link(value.name + " (deactivated)", '', {}, 'inactive')}} - {{else}} - {{:helper.link(value.name, '', {'switch_camera' : value.camera})}} - {{/if}} -{{/for}}