mirror of
https://github.com/iTracerFacer/DCS_MissionDev.git
synced 2025-12-03 04:14:46 +00:00
added config and airborne builder; switched MQ-9 and WingLoong to spawn in the air.
This commit is contained in:
parent
197b49c343
commit
6bf1de3966
Binary file not shown.
@ -188,6 +188,13 @@ CTLD.Config = {
|
|||||||
-- Safety offsets to avoid spawning units too close to player aircraft
|
-- 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)
|
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
|
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)
|
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
|
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
|
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
|
-- Indirect fire: mortar detachment
|
||||||
AR = {
|
AR = {
|
||||||
label = 'Mortar Team',
|
label = 'Mortar Team',
|
||||||
size = 2,
|
size = 4,
|
||||||
unitsBlue = { 'Mortar M252' },
|
unitsBlue = { 'Mortar M252' },
|
||||||
unitsRed = { '2B11 mortar' },
|
unitsRed = { '2B11 mortar' },
|
||||||
units = { 'Infantry AK' },
|
units = { 'Infantry AK' },
|
||||||
|
|||||||
@ -17,6 +17,66 @@ local function singleUnit(unitType)
|
|||||||
end
|
end
|
||||||
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)
|
local function multiUnits(units)
|
||||||
-- units: array of { type, dx, dz }
|
-- units: array of { type, dx, dz }
|
||||||
return function(point, headingDeg)
|
return function(point, headingDeg)
|
||||||
@ -171,8 +231,8 @@ cat['RED_BUK_REPAIR'] = { menuCategory='SAM long range', menu='BUK Repai
|
|||||||
end }
|
end }
|
||||||
|
|
||||||
-- Drones (JTAC)
|
-- 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['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=singleUnit('WingLoong-I') }
|
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
|
-- 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)
|
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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user