CONTROLLABLE:TaskLandAtVec2( Vec2, Duration , CombatLanding, DirectionAfterLand)

This commit is contained in:
Applevangelist 2024-07-12 19:33:35 +02:00
parent 7bc7fee6d7
commit af85745433
2 changed files with 22 additions and 8 deletions

View File

@ -1062,8 +1062,10 @@ end
-- @param #number Time Time in seconds to stay. Default 300 seconds.
-- @param #number Speed Speed in knots to fly to the target coordinate. Default 150kn.
-- @param #number MissionAlt Altitude to fly towards the mission in feet AGL. Default 1000ft.
-- @param #boolean CombatLanding (Optional) If true, set the Combat Landing option.
-- @param #number DirectionAfterLand (Optional) Heading after landing in degrees.
-- @return #AUFTRAG self
function AUFTRAG:NewLANDATCOORDINATE(Coordinate, OuterRadius, InnerRadius, Time, Speed, MissionAlt)
function AUFTRAG:NewLANDATCOORDINATE(Coordinate, OuterRadius, InnerRadius, Time, Speed, MissionAlt, CombatLanding, DirectionAfterLand)
local mission=AUFTRAG:New(AUFTRAG.Type.LANDATCOORDINATE)
@ -1071,6 +1073,8 @@ function AUFTRAG:NewLANDATCOORDINATE(Coordinate, OuterRadius, InnerRadius, Time,
mission.stayTime = Time or 300
mission.stayAt = Coordinate
mission.combatLand = CombatLanding
mission.directionAfter = DirectionAfterLand
self:SetMissionSpeed(Speed or 150)
self:SetMissionAltitude(MissionAlt or 1000)
@ -6492,8 +6496,7 @@ function AUFTRAG:GetDCSMissionTask()
local DCStask={}
local Vec2 = self.stayAt:GetVec2()
local DCStask = CONTROLLABLE.TaskLandAtVec2(nil,Vec2,self.stayTime)
local DCStask = CONTROLLABLE.TaskLandAtVec2(nil,Vec2,self.stayTime, self.combatLand, self.directionAfter)
table.insert(DCStasks, DCStask)
elseif self.type==AUFTRAG.Type.ONGUARD or self.type==AUFTRAG.Type.ARMOREDGUARD then

View File

@ -58,7 +58,7 @@
-- * @{#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne controllable.
-- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving.
-- * @{#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the controllable.
-- * @{#CONTROLLABLE.TaskLand}: (AIR HELICOPTER) Landing at the ground. For helicopters only.
-- * @{#CONTROLLABLE.TaskLandAtVec2}: (AIR HELICOPTER) Landing at the ground. For helicopters only.
-- * @{#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
-- * @{#CONTROLLABLE.TaskOrbitCircle}: (AIR) Orbit at the current position of the first unit of the controllable at a specified altitude.
-- * @{#CONTROLLABLE.TaskOrbitCircleAtVec2}: (AIR) Orbit at a specified position at a specified altitude during a specified duration with a specified speed.
@ -1516,8 +1516,10 @@ end
-- @param #CONTROLLABLE self
-- @param DCS#Vec2 Vec2 The point where to land.
-- @param #number Duration The duration in seconds to stay on the ground.
-- @param #boolean CombatLanding (optional) If true, set the Combat Landing option.
-- @param #number DirectionAfterLand (optional) Heading after landing in degrees.
-- @return #CONTROLLABLE self
function CONTROLLABLE:TaskLandAtVec2( Vec2, Duration )
function CONTROLLABLE:TaskLandAtVec2( Vec2, Duration , CombatLanding, DirectionAfterLand)
local DCSTask = {
id = 'Land',
@ -1525,9 +1527,15 @@ function CONTROLLABLE:TaskLandAtVec2( Vec2, Duration )
point = Vec2,
durationFlag = Duration and true or false,
duration = Duration,
combatLandingFlag = CombatLanding == true and true or false,
},
}
if DirectionAfterLand ~= nil and type(DirectionAfterLand) == "number" then
DCSTask.params.directionEnabled = true
DCSTask.params.direction = math.rad(DirectionAfterLand)
end
return DCSTask
end
@ -1535,13 +1543,16 @@ end
-- @param #CONTROLLABLE self
-- @param Core.Zone#ZONE Zone The zone where to land.
-- @param #number Duration The duration in seconds to stay on the ground.
-- @param #boolean RandomPoint (optional) If true,land at a random point inside of the zone.
-- @param #boolean CombatLanding (optional) If true, set the Combat Landing option.
-- @param #number DirectionAfterLand (optional) Heading after landing in degrees.
-- @return DCS#Task The DCS task structure.
function CONTROLLABLE:TaskLandAtZone( Zone, Duration, RandomPoint )
function CONTROLLABLE:TaskLandAtZone( Zone, Duration, RandomPoint, CombatLanding, DirectionAfterLand )
-- Get landing point
local Point = RandomPoint and Zone:GetRandomVec2() or Zone:GetVec2()
local DCSTask = CONTROLLABLE.TaskLandAtVec2( self, Point, Duration )
local DCSTask = CONTROLLABLE.TaskLandAtVec2( self, Point, Duration, CombatLanding, DirectionAfterLand)
return DCSTask
end