- Fixed bug in egress coord
- Improved barrage mission
- improved pickup at legion
- fixed bug in SetPathfindingOff function
This commit is contained in:
Frank 2021-11-11 21:16:48 +01:00
parent f157f3b5d6
commit a8132552de
8 changed files with 156 additions and 129 deletions

View File

@ -313,11 +313,15 @@ function ARMYGROUP:New(group)
--- Triggers the FSM event "Rearm".
-- @function [parent=#ARMYGROUP] Rearm
-- @param #ARMYGROUP self
-- @param Core.Point#COORDINATE Coordinate Coordinate where to rearm.
-- @param #number Formation Formation of the group.
--- Triggers the FSM event "Rearm" after a delay.
-- @function [parent=#ARMYGROUP] __Rearm
-- @param #ARMYGROUP self
-- @param #number delay Delay in seconds.
-- @param Core.Point#COORDINATE Coordinate Coordinate where to rearm.
-- @param #number Formation Formation of the group.
--- On after "Rearm" event.
-- @function [parent=#ARMYGROUP] OnAfterRearm
@ -325,6 +329,8 @@ function ARMYGROUP:New(group)
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Point#COORDINATE Coordinate Coordinate where to rearm.
-- @param #number Formation Formation of the group.
--- Triggers the FSM event "Rearming".
@ -448,6 +454,40 @@ function ARMYGROUP:AddTaskFireAtPoint(Coordinate, Clock, Radius, Nshots, WeaponT
return task
end
--- Add a *scheduled* task to fire at a given coordinate.
-- @param #ARMYGROUP self
-- @param #string Clock Time when to start the attack.
-- @param #number Heading Heading min in Degrees.
-- @param #number Alpha Shooting angle in Degrees.
-- @param #number Altitude Altitude in meters.
-- @param #number Radius Radius in meters. Default 100 m.
-- @param #number Nshots Number of shots to fire. Default nil.
-- @param #number WeaponType Type of weapon. Default auto.
-- @param #number Prio Priority of the task.
-- @return Ops.OpsGroup#OPSGROUP.Task The task table.
function ARMYGROUP:AddTaskBarrage(Clock, Heading, Alpha, Altitude, Radius, Nshots, WeaponType, Prio)
Heading=Heading or 0
Alpha=Alpha or 60
Altitude=Altitude or 100
local distance=Altitude/math.tan(math.rad(Alpha))
local a=self:GetVec2()
local vec2=UTILS.Vec2Translate(a, distance, Heading)
--local coord=COORDINATE:NewFromVec2(vec2):MarkToAll("Fire At Point",ReadOnly,Text)
local DCStask=CONTROLLABLE.TaskFireAtPoint(nil, vec2, Radius, Nshots, WeaponType, Altitude)
local task=self:AddTask(DCStask, Clock, nil, Prio)
return task
end
--- Add a *waypoint* task to fire at a given coordinate.
-- @param #ARMYGROUP self
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
@ -1043,28 +1083,39 @@ end
-- @param #string Event Event.
-- @param #string To To state.
function ARMYGROUP:onafterOutOfAmmo(From, Event, To)
self:T(self.lid..string.format("Group is out of ammo at t=%.3f", timer.getTime()))
self:I(self.lid..string.format("Group is out of ammo at t=%.3f", timer.getTime()))
-- Get current task.
local task=self:GetTaskCurrent()
if task then
if task.dcstask.id=="FireAtPoint" or task.dcstask.id==AUFTRAG.SpecialTask.BARRAGE then
self:I(self.lid..string.format("Cancelling current %s task because out of ammo!", task.dcstask.id))
self:TaskCancel(task)
end
end
-- Fist, check if we want to rearm once out-of-ammo.
--TODO: IsMobile() check
if self.rearmOnOutOfAmmo then
local truck, dist=self:FindNearestAmmoSupply(30)
if truck then
self:T(self.lid..string.format("Found Ammo Truck %s [%s]", truck:GetName(), truck:GetTypeName()))
local Coordinate=truck:GetCoordinate()
self:Rearm(Coordinate, Formation)
self:__Rearm(-1, Coordinate)
return
end
end
-- Second, check if we want to retreat once out of ammo.
if self.retreatOnOutOfAmmo then
self:Retreat()
self:__Retreat(-1)
return
end
-- Third, check if we want to RTZ once out of ammo.
if self.rtzOnOutOfAmmo then
self:RTZ()
self:__RTZ(-1)
end
end

View File

@ -105,7 +105,7 @@
-- @field #number artyShots Number of shots fired.
-- @field #number artyAltitude Altitude in meters. Can be used for a Barrage.
-- @field #number artyHeading Heading in degrees (for Barrage).
-- @field #number artyDistance Distance in meters (for barrage).
-- @field #number artyAngle Shooting angle in degrees (for Barrage).
--
-- @field #string alert5MissionType Alert 5 mission type. This is the mission type, the alerted assets will be able to carry out.
--
@ -1566,7 +1566,7 @@ function AUFTRAG:NewARTY(Target, Nshots, Radius, Altitude)
mission:_TargetFromObject(Target)
mission.artyShots=Nshots or 3
mission.artyShots=Nshots or nil
mission.artyRadius=Radius or 100
mission.artyAltitude=Altitude
@ -1590,13 +1590,13 @@ end
--- **[GROUND, NAVAL]** Create an BARRAGE mission. Assigned groups will move to a random coordinate within a given zone and start firing into the air.
-- @param #AUFTRAG self
-- @param Core.Zone#ZONE Zone The zone where the unit will go.
-- @param #number Heading Heading in degrees. Default random heading [0, 360).
-- @param #number Angle Shooting angle in degrees. Default random [45, 85].
-- @param #number Radius Radius of the shells in meters. Default 100 meters.
-- @param #number Altitude Altitude in meters. Default 500 m.
-- @param #number Heading Heading in degrees. Default random heading [0, 360).
-- @param #number Distance Distance in meters. Default 500 m.
-- @param #number Nshots Number of shots to be fired. Default is until ammo is empty (`#nil`).
-- @return #AUFTRAG self
function AUFTRAG:NewBARRAGE(Zone, Radius, Altitude, Heading, Distance, Nshots)
function AUFTRAG:NewBARRAGE(Zone, Heading, Angle, Radius, Altitude, Nshots)
local mission=AUFTRAG:New(AUFTRAG.Type.BARRAGE)
@ -1606,7 +1606,7 @@ function AUFTRAG:NewBARRAGE(Zone, Radius, Altitude, Heading, Distance, Nshots)
mission.artyRadius=Radius or 100
mission.artyAltitude=Altitude
mission.artyHeading=Heading
mission.artyDistance=Distance
mission.artyAngle=Angle
mission.engageWeaponType=ENUMS.WeaponFlag.Auto
@ -1701,7 +1701,9 @@ function AUFTRAG:NewAMMOSUPPLY(Zone)
mission.optionROE=ENUMS.ROE.WeaponHold
mission.optionAlarm=ENUMS.AlarmState.Auto
mission.missionFraction=0.9
mission.missionFraction=1.0
mission.missionWaypointRadius=0
mission.categories={AUFTRAG.Category.GROUND}
@ -1723,7 +1725,7 @@ function AUFTRAG:NewFUELSUPPLY(Zone)
mission.optionROE=ENUMS.ROE.WeaponHold
mission.optionAlarm=ENUMS.AlarmState.Auto
mission.missionFraction=0.9
mission.missionFraction=1.0
mission.categories={AUFTRAG.Category.GROUND}
@ -2572,6 +2574,17 @@ function AUFTRAG:SetICLS(Channel, Morse, UnitName)
return self
end
--- Set time interval between mission done and success/failure evaluation.
-- @param #AUFTRAG self
-- @param #number Teval Time in seconds before the mission result is evaluated. Default depends on mission type.
-- @return #AUFTRAG self
function AUFTRAG:SetEvaluationTime(Teval)
self.dTevaluate=Teval or 60
return self
end
--- Get mission type.
-- @param #AUFTRAG self
-- @return #string Mission type, e.g. "BAI".
@ -4799,7 +4812,7 @@ function AUFTRAG:GetDCSMissionTask(TaskControllable)
param.altitude=self.artyAltitude
param.radius=self.artyRadius
param.heading=self.artyHeading
param.distance=self.artyDistance
param.angle=self.artyAngle
param.shots=self.artyShots
param.weaponTypoe=self.engageWeaponType

View File

@ -2252,7 +2252,7 @@ function FLIGHTGROUP:onbeforeRTB(From, Event, To, airbase, SpeedTo, SpeedHold)
if not self.group:IsAirborne(true) then
-- this should really not happen, either the AUFTRAG is cancelled before the group was airborne or it is stuck at the ground for some reason
self:I(self.lid..string.format("WARNING: Group [%s] is not AIRBORNE ==> RTB event is suspended for 20 sec", self:GetState()))
self:T(self.lid..string.format("WARNING: Group [%s] is not AIRBORNE ==> RTB event is suspended for 20 sec", self:GetState()))
allowed=false
Tsuspend=-20
local groupspeed = self.group:GetVelocityMPS()

View File

@ -2261,13 +2261,15 @@ function LEGION:AssignAssetsForTransport(Legions, CargoAssets, NcarriersMin, Nca
-- Set pickup zone to spawn zone or airbase if the legion has one that is operational.
local pickupzone=legion.spawnzone
if legion.airbase and legion:IsRunwayOperational() then
pickupzone=ZONE_AIRBASE:New(legion.airbasename, 4000)
--pickupzone=ZONE_AIRBASE:New(legion.airbasename, 4000)
end
-- Add TZC from legion spawn zone to deploy zone.
local tpz=Transport:AddTransportZoneCombo(pickupzone, Transport:GetDeployZone())
local tpz=Transport:AddTransportZoneCombo(nil, pickupzone, Transport:GetDeployZone())
tpz.PickupAirbase=legion:IsRunwayOperational() and legion.airbase or nil
Transport:SetEmbarkZone(legion.spawnzone, tpz)
-- Add cargo assets to transport.
for _,_asset in pairs(CargoAssets) do
local asset=_asset --Functional.Warehouse#WAREHOUSE.Assetitem

View File

@ -454,7 +454,7 @@ end
-- @param #NAVYGROUP self
-- @return #NAVYGROUP self
function NAVYGROUP:SetPathfindingOff()
self:SetPathfinding(true, self.pathCorridor)
self:SetPathfinding(false, self.pathCorridor)
return self
end
@ -583,7 +583,7 @@ end
-- @param #NAVYGROUP self
-- @param #string starttime Start time, e.g. "8:00" for eight o'clock. Default now.
-- @param #string stoptime Stop time, e.g. "9:00" for nine o'clock. Default 90 minutes after start time.
-- @param #number speed Speed in knots during turn into wind leg.
-- @param #number speed Wind speed on deck in knots during turn into wind leg. Default 20 knots.
-- @param #boolean uturn If `true` (or `nil`), carrier wil perform a U-turn and go back to where it came from before resuming its route to the next waypoint. If false, it will go directly to the next waypoint.
-- @param #number offset Offset angle in degrees, e.g. to account for an angled runway. Default 0 deg.
-- @return #NAVYGROUP.IntoWind Turn into window data table.
@ -1041,16 +1041,17 @@ function NAVYGROUP:onafterUpdateRoute(From, Event, To, n, N, Speed, Depth)
if self:IsEngaging() or not self.passedfinalwp then
--[[
env.info("FF:")
for i=2,#waypoints do
local wp=waypoints[i] --Ops.OpsGroup#OPSGROUP.Waypoint
self:I(self.lid..string.format("[%d] UID=%d", i-1, wp.uid))
if self.verbose>=10 then
for i=1,#waypoints do
local wp=waypoints[i] --Ops.OpsGroup#OPSGROUP.Waypoint
local text=string.format("%s Waypoint [%d] UID=%d speed=%d", self.groupname, i-1, wp.uid or -1, wp.speed)
self:I(self.lid..text)
COORDINATE:NewFromWaypoint(wp):MarkToAll(text)
end
end
]]
-- Debug info.
self:I(self.lid..string.format("Updateing route: WP %d-->%d (%d/%d), Speed=%.1f knots, Depth=%d m", self.currentwp, n, #waypoints, #self.waypoints, UTILS.MpsToKnots(self.speedWp), self.altWp))
self:T(self.lid..string.format("Updateing route: WP %d-->%d (%d/%d), Speed=%.1f knots, Depth=%d m", self.currentwp, n, #waypoints, #self.waypoints, UTILS.MpsToKnots(self.speedWp), self.altWp))
-- Route group to all defined waypoints remaining.
self:Route(waypoints)

View File

@ -3635,15 +3635,8 @@ function OPSGROUP:onafterTaskExecute(From, Event, To, Task)
-- Task "Ammo Supply" or "Fuel Supply" mission.
---
-- Parameters.
local zone=Task.dcstask.params.zone --Core.Zone#ZONE
-- Random coordinate in zone.
local Coordinate=zone:GetRandomCoordinate()
-- Speed and altitude.
local Speed=UTILS.KmphToKnots(Task.dcstask.params.speed or self.speedCruise)
-- Just stay put and wait until something happens.
elseif Task.dcstask.id==AUFTRAG.SpecialTask.ALERT5 then
---
@ -3677,13 +3670,16 @@ function OPSGROUP:onafterTaskExecute(From, Event, To, Task)
-- BARRAGE is special!
if Task.dcstask.id==AUFTRAG.SpecialTask.BARRAGE then
--env.info("FF Barrage")
env.info("FF Barrage")
local vec2=self:GetVec2()
local param=Task.dcstask.params
local heading=param.heading or math.random(1, 360)
local distance=param.distance or 100
local Altitude=param.altitude or 500
local Alpha=param.angle or math.random(45, 85)
local distance=Altitude/math.tan(math.rad(Alpha))
local tvec2=UTILS.Vec2Translate(vec2, distance, heading)
DCSTask=CONTROLLABLE.TaskFireAtPoint(nil, tvec2, param.radius, param.shots, param.weaponType, param.altitude)
self:T(self.lid..string.format("Barrage: Shots=%s, Altitude=%d m, Angle=%d°, heading=%03d°, distance=%d m", tostring(param.shots), Altitude, Alpha, heading, distance))
DCSTask=CONTROLLABLE.TaskFireAtPoint(nil, tvec2, param.radius, param.shots, param.weaponType, Altitude)
else
DCSTask=Task.dcstask
end
@ -3892,8 +3888,8 @@ function OPSGROUP:onafterTaskDone(From, Event, To, Task)
self:T(self.lid.."Taske DONE Task_Land_At ==> Wait")
self:Wait(20, 100)
else
self:T(self.lid.."Task Done but NO mission found ==> _CheckGroupDone in 0 sec")
self:_CheckGroupDone()
self:T(self.lid.."Task Done but NO mission found ==> _CheckGroupDone in 1 sec")
self:_CheckGroupDone(1)
end
end
@ -3950,6 +3946,11 @@ function OPSGROUP:RemoveMission(Mission)
if Task then
self:RemoveTask(Task)
end
-- Take care of a paused mission.
if self.missionpaused and self.missionpaused.auftragsnummer==Mission.auftragsnummer then
self.missionpaused=nil
end
-- Remove mission from queue.
table.remove(self.missionqueue, i)
@ -4213,7 +4214,28 @@ function OPSGROUP:onafterMissionStart(From, Event, To, Mission)
Mission:__Started(3)
-- Route group to mission zone.
self:RouteToMission(Mission, 3)
if self.speedMax>3.6 then
self:RouteToMission(Mission, 3)
else
---
-- IMMOBILE Group
---
env.info("FF Immobile GROUP")
-- Add waypoint task. UpdateRoute is called inside.
local Clock=Mission.Tpush and UTILS.SecondsToClock(Mission.Tpush) or 5
local Task=self:AddTask(Mission.DCStask, Clock, Mission.name, Mission.prio, Mission.duration)
Task.ismission=true
-- Set waypoint task.
Mission:SetGroupWaypointTask(self, Task)
-- Execute task. This calls mission execute.
self:__TaskExecute(3, Task)
end
end
@ -4285,7 +4307,9 @@ function OPSGROUP:onafterUnpauseMission(From, Event, To)
local mission=self:GetMissionByID(self.missionpaused.auftragsnummer)
self:MissionStart(mission)
if mission then
self:MissionStart(mission)
end
self.missionpaused=nil
else
@ -4512,7 +4536,7 @@ function OPSGROUP:RouteToMission(mission, delay)
end
-- Get ingress waypoint.
if mission.type==AUFTRAG.Type.PATROLZONE or mission.type==AUFTRAG.Type.BARRAGE then
if mission.type==AUFTRAG.Type.PATROLZONE or mission.type==AUFTRAG.Type.BARRAGE or mission.type==AUFTRAG.Type.AMMOSUPPLY or mission.type.FUELSUPPLY then
local zone=mission.engageTarget:GetObject() --Core.Zone#ZONE
waypointcoord=zone:GetRandomCoordinate(nil , nil, surfacetypes)
elseif mission.type==AUFTRAG.Type.ONGUARD then
@ -4597,7 +4621,7 @@ function OPSGROUP:RouteToMission(mission, delay)
end
-- UID of this waypoint.
local uid=self:GetWaypointCurrent().uid
--local uid=self:GetWaypointCurrent().uid
-- Add waypoint.
local waypoint=nil --#OPSGROUP.Waypoint
@ -4625,16 +4649,16 @@ function OPSGROUP:RouteToMission(mission, delay)
if egresscoord then
--egresscoord:MarkToAll(string.format("Egress Mission %s alt=%d m", mission:GetName(), waypointcoord.y))
-- Add waypoint.
local waypoint=nil --#OPSGROUP.Waypoint
local Ewaypoint=nil --#OPSGROUP.Waypoint
if self:IsFlightgroup() then
waypoint=FLIGHTGROUP.AddWaypoint(self, egresscoord, SpeedToMission, uid, UTILS.MetersToFeet(mission.missionAltitude or self.altitudeCruise), false)
Ewaypoint=FLIGHTGROUP.AddWaypoint(self, egresscoord, SpeedToMission, waypoint.uid, UTILS.MetersToFeet(mission.missionAltitude or self.altitudeCruise), false)
elseif self:IsArmygroup() then
waypoint=ARMYGROUP.AddWaypoint(self, egresscoord, SpeedToMission, uid, mission.optionFormation, false)
Ewaypoint=ARMYGROUP.AddWaypoint(self, egresscoord, SpeedToMission, waypoint.uid, mission.optionFormation, false)
elseif self:IsNavygroup() then
waypoint=NAVYGROUP.AddWaypoint(self, egresscoord, SpeedToMission, uid, UTILS.MetersToFeet(mission.missionAltitude or self.altitudeCruise), false)
Ewaypoint=NAVYGROUP.AddWaypoint(self, egresscoord, SpeedToMission, waypoint.uid, UTILS.MetersToFeet(mission.missionAltitude or self.altitudeCruise), false)
end
waypoint.missionUID=mission.auftragsnummer
mission:SetGroupEgressWaypointUID(self, waypoint.uid)
Ewaypoint.missionUID=mission.auftragsnummer
mission:SetGroupEgressWaypointUID(self, Ewaypoint.uid)
end
---
@ -7115,7 +7139,7 @@ function OPSGROUP:onafterPickup(From, Event, To)
else
-- Aircraft is already parking at the pickup airbase.
ready4loading=self.currbase and self.currbase:GetName()==Zone:GetName() and self:IsParking()
ready4loading=self.currbase and airbasePickup and self.currbase:GetName()==airbasePickup:GetName() and self:IsParking()
-- If a helo is landed in the zone, we also are ready for loading.
if ready4loading==false and self.isHelo and self:IsLandedAt() and inzone then
@ -7503,7 +7527,7 @@ function OPSGROUP:onafterTransport(From, Event, To)
local Zone=self.cargoTZC.DeployZone
-- Check if already in deploy zone.
local inzone=self:IsInZone(Zone) --Zone:IsCoordinateInZone(self:GetCoordinate())
local inzone=self:IsInZone(Zone)
-- Deploy airbase (if any).
local airbaseDeploy=self.cargoTZC.DeployAirbase --Wrapper.Airbase#AIRBASE
@ -7514,7 +7538,7 @@ function OPSGROUP:onafterTransport(From, Event, To)
ready2deploy=inzone
else
-- Aircraft is already parking at the pickup airbase.
ready2deploy=self.currbase and self.currbase:GetName()==Zone:GetName() and self:IsParking()
ready2deploy=self.currbase and airbaseDeploy and self.currbase:GetName()==airbaseDeploy:GetName() and self:IsParking()
-- If a helo is landed in the zone, we also are ready for loading.
if ready2deploy==false and (self.isHelo or self.isVTOL) and self:IsLandedAt() and inzone then
@ -7538,7 +7562,7 @@ function OPSGROUP:onafterTransport(From, Event, To)
if self:IsArmygroup() or self:IsFlightgroup() then
surfacetypes={land.SurfaceType.LAND}
elseif self:IsNavygroup() then
surfacetypes={land.SurfaceType.WATER}
surfacetypes={land.SurfaceType.WATER, land.SurfaceType.SHALLOW_WATER}
end
-- Coord where the carrier goes to unload.
@ -9235,8 +9259,10 @@ function OPSGROUP._PassingWaypoint(opsgroup, uid)
-- Temporary Waypoint
---
if opsgroup:IsNavygroup() or opsgroup:IsArmygroup() then
if (opsgroup:IsNavygroup() or opsgroup:IsArmygroup()) and opsgroup.currentwp==#opsgroup.waypoints then
--TODO: not sure if this works with FLIGHTGROUPS
-- Removing this for now.
opsgroup:Cruise()
end
@ -9279,7 +9305,7 @@ function OPSGROUP._PassingWaypoint(opsgroup, uid)
if opsgroup.cargoTZC.PickupAirbase then
-- Pickup airbase specified. Land there.
env.info(opsgroup.lid.."FF Land at Pickup Airbase")
--env.info(opsgroup.lid.."FF Land at Pickup Airbase")
opsgroup:LandAtAirbase(opsgroup.cargoTZC.PickupAirbase)
else
-- Land somewhere in the pickup zone. Only helos can do that.
@ -9310,7 +9336,7 @@ function OPSGROUP._PassingWaypoint(opsgroup, uid)
if opsgroup.cargoTZC.DeployAirbase then
-- Pickup airbase specified. Land there.
env.info(opsgroup.lid.."FF Land at Deploy Airbase")
--env.info(opsgroup.lid.."FF Land at Deploy Airbase")
opsgroup:LandAtAirbase(opsgroup.cargoTZC.DeployAirbase)
else
-- Land somewhere in the pickup zone. Only helos can do that.
@ -9319,7 +9345,7 @@ function OPSGROUP._PassingWaypoint(opsgroup, uid)
end
else
coordinate=opsgroup:GetCoordinate()
local coordinate=opsgroup:GetCoordinate()
opsgroup:LandAt(coordinate, 60*60)
end

View File

@ -243,7 +243,7 @@ function OPSTRANSPORT:New(CargoGroups, PickupZone, DeployZone)
self.NcarrierDead=0
-- Set default TZC.
self.tzcDefault=self:AddTransportZoneCombo(PickupZone, DeployZone, CargoGroups)
self.tzcDefault=self:AddTransportZoneCombo(CargoGroups, PickupZone, DeployZone)
-- FMS start state is PLANNED.
self:SetStartState(OPSTRANSPORT.Status.PLANNED)
@ -465,11 +465,11 @@ end
--- Add pickup and deploy zone combination.
-- @param #OPSTRANSPORT self
-- @param Core.Set#SET_GROUP CargoGroups Groups to be transported as cargo. Can also be a single @{Wrapper.Group#GROUP} or @{Ops.OpsGroup#OPSGROUP} object.
-- @param Core.Zone#ZONE PickupZone Zone where the troops are picked up.
-- @param Core.Zone#ZONE DeployZone Zone where the troops are picked up.
-- @param Core.Set#SET_GROUP CargoGroups Groups to be transported as cargo. Can also be a single @{Wrapper.Group#GROUP} or @{Ops.OpsGroup#OPSGROUP} object.
-- @return #OPSTRANSPORT.TransportZoneCombo Transport zone table.
function OPSTRANSPORT:AddTransportZoneCombo(PickupZone, DeployZone, CargoGroups)
function OPSTRANSPORT:AddTransportZoneCombo(CargoGroups, PickupZone, DeployZone)
-- Increase counter.
self.tzcCounter=self.tzcCounter+1
@ -1183,14 +1183,13 @@ function OPSTRANSPORT:AddConditionStart(ConditionFunction, ...)
return self
end
--- Add path used for transportation from the pickup to the deploy zone for **ground** and **naval** carriers.
--- Add path used for transportation from the pickup to the deploy zone.
-- If multiple paths are defined, a random one is chosen. The path is retrieved from the waypoints of a given group.
-- **NOTE** that the category group defines for which carriers this path is valid.
-- For example, if you specify a GROUND group to provide the waypoints, only assigned GROUND carriers will use the
-- path.
-- @param #OPSTRANSPORT self
-- @param Wrapper.Group#GROUP PathGroup A (late activated) GROUP defining a transport path by their waypoints.
-- @param #boolean Reversed If `true`, add waypoints of group in reversed order.
-- @param #number Radius Randomization radius in meters. Default 0 m.
-- @param #OPSTRANSPORT.TransportZoneCombo TransportZoneCombo Transport Zone combo.
-- @return #OPSTRANSPORT self
@ -1204,10 +1203,8 @@ function OPSTRANSPORT:AddPathTransport(PathGroup, Reversed, Radius, TransportZon
end
local path={} --#OPSTRANSPORT.Path
path.coords={}
path.category=PathGroup:GetCategory()
path.radius=Radius or 0
path.reverse=Reversed
path.waypoints=PathGroup:GetTaskRoute()
-- TODO: Check that only flyover waypoints are given for aircraft.
@ -1252,70 +1249,6 @@ function OPSTRANSPORT:_GetPathTransport(Category, TransportZoneCombo)
return nil
end
--- Add path used to go to the pickup zone. If multiple paths are defined, a random one is chosen.
-- @param #OPSTRANSPORT self
-- @param Wrapper.Group#GROUP PathGroup A (late activated) GROUP defining a transport path by their waypoints.
-- @param #boolean Reversed If `true`, add waypoints of group in reversed order.
-- @param #number Radius Randomization radius in meters. Default 0 m.
-- @param #OPSTRANSPORT.TransportZoneCombo TransportZoneCombo Transport Zone combo.
-- @return #OPSTRANSPORT self
function OPSTRANSPORT:AddPathPickup(PathGroup, Reversed, Radius, TransportZoneCombo)
-- Use default TZC if no transport zone combo is provided.
TransportZoneCombo=TransportZoneCombo or self.tzcDefault
if type(PathGroup)=="string" then
PathGroup=GROUP:FindByName(PathGroup)
end
local path={} --#OPSTRANSPORT.Path
path.category=PathGroup:GetCategory()
path.radius=Radius or 0
path.reverse=Reversed
path.waypoints=PathGroup:GetTaskRoute()
-- Add path.
table.insert(TransportZoneCombo.PickupPaths, path)
return self
end
--- Get a path for pickup.
-- @param #OPSTRANSPORT self
-- @param #number Category Group category.
-- @param #OPSTRANSPORT.TransportZoneCombo TransportZoneCombo Transport Zone combo.
-- @return #table The path of COORDINATEs.
function OPSTRANSPORT:_GetPathPickup(Category, TransportZoneCombo)
-- Use default TZC if no transport zone combo is provided.
TransportZoneCombo=TransportZoneCombo or self.tzcDefault
local Paths=TransportZoneCombo.PickupPaths
if Paths and #Paths>0 then
local paths={}
for _,_path in pairs(Paths) do
local path=_path --#OPSTRANSPORT.Path
if path.category==Category then
table.insert(paths, path)
end
end
if #paths>0 then
local path=paths[math.random(#paths)] --#OPSTRANSPORT.Path
return path
end
end
return nil
end
--- Add a carrier assigned for this transport.
-- @param #OPSTRANSPORT self
-- @param Ops.OpsGroup#OPSGROUP CarrierGroup Carrier OPSGROUP.

View File

@ -1441,7 +1441,7 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType, Alti
y = Vec2.y,
zoneRadius = Radius,
radius = Radius,
expendQty = 100, -- dummy value
expendQty = 1, -- dummy value
expendQtyEnabled = false,
alt_type = ASL and 0 or 1
}
@ -1460,6 +1460,7 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType, Alti
DCSTask.params.weaponType=WeaponType
end
--env.info("FF fireatpoint")
--BASE:I(DCSTask)
return DCSTask