mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2026-08-19 13:46:01 +00:00
Version 1.51
Added sort by distance to nearest crates Added Steggles addition for AI pickup randomisation
This commit is contained in:
@@ -13,11 +13,8 @@
|
|||||||
Contributors:
|
Contributors:
|
||||||
- Steggles - https://github.com/Bob7heBuilder
|
- Steggles - https://github.com/Bob7heBuilder
|
||||||
|
|
||||||
Version: 1.50 - 22/12/2015 - Internal Rewrite of AA System Creation
|
Version: 1.51 - 06/01/2015 - Steggles Contribution - Random AI group pickups from a zone
|
||||||
- Added HAWK PCP to HAWK System to fix non firing
|
- Sorted nearby crates list by distance
|
||||||
- Added more launchers to HAWK to balance difficulty of building
|
|
||||||
- Added ctld.spawnGroupAtPoint
|
|
||||||
- Added 326 KHz to ignore list
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
ctld = {} -- DONT REMOVE!
|
ctld = {} -- DONT REMOVE!
|
||||||
@@ -72,7 +69,7 @@ ctld.deployedBeaconBattery = 30 -- the battery on deployed beacons will last for
|
|||||||
|
|
||||||
ctld.enabledRadioBeaconDrop = true -- if its set to false then beacons cannot be dropped by units
|
ctld.enabledRadioBeaconDrop = true -- if its set to false then beacons cannot be dropped by units
|
||||||
|
|
||||||
ctld.allowRandomAiTeamPickups = true -- Allows the AI to randomize the loading of infantry teams (specified below) at pickup zones
|
ctld.allowRandomAiTeamPickups = false -- Allows the AI to randomize the loading of infantry teams (specified below) at pickup zones
|
||||||
|
|
||||||
-- Simulated Sling load configuration
|
-- Simulated Sling load configuration
|
||||||
|
|
||||||
@@ -422,10 +419,10 @@ ctld.spawnableCrates = {
|
|||||||
-- End of KUB
|
-- End of KUB
|
||||||
|
|
||||||
-- BUK System
|
-- BUK System
|
||||||
-- { weight = 575, desc = "BUK Launcher", unit = "SA-11 Buk LN 9A310M1"},
|
-- { weight = 575, desc = "BUK Launcher", unit = "SA-11 Buk LN 9A310M1"},
|
||||||
-- { weight = 580, desc = "BUK Search Radar", unit = "SA-11 Buk SR 9S18M1"},
|
-- { weight = 580, desc = "BUK Search Radar", unit = "SA-11 Buk SR 9S18M1"},
|
||||||
-- { weight = 585, desc = "BUK CC Radar", unit = "SA-11 Buk CC 9S470M1"},
|
-- { weight = 585, desc = "BUK CC Radar", unit = "SA-11 Buk CC 9S470M1"},
|
||||||
-- { weight = 590, desc = "BUK Repair", unit = "BUK Repair"},
|
-- { weight = 590, desc = "BUK Repair", unit = "BUK Repair"},
|
||||||
-- END of BUK
|
-- END of BUK
|
||||||
|
|
||||||
{ weight = 595, desc = "Early Warning Radar", unit = "1L13 EWR", side = 1 }, -- cant be used by BLUE coalition
|
{ weight = 595, desc = "Early Warning Radar", unit = "1L13 EWR", side = 1 }, -- cant be used by BLUE coalition
|
||||||
@@ -2263,6 +2260,10 @@ function ctld.listNearbyCrates(_args)
|
|||||||
|
|
||||||
local _crates = ctld.getCratesAndDistance(_heli)
|
local _crates = ctld.getCratesAndDistance(_heli)
|
||||||
|
|
||||||
|
--sort
|
||||||
|
local _sort = function( a,b ) return a.dist < b.dist end
|
||||||
|
table.sort(_crates,_sort)
|
||||||
|
|
||||||
for _, _crate in pairs(_crates) do
|
for _, _crate in pairs(_crates) do
|
||||||
|
|
||||||
if _crate.dist < 1000 and _crate.details.unit ~= "FOB" then
|
if _crate.dist < 1000 and _crate.details.unit ~= "FOB" then
|
||||||
@@ -2536,7 +2537,7 @@ function ctld.unpackCrates(_arguments)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return -- stop processing
|
return -- stop processing
|
||||||
-- is multi crate?
|
-- is multi crate?
|
||||||
elseif _crate.details.cratesRequired ~= nil and _crate.details.cratesRequired > 1 then
|
elseif _crate.details.cratesRequired ~= nil and _crate.details.cratesRequired > 1 then
|
||||||
-- multicrate
|
-- multicrate
|
||||||
|
|
||||||
@@ -2569,7 +2570,7 @@ function ctld.unpackCrates(_arguments)
|
|||||||
if _crate.details.unit == "1L13 EWR" then
|
if _crate.details.unit == "1L13 EWR" then
|
||||||
ctld.addEWRTask(_spawnedGroups)
|
ctld.addEWRTask(_spawnedGroups)
|
||||||
|
|
||||||
-- env.info("Added EWR")
|
-- env.info("Added EWR")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -4052,19 +4053,20 @@ function ctld.checkAIStatus()
|
|||||||
-- env.error("Checking.. ".._unit:getName())
|
-- env.error("Checking.. ".._unit:getName())
|
||||||
if _zone.inZone == true and not ctld.troopsOnboard(_unit, true) then
|
if _zone.inZone == true and not ctld.troopsOnboard(_unit, true) then
|
||||||
-- env.error("in zone, loading.. ".._unit:getName())
|
-- env.error("in zone, loading.. ".._unit:getName())
|
||||||
|
|
||||||
if ctld.allowRandomAiTeamPickups == true then
|
if ctld.allowRandomAiTeamPickups == true then
|
||||||
-- Random troop pickup implementation
|
-- Random troop pickup implementation
|
||||||
if _unit:getCoalition() == 1 then
|
local _team = nil
|
||||||
_team = math.floor((math.random(#ctld.redTeams * 100) / 100) + 1)
|
if _unit:getCoalition() == 1 then
|
||||||
ctld.loadTroopsFromZone({ _unitName, true,ctld.loadableGroups[ctld.redTeams[_team]],true })
|
_team = math.floor((math.random(#ctld.redTeams * 100) / 100) + 1)
|
||||||
else
|
ctld.loadTroopsFromZone({ _unitName, true,ctld.loadableGroups[ctld.redTeams[_team]],true })
|
||||||
_team = math.floor((math.random(#ctld.blueTeams * 100) / 100) + 1)
|
else
|
||||||
ctld.loadTroopsFromZone({ _unitName, true,ctld.loadableGroups[ctld.blueTeams[_team]],true })
|
_team = math.floor((math.random(#ctld.blueTeams * 100) / 100) + 1)
|
||||||
end
|
ctld.loadTroopsFromZone({ _unitName, true,ctld.loadableGroups[ctld.blueTeams[_team]],true })
|
||||||
else
|
end
|
||||||
ctld.loadTroopsFromZone({ _unitName, true,"",true })
|
else
|
||||||
end
|
ctld.loadTroopsFromZone({ _unitName, true,"",true })
|
||||||
|
end
|
||||||
|
|
||||||
elseif ctld.inDropoffZone(_unit) and ctld.troopsOnboard(_unit, true) then
|
elseif ctld.inDropoffZone(_unit) and ctld.troopsOnboard(_unit, true) then
|
||||||
-- env.error("in dropoff zone, unloading.. ".._unit:getName())
|
-- env.error("in dropoff zone, unloading.. ".._unit:getName())
|
||||||
@@ -5258,18 +5260,18 @@ end
|
|||||||
|
|
||||||
-- Seperate troop teams into red and blue for random AI pickups
|
-- Seperate troop teams into red and blue for random AI pickups
|
||||||
if ctld.allowRandomAiTeamPickups == true then
|
if ctld.allowRandomAiTeamPickups == true then
|
||||||
ctld.redTeams = {}
|
ctld.redTeams = {}
|
||||||
ctld.blueTeams = {}
|
ctld.blueTeams = {}
|
||||||
for _,_loadGroup in pairs(ctld.loadableGroups) do
|
for _,_loadGroup in pairs(ctld.loadableGroups) do
|
||||||
if not _loadGroup.side then
|
if not _loadGroup.side then
|
||||||
table.insert(ctld.redTeams, _)
|
table.insert(ctld.redTeams, _)
|
||||||
table.insert(ctld.blueTeams, _)
|
table.insert(ctld.blueTeams, _)
|
||||||
elseif _loadGroup.side == 1 then
|
elseif _loadGroup.side == 1 then
|
||||||
table.insert(ctld.redTeams, _)
|
table.insert(ctld.redTeams, _)
|
||||||
elseif _loadGroup.side == 2 then
|
elseif _loadGroup.side == 2 then
|
||||||
table.insert(ctld.blueTeams, _)
|
table.insert(ctld.blueTeams, _)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user