Warehouse 0.1.4

zone: fixed GetRandomCoordinate inner, outer missing
controllable: fixed path cannot be found
group: added getrange
unit: added getrange
This commit is contained in:
funkyfranky
2018-08-13 00:36:34 +02:00
parent 195459d6d8
commit d91166c3c4
8 changed files with 782 additions and 331 deletions

View File

@@ -294,8 +294,9 @@ end
--- Sends a MESSAGE to a Coalition if the given Condition is true.
-- @param #MESSAGE self
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}.
-- @return #MESSAGE
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}.
-- @param #boolean Condition Sends the message only if the condition is true.
-- @return #MESSAGE self
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
self:F( CoalitionSide )

View File

@@ -1098,11 +1098,14 @@ do -- COORDINATE
--- Gets the nearest airbase with respect to the current coordinates.
-- @param #COORDINATE self
-- @param #number AirbaseCategory Category of the airbase.
-- @param #number Category (Optional) Category of the airbase. Enumerator of @{Wrapper.Airbase#AIRBASE.Category}.
-- @param #number Coalition (Optional) Coalition of the airbase.
-- @return Wrapper.Airbase#AIRBASE Closest Airbase to the given coordinate.
-- @return #number Distance to the closest airbase in meters.
function COORDINATE:GetClosestAirbase(AirbaseCategory)
local airbases=AIRBASE.GetAllAirbases()
function COORDINATE:GetClosestAirbase(Category, Coalition)
-- Get all airbases of the map.
local airbases=AIRBASE.GetAllAirbases(Coalition)
local closest=nil
local distmin=nil
@@ -1110,7 +1113,7 @@ do -- COORDINATE
for _,_airbase in pairs(airbases) do
local airbase=_airbase --Wrapper.Airbase#AIRBASE
local category=airbase:GetDesc().category
if AirbaseCategory and AirbaseCategory==category or AirbaseCategory==nil then
if Category and Category==category or Category==nil then
local dist=self:Get2DDistance(airbase:GetCoordinate())
if closest==nil then
distmin=dist
@@ -1257,6 +1260,8 @@ do -- COORDINATE
Path[#Path+1]=COORDINATE:NewFromVec2(_vec2)
--COORDINATE:NewFromVec2(_vec2):SmokeGreen()
end
--COORDINATE:NewFromVec2(path[1]):SmokeBlue()
--COORDINATE:NewFromVec2(path[#path]):SmokeBlue()
else
self:E("Path is nil. No valid path on road could be found.")

View File

@@ -496,7 +496,7 @@ end
--- Sets the coalition of the spawned group. Note that it might be necessary to also set the country explicitly!
-- @param #SPAWN self
-- @param #DCS.coalition Coaliton Coaliton of the group as number of enumerator, i.e. 0=coaliton.side.NEUTRAL, 1=coaliton.side.RED, 2=coalition.side.BLUE.
-- @param DCS#coalition.side Coalition Coalition of the group as number of enumerator, i.e. 0=coaliton.side.NEUTRAL, 1=coaliton.side.RED, 2=coalition.side.BLUE.
-- @return #SPAWN self
function SPAWN:InitCoalition( Coalition )
self:F({coalition=Coalition})

View File

@@ -933,7 +933,7 @@ end
function ZONE_RADIUS:GetRandomCoordinate( inner, outer )
self:F( self.ZoneName, inner, outer )
local Coordinate = COORDINATE:NewFromVec2( self:GetRandomVec2() )
local Coordinate = COORDINATE:NewFromVec2( self:GetRandomVec2(inner, outer) )
self:T3( { Coordinate = Coordinate } )