Merge branch 'master' of https://github.com/Yawn-Wider/YWPolarisVore into August2020UpstreamPull

August2020UpstreamPull
This commit is contained in:
Razgriz
2020-08-09 02:58:18 -07:00
915 changed files with 253357 additions and 90809 deletions

View File

@@ -5,8 +5,13 @@
var/required_access = null // List of required accesses to run/download the program.
var/requires_access_to_run = 1 // Whether the program checks for required_access when run.
var/requires_access_to_download = 1 // Whether the program checks for required_access when downloading.
// NanoModule
var/datum/nano_module/NM = null // If the program uses NanoModule, put it here and it will be automagically opened. Otherwise implement ui_interact.
var/nanomodule_path = null // Path to nanomodule, make sure to set this if implementing new program.
// TGUIModule
var/datum/tgui_module/TM = null // If the program uses TGUIModule, put it here and it will be automagically opened. Otherwise implement tgui_interact.
var/tguimodule_path = null // Path to tguimodule, make sure to set this if implementing new program.
// Etc Program stuff
var/program_state = PROGRAM_STATE_KILLED// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running.
var/obj/item/modular_computer/computer // Device that runs this program.
var/filedesc = "Unknown Program" // User-friendly name of this program.
@@ -125,9 +130,14 @@
// When implementing new program based device, use this to run the program.
/datum/computer_file/program/proc/run_program(var/mob/living/user)
if(can_run(user, 1) || !requires_access_to_run)
computer.active_program = src
if(nanomodule_path)
NM = new nanomodule_path(src, new /datum/topic_manager/program(src), src)
NM.using_access = user.GetAccess()
if(tguimodule_path)
TM = new tguimodule_path(src)
TM.using_access = user.GetAccess()
TM.tgui_interact(user)
if(requires_ntnet && network_destination)
generate_network_log("Connection opened to [network_destination].")
program_state = PROGRAM_STATE_ACTIVE
@@ -139,9 +149,11 @@
program_state = PROGRAM_STATE_KILLED
if(network_destination)
generate_network_log("Connection to [network_destination] closed.")
if(NM)
qdel(NM)
NM = null
QDEL_NULL(NM)
if(TM)
SStgui.close_uis(TM)
qdel(TM)
TM = null
return 1
// This is called every tick when the program is enabled. Ensure you do parent call if you override it. If parent returns 1 continue with UI initialisation.
@@ -154,9 +166,11 @@
if(istype(NM))
NM.ui_interact(user, ui_key, null, force_open)
return 0
if(istype(TM))
TM.tgui_interact(user)
return 0
return 1
// CONVENTIONS, READ THIS WHEN CREATING NEW PROGRAM AND OVERRIDING THIS PROC:
// Topic calls are automagically forwarded from NanoModule this program contains.
// Calls beginning with "PRG_" are reserved for programs handling.

View File

@@ -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

View File

@@ -30,7 +30,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"
@@ -39,163 +39,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)
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)

View File

@@ -41,13 +41,13 @@
set_current(null)
else // Don't reset counter until we find a UAV that's actually in range we can stay connected to
signal_test_counter = 20
data["current_uav"] = null
if(current_uav)
data["current_uav"] = list("status" = current_uav.get_status_string(), "power" = current_uav.state == 1 ? 1 : null)
data["signal_strength"] = signal_strength ? signal_strength >= 2 ? "High" : "Low" : "None"
data["in_use"] = LAZYLEN(viewers)
var/list/paired_map = list()
var/obj/item/modular_computer/mc_host = nano_host()
if(istype(mc_host))
@@ -55,7 +55,7 @@
var/weakref/wr = puav
var/obj/item/device/uav/U = wr.resolve()
paired_map[++paired_map.len] = list("name" = "[U ? U.nickname : "!!Missing!!"]", "uavref" = "\ref[U]")
data["paired_uavs"] = paired_map
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
@@ -102,7 +102,7 @@
else if(href_list["view_uav"])
if(!current_uav)
return TOPIC_NOACTION
if(current_uav.check_eye(user) < 0)
to_chat(usr,"<span class='warning'>The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV.</span>")
else
@@ -139,7 +139,7 @@
signal_strength = 0
current_uav = U
if(LAZYLEN(viewers))
for(var/weakref/W in viewers)
var/M = W.resolve()
@@ -172,7 +172,7 @@
return 0
var/list/zlevels_in_range = using_map.get_map_levels(their_z, FALSE)
var/list/zlevels_in_long_range = using_map.get_map_levels(their_z, TRUE) - zlevels_in_range
var/list/zlevels_in_long_range = using_map.get_map_levels(their_z, TRUE, om_range = DEFAULT_OVERMAP_RANGE) - zlevels_in_range
var/their_signal = 0
for(var/relay in ntnet_global.relays)
var/obj/machinery/ntnet_relay/R = relay
@@ -209,7 +209,7 @@
if(!current_uav)
return
user.set_machine(nano_host())
user.reset_view(current_uav)
current_uav.add_master(user)
@@ -250,7 +250,7 @@
if(weakref(M) in viewers)
M.overlay_fullscreen("fishbed",/obj/screen/fullscreen/fishbed)
M.overlay_fullscreen("scanlines",/obj/screen/fullscreen/scanline)
if(signal_strength <= 1)
M.overlay_fullscreen("whitenoise",/obj/screen/fullscreen/noise)
else

View File

@@ -1,7 +1,7 @@
/datum/computer_file/program/suit_sensors
filename = "sensormonitor"
filedesc = "Suit Sensors Monitoring"
nanomodule_path = /datum/nano_module/program/crew_monitor
tguimodule_path = /datum/tgui_module/crew_monitor/ntos
program_icon_state = "crew"
program_key_state = "med_key"
program_menu_icon = "heart"
@@ -10,68 +10,3 @@
requires_ntnet = 1
network_destination = "crew lifesigns monitoring system"
size = 11
/datum/nano_module/program/crew_monitor
name = "Crew monitor"
/datum/nano_module/program/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/program/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)
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(program)
program.kill_program()
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)
/*/datum/nano_module/program/crew_monitor/proc/scan()
for(var/mob/living/carbon/human/H in mob_list)
if(istype(H.w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/C = H.w_uniform
if (C.has_sensor)
tracked |= C
return 1
*/