diff --git a/DCS_Kola/Operation_Polar_Shield/F99th-Operation_Polar_Shield_1.1.7.miz b/DCS_Kola/Operation_Polar_Shield/F99th-Operation_Polar_Shield_1.1.7.miz index 706cfca..8a696d5 100644 Binary files a/DCS_Kola/Operation_Polar_Shield/F99th-Operation_Polar_Shield_1.1.7.miz and b/DCS_Kola/Operation_Polar_Shield/F99th-Operation_Polar_Shield_1.1.7.miz differ diff --git a/Moose_CTLD_Pure/Moose_CTLD.lua b/Moose_CTLD_Pure/Moose_CTLD.lua index 8a09ab8..c4629a1 100644 --- a/Moose_CTLD_Pure/Moose_CTLD.lua +++ b/Moose_CTLD_Pure/Moose_CTLD.lua @@ -188,6 +188,13 @@ CTLD.Config = { -- Safety offsets to avoid spawning units too close to player aircraft BuildSpawnOffset = 40, -- meters: shift build point forward from the aircraft to avoid rotor/ground collisions (0 = spawn centered on aircraft) TroopSpawnOffset = 40, -- meters: shift troop unload point forward from the aircraft + + -- Air-spawn settings for CTLD-built drones (AIRPLANE category entries in the catalog like MQ-9 / WingLoong) + DroneAirSpawn = { + Enabled = true, -- when true, AIRPLANE catalog items that opt-in can spawn in the air at a set altitude + AltitudeMeters = 5000, -- default spawn altitude ASL (meters) + SpeedMps = 120 -- default initial speed in m/s + }, DropCrateForwardOffset = 20, -- meters: drop loaded crates this far in front of the aircraft (instead of directly under) RestrictFOBToZones = false, -- if true, recipes marked isFOB only build inside configured FOBZones AutoBuildFOBInZones = false, -- if true, CTLD auto-builds FOB recipes when required crates are inside a FOB zone @@ -325,7 +332,7 @@ CTLD.Config = { -- Indirect fire: mortar detachment AR = { label = 'Mortar Team', - size = 2, + size = 4, unitsBlue = { 'Mortar M252' }, unitsRed = { '2B11 mortar' }, units = { 'Infantry AK' }, diff --git a/Moose_CTLD_Pure/catalogs/Moose_CTLD_Catalog.lua b/Moose_CTLD_Pure/catalogs/Moose_CTLD_Catalog.lua index 8a79ee6..e948566 100644 --- a/Moose_CTLD_Pure/catalogs/Moose_CTLD_Catalog.lua +++ b/Moose_CTLD_Pure/catalogs/Moose_CTLD_Catalog.lua @@ -17,6 +17,66 @@ local function singleUnit(unitType) end end +-- Build a single AIR unit that spawns in the air at a configured altitude/speed. +-- Falls back gracefully to singleUnit behavior if config is unavailable/disabled. +local function singleAirUnit(unitType) + return function(point, headingDeg) + local cfg = (rawget(_G, 'CTLD') and CTLD.Config and CTLD.Config.DroneAirSpawn) or nil + if not cfg or cfg.Enabled == false then + return singleUnit(unitType)(point, headingDeg) + end + + local name = string.format('%s-%d', unitType, math.random(100000,999999)) + local hdgDeg = headingDeg or 0 + local hdg = math.rad(hdgDeg) + local alt = tonumber(cfg.AltitudeMeters) or 1200 + local spd = tonumber(cfg.SpeedMps) or 120 + + -- Create a tiny 2-point route to ensure forward flight at the chosen altitude. + local function fwdOffset(px, pz, meters, headingRadians) + return px + math.sin(headingRadians) * meters, pz + math.cos(headingRadians) * meters + end + local p1x, p1z = point.x, point.z + local p2x, p2z = fwdOffset(point.x, point.z, 1000, hdg) -- 1 km ahead + + local group = { + visible=false, + lateActivation=false, + tasks={}, + task='CAS', + route={ + points={ + { + alt = alt, alt_type = 'BARO', + type = 'Turning Point', action = 'Turning Point', + x = p1x, y = p1z, + speed = spd, ETA = 0, ETA_locked = false, + task = {} + }, + { + alt = alt, alt_type = 'BARO', + type = 'Turning Point', action = 'Turning Point', + x = p2x, y = p2z, + speed = spd, ETA = 0, ETA_locked = false, + task = {} + } + } + }, + units={ + { + type=unitType, name=name, + x=p1x, y=p1z, + heading=hdg, + speed = spd, + alt = alt, alt_type = 'BARO' + } + }, + name = 'CTLD_'..name + } + return group + end +end + local function multiUnits(units) -- units: array of { type, dx, dz } return function(point, headingDeg) @@ -171,8 +231,8 @@ cat['RED_BUK_REPAIR'] = { menuCategory='SAM long range', menu='BUK Repai end } -- Drones (JTAC) -cat['BLUE_MQ9'] = { menuCategory='Drones', menu='MQ-9 Reaper - JTAC', description='MQ-9 JTAC', dcsCargoType='container_cargo', required=1, initialStock=3, side=BLUE, category=Group.Category.AIRPLANE, build=singleUnit('MQ-9 Reaper') } -cat['RED_WINGLOONG'] = { menuCategory='Drones', menu='WingLoong-I - JTAC', description='WingLoong-I JTAC', dcsCargoType='container_cargo', required=1, initialStock=3, side=RED, category=Group.Category.AIRPLANE, build=singleUnit('WingLoong-I') } +cat['BLUE_MQ9'] = { menuCategory='Drones', menu='MQ-9 Reaper - JTAC', description='MQ-9 JTAC', dcsCargoType='container_cargo', required=1, initialStock=3, side=BLUE, category=Group.Category.AIRPLANE, build=singleAirUnit('MQ-9 Reaper') } +cat['RED_WINGLOONG'] = { menuCategory='Drones', menu='WingLoong-I - JTAC', description='WingLoong-I JTAC', dcsCargoType='container_cargo', required=1, initialStock=3, side=RED, category=Group.Category.AIRPLANE, build=singleAirUnit('WingLoong-I') } -- FOB crates (Support) — three small crates build a FOB site cat['FOB_SMALL'] = { menuCategory='Support', menu='FOB Crate - Small', description='FOB small crate', dcsCargoType='container_cargo', required=1, initialStock=12, side=nil, category=Group.Category.GROUND, build=function(point, headingDeg)