mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-07-13 17:22:41 +01:00
TGUI 4.0 & Camera Console
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/datum/computer_file/program/camera_monitor/hacked
|
||||
filename = "camcrypt"
|
||||
filedesc = "Camera Decryption Tool"
|
||||
nanomodule_path = /datum/nano_module/camera_monitor/hacked
|
||||
tguimodule_path = /datum/tgui_module/camera/ntos/hacked
|
||||
program_icon_state = "hostile"
|
||||
program_key_state = "security_key"
|
||||
program_menu_icon = "zoomin"
|
||||
@@ -15,25 +15,8 @@
|
||||
if(program_state != PROGRAM_STATE_ACTIVE) // Background programs won't trigger alarms.
|
||||
return
|
||||
|
||||
var/datum/nano_module/camera_monitor/hacked/HNM = NM
|
||||
|
||||
// The program is active and connected to one of the station's networks. Has a very small chance to trigger IDS alarm every tick.
|
||||
if(HNM && HNM.current_network && (HNM.current_network in using_map.station_networks) && prob(0.1))
|
||||
if(prob(0.1))
|
||||
if(ntnet_global.intrusion_detection_enabled)
|
||||
ntnet_global.add_log("IDS WARNING - Unauthorised access detected to camera network [HNM.current_network] by device with NID [computer.network_card.get_network_tag()]")
|
||||
ntnet_global.add_log("IDS WARNING - Unauthorised access detected to camera network by device with NID [computer.network_card.get_network_tag()]")
|
||||
ntnet_global.intrusion_detection_alarm = 1
|
||||
|
||||
|
||||
/datum/nano_module/camera_monitor/hacked
|
||||
name = "Hacked Camera Monitoring Program"
|
||||
//available_to_ai = FALSE
|
||||
|
||||
/datum/nano_module/camera_monitor/hacked/can_access_network(var/mob/user, var/network_access)
|
||||
return 1
|
||||
|
||||
// The hacked variant has access to all commonly used networks.
|
||||
/datum/nano_module/camera_monitor/hacked/modify_networks_list(var/list/networks)
|
||||
networks.Add(list(list("tag" = NETWORK_MERCENARY, "has_access" = 1)))
|
||||
networks.Add(list(list("tag" = NETWORK_ERT, "has_access" = 1)))
|
||||
networks.Add(list(list("tag" = NETWORK_CRESCENT, "has_access" = 1)))
|
||||
return networks
|
||||
@@ -24,7 +24,7 @@
|
||||
/datum/computer_file/program/camera_monitor
|
||||
filename = "cammon"
|
||||
filedesc = "Camera Monitoring"
|
||||
nanomodule_path = /datum/nano_module/camera_monitor
|
||||
tguimodule_path = /datum/tgui_module/camera/ntos
|
||||
program_icon_state = "cameras"
|
||||
program_key_state = "generic_key"
|
||||
program_menu_icon = "search"
|
||||
@@ -33,163 +33,11 @@
|
||||
available_on_ntnet = 1
|
||||
requires_ntnet = 1
|
||||
|
||||
/datum/nano_module/camera_monitor
|
||||
name = "Camera Monitoring program"
|
||||
var/obj/machinery/camera/current_camera = null
|
||||
var/current_network = null
|
||||
|
||||
/datum/nano_module/camera_monitor/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, state = default_state)
|
||||
var/list/data = host.initial_data()
|
||||
|
||||
data["current_camera"] = current_camera ? current_camera.nano_structure() : null
|
||||
data["current_network"] = current_network
|
||||
|
||||
var/list/all_networks[0]
|
||||
for(var/network in using_map.station_networks)
|
||||
if(can_access_network(user, get_camera_access(network), 1))
|
||||
all_networks.Add(list(list(
|
||||
"tag" = network,
|
||||
"has_access" = 1
|
||||
)))
|
||||
for(var/network in using_map.secondary_networks)
|
||||
if(can_access_network(user, get_camera_access(network), 0))
|
||||
all_networks.Add(list(list(
|
||||
"tag" = network,
|
||||
"has_access" = 1
|
||||
)))
|
||||
|
||||
all_networks = modify_networks_list(all_networks)
|
||||
|
||||
data["networks"] = all_networks
|
||||
|
||||
var/list/map_levels = using_map.get_map_levels(get_z(nano_host()), TRUE, om_range = DEFAULT_OVERMAP_RANGE)
|
||||
|
||||
if(current_network)
|
||||
data["cameras"] = camera_repository.cameras_in_network(current_network, map_levels)
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "mod_sec_camera.tmpl", "Camera Monitoring", 900, 800)
|
||||
// ui.auto_update_layout = 1 // Disabled as with suit sensors monitor - breaks the UI map. Re-enable once it's fixed somehow.
|
||||
|
||||
ui.add_template("mapContent", "sec_camera_map_content.tmpl")
|
||||
ui.add_template("mapHeader", "mod_sec_camera_map_header.tmpl")
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
|
||||
// Intended to be overriden by subtypes to manually add non-station networks to the list.
|
||||
/datum/nano_module/camera_monitor/proc/modify_networks_list(var/list/networks)
|
||||
return networks
|
||||
|
||||
/datum/nano_module/camera_monitor/proc/can_access_network(var/mob/user, var/network_access, var/station_network = 0)
|
||||
// No access passed, or 0 which is considered no access requirement. Allow it.
|
||||
if(!network_access)
|
||||
return 1
|
||||
|
||||
if(station_network)
|
||||
return check_access(user, network_access) || check_access(user, access_security) || check_access(user, access_heads)
|
||||
else
|
||||
return check_access(user, network_access)
|
||||
|
||||
/datum/nano_module/camera_monitor/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["switch_camera"])
|
||||
var/obj/machinery/camera/C = locate(href_list["switch_camera"]) in cameranet.cameras
|
||||
if(!C)
|
||||
return
|
||||
if(!(current_network in C.network))
|
||||
return
|
||||
|
||||
switch_to_camera(usr, C)
|
||||
return 1
|
||||
|
||||
else if(href_list["switch_network"])
|
||||
// Either security access, or access to the specific camera network's department is required in order to access the network.
|
||||
if(can_access_network(usr, get_camera_access(href_list["switch_network"]), (href_list["switch_network"] in using_map.station_networks)))
|
||||
current_network = href_list["switch_network"]
|
||||
else
|
||||
to_chat(usr, "\The [nano_host()] shows an \"Network Access Denied\" error message.")
|
||||
return 1
|
||||
|
||||
else if(href_list["reset"])
|
||||
reset_current()
|
||||
usr.reset_view(current_camera)
|
||||
return 1
|
||||
|
||||
/datum/nano_module/camera_monitor/proc/switch_to_camera(var/mob/user, var/obj/machinery/camera/C)
|
||||
//don't need to check if the camera works for AI because the AI jumps to the camera location and doesn't actually look through cameras.
|
||||
if(isAI(user))
|
||||
var/mob/living/silicon/ai/A = user
|
||||
// Only allow non-carded AIs to view because the interaction with the eye gets all wonky otherwise.
|
||||
if(!A.is_in_chassis())
|
||||
return 0
|
||||
|
||||
A.eyeobj.setLoc(get_turf(C))
|
||||
A.client.eye = A.eyeobj
|
||||
return 1
|
||||
|
||||
set_current(C)
|
||||
user.machine = nano_host()
|
||||
user.reset_view(C)
|
||||
return 1
|
||||
|
||||
/datum/nano_module/camera_monitor/proc/set_current(var/obj/machinery/camera/C)
|
||||
if(current_camera == C)
|
||||
return
|
||||
|
||||
if(current_camera)
|
||||
reset_current()
|
||||
|
||||
current_camera = C
|
||||
if(current_camera)
|
||||
var/mob/living/L = current_camera.loc
|
||||
if(istype(L))
|
||||
L.tracking_initiated()
|
||||
|
||||
/datum/nano_module/camera_monitor/proc/reset_current()
|
||||
if(current_camera)
|
||||
var/mob/living/L = current_camera.loc
|
||||
if(istype(L))
|
||||
L.tracking_cancelled()
|
||||
current_camera = null
|
||||
|
||||
/datum/nano_module/camera_monitor/check_eye(var/mob/user as mob)
|
||||
if(!current_camera)
|
||||
return 0
|
||||
var/viewflag = current_camera.check_eye(user)
|
||||
if ( viewflag < 0 ) //camera doesn't work
|
||||
reset_current()
|
||||
return viewflag
|
||||
|
||||
|
||||
// ERT Variant of the program
|
||||
/datum/computer_file/program/camera_monitor/ert
|
||||
filename = "ntcammon"
|
||||
filedesc = "Advanced Camera Monitoring"
|
||||
extended_desc = "This program allows remote access to the camera system. Some camera networks may have additional access requirements. This version has an integrated database with additional encrypted keys."
|
||||
size = 14
|
||||
nanomodule_path = /datum/nano_module/camera_monitor/ert
|
||||
tguimodule_path = /datum/tgui_module/camera/ntos/ert
|
||||
available_on_ntnet = 0
|
||||
|
||||
/datum/nano_module/camera_monitor/ert
|
||||
name = "Advanced Camera Monitoring Program"
|
||||
//available_to_ai = FALSE
|
||||
|
||||
// The ERT variant has access to ERT and crescent cams, but still checks for accesses. ERT members should be able to use it.
|
||||
/datum/nano_module/camera_monitor/ert/modify_networks_list(var/list/networks)
|
||||
..()
|
||||
networks.Add(list(list("tag" = NETWORK_ERT, "has_access" = 1)))
|
||||
networks.Add(list(list("tag" = NETWORK_CRESCENT, "has_access" = 1)))
|
||||
return networks
|
||||
|
||||
/datum/nano_module/camera_monitor/apply_visual(mob/M)
|
||||
if(current_camera)
|
||||
current_camera.apply_visual(M)
|
||||
else
|
||||
remove_visual(M)
|
||||
|
||||
/datum/nano_module/camera_monitor/remove_visual(mob/M)
|
||||
if(current_camera)
|
||||
current_camera.remove_visual(M)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/datum/computer_file/program/suit_sensors
|
||||
filename = "sensormonitor"
|
||||
filedesc = "Suit Sensors Monitoring"
|
||||
nanomodule_path = /datum/nano_module/crew_monitor
|
||||
tguimodule_path = /datum/tgui_module/crew_monitor/ntos
|
||||
program_icon_state = "crew"
|
||||
program_key_state = "med_key"
|
||||
program_menu_icon = "heart"
|
||||
@@ -10,60 +10,3 @@
|
||||
requires_ntnet = 1
|
||||
network_destination = "crew lifesigns monitoring system"
|
||||
size = 11
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/datum/nano_module/crew_monitor
|
||||
name = "Crew monitor"
|
||||
|
||||
/datum/nano_module/crew_monitor/Topic(href, href_list)
|
||||
if(..()) return 1
|
||||
var/turf/T = get_turf(nano_host()) // TODO: Allow setting any using_map.contact_levels from the interface.
|
||||
if (!T || !(T.z in using_map.player_levels))
|
||||
to_chat(usr, "<span class='warning'>Unable to establish a connection</span>: You're too far away from the station!")
|
||||
return 0
|
||||
if(href_list["track"])
|
||||
if(isAI(usr))
|
||||
var/mob/living/silicon/ai/AI = usr
|
||||
var/mob/living/carbon/human/H = locate(href_list["track"]) in mob_list
|
||||
if(hassensorlevel(H, SUIT_SENSOR_TRACKING))
|
||||
AI.ai_actual_track(H)
|
||||
return 1
|
||||
|
||||
/datum/nano_module/crew_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
|
||||
var/list/data = host.initial_data()
|
||||
|
||||
data["isAI"] = isAI(user)
|
||||
|
||||
var/z = get_z(nano_host())
|
||||
var/list/map_levels = using_map.get_map_levels(z, TRUE, om_range = DEFAULT_OVERMAP_RANGE)
|
||||
data["map_levels"] = map_levels
|
||||
|
||||
data["crewmembers"] = list()
|
||||
for(var/zlevel in map_levels)
|
||||
data["crewmembers"] += crew_repository.health_data(zlevel)
|
||||
|
||||
if(!data["map_levels"].len)
|
||||
to_chat(user, "<span class='warning'>The crew monitor doesn't seem like it'll work here.</span>")
|
||||
if(ui)
|
||||
ui.close()
|
||||
return
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "crew_monitor.tmpl", "Crew Monitoring Computer", 900, 800, state = state)
|
||||
|
||||
// adding a template with the key "mapContent" enables the map ui functionality
|
||||
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()
|
||||
|
||||
// should make the UI auto-update; doesn't seem to?
|
||||
ui.set_auto_update(1)
|
||||
|
||||
Reference in New Issue
Block a user