mirror of
https://github.com/mrSkortch/MissionScriptingTools.git
synced 2025-08-15 10:47:23 +00:00
added mist.getUnitsInPolygon
like getUnitsInZones this function returns a table of unit objects
This commit is contained in:
parent
8b545fc6b2
commit
89cb721384
17
mist.lua
17
mist.lua
@ -5,6 +5,7 @@ added mist.stringMatch
|
|||||||
added mist.groupTableCheck
|
added mist.groupTableCheck
|
||||||
added mist.spawnRandomizedGroup
|
added mist.spawnRandomizedGroup
|
||||||
added mist.randomizeGroupOrder
|
added mist.randomizeGroupOrder
|
||||||
|
added mist.getUnitsInPolygon
|
||||||
|
|
||||||
|
|
||||||
v27
|
v27
|
||||||
@ -2034,6 +2035,22 @@ function mist.pointInPolygon(point, poly, maxalt) --raycasting point in polygon.
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mist.getUnitsInPolygon = function (unit_names, polyZone, max_alt)
|
||||||
|
local units = {}
|
||||||
|
|
||||||
|
for i = 1, #unit_names do
|
||||||
|
units[#units + 1] = Unit.getByName(unitNames[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
local inZoneUnits = {}
|
||||||
|
for i =1, #units do
|
||||||
|
if mist.pointInPolygon(units[i]:getPosition().p, polyZone, max_alt) then
|
||||||
|
inZoneUnits[inZoneUnits + 1] = units[i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return inZoneUnits
|
||||||
|
end
|
||||||
|
|
||||||
function mist.flagFunc.units_in_polygon(vars)
|
function mist.flagFunc.units_in_polygon(vars)
|
||||||
--[[vars needs to be:
|
--[[vars needs to be:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user