diff --git a/Scripts/Range.lua b/Scripts/Range.lua index 5a360cd..65adc54 100644 --- a/Scripts/Range.lua +++ b/Scripts/Range.lua @@ -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 \ No newline at end of file