mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
da312cd5ac
@ -2771,7 +2771,10 @@ function AUFTRAG:SetRepeatOnSuccess(Nrepeat)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- **[LEGION, COMMANDER, CHIEF]** Set that mission assets get reinforced if their number drops below Nmin.
|
--- **[LEGION, COMMANDER, CHIEF]** Set that mission assets get reinforced if their number drops below the minimum number of required assets of the mission (*c.f.* SetRequiredAssets() function).
|
||||||
|
--
|
||||||
|
-- **Note** that reinforcement groups are only recruited from the legion (airwing, brigade, fleet) the mission was assigned to. If the legion does not have any more of these assets,
|
||||||
|
-- no reinforcement can take place, even if the mission is submitted to a COMMANDER or CHIEF.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #number Nreinforce Number of max asset groups used to reinforce.
|
-- @param #number Nreinforce Number of max asset groups used to reinforce.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
@ -4029,7 +4032,7 @@ function AUFTRAG:onafterStatus(From, Event, To)
|
|||||||
self:T(self.lid.."No targets left cancelling mission!")
|
self:T(self.lid.."No targets left cancelling mission!")
|
||||||
self:Cancel()
|
self:Cancel()
|
||||||
|
|
||||||
elseif self:IsExecuting() and ((not self.reinforce) or (self.reinforce==0 and Nassigned<=0)) then
|
elseif self:IsExecuting() and self:_IsNotReinforcing() then
|
||||||
|
|
||||||
-- env.info("Mission Done:")
|
-- env.info("Mission Done:")
|
||||||
-- env.info(string.format("Nreinforce= %d", self.reinforce or 0))
|
-- env.info(string.format("Nreinforce= %d", self.reinforce or 0))
|
||||||
@ -4575,7 +4578,7 @@ function AUFTRAG:CheckGroupsDone()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check if there is still reinforcement to be expected.
|
-- Check if there is still reinforcement to be expected.
|
||||||
if self:IsExecuting() and self.reinforce and (self.reinforce>0 or self.Nassigned-self.Ndead>0) then
|
if self:IsExecuting() and self:_IsReinforcing() then
|
||||||
self:T2(self.lid..string.format("CheckGroupsDone: Mission is still in state %s [FSM=%s] and reinfoce=%d. Mission NOT DONE!", self.status, self:GetState(), self.reinforce))
|
self:T2(self.lid..string.format("CheckGroupsDone: Mission is still in state %s [FSM=%s] and reinfoce=%d. Mission NOT DONE!", self.status, self:GetState(), self.reinforce))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -4736,10 +4739,12 @@ function AUFTRAG:onafterAssetDead(From, Event, To, Asset)
|
|||||||
-- Number of groups alive.
|
-- Number of groups alive.
|
||||||
local N=self:CountOpsGroups()
|
local N=self:CountOpsGroups()
|
||||||
|
|
||||||
self:T(self.lid..string.format("Asset %s dead! Number of ops groups remaining %d", tostring(Asset.spawngroupname), N))
|
local notreinforcing=self:_IsNotReinforcing()
|
||||||
|
|
||||||
|
self:T(self.lid..string.format("Asset %s dead! Number of ops groups remaining %d (reinforcing=%s)", tostring(Asset.spawngroupname), N, tostring(not notreinforcing)))
|
||||||
|
|
||||||
-- All assets dead?
|
-- All assets dead?
|
||||||
if N==0 and (self.reinforce==nil or self.reinforce==0) then
|
if N==0 and notreinforcing then
|
||||||
|
|
||||||
if self:IsNotOver() then
|
if self:IsNotOver() then
|
||||||
|
|
||||||
@ -5374,12 +5379,20 @@ function AUFTRAG:AddAsset(Asset)
|
|||||||
-- Add to table.
|
-- Add to table.
|
||||||
self.assets=self.assets or {}
|
self.assets=self.assets or {}
|
||||||
|
|
||||||
-- Add to table.
|
-- Get asset if it was already added.
|
||||||
table.insert(self.assets, Asset)
|
local asset=self:GetAssetByName(Asset.spawngroupname)
|
||||||
|
|
||||||
self.Nassigned=self.Nassigned or 0
|
-- Only add an asset is not already in.
|
||||||
|
if not asset then
|
||||||
|
|
||||||
self.Nassigned=self.Nassigned+1
|
-- Add to table.
|
||||||
|
table.insert(self.assets, Asset)
|
||||||
|
|
||||||
|
self.Nassigned=self.Nassigned or 0
|
||||||
|
|
||||||
|
self.Nassigned=self.Nassigned+1
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -5658,6 +5671,31 @@ function AUFTRAG:_SetRequestID(Legion, RequestID)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if reinforcement is done.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @return #boolean If `true`, reinforcing is over.
|
||||||
|
function AUFTRAG:_IsNotReinforcing()
|
||||||
|
|
||||||
|
-- Number of assigned assets that are still alive.
|
||||||
|
local Nassigned=self.Nassigned and self.Nassigned-self.Ndead or 0
|
||||||
|
|
||||||
|
-- Not reinforcing?
|
||||||
|
local notreinforcing=((not self.reinforce) or (self.reinforce==0 and Nassigned<=0))
|
||||||
|
|
||||||
|
return notreinforcing
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Check if reinforcement is still ongoing.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @return #boolean If `true`, reinforcing is ongoing.
|
||||||
|
function AUFTRAG:_IsReinforcing()
|
||||||
|
|
||||||
|
local reinforcing=not self:_IsNotReinforcing()
|
||||||
|
|
||||||
|
return reinforcing
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Update mission F10 map marker.
|
--- Update mission F10 map marker.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
|
|||||||
@ -1003,6 +1003,7 @@ function LEGION:onafterMissionRequest(From, Event, To, Mission, Assets)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Add asset to mission.
|
||||||
Mission:AddAsset(asset)
|
Mission:AddAsset(asset)
|
||||||
|
|
||||||
-- Trigger event.
|
-- Trigger event.
|
||||||
@ -1054,6 +1055,7 @@ function LEGION:onafterMissionRequest(From, Event, To, Mission, Assets)
|
|||||||
asset.takeoffType=COORDINATE.WaypointType.TakeOffParking
|
asset.takeoffType=COORDINATE.WaypointType.TakeOffParking
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Add asset to mission.
|
||||||
Mission:AddAsset(asset)
|
Mission:AddAsset(asset)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2930,6 +2930,14 @@ end
|
|||||||
-- @param #string CarrierGroupName (Optional) Additionally check if group is loaded into a particular carrier group(s).
|
-- @param #string CarrierGroupName (Optional) Additionally check if group is loaded into a particular carrier group(s).
|
||||||
-- @return #boolean If true, group is loaded.
|
-- @return #boolean If true, group is loaded.
|
||||||
function OPSGROUP:IsLoaded(CarrierGroupName)
|
function OPSGROUP:IsLoaded(CarrierGroupName)
|
||||||
|
|
||||||
|
local isloaded=self.cargoStatus==OPSGROUP.CargoStatus.LOADED
|
||||||
|
|
||||||
|
-- If not loaded, we can return false
|
||||||
|
if not isloaded then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if CarrierGroupName then
|
if CarrierGroupName then
|
||||||
if type(CarrierGroupName)~="table" then
|
if type(CarrierGroupName)~="table" then
|
||||||
CarrierGroupName={CarrierGroupName}
|
CarrierGroupName={CarrierGroupName}
|
||||||
@ -2937,12 +2945,14 @@ function OPSGROUP:IsLoaded(CarrierGroupName)
|
|||||||
for _,CarrierName in pairs(CarrierGroupName) do
|
for _,CarrierName in pairs(CarrierGroupName) do
|
||||||
local carrierGroup=self:_GetMyCarrierGroup()
|
local carrierGroup=self:_GetMyCarrierGroup()
|
||||||
if carrierGroup and carrierGroup.groupname==CarrierName then
|
if carrierGroup and carrierGroup.groupname==CarrierName then
|
||||||
return true
|
return isloaded
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- Not in any specified carrier.
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return self.cargoStatus==OPSGROUP.CargoStatus.LOADED
|
|
||||||
|
return isloaded
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the group is currently busy doing something.
|
--- Check if the group is currently busy doing something.
|
||||||
@ -10058,7 +10068,6 @@ function OPSGROUP:onafterBoard(From, Event, To, CarrierGroup, Carrier)
|
|||||||
|
|
||||||
-- Trigger Load event.
|
-- Trigger Load event.
|
||||||
CarrierGroup:Load(self)
|
CarrierGroup:Load(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -10069,7 +10078,6 @@ function OPSGROUP:onafterBoard(From, Event, To, CarrierGroup, Carrier)
|
|||||||
|
|
||||||
-- Set carrier. As long as the group is not loaded, we only reserve the cargo space.�
|
-- Set carrier. As long as the group is not loaded, we only reserve the cargo space.�
|
||||||
CarrierGroup:_AddCargobay(self, Carrier, true)
|
CarrierGroup:_AddCargobay(self, Carrier, true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user