fix(client/zones): setDebug early return

This commit is contained in:
Linden
2023-07-27 00:38:36 +10:00
parent 89b9016586
commit d2c5be8ea8

View File

@@ -6,7 +6,7 @@ local glm = require 'glm'
---@field distance number ---@field distance number
---@field type 'poly' | 'sphere' | 'box' ---@field type 'poly' | 'sphere' | 'box'
---@field debugColour vector4? ---@field debugColour vector4?
---@field setDebug fun(self: CZone) ---@field setDebug fun(self: CZone, enable?: boolean, colour?: vector)
---@field remove fun() ---@field remove fun()
---@field contains fun(self: CZone, coords?: vector3): boolean ---@field contains fun(self: CZone, coords?: vector3): boolean
---@field onEnter fun(self: CZone)? ---@field onEnter fun(self: CZone)?
@@ -267,10 +267,16 @@ local function setDebug(self, bool, colour)
self.debugColour = bool and vec4(colour?.r or self.debugColour?.r or 255, colour?.g or self.debugColour?.g or 42, colour?.b or self.debugColour?.b or 24, colour?.a or self.debugColour?.a or 100) or nil self.debugColour = bool and vec4(colour?.r or self.debugColour?.r or 255, colour?.g or self.debugColour?.g or 42, colour?.b or self.debugColour?.b or 24, colour?.a or self.debugColour?.a or 100) or nil
if bool and self.debug or not bool and not self.debug then return end if not bool and self.debug then
self.triangles = nil
self.debug = nil
return
end
self.triangles = bool and (self.type == 'poly' and getTriangles(self.polygon) or self.type == 'box' and { mat(self.polygon[1], self.polygon[2], self.polygon[3]), mat(self.polygon[1], self.polygon[3], self.polygon[4]) }) or nil if bool and self.debug and self.debug ~= true then return end
self.debug = bool and (self.type == 'sphere' and debugSphere or debugPoly) or nil
self.triangles = self.type == 'poly' and getTriangles(self.polygon) or self.type == 'box' and { mat(self.polygon[1], self.polygon[2], self.polygon[3]), mat(self.polygon[1], self.polygon[3], self.polygon[4]) } or nil
self.debug = self.type == 'sphere' and debugSphere or debugPoly or nil
end end
lib.zones = { lib.zones = {