Reworks how AI tracking is handled & reorganizes it (#77776)

## About The Pull Request

Completely reworks how AI tracking is handled, this has no in-game
effects.
This moves nearly all AI tracking handling onto ``/datum/tracking``,
which previously was pretty bad. I tried documenting as much as I can,
making comments actually useful and give accurate information.

Turns ``get_camera_list`` into a global proc, which we now use for
camera consoles (including the app), cutting down on copy paste in 2
areas and standardizing its behavior/backend.

## Why It's Good For The Game

I wanted to generalize this behavior so I can use it for tracking
players in https://github.com/tgstation/tgstation/pull/77713 - This
helps me do that.
Also the current state of AI tracking code is pretty poor and hopefully
this improves that area.

Closes https://github.com/tgstation/tgstation/issues/42355

## Changelog

🆑
refactor: AI's player-tracking eyes received an unwanted obligatory
update, and should now not tell you that a player is untrackable when
they clearly obviously can be.
/🆑
This commit is contained in:
John Willard
2023-08-21 08:59:28 -04:00
committed by GitHub
parent bf9b39d1f4
commit 78e96f2f12
18 changed files with 268 additions and 290 deletions
@@ -86,7 +86,7 @@
/datum/computer_file/program/secureye/ui_static_data(mob/user)
var/list/data = list()
data["mapRef"] = cam_screen.assigned_map
var/list/cameras = get_available_cameras()
var/list/cameras = get_camera_list(network)
data["cameras"] = list()
for(var/i in cameras)
var/obj/machinery/camera/C = cameras[i]
@@ -102,7 +102,7 @@
return
if(action == "switch_camera")
var/c_tag = format_text(params["name"])
var/list/cameras = get_available_cameras()
var/list/cameras = get_camera_list(network)
var/obj/machinery/camera/selected_camera = cameras[c_tag]
camera_ref = WEAKREF(selected_camera)
playsound(src, get_sfx(SFX_TERMINAL_TYPE), 25, FALSE)
@@ -168,26 +168,4 @@
cam_background.icon_state = "scanline2"
cam_background.fill_rect(1, 1, DEFAULT_MAP_SIZE, DEFAULT_MAP_SIZE)
// Returns the list of cameras accessible from this computer
/datum/computer_file/program/secureye/proc/get_available_cameras()
var/list/L = list()
for (var/obj/machinery/camera/cam as anything in GLOB.cameranet.cameras)
//Get the camera's turf in case it's inside something like a borg
var/turf/camera_turf = get_turf(cam)
if(!is_station_level(camera_turf.z))//Only show station cameras.
continue
L.Add(cam)
var/list/camlist = list()
for(var/obj/machinery/camera/cam in L)
if(!cam.network)
stack_trace("Camera in a cameranet has no camera network")
continue
if(!(islist(cam.network)))
stack_trace("Camera in a cameranet has a non-list camera network")
continue
var/list/tempnetwork = cam.network & network
if(tempnetwork.len)
camlist["[cam.c_tag]"] = cam
return camlist
#undef DEFAULT_MAP_SIZE