Skip to content

Commit

Permalink
fix(client/zones): scuffed ternary
Browse files Browse the repository at this point in the history
Since Lua "ternary" expressions run until they have a truthy value,
boxzone and polyzone will try compare distance to radius.
  • Loading branch information
thelindat committed Sep 11, 2022
1 parent 57187c8 commit 0ccdf56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions imports/zones/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0ccdf56

Please sign in to comment.