This commit is contained in:
Frank
2020-04-25 21:46:05 +02:00
parent 78ef53fbea
commit 443a37a9c5
2 changed files with 32 additions and 26 deletions
+26 -19
View File
@@ -2517,6 +2517,17 @@ function AUFTRAG:GetTargetType()
return self:GetTargetData().Type
end
--- Get 2D vector of target.
-- @param #AUFTRAG self
-- @return DCS#VEC2 The target 2D vector or *nil*.
function AUFTRAG:GetTargetVec2()
local coord=self:GetTargetCoordinate()
if coord then
return coord:GetVec2()
end
return nil
end
--- Get coordinate of target.
-- @param #AUFTRAG self
-- @return Core.Point#COORDINATE The target coordinate or *nil*.
@@ -2641,8 +2652,9 @@ end
--- Get DCS task table for the given mission.
-- @param #AUFTRAG self
-- @param Wrapper.Controllable#CONTROLLABLE TaskControllable The controllable for which this task is set. Most tasks don't need it.
-- @return DCS#Task The DCS task table. If multiple tasks are necessary, this is returned as a combo task.
function AUFTRAG:GetDCSMissionTask()
function AUFTRAG:GetDCSMissionTask(TaskControllable)
local DCStasks={}
@@ -2679,9 +2691,7 @@ function AUFTRAG:GetDCSMissionTask()
-- BOMBING Mission --
---------------------
local Vec2=self:GetTargetCoordinate():GetVec2()
local DCStask=CONTROLLABLE.TaskBombing(nil, Vec2, self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, Divebomb)
local DCStask=CONTROLLABLE.TaskBombing(nil, self:GetTargetVec2(), self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, Divebomb)
table.insert(DCStasks, DCStask)
@@ -2701,9 +2711,7 @@ function AUFTRAG:GetDCSMissionTask()
-- BOMBCARPET Mission --
------------------------
local Vec2=self:GetTargetCoordinate():GetVec2()
local DCStask=CONTROLLABLE.TaskCarpetBombing(nil, Vec2, self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, self.engageCarpetLength)
local DCStask=CONTROLLABLE.TaskCarpetBombing(nil, self:GetTargetVec2(), self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, self.engageCarpetLength)
table.insert(DCStasks, DCStask)
@@ -2785,7 +2793,7 @@ function AUFTRAG:GetDCSMissionTask()
-- RECON Mission --
-------------------
-- TODO: What?
-- TODO: What? Table of coordinates?
elseif self.type==AUFTRAG.Type.SEAD then
@@ -2806,10 +2814,8 @@ function AUFTRAG:GetDCSMissionTask()
--------------------
-- STRIKE Mission --
--------------------
local Vec2=self:GetTargetCoordinate():GetVec2()
local DCStask=CONTROLLABLE.TaskAttackMapObject(nil, Vec2, self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType)
local DCStask=CONTROLLABLE.TaskAttackMapObject(nil, self:GetTargetVec2(), self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType)
table.insert(DCStasks, DCStask)
@@ -2825,17 +2831,18 @@ function AUFTRAG:GetDCSMissionTask()
elseif self.type==AUFTRAG.Type.TROOPTRANSPORT then
-----------------------
-- TRANSPORT Mission --
-----------------------
----------------------------
-- TROOPTRANSPORT Mission --
----------------------------
-- TODO: What about the groups to embark? And where to go?
-- Task to embark the troops at the pick up point.
local TaskEmbark=CONTROLLABLE.TaskEmbarking(TaskControllable, self.transportPickup, self.transportGroupSet, self.transportWaitForCargo)
local Vec2=self.transportPickup:GetVec2()
-- Task to disembark the troops at the drop off point.
local TaskDisEmbark=CONTROLLABLE.TaskDisembarking(TaskControllable, self.transportDropoff, self.transportGroupSet)
local DCStask=CONTROLLABLE.TaskEmbarking(nil, self.transportPickup, self.transportGroupSet, 120, DistributionGroupSet)
table.insert(DCStasks, DCStask)
table.insert(DCStasks, TaskEmbark)
table.insert(DCStasks, TaskDisEmbark)
elseif self.type==AUFTRAG.Type.RESCUEHELO then
+6 -7
View File
@@ -3073,7 +3073,7 @@ function FLIGHTGROUP:onafterRefuel(From, Event, To, Coordinate)
local TaskFunction=self.group:TaskFunction("FLIGHTGROUP._FinishedRefuelling", self)
local DCSTasks={TaskRefuel, TaskFunction}
local Speed=self.speedCruise --UTILS.KnotsToKmph(300)
local Speed=self.speedCruise
local coordinate=self.group:GetCoordinate()
@@ -3937,12 +3937,10 @@ function FLIGHTGROUP:RouteToMission(mission, delay)
if mission.type==AUFTRAG.Type.TROOPTRANSPORT then
local Temb=self.group:TaskEmbarking(mission.transportPickup, mission.transportGroupSet, 300)
local Tdis=self.group:TaskDisembarking(mission.transportDropoff, mission.transportGroupSet)
mission.DCStask=self.group:TaskCombo({Temb, Tdis})
-- Refresh DCS task with the known controllable.
mission.DCStask=mission:GetDCSMissionTask(self.group)
-- Add task to embark for the troops.
for _,_group in pairs(mission.transportGroupSet.Set) do
local group=_group --Wrapper.Group#GROUP
@@ -3985,6 +3983,7 @@ function FLIGHTGROUP:RouteToMission(mission, delay)
if mission.tacanChannel then
self:SwitchTACANOn(mission.tacanChannel, mission.tacanMorse)
end
end
end