Troop Transport

- Auftrag TROOPTRANSPORT: troops will wait in a zone and not at the exact position where the carrier lands.
This commit is contained in:
Frank 2022-03-02 09:34:18 +01:00
parent 594febaece
commit e41ba1be45
2 changed files with 20 additions and 7 deletions

View File

@ -94,6 +94,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 Core.Point#COORDINATE transportDropoff Coordinate where to drop off the cargo.
-- @field #number transportPickupRadius Radius in meters for pickup zone. Default 500 m.
-- --
-- @field Ops.OpsTransport#OPSTRANSPORT opstransport OPS transport assignment. -- @field Ops.OpsTransport#OPSTRANSPORT opstransport OPS transport assignment.
-- @field #number NcarriersMin Min number of required carrier assets. -- @field #number NcarriersMin Min number of required carrier assets.
@ -557,7 +558,7 @@ AUFTRAG.Category={
--- AUFTRAG class version. --- AUFTRAG class version.
-- @field #string version -- @field #string version
AUFTRAG.version="0.8.1" AUFTRAG.version="0.8.2"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@ -1492,8 +1493,9 @@ end
-- @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 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.
-- @param #number PickupRadius Radius around the pickup coordinate in meters. Default 500 m.
-- @return #AUFTRAG self -- @return #AUFTRAG self
function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupCoordinate) function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupCoordinate, PickupRadius)
local mission=AUFTRAG:New(AUFTRAG.Type.TROOPTRANSPORT) local mission=AUFTRAG:New(AUFTRAG.Type.TROOPTRANSPORT)
@ -1512,11 +1514,13 @@ function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupC
mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate() mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate()
mission.transportDropoff=DropoffCoordinate mission.transportDropoff=DropoffCoordinate
mission.transportPickupRadius=PickupRadius or 500
mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.TROOPTRANSPORT) mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.TROOPTRANSPORT)
-- Debug. -- Debug.
mission.transportPickup:MarkToAll("Pickup") --mission.transportPickup:MarkToAll("Pickup Transport")
mission.transportDropoff:MarkToAll("Drop off") --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

View File

@ -466,7 +466,7 @@ OPSGROUP.CargoStatus={
--- OpsGroup version. --- OpsGroup version.
-- @field #string version -- @field #string version
OPSGROUP.version="0.7.5" OPSGROUP.version="0.7.6"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@ -4581,12 +4581,21 @@ function OPSGROUP:RouteToMission(mission, delay)
-- Refresh DCS task with the known controllable. -- Refresh DCS task with the known controllable.
mission.DCStask=mission:GetDCSMissionTask(self.group) mission.DCStask=mission:GetDCSMissionTask(self.group)
-- Create a pickup zone around the pickup coordinate. The troops will go to a random point inside the zone.
-- This is necessary so the helos do not try to land at the exact same location where the troops wait.
local pradius=500
local pickupZone=ZONE_RADIUS:New("Pickup Zone", mission.transportPickup:GetVec2(), pradius)
-- Add task to embark for the troops. -- Add task to embark for the troops.
for _,_group in pairs(mission.transportGroupSet.Set) do for _,_group in pairs(mission.transportGroupSet.Set) do
local group=_group --Wrapper.Group#GROUP local group=_group --Wrapper.Group#GROUP
if group and group:IsAlive() then if group and group:IsAlive() then
local DCSTask=group:TaskEmbarkToTransport(mission.transportPickup, 500) -- Get random coordinate inside the zone.
local pcoord=pickupZone:GetRandomCoordinate(20, pradius, {land.SurfaceType.LAND, land.SurfaceType.ROAD})
-- Let the troops embark the transport.
local DCSTask=group:TaskEmbarkToTransport(pcoord, pradius)
group:SetTask(DCSTask, 5) group:SetTask(DCSTask, 5)
end end