From e41ba1be45d07b6fe3b05a8a8babbc761144c2a1 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 2 Mar 2022 09:34:18 +0100 Subject: [PATCH] Troop Transport - Auftrag TROOPTRANSPORT: troops will wait in a zone and not at the exact position where the carrier lands. --- Moose Development/Moose/Ops/Auftrag.lua | 14 +++++++++----- Moose Development/Moose/Ops/OpsGroup.lua | 13 +++++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 87b24efaf..08d316299 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -94,6 +94,7 @@ -- @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 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 #number NcarriersMin Min number of required carrier assets. @@ -557,7 +558,7 @@ AUFTRAG.Category={ --- AUFTRAG class version. -- @field #string version -AUFTRAG.version="0.8.1" +AUFTRAG.version="0.8.2" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -1492,8 +1493,9 @@ end -- @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 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 -function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupCoordinate) +function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupCoordinate, PickupRadius) local mission=AUFTRAG:New(AUFTRAG.Type.TROOPTRANSPORT) @@ -1509,14 +1511,16 @@ function AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet, DropoffCoordinate, PickupC mission:_TargetFromObject(mission.transportGroupSet) - mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate() + mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate() mission.transportDropoff=DropoffCoordinate + + mission.transportPickupRadius=PickupRadius or 500 mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.TROOPTRANSPORT) -- Debug. - mission.transportPickup:MarkToAll("Pickup") - mission.transportDropoff:MarkToAll("Drop off") + --mission.transportPickup:MarkToAll("Pickup Transport") + --mission.transportDropoff:MarkToAll("Drop off") -- TODO: what's the best ROE here? mission.optionROE=ENUMS.ROE.ReturnFire diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 6f582473a..7ab4996bf 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -466,7 +466,7 @@ OPSGROUP.CargoStatus={ --- OpsGroup version. -- @field #string version -OPSGROUP.version="0.7.5" +OPSGROUP.version="0.7.6" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -4580,13 +4580,22 @@ function OPSGROUP:RouteToMission(mission, delay) -- Refresh DCS task with the known controllable. 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. for _,_group in pairs(mission.transportGroupSet.Set) do local group=_group --Wrapper.Group#GROUP 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) end