#ZONE_CAPTURE_COALITION - allow zone to be a ZONE_POLYGON

This commit is contained in:
Applevangelist 2022-09-28 11:51:59 +02:00
commit 117e41dafb
2 changed files with 12 additions and 12 deletions

View File

@ -46,7 +46,7 @@
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions: **Applevangelist**, **FunkyFranky**
-- --
-- === -- ===
-- --
@ -1290,13 +1290,13 @@ end
-- @return DCS#Vec2 The random location within the zone. -- @return DCS#Vec2 The random location within the zone.
function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes) function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes)
local Vec2 = self:GetVec2() local Vec2 = self:GetVec2()
local _inner = inner or 0 local _inner = inner or 0
local _outer = outer or self:GetRadius() local _outer = outer or self:GetRadius()
if surfacetypes and type(surfacetypes)~="table" then if surfacetypes and type(surfacetypes)~="table" then
surfacetypes={surfacetypes} surfacetypes={surfacetypes}
end end
local function _getpoint() local function _getpoint()
local point = {} local point = {}
@ -1316,10 +1316,10 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes)
return false return false
end end
local point=_getpoint() local point=_getpoint()
if surfacetypes then if surfacetypes then
local N=1 ; local Nmax=100 ; local gotit=false local N=1 ; local Nmax=100 ; local gotit=false
while gotit==false and N<=Nmax do while gotit==false and N<=Nmax do
gotit=_checkSurface(point) gotit=_checkSurface(point)
if gotit then if gotit then
@ -1331,7 +1331,7 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes)
end end
end end
return point return point
end end
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone. --- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone.

View File

@ -8,7 +8,7 @@
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: **funkyfranky** -- ### Contributions: **funkyfranky**, **Applevangelist**
-- --
-- === -- ===
-- --
@ -56,7 +56,7 @@ do -- Zone
--- ZONE_GOAL Constructor. --- ZONE_GOAL Constructor.
-- @param #ZONE_GOAL self -- @param #ZONE_GOAL self
-- @param Core.Zone#ZONE_RADIUS Zone A @{Zone} object with the goal to be achieved. -- @param Core.Zone#ZONE_RADIUS Zone A @{Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a @{ZONE_POLYGON} with its waypoints.
-- @return #ZONE_GOAL -- @return #ZONE_GOAL
function ZONE_GOAL:New( Zone ) function ZONE_GOAL:New( Zone )