This commit is contained in:
Frank
2023-10-31 10:45:58 +01:00
21 changed files with 694 additions and 126 deletions

View File

@@ -5329,3 +5329,54 @@ function CONTROLLABLE:TaskAerobaticsBarrelRoll(TaskAerobatics,Repeats,InitAltitu
return TaskAerobatics
end
--- [Air] Make an airplane or helicopter patrol between two points in a racetrack - resulting in a much tighter track around the start and end points.
-- @param #CONTROLLABLE self
-- @param Core.Point#COORDINATE Point1 Start point.
-- @param Core.Point#COORDINATE Point2 End point.
-- @param #number Altitude (Optional) Altitude in meters. Defaults to the altitude of the coordinate.
-- @param #number Speed (Optional) Speed in kph. Defaults to 500 kph.
-- @param #number Formation (Optional) Formation to take, e.g. ENUMS.Formation.FixedWing.Trail.Close, also see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_option_formation).
-- @param #boolean AGL (Optional) If true, set altitude to above ground level (AGL), not above sea level (ASL).
-- @param #number Delay (Optional) Set the task after delay seconds only.
-- @return #CONTROLLABLE self
function CONTROLLABLE:PatrolRaceTrack(Point1, Point2, Altitude, Speed, Formation, AGL, Delay)
local PatrolGroup = self -- Wrapper.Group#GROUP
if not self:IsInstanceOf( "GROUP" ) then
PatrolGroup = self:GetGroup() -- Wrapper.Group#GROUP
end
local delay = Delay or 1
self:F( { PatrolGroup = PatrolGroup:GetName() } )
if PatrolGroup:IsAir() then
if Formation then
PatrolGroup:SetOption(AI.Option.Air.id.FORMATION,Formation) -- https://wiki.hoggitworld.com/view/DCS_option_formation
end
local FromCoord = PatrolGroup:GetCoordinate()
local ToCoord = Point1:GetCoordinate()
-- Calculate the new Route
if Altitude then
local asl = true
if AGL then asl = false end
FromCoord:SetAltitude(Altitude, asl)
ToCoord:SetAltitude(Altitude, asl)
end
-- Create a "air waypoint", which is a "point" structure that can be given as a parameter to a Task
local Route = {}
Route[#Route + 1] = FromCoord:WaypointAir( AltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true, nil, DCSTasks, description, timeReFuAr )
Route[#Route + 1] = ToCoord:WaypointAir( AltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true, nil, DCSTasks, description, timeReFuAr )
local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolRaceTrack", Point2, Point1, Altitude, Speed, Formation, Delay )
PatrolGroup:SetTaskWaypoint( Route[#Route], TaskRouteToZone ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone.
PatrolGroup:Route( Route, Delay ) -- Move after delay seconds to the Route. See the Route method for details.
end
return self
end

View File

@@ -20,8 +20,8 @@
-- @module Wrapper.Unit
-- @image Wrapper_Unit.JPG
--- @type UNIT
---
-- @type UNIT
-- @field #string ClassName Name of the class.
-- @field #string UnitName Name of the unit.
-- @field #string GroupName Name of the group the unit belongs to.
@@ -561,7 +561,7 @@ end
--- Check if the unit is a tanker. Also retrieves the refuelling system (boom or probe) if applicable.
-- @param #UNIT self
-- @return #boolean If true, unit is refuelable (checks for the attribute "Refuelable").
-- @return #boolean If true, unit is a tanker (checks for the attribute "Tankers").
-- @return #number Refueling system (if any): 0=boom, 1=probe.
function UNIT:IsTanker()
self:F2( self.UnitName )
@@ -582,7 +582,7 @@ function UNIT:IsTanker()
-- Some hard coded data as this is not in the descriptors...
if typename=="IL-78M" then
system=1 --probe
elseif typename=="KC130" then
elseif typename=="KC130" or typename=="KC130J" then
system=1 --probe
elseif typename=="KC135BDA" then
system=1 --probe
@@ -590,6 +590,10 @@ function UNIT:IsTanker()
system=1 --probe
elseif typename=="S-3B Tanker" then
system=1 --probe
elseif typename=="KC_10_Extender" then
system=1 --probe
elseif typename=="KC_10_Extender_D" then
system=0 --boom
end
end