diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 322e829d6fd..3256818b3df 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -35,10 +35,7 @@ networks["Thunderdome"] = list(access_cent_captain) attack_ai(var/mob/user as mob) - if(isAI(user)) - return ui_interact(user) - else - return attack_hand(user) + return attack_hand(user) attack_paw(var/mob/user as mob) return attack_hand(user) @@ -51,6 +48,7 @@ // Network configuration attackby(I as obj, user as mob) + access = list() if(istype(I,/obj/item/weapon/card/emag)) // If hit by an emag. var/obj/item/weapon/card/emag/E = I if(!emagged) @@ -71,18 +69,45 @@ ..() ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) - if(..()) - return - if(stat & (NOPOWER|BROKEN)) - return + if(src.z > 6) return + if(stat & (NOPOWER|BROKEN)) return + if(user.stat) return + + var/data[0] + + data["current"] = null + + var/list/L = list() + for (var/obj/machinery/camera/C in cameranet.viewpoints) + if(can_access_camera(C)) + L.Add(C) + + camera_sort(L) + + var/cameras[0] + for(var/obj/machinery/camera/C in L) + var/cam[0] + cam["name"] = C.c_tag + cam["deact"] = !C.can_use() + cam["camera"] = "\ref[C]" + cam["x"] = C.x + cam["y"] = C.y + cam["z"] = C.z + + cameras[++cameras.len] = cam + + if(C == current) + data["current"] = cam + + data["cameras"] = cameras - data.Cut() tempnets.Cut() if(emagged) access = list(access_captain) // Assume captain level access when emagged data["emagged"] = 1 - if(isAI(user)) + if(isAI(user) || isrobot (user)) access = list(access_captain) // Assume captain level access when AI + // Loop through the ID's permission, and check which networks the ID has access to. for(var/l in networks) // Loop through networks. for(var/m in networks[l]) // Loop through access levels of the networks. @@ -93,16 +118,36 @@ tempnets.Add(list(list("name" = l, "active" = 0))) break data["networks"] = tempnets + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) - if(!ui) - ui = new(user, src, ui_key, "camera_console.tmpl", "Camera Monitor UI", 670, 280) + if (!ui) + ui = new(user, src, ui_key, "sec_camera.tmpl", "Camera Console", 900, 800) + + // adding a template with the key "mapContent" enables the map ui functionality + ui.add_template("mapContent", "sec_camera_map_content.tmpl") + // adding a template with the key "mapHeader" replaces the map header content + ui.add_template("mapHeader", "sec_camera_map_header.tmpl") + ui.set_initial_data(data) ui.open() - + ui.set_auto_update(1) + Topic(href, href_list) - if(..()) - return - if(href_list["activate"]) // Activate: enable or disable networks + if(href_list["switchTo"]) + if(src.z>6 || stat&(NOPOWER|BROKEN)) return + if(usr.stat || ((get_dist(usr, src) > 1 || !( usr.canmove ) || usr.blinded) && !istype(usr, /mob/living/silicon))) return + var/obj/machinery/camera/C = locate(href_list["switchTo"]) in cameranet.viewpoints + if(!C) return + + switch_to_camera(usr, C) + return 1 + else if(href_list["reset"]) + if(src.z>6 || stat&(NOPOWER|BROKEN)) return + if(usr.stat || ((get_dist(usr, src) > 1 || !( usr.canmove ) || usr.blinded) && !istype(usr, /mob/living/silicon))) return + current = null + usr.check_eye(current) + return 1 + else if(href_list["activate"]) // Activate: enable or disable networks var/net = href_list["activate"] // Network to be enabled or disabled. var/active = href_list["active"] // Is the network currently active. for(var/a in networks[net]) @@ -114,50 +159,26 @@ src.network += net break nanomanager.update_uis(src) + else + . = ..() attack_hand(var/mob/user as mob) - if(src.z > 6) - user << "\red Unable to establish a connection: \black You're too far away from the station!" - return - if(stat & (NOPOWER|BROKEN)) + access = list() + if (src.z > 6) + user << "\red Unable to establish a connection: \black You're too far away from the station!" return + if(stat & (NOPOWER|BROKEN)) return if(!isAI(user)) user.set_machine(src) - if(network.len == 0) - user << "\red No networks configured! Swipe the monitor with an authorized ID to configure them." - return - - // Camera listing - var/list/L = list() - for (var/obj/machinery/camera/C in cameranet.viewpoints) - L.Add(C) - camera_sort(L) - - var/list/D = list() - D["Cancel"] = "Cancel" - for(var/obj/machinery/camera/C in L) - if(can_access_camera(C)) - D[text("[][]", C.c_tag, (C.status ? null : " (Deactivated)"))] = C - C.watcherslist -= user - var/t = input(user, "Which camera should you change to?") as null|anything in D - if(!t) - user.unset_machine() - return 0 - - var/obj/machinery/camera/C = D[t] + if(ishuman(user)) + var/mob/living/carbon/human/H = user + if(H.wear_id) + var/obj/item/weapon/card/id/gold/C = H.wear_id + access = C.access - if(t == "Cancel") - user.unset_machine() - return 0 - - if(C) - C.watcherslist += user - switch_to_camera(user, C) - spawn(5) - attack_hand(user) - return + ui_interact(user) // Check if camera is accessible when jumping proc/can_access_camera(var/obj/machinery/camera/C) diff --git a/maps/cyberiad.dmm b/maps/cyberiad.dmm index 1c9bd20778b..3434c417a12 100644 --- a/maps/cyberiad.dmm +++ b/maps/cyberiad.dmm @@ -3227,7 +3227,7 @@ "bkc" = (/turf/simulated/floor/bluegrid,/area/turret_protected/ai) "bkd" = (/obj/machinery/atmospherics/pipe/simple/supply/hidden,/obj/structure/cable{d1 = 4; d2 = 8; icon_state = "4-8"; tag = ""},/obj/item/device/radio/beacon,/turf/simulated/floor,/area/bridge) "bke" = (/obj/machinery/computer/prisoner{req_access = null; req_access_txt = "2"},/turf/simulated/floor{icon_state = "red"; dir = 9},/area/bridge) -"bkf" = (/obj/machinery/computer/security{network = list("SS13","Research Outpost","Mining Outpost")},/obj/machinery/camera{c_tag = "Bridge West"; dir = 2; network = list("SS13")},/turf/simulated/floor{icon_state = "red"; dir = 1},/area/bridge) +"bkf" = (/obj/machinery/computer/security{network = list("SS13","Research Outpost","Mining Outpost","Telecomms")},/obj/machinery/camera{c_tag = "Bridge West"; dir = 2; network = list("SS13")},/turf/simulated/floor{icon_state = "red"; dir = 1},/area/bridge) "bkg" = (/obj/structure/table/reinforced,/obj/machinery/recharger{pixel_y = 0},/turf/simulated/floor{icon_state = "redcorner"; dir = 1},/area/bridge) "bkh" = (/obj/structure/filingcabinet,/obj/machinery/alarm{dir = 1; icon_state = "alarm0"; pixel_y = -22},/turf/simulated/floor{icon_state = "blue"; dir = 10},/area/bridge) "bki" = (/obj/machinery/disposal,/obj/structure/disposalpipe/trunk{dir = 4},/turf/simulated/floor/wood,/area/crew_quarters/captain) diff --git a/nano/debug.html b/nano/debug.html index abe9da0bc8a..15637f035fc 100644 --- a/nano/debug.html +++ b/nano/debug.html @@ -16,7 +16,7 @@ - +