mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-16 07:56:35 +00:00
Ops
This commit is contained in:
@@ -70,6 +70,7 @@
|
|||||||
--
|
--
|
||||||
-- @field Core.Set#SET_GROUP transportGroupSet Groups to be transported.
|
-- @field Core.Set#SET_GROUP transportGroupSet Groups to be transported.
|
||||||
-- @field Core.Point#COORDINATE transportPickup Coordinate where to pickup the cargo.
|
-- @field Core.Point#COORDINATE transportPickup Coordinate where to pickup the cargo.
|
||||||
|
-- @field Core.Point#COORDINATE transportDropoff Coordinate where to drop off the cargo.
|
||||||
--
|
--
|
||||||
-- @field Ops.WingCommander#WINGCOMMANDER wingcommander The WINGCOMMANDER managing this mission.
|
-- @field Ops.WingCommander#WINGCOMMANDER wingcommander The WINGCOMMANDER managing this mission.
|
||||||
-- @field Ops.AirWing#AIRWING airwing The assigned airwing.
|
-- @field Ops.AirWing#AIRWING airwing The assigned airwing.
|
||||||
@@ -197,7 +198,7 @@ _AUFTRAGSNR=0
|
|||||||
-- @field #string SEAD Suppression/destruction of enemy air defences.
|
-- @field #string SEAD Suppression/destruction of enemy air defences.
|
||||||
-- @field #string STRIKE Strike mission.
|
-- @field #string STRIKE Strike mission.
|
||||||
-- @field #string TANKER Tanker mission.
|
-- @field #string TANKER Tanker mission.
|
||||||
-- @field #string TRANSPORT Transport mission.
|
-- @field #string TROOPTRANSPORT Troop transport mission.
|
||||||
AUFTRAG.Type={
|
AUFTRAG.Type={
|
||||||
ANTISHIP="Anti Ship",
|
ANTISHIP="Anti Ship",
|
||||||
AWACS="AWACS",
|
AWACS="AWACS",
|
||||||
@@ -219,7 +220,7 @@ AUFTRAG.Type={
|
|||||||
SEAD="SEAD",
|
SEAD="SEAD",
|
||||||
STRIKE="Strike",
|
STRIKE="Strike",
|
||||||
TANKER="Tanker",
|
TANKER="Tanker",
|
||||||
TRANSPORT="Transport",
|
TROOPTRANSPORT="Troop Transport",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Mission status.
|
--- Mission status.
|
||||||
@@ -963,14 +964,15 @@ function AUFTRAG:NewESCORT(EscortGroup, OffsetVector, EngageMaxDistance, TargetT
|
|||||||
return mission
|
return mission
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create an TRANSPORT mission.
|
--- Create a TROOP TRANSPORT mission.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Set#SET_GROUP TransportGroupSet The set group(s) to be transported.
|
-- @param Core.Set#SET_GROUP TransportGroupSet The set group(s) to be transported.
|
||||||
|
-- @param Core.Point#COORDINATE DropoffCoordinate Coordinate where the helo will land drop off the the troops.
|
||||||
-- @param Core.Point#COORDINATE PickupCoordinate Coordinate where the helo will land to pick up the the cargo. Default is the fist transport group.
|
-- @param Core.Point#COORDINATE PickupCoordinate Coordinate where the helo will land to pick up the the cargo. Default is the fist transport group.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:NewTRANSPORT(TransportGroupSet, PickupCoordinate)
|
function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupCoordinate)
|
||||||
|
|
||||||
local mission=AUFTRAG:New(AUFTRAG.Type.TRANSPORT)
|
local mission=AUFTRAG:New(AUFTRAG.Type.TROOPTRANSPORT)
|
||||||
|
|
||||||
if TransportGroupSet:IsInstanceOf("GROUP") then
|
if TransportGroupSet:IsInstanceOf("GROUP") then
|
||||||
mission.transportGroupSet=SET_GROUP:New()
|
mission.transportGroupSet=SET_GROUP:New()
|
||||||
@@ -978,14 +980,17 @@ function AUFTRAG:NewTRANSPORT(TransportGroupSet, PickupCoordinate)
|
|||||||
elseif TransportGroupSet:IsInstanceOf("SET_GROUP") then
|
elseif TransportGroupSet:IsInstanceOf("SET_GROUP") then
|
||||||
mission.transportGroupSet=TransportGroupSet
|
mission.transportGroupSet=TransportGroupSet
|
||||||
else
|
else
|
||||||
env.info("FF error in TRANSPORT auftrag")
|
mission:E(mission.lid.."ERROR: TransportGroupSet must be a GROUP or SET_GROUP object!")
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
mission:_TargetFromObject(mission.transportGroupSet)
|
mission:_TargetFromObject(mission.transportGroupSet)
|
||||||
|
|
||||||
mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate()
|
mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate()
|
||||||
|
mission.transportDropoff=DropoffCoordinate
|
||||||
|
|
||||||
mission.transportPickup:MarkToAll("Pickup")
|
mission.transportPickup:MarkToAll("Pickup")
|
||||||
|
mission.transportDropoff:MarkToAll("Drop off")
|
||||||
|
|
||||||
-- TODO: what's the best ROE here?
|
-- TODO: what's the best ROE here?
|
||||||
mission.optionROE=ENUMS.ROE.ReturnFire
|
mission.optionROE=ENUMS.ROE.ReturnFire
|
||||||
@@ -1673,8 +1678,18 @@ function AUFTRAG:Evaluate()
|
|||||||
local Ntargets=self:CountMissionTargets()
|
local Ntargets=self:CountMissionTargets()
|
||||||
|
|
||||||
-- Number of current targets is still >0 ==> Not everything was destroyed.
|
-- Number of current targets is still >0 ==> Not everything was destroyed.
|
||||||
if self.Ntargets>0 and Ntargets>0 then
|
if self.type==AUFTRAG.Type.TROOPTRANSPORT then
|
||||||
failed=true
|
|
||||||
|
if self.Ntargets>0 and Ntargets<self.Ntargets then
|
||||||
|
failed=true
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
if self.Ntargets>0 and Ntargets>0 then
|
||||||
|
failed=true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--TODO: all assets dead? Is this a FAILED criterion even if all targets have been destroyed? What if there are no initial targets (e.g. when ORBIT, PATROL, RECON missions).
|
--TODO: all assets dead? Is this a FAILED criterion even if all targets have been destroyed? What if there are no initial targets (e.g. when ORBIT, PATROL, RECON missions).
|
||||||
@@ -2808,7 +2823,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
|
|
||||||
table.insert(self.enrouteTasks, DCStask)
|
table.insert(self.enrouteTasks, DCStask)
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.TRANSPORT then
|
elseif self.type==AUFTRAG.Type.TROOPTRANSPORT then
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
-- TRANSPORT Mission --
|
-- TRANSPORT Mission --
|
||||||
@@ -2818,7 +2833,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
|
|
||||||
local Vec2=self.transportPickup:GetVec2()
|
local Vec2=self.transportPickup:GetVec2()
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.TaskEmbarking(self, Vec2, self.transportGroupSet, 120, DistributionGroupSet)
|
local DCStask=CONTROLLABLE.TaskEmbarking(nil, self.transportPickup, self.transportGroupSet, 120, DistributionGroupSet)
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
|
|||||||
@@ -1650,7 +1650,6 @@ function FLIGHTGROUP:onafterFlightStatus(From, Event, To)
|
|||||||
-- Fuel State
|
-- Fuel State
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
-- Only if group is in air.
|
-- Only if group is in air.
|
||||||
if self:IsAlive() and self.group:IsAirborne(true) then
|
if self:IsAlive() and self.group:IsAirborne(true) then
|
||||||
|
|
||||||
@@ -2796,6 +2795,12 @@ function FLIGHTGROUP:onbeforeRTB(From, Event, To, airbase, SpeedTo, SpeedHold)
|
|||||||
allowed=false
|
allowed=false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not self.group:IsAirborne(true) then
|
||||||
|
self:I(self.lid..string.format("WARNING: Group is not AIRBORNE ==> RTB event is suspended for 10 sec."))
|
||||||
|
allowed=false
|
||||||
|
Tsuspend=-10
|
||||||
|
end
|
||||||
|
|
||||||
-- Only if fuel is not low or critical.
|
-- Only if fuel is not low or critical.
|
||||||
if not (self:IsFuelLow() or self:IsFuelCritical()) then
|
if not (self:IsFuelLow() or self:IsFuelCritical()) then
|
||||||
|
|
||||||
@@ -2840,7 +2845,7 @@ end
|
|||||||
-- @param #number SpeedLand Landing speed in knots. Default 170 kts.
|
-- @param #number SpeedLand Landing speed in knots. Default 170 kts.
|
||||||
function FLIGHTGROUP:onafterRTB(From, Event, To, airbase, SpeedTo, SpeedHold, SpeedLand)
|
function FLIGHTGROUP:onafterRTB(From, Event, To, airbase, SpeedTo, SpeedHold, SpeedLand)
|
||||||
|
|
||||||
self:I(self.lid..string.format("RTB: event=%s: %s --> %s", Event, From, To))
|
self:I(self.lid..string.format("RTB: event=%s: %s --> %s to %s", Event, From, To, airbase:GetName()))
|
||||||
|
|
||||||
self.destbase=airbase
|
self.destbase=airbase
|
||||||
|
|
||||||
@@ -2907,10 +2912,10 @@ function FLIGHTGROUP:onafterRTB(From, Event, To, airbase, SpeedTo, SpeedHold, Sp
|
|||||||
local TaskArrived=self.group:TaskFunction("FLIGHTGROUP._ReachedHolding", self)
|
local TaskArrived=self.group:TaskFunction("FLIGHTGROUP._ReachedHolding", self)
|
||||||
|
|
||||||
-- Orbit until flaghold=1 (true) but max 5 min if no FC is giving the landing clearance.
|
-- Orbit until flaghold=1 (true) but max 5 min if no FC is giving the landing clearance.
|
||||||
local TaskOrbit=self.group:TaskOrbit(p0, nil, UTILS.KnotsToMps(SpeedHold), p1)
|
local TaskOrbit = self.group:TaskOrbit(p0, nil, UTILS.KnotsToMps(SpeedHold), p1)
|
||||||
local TaskLand=self.group:TaskCondition(nil, self.flaghold.UserFlagName, 1, nil, holdtime)
|
local TaskLand = self.group:TaskCondition(nil, self.flaghold.UserFlagName, 1, nil, holdtime)
|
||||||
local TaskHold=self.group:TaskControlled(TaskOrbit, TaskLand)
|
local TaskHold = self.group:TaskControlled(TaskOrbit, TaskLand)
|
||||||
local TaskKlar=self.group:TaskFunction("FLIGHTGROUP._ClearedToLand", self) -- Once the holding flag becomes true, set trigger FLIGHTLANDING, i.e. set flight STATUS to LANDING.
|
local TaskKlar = self.group:TaskFunction("FLIGHTGROUP._ClearedToLand", self) -- Once the holding flag becomes true, set trigger FLIGHTLANDING, i.e. set flight STATUS to LANDING.
|
||||||
|
|
||||||
-- Waypoints from current position to holding point.
|
-- Waypoints from current position to holding point.
|
||||||
local wp={}
|
local wp={}
|
||||||
@@ -2950,14 +2955,14 @@ function FLIGHTGROUP:onafterRTB(From, Event, To, airbase, SpeedTo, SpeedHold, Sp
|
|||||||
-- Respawn?
|
-- Respawn?
|
||||||
if routeto then
|
if routeto then
|
||||||
|
|
||||||
self:I(self.lid.."FF route (not repawn)")
|
--self:I(self.lid.."FF route (not repawn)")
|
||||||
|
|
||||||
-- Just route the group. Respawn might happen when going from holding to final.
|
-- Just route the group. Respawn might happen when going from holding to final.
|
||||||
self:Route(wp, 1)
|
self:Route(wp, 1)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
self:I(self.lid.."FF respawn (not route)")
|
--self:I(self.lid.."FF respawn (not route)")
|
||||||
|
|
||||||
-- Get group template.
|
-- Get group template.
|
||||||
local Template=self.group:GetTemplate()
|
local Template=self.group:GetTemplate()
|
||||||
@@ -3117,9 +3122,13 @@ function FLIGHTGROUP:onafterHolding(From, Event, To)
|
|||||||
|
|
||||||
-- Add flight to waiting/holding queue.
|
-- Add flight to waiting/holding queue.
|
||||||
if self.flightcontrol then
|
if self.flightcontrol then
|
||||||
-- Add flight to holding queue.
|
|
||||||
|
-- Remove flight from inbound queue.
|
||||||
self.flightcontrol:_RemoveFlightFromQueue(self.flightcontrol.Qinbound, self, "inbound")
|
self.flightcontrol:_RemoveFlightFromQueue(self.flightcontrol.Qinbound, self, "inbound")
|
||||||
|
|
||||||
|
-- Add flight to holding queue.
|
||||||
self.flightcontrol:_AddFlightToHoldingQueue(self)
|
self.flightcontrol:_AddFlightToHoldingQueue(self)
|
||||||
|
|
||||||
if not self.ai then
|
if not self.ai then
|
||||||
self:_UpdateMenu()
|
self:_UpdateMenu()
|
||||||
end
|
end
|
||||||
@@ -3754,7 +3763,6 @@ function FLIGHTGROUP:onafterMissionStart(From, Event, To, Mission)
|
|||||||
|
|
||||||
-- Route flight to mission zone.
|
-- Route flight to mission zone.
|
||||||
self:RouteToMission(Mission, 5)
|
self:RouteToMission(Mission, 5)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "MissionExecute" event. Mission execution began.
|
--- On after "MissionExecute" event. Mission execution began.
|
||||||
@@ -3927,6 +3935,26 @@ function FLIGHTGROUP:RouteToMission(mission, delay)
|
|||||||
-- Add waypoint.
|
-- Add waypoint.
|
||||||
self:AddWaypointAir(waypointcoord, nextwaypoint, speed, false)
|
self:AddWaypointAir(waypointcoord, nextwaypoint, speed, false)
|
||||||
|
|
||||||
|
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})
|
||||||
|
|
||||||
|
|
||||||
|
for _,_group in pairs(mission.transportGroupSet.Set) do
|
||||||
|
local group=_group --Wrapper.Group#GROUP
|
||||||
|
|
||||||
|
if group and group:IsAlive() then
|
||||||
|
local DCSTask=group:TaskEmbarkToTransport(mission.transportPickup, 500)
|
||||||
|
group:SetTask(DCSTask, 5)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- Add waypoint task. UpdateRoute is called inside.
|
-- Add waypoint task. UpdateRoute is called inside.
|
||||||
local waypointtask=self:AddTaskWaypoint(mission.DCStask, nextwaypoint, mission.name, mission.prio, mission.duration)
|
local waypointtask=self:AddTaskWaypoint(mission.DCStask, nextwaypoint, mission.name, mission.prio, mission.duration)
|
||||||
|
|
||||||
|
|||||||
@@ -1063,7 +1063,7 @@ end
|
|||||||
-- @param #number Duration (Optional) The maximum duration in seconds to wait until all groups have embarked.
|
-- @param #number Duration (Optional) The maximum duration in seconds to wait until all groups have embarked.
|
||||||
-- @param #table Distribution (Optional) Distribution used to put the infantry groups into specific carrier units.
|
-- @param #table Distribution (Optional) Distribution used to put the infantry groups into specific carrier units.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distribution)
|
function CONTROLLABLE:TaskEmbarking(Coordinate, GroupSetForEmbarking, Duration, Distribution)
|
||||||
|
|
||||||
-- Table of group IDs for embarking.
|
-- Table of group IDs for embarking.
|
||||||
local g4e={}
|
local g4e={}
|
||||||
@@ -1091,9 +1091,8 @@ function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distri
|
|||||||
id = 'Embarking',
|
id = 'Embarking',
|
||||||
params = {
|
params = {
|
||||||
selectedTransport = groupID,
|
selectedTransport = groupID,
|
||||||
Vec2 = Vec2,
|
x = Coordinate.x,
|
||||||
x = Vec2.x,
|
y = Coordinate.z,
|
||||||
y = Vec2.y,
|
|
||||||
groupsForEmbarking = g4e,
|
groupsForEmbarking = g4e,
|
||||||
durationFlag = Duration and true or false,
|
durationFlag = Duration and true or false,
|
||||||
duration = Duration,
|
duration = Duration,
|
||||||
@@ -1101,6 +1100,9 @@ function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distri
|
|||||||
distribution = Distribution,
|
distribution = Distribution,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env.info("FF")
|
||||||
|
BASE:E(DCSTask)
|
||||||
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
@@ -1149,8 +1151,8 @@ function CONTROLLABLE:TaskDisembarking(Coordinate, GroupSetToDisembark)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local DisembarkFromTransport={
|
local Disembarking={
|
||||||
id="DisembarkFromTransport",
|
id = "Disembarking",
|
||||||
params = {
|
params = {
|
||||||
x = Coordinate.x,
|
x = Coordinate.x,
|
||||||
y = Coordinate.z,
|
y = Coordinate.z,
|
||||||
@@ -1158,7 +1160,7 @@ function CONTROLLABLE:TaskDisembarking(Coordinate, GroupSetToDisembark)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DisembarkFromTransport
|
return Disembarking
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user