From b6d725920a5dfb1c2a55fc3f13128dcd10bdd390 Mon Sep 17 00:00:00 2001 From: smiki Date: Mon, 25 Aug 2025 23:22:00 +0200 Subject: [PATCH 1/3] [ADDED] `ValidateAndRepositionGroundUnits` to OPSGROUP --- Moose Development/Moose/Ops/Legion.lua | 1 + Moose Development/Moose/Ops/OpsGroup.lua | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index b3c00592f..71b1c0f55 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -1823,6 +1823,7 @@ function LEGION:_CreateFlightGroup(asset) --- opsgroup=ARMYGROUP:New(asset.spawngroupname) + opsgroup:SetValidateAndRepositionGroundUnits(self.ValidateAndRepositionGroundUnits) elseif self:IsFleet() then diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 40dccb84e..02ea215f4 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -7847,6 +7847,10 @@ function OPSGROUP:_Spawn(Delay, Template) -- Debug output. self:T2({Template=Template}) + if self:IsArmygroup() and self.ValidateAndRepositionGroundUnits then + UTILS.ValidateAndRepositionGroundUnits(Template.units) + end + -- Spawn new group. self.group=_DATABASE:Spawn(Template) --local countryID=self.group:GetCountry() @@ -13955,6 +13959,15 @@ function OPSGROUP:_GetDetectedTarget() return targetgroup, targetdist end +--- This function uses Disposition and other fallback logic to find better ground positions for ground units. +--- NOTE: This is not a spawn randomizer. +--- It will try to find clear ground locations avoiding trees, water, roads, runways, map scenery, statics and other units in the area and modifies the provided positions table. +--- Maintains the original layout and unit positions as close as possible by searching for the next closest valid position to each unit. +--- Uses UTILS.ValidateAndRepositionGroundUnits. +-- @param #boolean Enabled Enable/disable the feature. +function OPSGROUP:SetValidateAndRepositionGroundUnits(Enabled) + self.ValidateAndRepositionGroundUnits = Enabled +end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- From 2479147fd9948ef8bea9dd6e13edd4449261aa75 Mon Sep 17 00:00:00 2001 From: smiki Date: Tue, 26 Aug 2025 13:15:12 +0200 Subject: [PATCH 2/3] [ADDED] `ValidateAndRepositionGroundUnits` to OPSGROUP --- Moose Development/Moose/Ops/OpsGroup.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 02ea215f4..f23053a18 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -7853,6 +7853,7 @@ function OPSGROUP:_Spawn(Delay, Template) -- Spawn new group. self.group=_DATABASE:Spawn(Template) + self.group:SetValidateAndRepositionGroundUnits(self.ValidateAndRepositionGroundUnits) --local countryID=self.group:GetCountry() --local categoryID=self.group:GetCategory() --local dcsgroup=coalition.addGroup(countryID, categoryID, Template) From e590701c01e331d9d972434a304bc59a5ab5be5b Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 28 Aug 2025 11:13:50 +0200 Subject: [PATCH 3/3] xx --- Moose Development/Moose/Ops/Auftrag.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index b4e6128a1..41bac80e0 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -1321,13 +1321,19 @@ end -- @param #number Altitude Orbit altitude in feet. Default is y component of `Coordinate`. -- @param #number Speed Orbit indicated airspeed in knots at the set altitude ASL. Default 350 KIAS. -- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West). --- @param #number Leg Length of race-track in NM. Default 10 NM. +-- @param #number Leg Length of race-track in NM. Default 10 NM. Set to 0 for a simple circular orbit. -- @param #number RefuelSystem Refueling system (0=boom, 1=probe). This info is *only* for AIRWINGs so they launch the right tanker type. -- @return #AUFTRAG self function AUFTRAG:NewTANKER(Coordinate, Altitude, Speed, Heading, Leg, RefuelSystem) - + + local mission + if Leg == 0 then + mission=AUFTRAG:NewORBIT_CIRCLE(Coordinate,Altitude,Speed) + else + mission=AUFTRAG:NewORBIT_RACETRACK(Coordinate,Altitude,Speed,Heading,Leg) + end -- Create ORBIT first. - local mission=AUFTRAG:NewORBIT_RACETRACK(Coordinate, Altitude, Speed, Heading, Leg) + --local mission=AUFTRAG:NewORBIT_RACETRACK(Coordinate, Altitude, Speed, Heading, Leg) -- Mission type TANKER. mission.type=AUFTRAG.Type.TANKER