mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPS
- CHIEF: fixed bug in LEGION.RecruitCohortAssets() function call - COMMANDER: added total weight to LEGION.RecruitCohortAssets() function call - POSITIONABLE: fixed bug in relFuel calculation for cargo bay size
This commit is contained in:
parent
ff1ebf9775
commit
5dae9a197a
@ -180,7 +180,7 @@ CHIEF.Strategy = {
|
||||
|
||||
--- CHIEF class version.
|
||||
-- @field #string version
|
||||
CHIEF.version="0.1.0"
|
||||
CHIEF.version="0.1.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@ -2209,7 +2209,7 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM
|
||||
end
|
||||
|
||||
-- Recruite infantry assets.
|
||||
local recruited, assets, legions=LEGION.RecruitCohortAssets(Cohorts, MissionType, nil, NassetsMin, NassetsMax, TargetVec2, nil, RangeMax, nil, nil, Categories, Attributes)
|
||||
local recruited, assets, legions=LEGION.RecruitCohortAssets(Cohorts, MissionType, nil, NassetsMin, NassetsMax, TargetVec2, nil, RangeMax, nil, nil, nil, Categories, Attributes)
|
||||
|
||||
if recruited then
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ COMMANDER = {
|
||||
|
||||
--- COMMANDER class version.
|
||||
-- @field #string version
|
||||
COMMANDER.version="0.1.0"
|
||||
COMMANDER.version="0.1.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@ -1190,7 +1190,7 @@ function COMMANDER:RecruitAssetsForMission(Mission)
|
||||
local Payloads=Mission.payloads
|
||||
|
||||
-- Recruite assets.
|
||||
local recruited, assets, legions=LEGION.RecruitCohortAssets(Cohorts, Mission.type, Mission.alert5MissionType, NreqMin, NreqMax, TargetVec2, Payloads, Mission.engageRange, Mission.refuelSystem, nil)
|
||||
local recruited, assets, legions=LEGION.RecruitCohortAssets(Cohorts, Mission.type, Mission.alert5MissionType, NreqMin, NreqMax, TargetVec2, Payloads, Mission.engageRange, Mission.refuelSystem)
|
||||
|
||||
return recruited, assets, legions
|
||||
end
|
||||
@ -1292,6 +1292,7 @@ function COMMANDER:CheckTransportQueue()
|
||||
|
||||
-- Weight of the heaviest cargo group. Necessary condition that this fits into on carrier unit!
|
||||
local weightGroup=0
|
||||
local TotalWeight=0
|
||||
|
||||
-- Calculate the max weight so we know which cohorts can provide carriers.
|
||||
if #cargoOpsGroups>0 then
|
||||
@ -1301,13 +1302,14 @@ function COMMANDER:CheckTransportQueue()
|
||||
if weight>weightGroup then
|
||||
weightGroup=weight
|
||||
end
|
||||
TotalWeight=TotalWeight+weight
|
||||
end
|
||||
end
|
||||
|
||||
if weightGroup>0 then
|
||||
|
||||
-- Recruite assets from legions.
|
||||
local recruited, assets, legions=self:RecruitAssetsForTransport(transport, weightGroup)
|
||||
local recruited, assets, legions=self:RecruitAssetsForTransport(transport, weightGroup, TotalWeight)
|
||||
|
||||
if recruited then
|
||||
|
||||
@ -1344,10 +1346,12 @@ end
|
||||
--- Recruit assets for a given OPS transport.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Ops.OpsTransport#OPSTRANSPORT Transport The OPS transport.
|
||||
-- @param #number CargoWeight Weight of the heaviest cargo group.
|
||||
-- @param #number TotalWeight Total weight of all cargo groups.
|
||||
-- @return #boolean If `true`, enough assets could be recruited.
|
||||
-- @return #table Recruited assets.
|
||||
-- @return #table Legions that have recruited assets.
|
||||
function COMMANDER:RecruitAssetsForTransport(Transport, CargoWeight)
|
||||
function COMMANDER:RecruitAssetsForTransport(Transport, CargoWeight, TotalWeight)
|
||||
|
||||
if CargoWeight==0 then
|
||||
-- No cargo groups!
|
||||
@ -1381,7 +1385,7 @@ function COMMANDER:RecruitAssetsForTransport(Transport, CargoWeight)
|
||||
local NreqMin,NreqMax=Transport:GetRequiredCarriers()
|
||||
|
||||
-- Recruit assets and legions.
|
||||
local recruited, assets, legions=LEGION.RecruitCohortAssets(Cohorts, AUFTRAG.Type.OPSTRANSPORT, nil, NreqMin, NreqMax, TargetVec2, nil, nil, nil, CargoWeight)
|
||||
local recruited, assets, legions=LEGION.RecruitCohortAssets(Cohorts, AUFTRAG.Type.OPSTRANSPORT, nil, NreqMin, NreqMax, TargetVec2, nil, nil, nil, CargoWeight, TotalWeight)
|
||||
|
||||
return recruited, assets, legions
|
||||
end
|
||||
|
||||
@ -541,6 +541,9 @@ function OPSGROUP:New(group)
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
-- Set gen attribute.
|
||||
self.attribute=self.group:GetAttribute()
|
||||
|
||||
local units=self.group:GetUnits()
|
||||
|
||||
@ -864,6 +867,12 @@ function OPSGROUP:GetLifePoints(Element)
|
||||
return life, life0
|
||||
end
|
||||
|
||||
--- Get generalized attribute.
|
||||
-- @param #OPSGROUP self
|
||||
-- @return #string Generalized attribute.
|
||||
function OPSGROUP:GetAttribute()
|
||||
return self.attribute
|
||||
end
|
||||
|
||||
--- Set verbosity level.
|
||||
-- @param #OPSGROUP self
|
||||
|
||||
@ -1494,7 +1494,7 @@ do -- Cargo
|
||||
|
||||
-- Fuel. The descriptor provides the max fuel mass in kg. This needs to be multiplied by the relative fuel amount to calculate the actual fuel mass on board.
|
||||
local massFuelMax=Desc.fuelMassMax or 0
|
||||
local relFuel=math.max(self:GetFuel() or 1.0, 1.0) -- We take 1.0 as max in case of external fuel tanks.
|
||||
local relFuel=math.min(self:GetFuel() or 1.0, 1.0) -- We take 1.0 as max in case of external fuel tanks.
|
||||
local massFuel=massFuelMax*relFuel
|
||||
|
||||
-- Number of soldiers according to DCS function
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user