From bc45f866c246d325356f8b85b36ac971966acaa5 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 13 Sep 2020 13:28:41 +0200 Subject: [PATCH] fix: fix the actor in rect query * use x2/y2 as secondary limit comparison * return the query and not an non-initilized variable --- sonic-radiance.love/core/modules/world/baseworld.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sonic-radiance.love/core/modules/world/baseworld.lua b/sonic-radiance.love/core/modules/world/baseworld.lua index 2ad0dce..e608183 100644 --- a/sonic-radiance.love/core/modules/world/baseworld.lua +++ b/sonic-radiance.love/core/modules/world/baseworld.lua @@ -142,14 +142,14 @@ function BaseWorld:getActorsInRect(x, y, w, h) local query = {} local x2, y2 = x + w, y + h for i,v in ipairs(self.actors) do - if (v.x >= x) and (v.x + v.w >= x1) and - (v.y >= y) and (v.y + v.h >= y1) then + if (v.x >= x) and (v.x + v.w >= x2) and + (v.y >= y) and (v.y + v.h >= y2) then table.insert(query, v) end end - return v + return query end