mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-27 18:41:59 +00:00
Improves camera EMP handling. Now uses a var and processing to determine when the EMP should end, preventing inconsistent states when a camera is EMPd multiple times. Reduces the process and bandwidth need for cameras. * There is now a common camera repository, responsible for setting up cameras once for every invalidation. * Camera consoles now only updates when the camera cache is invalidated, not every second. * The console now only presents one network at a time, and only sends the data necessary to view that network (as opposed to sending the data for all cameras).
35 lines
936 B
Plaintext
35 lines
936 B
Plaintext
var/global/datum/repository/cameras/camera_repository = new()
|
|
|
|
/proc/invalidateCameraCache()
|
|
camera_repository.networks.Cut()
|
|
camera_repository.invalidated = 1
|
|
camera_repository.camera_cache_id = (++camera_repository.camera_cache_id % 999999)
|
|
|
|
/datum/repository/cameras
|
|
var/list/networks
|
|
var/invalidated = 1
|
|
var/camera_cache_id = 1
|
|
|
|
/datum/repository/cameras/New()
|
|
networks = list()
|
|
..()
|
|
|
|
/datum/repository/cameras/proc/cameras_in_network(var/network)
|
|
setup_cache()
|
|
var/list/network_list = networks[network]
|
|
return network_list
|
|
|
|
/datum/repository/cameras/proc/setup_cache()
|
|
if(!invalidated)
|
|
return
|
|
invalidated = 0
|
|
|
|
cameranet.process_sort()
|
|
for(var/obj/machinery/camera/C in cameranet.cameras)
|
|
var/cam = C.nano_structure()
|
|
for(var/network in C.network)
|
|
if(!networks[network])
|
|
networks[network] = list()
|
|
var/list/netlist = networks[network]
|
|
netlist[++netlist.len] = cam
|