mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
perf(zones): debug
Iterate polygon userdata directly, instead of creating a new table each frame.
This commit is contained in:
@@ -6,16 +6,18 @@ local function removeZone(self)
|
||||
end
|
||||
|
||||
local function debug(self)
|
||||
local points = self.polygon()
|
||||
for i = 1, #points do
|
||||
if i == #points then
|
||||
DrawPoly(points[i], points[1], self.centroid, 255, 0, 0, 50)
|
||||
DrawPoly(points[1], points[i], self.centroid, 255, 0, 0, 50)
|
||||
else
|
||||
DrawPoly(points[i], points[i + 1], self.centroid, 255, 0, 0, 50)
|
||||
DrawPoly(points[i + 1], points[i], self.centroid, 255, 0, 0, 50)
|
||||
end
|
||||
end
|
||||
local polygon = self.polygon
|
||||
local polyCount = #self.polygon
|
||||
|
||||
for i = 1, polyCount do
|
||||
if i == polyCount then
|
||||
DrawPoly(polygon[i], polygon[1], self.centroid, 255, 0, 0, 50)
|
||||
DrawPoly(polygon[1], polygon[i], self.centroid, 255, 0, 0, 50)
|
||||
else
|
||||
DrawPoly(polygon[i], polygon[i + 1], self.centroid, 255, 0, 0, 50)
|
||||
DrawPoly(polygon[i + 1], polygon[i], self.centroid, 255, 0, 0, 50)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local inside = {}
|
||||
|
||||
Reference in New Issue
Block a user