From 09fd4d25b70cab5286be51486d84202624d791ef Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 16 Feb 2026 22:25:59 +0100 Subject: [PATCH 1/2] AUFTRAG - Added check for cargo in zone --- Moose Development/Moose/Core/Set.lua | 22 ++++++++++++++++++++++ Moose Development/Moose/Ops/Auftrag.lua | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 0d567c472..b3e4f82cf 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -979,6 +979,28 @@ do -- SET_BASE return ObjectNames end + + --- Checks whether all or optionally any objects is inside a given zone. + -- @param #SET_BASE self + -- @param Core.Zone#ZONE Zone The zone. + -- @param #boolean Any If `true`, at least one object has to be inside the zone. If `false` or `nil`, all objects need to be in the zone. + -- @return #boolean Retruns `true` if objects are in the zone and `false` otherwise. + function SET_BASE:IsInZone(Zone, Any) + + for ObjectName, Object in pairs(self.Set) do + local object=Object --Wrapper.Positionable#POSITIONABLE + local inzone=object:IsInZone(Zone) + if inzone and Any then + -- We want at least one and this one is + return true + elseif not inzone then + -- We want all but at least one is not + return false + end + end + + return true + end --- Flushes the current SET_BASE contents in the log ... (for debugging reasons). -- @param #SET_BASE self diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index f219083b2..0ff182dd2 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -4227,6 +4227,28 @@ function AUFTRAG:IsReadyToGo() if not startme then return false end + + if self.type==AUFTRAG.Type.FREIGHTTRANSPORT then + + local cargoset=self.DCStask.params.cargo --Core.Set#SET_STATIC + + for _,_opsgroup in pairs(self:GetOpsGroups()) do + local opsgroup=_opsgroup --Ops.OpsGroup#OPSGROUP + + local vec2=opsgroup.group:GetFirstUnitAlive():GetVec2() + + local zone=ZONE_RADIUS:New("Bla", vec2, 40, true) + + local inzone=cargoset:IsInZone(zone) + + if not inzone then + printf("FF cargo is not inside zone") + return false + end + + end + + end -- We're good to go! From 8471132fe79b616a596d0a53052eff30809887c3 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 22 Feb 2026 16:31:03 +0100 Subject: [PATCH 2/2] AUFTRAG AUFTRAG FREIGHTTRANSPORT - Added proper success/failure evaluation --- Moose Development/Moose/Ops/Auftrag.lua | 27 ++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 0ff182dd2..05b5cfa72 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -676,7 +676,7 @@ AUFTRAG.Category={ --- AUFTRAG class version. -- @field #string version -AUFTRAG.version="1.3.0" +AUFTRAG.version="1.4.0" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -2177,6 +2177,11 @@ end --- **[AIR]** Create a FREIGHT TRANSPORT mission. -- This mission type can be used to transport cargo items internally via suitable transport aircraft (planes and helicopters), e.g. C-130 or CH-47. -- It supports transporting one or multiple cargos (weight limits are not checked). +-- +-- All cargo must be within a 40 meter radius around the transport aircraft for the mission to start. +-- The mission is successful if any cargo item is delivered to the destination. +-- +-- This mission type uses the underlying DCS tasks: "Cargo Transportation (internal)", "Cargo Unload" -- @param #AUFTRAG self -- @param Wrapper.Static#STATIC StaticCargo Static cargo object. Can also be passed as a `SET_STATIC` object. -- @param Wrapper.Airbase#AIRBASE Destination Destination airbase, where the cargo is unloaded. @@ -4237,12 +4242,12 @@ function AUFTRAG:IsReadyToGo() local vec2=opsgroup.group:GetFirstUnitAlive():GetVec2() - local zone=ZONE_RADIUS:New("Bla", vec2, 40, true) + local zone=ZONE_RADIUS:New("Freighttransport", vec2, 40, true) local inzone=cargoset:IsInZone(zone) if not inzone then - printf("FF cargo is not inside zone") + self:T(self.lid.."FREIGHTTRANSPORT: cargo is not inside zone ==> mission not ready to start yet!") return false end @@ -4593,6 +4598,22 @@ function AUFTRAG:Evaluate() else failed=true end + + elseif self.type==AUFTRAG.Type.FREIGHTTRANSPORT then + + local cargoset=self.DCStask.params.cargo --Core.Set#SET_STATIC + + -- Get the destination airbase zone + local dest=self.DCStask.params.destination --Wrapper.Airbase#AIRBASE + local zone=dest:GetZone() + + -- Check if ANY cargo is inside the zone (might want to make it optional that all cargo needs to be) + local inzone=cargoset:IsInZone(zone, true) + + if not inzone then + self:I(self.lid.."FF Freight/cargo not delivered to airbase zone") + failed=true + end elseif self.type==AUFTRAG.Type.RESCUEHELO then