From 0ccdf5675cb9921418890b60e50275d069ed178e Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sun, 11 Sep 2022 12:27:23 +1000 Subject: [PATCH] fix(client/zones): scuffed ternary Since Lua "ternary" expressions run until they have a truthy value, boxzone and polyzone will try compare distance to radius. --- imports/zones/client.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/imports/zones/client.lua b/imports/zones/client.lua index a6c87f582..556362b4f 100644 --- a/imports/zones/client.lua +++ b/imports/zones/client.lua @@ -235,9 +235,15 @@ CreateThread(function() for _, zone in pairs(Zones) do zone.distance = #(zone.coords - coords) - local radius = zone.radius + local radius, contains = zone.radius - if not radius and glm_polygon_contains(zone.polygon, coords, zone.thickness / 4) or zone.distance < radius then + if radius then + contains = zone.distance < radius + else + contains = glm_polygon_contains(zone.polygon, coords, zone.thickness / 4) + end + + if contains then if not zone.insideZone then zone.insideZone = true