Add test codes for display range zone(s) and its sections.

This commit is contained in:
2024-12-26 18:01:20 +08:00
parent 1c88738494
commit 9baed7be1b
+53 -1
View File
@@ -25,7 +25,39 @@ Range = {
do
function Range:New()
local zoneGroupNamePrefix = 'RangeZone'
for i=1,10,1 do
local zoneGroupName = zoneGroupNamePrefix..i
local points = Utils.getWayPoints(zoneGroupName)
if not points then
break
end
for j=1,100,1 do
local sectionName = '-Urban-'..j
points = Utils.getWayPoints(zoneGroupName..sectionName)
if points then
Range.drawPolygon(points)
trigger.action.textToAll(-1,Utils.getMarkID(),Utils.makeVec3(points[1]),{1,1,1,1},{0,0,0,0},8,false,sectionName)
end
sectionName = '-Tree-'..j
points = Utils.getWayPoints(zoneGroupName..sectionName)
if points then
Range.drawPolygon(points)
trigger.action.textToAll(-1,Utils.getMarkID(),Utils.makeVec3(points[1]),{1,1,1,1},{0,0,0,0},8,false,sectionName)
end
sectionName = '-Open-'..j
points = Utils.getWayPoints(zoneGroupName..sectionName)
if points then
Range.drawPolygon(points)
trigger.action.textToAll(-1,Utils.getMarkID(),Utils.makeVec3(points[1]),{1,1,1,1},{0,0,0,0},8,false,sectionName)
end
end
end
end
function Range:createPlayerProfile()
@@ -40,6 +72,26 @@ do
end
function Range.drawPolygon(points)
local regionPolygonID = Utils.getMarkID()
if #points == 3 then
trigger.action.rectToAll(-1,regionPolygonID,points[1],points[2],points[3],{0,1,0,1},{0,1,0,0.3},1)
end
if #points == 4 then
trigger.action.quadToAll(-1,regionPolygonID,
points[1],
points[2],
points[3],
points[4],
{0,1,0,1},{0,1,0,0.3},1)
end
if #points > 4 then
Utils.drawPolygon(-1,regionPolygonID,points,{0,1,0,1},{0,1,0,0.3},1)
end
end
Range:New()
end