- AUFTRAG: Orbit is now in KIAS
- CHIEF: fixes for resource
This commit is contained in:
Frank 2022-11-03 22:46:10 +01:00
parent 1a575d9364
commit 39f690f2b4
3 changed files with 23 additions and 22 deletions

View File

@ -1202,7 +1202,8 @@ function ARMYGROUP:onafterUpdateRoute(From, Event, To, n, N, Speed, Formation)
formation=Formation
end
env.info(self.lid..string.format("FF Formation %s", formation))
-- Debug
--env.info(self.lid..string.format("FF Formation %s", formation))
-- Add road waypoint.
if formation==ENUMS.Formation.Vehicle.OnRoad then
@ -1754,7 +1755,7 @@ function ARMYGROUP:onafterEngageTarget(From, Event, To, Target, Speed, Formation
self:SwitchROE(ENUMS.ROE.OpenFire)
-- ID of current waypoint.
local uid=self:GetWaypointCurrent().uid
local uid=self:GetWaypointCurrentUID()
-- Set formation.
self.engage.Formation=Formation or ENUMS.Formation.Vehicle.Vee

View File

@ -74,6 +74,7 @@
-- @field #number orbitDeltaR Distance threshold in meters for moving orbit targets.
--
-- @field Ops.Target#TARGET engageTarget Target data to engage.
-- @field #number targetHeading Heading of target in degrees.
--
-- @field Ops.Operation#OPERATION operation Operation this mission is part of.
--
@ -1043,7 +1044,7 @@ function AUFTRAG:NewORBIT(Coordinate, Altitude, Speed, Heading, Leg)
end
-- Orbit speed in m/s.
mission.orbitSpeed = UTILS.KnotsToMps(Speed or 350)
mission.orbitSpeed = UTILS.KnotsToMps(UTILS.KnotsToAltKIAS(Speed or 350, UTILS.MetersToFeet(mission.orbitAltitude)))
-- Mission speed in km/h.
mission.missionSpeed = UTILS.KnotsToKmph(Speed or 350)
@ -1696,7 +1697,7 @@ end
-- @param #number Altitude Orbit altitude in feet. Default is 6,000 ft.
-- @param #number Speed Orbit speed in knots. Default 250 KIAS.
-- @param #number Leg Length of race-track in NM. Default 14 NM.
-- @param #number RelHeading Relative heading [0, 360) of race-track pattern in degrees. Default is heading of the carrier.
-- @param #number RelHeading Relative heading [0, 360) of race-track pattern in degrees wrt heading of the carrier. Default is heading of the carrier.
-- @param #number OffsetDist Relative distance of the first race-track point wrt to the carrier. Default 6 NM.
-- @param #number OffsetAngle Relative angle of the first race-track point wrt. to the carrier. Default 180 (behind the boat).
-- @param #number UpdateDistance Threshold distance in NM before orbit pattern is updated. Default 5 NM.
@ -5963,9 +5964,7 @@ function AUFTRAG:GetDCSMissionTask()
if self.orbitVec2 then
-- Heading of the target.
local targetheading=self:GetTargetHeading()
self.targetHeading=targetheading
self.targetHeading=self:GetTargetHeading()
local OffsetVec2=nil --DCS#Vec2
if (self.orbitOffsetVec2~=nil) then
@ -5977,7 +5976,7 @@ function AUFTRAG:GetDCSMissionTask()
if self.orbitOffsetVec2.r then
-- Polar coordinates
local r=self.orbitOffsetVec2.r
local phi=(self.orbitOffsetVec2.phi or 0) + targetheading
local phi=(self.orbitOffsetVec2.phi or 0) + self.targetHeading
OffsetVec2.x=r*math.cos(math.rad(phi))
OffsetVec2.y=r*math.sin(math.rad(phi))
@ -6005,7 +6004,7 @@ function AUFTRAG:GetDCSMissionTask()
-- Is heading realtive to target?
if self.orbitHeadingRel then
-- Relative heading wrt target.
heading=targetheading+self.orbitHeading
heading=self.targetHeading+self.orbitHeading
else
-- Take given heading.
heading=self.orbitHeading
@ -6013,7 +6012,7 @@ function AUFTRAG:GetDCSMissionTask()
else
-- Not specific heading specified ==> Take heading of target.
heading=targetheading or 0
heading=self.targetHeading or 0
end
-- Race-track vector.

View File

@ -762,12 +762,12 @@ function CHIEF:CreateResource(MissionType, Nmin, Nmax, Attributes, Properties)
return resources, resource
end
--- Add mission type and number of required assets to resource.
--- Add mission type and number of required assets to resource list.
-- @param #CHIEF self
-- @param #CHIEF.Resources Resource Resource list.
-- @param #CHIEF.Resources Resource List of resources.
-- @param #string MissionType Mission Type.
-- @param #number Nmin Min number of required assets.
-- @param #number Nmax Max number of requried assets.
-- @param #number Nmin Min number of required assets. Default 1.
-- @param #number Nmax Max number of requried assets. Default equal `Nmin`.
-- @param #table Attributes Generalized attribute(s).
-- @param #table Properties DCS attribute(s). Default `nil`.
-- @return #CHIEF.Resource Resource table.
@ -777,7 +777,7 @@ function CHIEF:AddToResource(Resource, MissionType, Nmin, Nmax, Attributes, Prop
local resource={} --#CHIEF.Resource
resource.MissionType=MissionType
resource.Nmin=Nmin or 1
resource.Nmax=Nmax or 1
resource.Nmax=Nmax or Nmin
resource.Attributes=UTILS.EnsureTable(Attributes)
resource.Properties=UTILS.EnsureTable(Properties)
@ -814,7 +814,7 @@ end
-- @param #table CargoProperties DCS attribute(s) of the cargo assets.
-- @param #table CargoCategories Group categories of the cargo assets.
-- @param #number Nmin Min number of required assets. Default 1.
-- @param #number Nmax Max number of requried assets. Default 1.
-- @param #number Nmax Max number of requried assets. Default is equal to `Nmin`.
-- @param #table CarrierAttributes Generalized attribute(s) of the carrier assets.
-- @param #table CarrierProperties DCS attribute(s) of the carrier assets.
-- @param #table CarrierCategories Group categories of the carrier assets.
@ -825,7 +825,7 @@ function CHIEF:AddTransportToResource(Resource, CargoAttributes, CargoProperties
Resource.cargoAttributes=CargoAttributes
Resource.cargoProperties=CargoProperties
Resource.carrierNmin=Nmin or 1
Resource.carrierNmax=Nmin or 1
Resource.carrierNmax=Nmax or Nmin
Resource.carrierCategories=CarrierCategories
Resource.carrierAttributes=CarrierAttributes
Resource.carrierProperties=CarrierProperties
@ -1275,8 +1275,9 @@ function CHIEF:AddStrategicZone(OpsZone, Priority, Importance, ResourceOccupied,
stratzone.resourceEmpty=UTILS.DeepCopy(ResourceEmpty)
else
local resourceEmpty, resourceInfantry=self:CreateResource(AUFTRAG.Type.ONGUARD, 1, 3, GROUP.Attribute.GROUND_INFANTRY)
self:AddToResource(resourceEmpty, AUFTRAG.Type.ONGUARD, 1, 1, GROUP.Attribute.GROUND_TANK)
self:AddTransportToResource(resourceInfantry, GROUP.Attribute.GROUND_INFANTRY, nil, nil, 1, 1, {GROUP.Attribute.AIR_TRANSPORTHELO, GROUP.Attribute.GROUND_APC})
self:AddToResource(resourceEmpty, AUFTRAG.Type.ONGUARD, 0, 1, GROUP.Attribute.GROUND_TANK)
self:AddToResource(resourceEmpty, AUFTRAG.Type.ONGUARD, 0, 1, GROUP.Attribute.GROUND_IFV)
self:AddTransportToResource(resourceInfantry, GROUP.Attribute.GROUND_INFANTRY, nil, nil, 0, 1, {GROUP.Attribute.AIR_TRANSPORTHELO, GROUP.Attribute.GROUND_APC})
stratzone.resourceEmpty=resourceEmpty
end
@ -2963,7 +2964,7 @@ function CHIEF:RecruitAssetsForZone(StratZone, Resource)
-- First check if we need a transportation.
local transport=nil
if Resource.carrierNmin and Resource.carrierNmin>0 then
if Resource.carrierNmin and Resource.carrierNmax and Resource.carrierNmax>0 then
-- Filter only those assets that shall be transported.
local cargoassets=CHIEF._FilterAssets(assets, Resource.cargoCategories, Resource.cargoAttributes, Resource.cargoProperties)
@ -2972,7 +2973,7 @@ function CHIEF:RecruitAssetsForZone(StratZone, Resource)
-- Recruit transport carrier assets.
recruited, transport=LEGION.AssignAssetsForTransport(self.commander, self.commander.legions, cargoassets,
Resource.carrierNmin, Resource.carrierNmin, TargetZone, nil, Resource.carrierCategories, Resource.carrierAttributes)
Resource.carrierNmin, Resource.carrierNmax, TargetZone, nil, Resource.carrierCategories, Resource.carrierAttributes)
end