From cbc86ff187aef59f60331d60f59c395ec61917d7 Mon Sep 17 00:00:00 2001 From: Erki Date: Wed, 6 Sep 2017 23:00:58 +0300 Subject: [PATCH] Fix camera lag (#3405) Edge case where the turf you click is the outside station area, and it has to crawl that fucking massive area. Also makes the loop generally more efficient. --- code/game/machinery/computer/camera.dm | 12 +++++++++++- html/changelogs/skull132-kill_camera_lag.yml | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 html/changelogs/skull132-kill_camera_lag.yml diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 621e4e6722e..cc143357143 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -142,7 +142,17 @@ jump_to = locate() in A else if(isturf(A)) var/best_dist = INFINITY - for(var/obj/machinery/camera/camera in get_area(A)) + var/check_area = get_area(A) + + if (!check_area) + return + + for(var/cc in SSmachinery.all_cameras) + var/obj/machinery/camera/camera = cc + if(!camera.loc) + continue + if (camera.loc.loc != check_area) + continue if(!camera.can_use()) continue if(!can_access_camera(camera)) diff --git a/html/changelogs/skull132-kill_camera_lag.yml b/html/changelogs/skull132-kill_camera_lag.yml new file mode 100644 index 00000000000..8eb31971887 --- /dev/null +++ b/html/changelogs/skull132-kill_camera_lag.yml @@ -0,0 +1,5 @@ +author: Skull132 +delete-after: true + +changes: + - bugfix: "Cameras will no longer lag the server to death whenever you click to jump to a turf that's outside the station."