Moves camera update handling to background subsystem, (maybe) fixing lag (#92208)

## About The Pull Request

When a camera update is triggered, it is instead added to a queue on a
background subsystem

An AI entering a camera chunk which is queued to update will force the
update immediately (bypassing the queue)

While the root problem of this is, ultimately, not addressed...

<img width="554" height="58"
alt="467828777-eff3f0e5-49d6-4997-b4d7-05eff6432155"
src="https://github.com/user-attachments/assets/c2d6a5f5-d958-463e-959f-116bd0dab475"
/>

...the change will ultimately prevent update spam from consuming all of
the server's resources - instead allocating updates to the backburner in
times of high server stress (or on multi-z maps)

## Changelog

🆑 Melbert
refactor: Refactored the way camera updates are handled to hopefully
reduce some lag. Report any oddities
/🆑
This commit is contained in:
MrMelbert
2025-11-08 01:43:48 +01:00
committed by GitHub
parent ad7887064e
commit 5146cfd403
42 changed files with 472 additions and 426 deletions
+1 -1
View File
@@ -320,7 +320,7 @@ ADMIN_VERB(cmd_admin_areatest, R_DEBUG, "Test Areas", "Tests the areas for vario
areas_with_intercom.Add(A.type)
CHECK_TICK
for(var/obj/machinery/camera/C as anything in GLOB.cameranet.cameras)
for(var/obj/machinery/camera/C as anything in SScameras.cameras)
var/area/A = get_area(C)
if(!A)
dat += "Skipped over [C] in invalid location, [C.loc].<br>"
+6 -6
View File
@@ -8,11 +8,11 @@ ADMIN_VERB(camera_view, R_DEBUG, "Camera Range Display", "Shows the range of cam
if(!on)
var/list/seen = list()
for(var/obj/machinery/camera/C as anything in GLOB.cameranet.cameras)
for(var/turf/T in C.can_see())
seen[T]++
for(var/turf/T in seen)
T.maptext = MAPTEXT(seen[T])
for(var/obj/machinery/camera/cam as anything in SScameras.cameras)
for(var/turf/cam_turf as anything in cam.can_see())
seen[cam]++
for(var/turf/seen_turf as anything in seen)
seen_turf.maptext = MAPTEXT(seen[seen_turf])
BLACKBOX_LOG_ADMIN_VERB("Show Camera Range")
#ifdef TESTING
@@ -34,7 +34,7 @@ ADMIN_VERB_VISIBILITY(sec_camera_report, ADMIN_VERB_VISIBLITY_FLAG_MAPPING_DEBUG
ADMIN_VERB(sec_camera_report, R_DEBUG, "Camera Report", "Get a printout of all camera issues.", ADMIN_CATEGORY_MAPPING)
var/list/obj/machinery/camera/CL = list()
for(var/obj/machinery/camera/C as anything in GLOB.cameranet.cameras)
for(var/obj/machinery/camera/C as anything in SScameras.cameras)
CL += C
var/output = {"<B>Camera Abnormalities Report</B><HR>