From 695704543569f0bea73e8b9e5decfc37d8423b10 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Tue, 23 Jul 2024 11:34:52 -0400 Subject: [PATCH] Fix quadtree AABB issue (#6782) # About the pull request Quadtree AABB testing now correctly uses the Y bounds to test if the Y coordinate is in range. # Explain why it's good for the game Bug bad. Shouldn't use the X coordinate to determine if you're in bounds of the Y coordinate. Fortunate that so many things are squares that it didn't cause an issue. # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: fix: sounds & motion detectors should be more reliable /:cl: --- code/datums/quadtree.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/quadtree.dm b/code/datums/quadtree.dm index 200a51b358a0..9056dfd6bd59 100644 --- a/code/datums/quadtree.dm +++ b/code/datums/quadtree.dm @@ -82,7 +82,7 @@ /// Returns TRUE if this shape's bounding box intersects the provided shape's bounding box, otherwise FALSE. Generally faster than a full intersection test. /datum/shape/proc/intersects_aabb(datum/shape/aabb) - return (abs(src.center_x - aabb.center_x) <= (src.bounds_x + aabb.bounds_x) * 0.5) && (abs(src.center_y - aabb.center_y) <= (src.bounds_x + aabb.bounds_x) * 0.5) + return (abs(src.center_x - aabb.center_x) <= (src.bounds_x + aabb.bounds_x) * 0.5) && (abs(src.center_y - aabb.center_y) <= (src.bounds_y + aabb.bounds_y) * 0.5) /// Returns TRUE if this shape intersects the provided rectangle shape, otherwise FALSE. /datum/shape/proc/intersects_rect(datum/shape/rectangle/rect)