fix(zones): update zone distance when checking contains

todo: consume caffeine
This commit is contained in:
Linden
2025-03-14 10:11:08 +11:00
parent ae02b74878
commit 4d8af3c31e

View File

@@ -262,16 +262,18 @@ local function debugSphere(self)
self.debugColour.g, self.debugColour.b, self.debugColour.a, false, false, 0, false, false, false, false) self.debugColour.g, self.debugColour.b, self.debugColour.a, false, false, 0, false, false, false, false)
end end
local function contains(self, coords) local function contains(self, coords, updateDistance)
if updateDistance then self.distance = #(self.coords - coords) end
return glm_polygon_contains(self.polygon, coords, self.thickness / 4) return glm_polygon_contains(self.polygon, coords, self.thickness / 4)
end end
local function insideSphere(self, coords, updateDistance) local function insideSphere(self, coords, updateDistance)
local distance = #(self.coords - coords) < self.radius local distance = #(self.coords - coords)
if updateDistance then self.distance = distance end if updateDistance then self.distance = distance end
return distance return distance < self.radius
end end
local function convertToVector(coords) local function convertToVector(coords)