fix(client/zones): zone triggers twice when inside and debug is enabled

Zones would be added to the temporary array twice, so callback functions
and the zone draw would trigger twice.
This commit is contained in:
Linden
2022-09-11 11:02:04 +10:00
parent 5d4eff8cd3
commit 99b146d7b9

View File

@@ -232,30 +232,32 @@ CreateThread(function()
zone.distance = #(zone.coords - coords) zone.distance = #(zone.coords - coords)
if contains then if contains then
if zone.onEnter and not zone.insideZone then if not zone.insideZone then
zone:onEnter() zone.insideZone = true
if zone.onEnter then
zone:onEnter()
end
end end
if zone.inside then if zone.inside then
insideCount += 1 insideCount += 1
inside[insideCount] = zone inside[insideCount] = zone
end end
else
if zone.insideZone then
zone.insideZone = false
if not zone.insideZone then if zone.onExit then
zone.insideZone = true zone:onExit()
end
end end
elseif zone.insideZone then
zone.insideZone = false
if zone.onExit then if zone.debug then
zone:onExit() insideCount += 1
inside[insideCount] = zone
end end
end end
if zone.debug then
insideCount += 1
inside[insideCount] = zone
end
end end
if not tick then if not tick then
@@ -266,10 +268,12 @@ CreateThread(function()
if zone.debug then if zone.debug then
if zone.insideZone then zone:inside() end
zone:debug() zone:debug()
elseif zone.insideZone then
if zone.inside and zone.insideZone then
zone:inside()
end
else
zone:inside() zone:inside()
end end
end end