Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ce22b0c13 | ||
|
|
9dee80e204 |
Binary file not shown.
+36
-3
@@ -1,12 +1,45 @@
|
||||
Range = {}
|
||||
Range = {
|
||||
points = {},
|
||||
name = nil,
|
||||
urbanZones = {
|
||||
--[[
|
||||
[1] = {
|
||||
points = {},
|
||||
active = false,
|
||||
type = 'urban',
|
||||
},
|
||||
]]
|
||||
},
|
||||
treeZones = {
|
||||
--[[
|
||||
[1] = {
|
||||
points = {},
|
||||
active = false,
|
||||
type = 'tree',
|
||||
},
|
||||
]]
|
||||
},
|
||||
playerList = {},
|
||||
|
||||
}
|
||||
|
||||
do
|
||||
function Range:New()
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function Range:createPlayerProfile()
|
||||
|
||||
end
|
||||
|
||||
function Range:removePlayerProfile()
|
||||
|
||||
end
|
||||
|
||||
function Range:setTargetFightBack()
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
@@ -279,4 +279,81 @@ do
|
||||
end --if coa_name == 'red' or coa_name == 'blue' and type(coa_data) == 'table' then
|
||||
end --for coa_name, coa_data in pairs(mission.coalition) do
|
||||
end
|
||||
|
||||
function Utils.pointInPolygon(point, poly, maxalt)
|
||||
point = Utils.makeVec3(point)
|
||||
local px = point.x
|
||||
local pz = point.z
|
||||
local cn = 0
|
||||
local newpoly = Utils.deepCopy(poly)
|
||||
|
||||
if not maxalt or (point.y <= maxalt) then
|
||||
local polysize = #newpoly
|
||||
newpoly[#newpoly + 1] = newpoly[1]
|
||||
|
||||
newpoly[1] = Utils.makeVec3(newpoly[1])
|
||||
|
||||
for k = 1, polysize do
|
||||
newpoly[k+1] = Utils.makeVec3(newpoly[k+1])
|
||||
if ((newpoly[k].z <= pz) and (newpoly[k+1].z > pz)) or ((newpoly[k].z > pz) and (newpoly[k+1].z <= pz)) then
|
||||
local vt = (pz - newpoly[k].z) / (newpoly[k+1].z - newpoly[k].z)
|
||||
if (px < newpoly[k].x + vt*(newpoly[k+1].x - newpoly[k].x)) then
|
||||
cn = cn + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return cn%2 == 1
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function Utils.doString(s)
|
||||
local f, err = loadstring(s)
|
||||
if f then
|
||||
return true, f()
|
||||
else
|
||||
return false, err
|
||||
end
|
||||
end
|
||||
|
||||
function Utils.drawPolygon(Coalition,MarkID,vecs,Color,FillColor,LineType,ReadOnly,Text)
|
||||
local s=string.format("trigger.action.markupToAll(7, %d, %d,", Coalition, MarkID)
|
||||
for _,vec in pairs(vecs) do
|
||||
--s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
|
||||
s=s..string.format("{x=%.1f, y=%.1f, z=%.1f},", vec.x, vec.y, vec.z)
|
||||
end
|
||||
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", Color[1], Color[2], Color[3], Color[4])
|
||||
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", FillColor[1], FillColor[2], FillColor[3], FillColor[4])
|
||||
s=s..string.format("%d,", LineType or 1)
|
||||
s=s..string.format("%s", tostring(ReadOnly))
|
||||
if Text and type(Text)=="string" and string.len(Text)>0 then
|
||||
s=s..string.format(", \"%s\"", tostring(Text))
|
||||
end
|
||||
s=s..")"
|
||||
|
||||
-- Execute string command
|
||||
local success=Utils.doString(s)
|
||||
|
||||
if not success then
|
||||
self:E("ERROR: Could not draw polygon")
|
||||
env.info(s)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user