Skip to content

Commit 8dcf830

Browse files
committedOct 19, 2020
Fixed debugBlip on ComboZones
Given ComboZones are used a lot by starting them empty and using AddZone overtime, doing a one-and-done style addDebugBlip won't work in most cases, and the print wouldn't make much sense either. To fix, on first call addDebugBlip will add blips to all the zones currently in the ComboZone, then during each AddZone() call, if debugBlip is true on the ComboZone, addDebugBlip() will be called on the added zone.
1 parent 7739f41 commit 8dcf830

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed
 

‎ComboZone.lua

+3-15
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ function ComboZone:AddZone(zone)
189189
if self.useGrid == nil and newIndex >= 25 then
190190
self.useGrid = true
191191
end
192+
if self.debugBlip then zone:addDebugBlip() end
192193
end
193194

194195
function ComboZone:isPointInside(point)
@@ -298,25 +299,12 @@ function ComboZone:onPlayerInOutExhaustive(onPointInOutCb, waitInMS)
298299
end
299300

300301
function ComboZone:addDebugBlip()
302+
self.debugBlip = true
301303
local zones = self.zones
302-
local polyCount, boxCount, circleCount, entityCount = 0, 0, 0, 0
303304
for i=1, #zones do
304305
local zone = zones[i]
305-
if zone then
306-
zone:addDebugBlip()
307-
if zone.isPolyZone then polyCount = polyCount + 1 end
308-
if zone.isBoxZone then boxCount = boxCount + 1 end
309-
if zone.isCircleZone then circleCount = circleCount + 1 end
310-
if zone.isEntityZone then entityCount = entityCount + 1 end
311-
end
306+
if zone then zone:addDebugBlip() end
312307
end
313-
local name = self.name ~= nil and ("\"" .. self.name .. "\"") or nil
314-
print("[PolyZone] Debug for ComboZone { name = " .. tostring(name) .. " }:")
315-
print("[PolyZone] Total zones: " .. #zones)
316-
print("[PolyZone] BoxZones: " .. boxCount)
317-
print("[PolyZone] CircleZones: " .. circleCount)
318-
print("[PolyZone] PolyZones: " .. polyCount)
319-
print("[PolyZone] EntityZones: " .. entityCount)
320308
end
321309

322310
function ComboZone:setPaused(paused)

0 commit comments

Comments
 (0)
Please sign in to comment.