mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
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.
This commit is contained in:
@@ -235,9 +235,15 @@ CreateThread(function()
|
|||||||
|
|
||||||
for _, zone in pairs(Zones) do
|
for _, zone in pairs(Zones) do
|
||||||
zone.distance = #(zone.coords - coords)
|
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
|
if not zone.insideZone then
|
||||||
zone.insideZone = true
|
zone.insideZone = true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user