From ff0371faa5aa1bd14d4d560f4daef4cdcdd69815 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 27 Jan 2019 13:07:48 +0100 Subject: [PATCH] CONTROLLABLE Fixed task bombing runway. --- Moose Development/Moose/Ops/Airboss.lua | 14 +++---- .../Moose/Wrapper/Controllable.lua | 37 +++++++++++++------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 5925d9b40..81d772db2 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -9881,12 +9881,12 @@ end --- Carrier resumes the route at its next waypoint. --@param #AIRBOSS self ---@param Core.Point#COORDINATE goto (Optional) First goto this coordinate before resuming route. +--@param Core.Point#COORDINATE gotocoord (Optional) First goto this coordinate before resuming route. --@return #AIRBOSS self -function AIRBOSS:CarrierResumeRoute(goto) +function AIRBOSS:CarrierResumeRoute(gotocoord) -- Make carrier resume its route. - AIRBOSS._ResumeRoute(self.carrier:GetGroup(), self, goto) + AIRBOSS._ResumeRoute(self.carrier:GetGroup(), self, gotocoord) return self end @@ -10202,8 +10202,8 @@ end --- Carrier Strike Group resumes the route of the waypoints defined in the mission editor. --@param Wrapper.Group#GROUP group Carrier Strike Group that passed the waypoint. --@param #AIRBOSS airboss Airboss object. ---@param Core.Point#COORDINATE goto Go to coordinate before route is resumed. -function AIRBOSS._ResumeRoute(group, airboss, goto) +--@param Core.Point#COORDINATE gotocoord Go to coordinate before route is resumed. +function AIRBOSS._ResumeRoute(group, airboss, gotocoord) -- Next wp = current+1 (or last) local nextwp=math.min(airboss.currentwp+1, #airboss.waypoints) @@ -10225,8 +10225,8 @@ function AIRBOSS._ResumeRoute(group, airboss, goto) local wp0=group:GetCoordinate():WaypointGround(velocity) table.insert(waypoints, wp0) - if goto then - local wp1=goto:WaypointGround(velocity) + if gotocoord then + local wp1=gotocoord:WaypointGround(velocity) table.insert(waypoints, wp1) end diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 0353c42f9..eac3ce207 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -1068,17 +1068,27 @@ end ---- (AIR) Delivering weapon on the runway. +--- (AIR) Delivering weapon on the runway. See [hoggit](https://wiki.hoggitworld.com/view/DCS_task_bombingRunway) +-- +-- Make sure the aircraft has the following role: +-- +-- * CAS +-- * Ground Attack +-- * Runway Attack +-- * Anti-Ship Strike +-- * AFAC +-- * Pinpoint Strike +-- -- @param #CONTROLLABLE self -- @param Wrapper.Airbase#AIRBASE Airbase Airbase to attack. --- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage. --- @param DCS#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion. --- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo. +-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. See [DCS enum weapon flag](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag). Default 2147485694 = AnyBomb (GuidedBomb + AnyUnguidedBomb). +-- @param DCS#AI.Task.WeaponExpend WeaponExpend Enum AI.Task.WeaponExpend that defines how much munitions the AI will expend per attack run. Default "ALL". +-- @param #number AttackQty Number of times the group will attack if the target. Default 1. -- @param DCS#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction. --- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft. +-- @param #boolean GroupAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a group and not to a single aircraft. -- @return DCS#Task The DCS task structure. -function CONTROLLABLE:TaskBombingRunway( Airbase, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack ) - self:F2( { self.ControllableName, Airbase, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack } ) +function CONTROLLABLE:TaskBombingRunway(Airbase, WeaponType, WeaponExpend, AttackQty, Direction, GroupAttack) + self:F2( { self.ControllableName, Airbase, WeaponType, WeaponExpend, AttackQty, Direction, GroupAttack } ) -- BombingRunway = { -- id = 'BombingRunway', @@ -1088,19 +1098,24 @@ function CONTROLLABLE:TaskBombingRunway( Airbase, WeaponType, WeaponExpend, Atta -- expend = enum AI.Task.WeaponExpend, -- attackQty = number, -- direction = Azimuth, --- controllableAttack = boolean, +-- groupAttack = boolean, -- } --- } +-- } + + -- Defaults. + WeaponType=WeaponType or 2147485694 + WeaponExpend=WeaponExpend or AI.Task.WeaponExpend.ALL + AttackQty=AttackQty or 1 local DCSTask DCSTask = { id = 'BombingRunway', params = { - point = Airbase:GetID(), + runwayId = Airbase:GetID(), weaponType = WeaponType, expend = WeaponExpend, attackQty = AttackQty, direction = Direction, - controllableAttack = ControllableAttack, + groupAttack = GroupAttack, }, },