Files
DCS_TrainingMap_Caucasus/Scripts/Range.lua
T

97 lines
2.6 KiB
Lua

Range = {
points = {},
name = nil,
urbanZones = {
--[[
[1] = {
points = {},
active = false,
type = 'urban',
},
]]
},
treeZones = {
--[[
[1] = {
points = {},
active = false,
type = 'tree',
},
]]
},
playerList = {},
}
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()
end
function Range:removePlayerProfile()
end
function Range:setTargetFightBack()
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