mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
Small updates:
- indentation - comments - documentation - default values
This commit is contained in:
108
CTLD.lua
108
CTLD.lua
@@ -10,12 +10,14 @@
|
||||
|
||||
See https://github.com/ciribob/DCS-CTLD for a user manual and the latest version
|
||||
|
||||
Contributors:
|
||||
- Steggles - https://github.com/Bob7heBuilder
|
||||
- mvee - https://github.com/mvee
|
||||
- jmontleon - https://github.com/jmontleon
|
||||
- emilianomolina - https://github.com/emilianomolina
|
||||
- davidp57 - https://github.com/veaf
|
||||
Contributors:
|
||||
- Steggles - https://github.com/Bob7heBuilder
|
||||
- mvee - https://github.com/mvee
|
||||
- jmontleon - https://github.com/jmontleon
|
||||
- emilianomolina - https://github.com/emilianomolina
|
||||
- davidp57 - https://github.com/veaf
|
||||
- Queton1-1 - https://github.com/Queton1-1
|
||||
- Proxy404 - https://github.com/Proxy404
|
||||
|
||||
- Allow minimum distance from friendly logistics to be set
|
||||
]]
|
||||
@@ -26,12 +28,11 @@ ctld = {} -- DONT REMOVE!
|
||||
ctld.Id = "CTLD - "
|
||||
|
||||
--- Version.
|
||||
ctld.Version = "20230825.01"
|
||||
ctld.Version = "202310.01"
|
||||
|
||||
-- debug level, specific to this module
|
||||
ctld.Debug = true
|
||||
-- trace level, specific to this module
|
||||
ctld.Trace = true
|
||||
-- To add debugging messages to dcs.log, change the following log levels to `true`; `Debug` is less detailed than `Trace`
|
||||
ctld.Debug = false
|
||||
ctld.Trace = false
|
||||
|
||||
ctld.alreadyInitialized = false -- if true, ctld.initialize() will not run
|
||||
|
||||
@@ -43,7 +44,7 @@ ctld.staticBugWorkaround = false -- DCS had a bug where destroying statics woul
|
||||
ctld.disableAllSmoke = false -- if true, all smoke is diabled at pickup and drop off zones regardless of settings below. Leave false to respect settings below
|
||||
|
||||
ctld.hoverPickup = true -- if set to false you can load crates with the F10 menu instead of hovering... Only if not using real crates!
|
||||
ctld.loadCrateFromMenu = true -- if set to true, you can load crates with the F10 menu OR hovering, in case of using choppers and planes for example.
|
||||
ctld.loadCrateFromMenu = false -- if set to true, you can load crates with the F10 menu OR hovering, in case of using choppers and planes for example.
|
||||
|
||||
ctld.enableCrates = true -- if false, Helis will not be able to spawn or unpack crates so will be normal CTTS
|
||||
ctld.slingLoad = false -- if false, crates can be used WITHOUT slingloading, by hovering above the crate, simulating slingloading but not the weight...
|
||||
@@ -61,7 +62,7 @@ ctld.maximumMoveDistance = 2000 -- max distance for troops to move from drop poi
|
||||
ctld.minimumDeployDistance = 1000 -- minimum distance from a friendly pickup zone where you can deploy a crate
|
||||
|
||||
ctld.numberOfTroops = 10 -- default number of troops to load on a transport heli or C-130
|
||||
-- also works as maximum size of group that'll fit into a helicopter unless overridden
|
||||
-- also works as maximum size of group that'll fit into a helicopter unless overridden
|
||||
ctld.enableFastRopeInsertion = true -- allows you to drop troops by fast rope
|
||||
ctld.fastRopeMaximumHeight = 18.28 -- in meters which is 60 ft max fast rope (not rappell) safe height
|
||||
|
||||
@@ -143,9 +144,9 @@ ctld.JTAC_smokeOn_BLUE = true -- enables marking of target with smoke for BLUE f
|
||||
ctld.JTAC_smokeColour_RED = 4 -- RED side smoke colour -- Green = 0 , Red = 1, White = 2, Orange = 3, Blue = 4
|
||||
ctld.JTAC_smokeColour_BLUE = 1 -- BLUE side smoke colour -- Green = 0 , Red = 1, White = 2, Orange = 3, Blue = 4
|
||||
|
||||
ctld.JTAC_smokeOffset_x = 0.0 -- distance in the X direction from target to smoke (default 0.0)
|
||||
ctld.JTAC_smokeOffset_y = 2.0 -- distance in the Y direction from target to smoke (default 2.0)
|
||||
ctld.JTAC_smokeOffset_z = 0.0 -- distance in the z direction from target to smoke (default 0.0)
|
||||
ctld.JTAC_smokeOffset_x = 0.0 -- distance in the X direction from target to smoke (meters)
|
||||
ctld.JTAC_smokeOffset_y = 2.0 -- distance in the Y direction from target to smoke (meters)
|
||||
ctld.JTAC_smokeOffset_z = 0.0 -- distance in the z direction from target to smoke (meters)
|
||||
|
||||
ctld.JTAC_jtacStatusF10 = true -- enables F10 JTAC Status menu
|
||||
|
||||
@@ -549,7 +550,7 @@ ctld.spawnableCrates = {
|
||||
{ weight = 545, desc = "HAWK Search Radar", unit = "Hawk sr", side = 2 },
|
||||
{ weight = 546, desc = "HAWK Track Radar", unit = "Hawk tr", side = 2 },
|
||||
{ weight = 547, desc = "HAWK PCP", unit = "Hawk pcp" , side = 2 }, -- Remove this if on 1.2
|
||||
{ weight = 548, desc = "HAWK CWAR", unit = "Hawk cwar" , side = 2 }, -- Remove this if on 2.5
|
||||
{ weight = 548, desc = "HAWK CWAR", unit = "Hawk cwar" , side = 2 }, -- Remove this if on 2.5
|
||||
{ weight = 549, desc = "HAWK Repair", unit = "HAWK Repair" , side = 2 },
|
||||
-- End of HAWK
|
||||
|
||||
@@ -1402,7 +1403,7 @@ ctld.AASystemTemplate = {
|
||||
{name = "Hawk tr", desc = "HAWK Track Radar"},
|
||||
{name = "Hawk sr", desc = "HAWK Search Radar"},
|
||||
{name = "Hawk pcp", desc = "HAWK PCP"},
|
||||
{name = "Hawk cwar", desc = "HAWK CWAR"},
|
||||
{name = "Hawk cwar", desc = "HAWK CWAR"},
|
||||
},
|
||||
repair = "HAWK Repair",
|
||||
},
|
||||
@@ -1416,7 +1417,7 @@ ctld.AASystemTemplate = {
|
||||
},
|
||||
repair = "Patriot Repair",
|
||||
},
|
||||
{
|
||||
{
|
||||
name = "BUK AA System",
|
||||
count = 3,
|
||||
parts = {
|
||||
@@ -1571,7 +1572,7 @@ function ctld.spawnCrateStatic(_country, _unitId, _point, _name, _weight,_side)
|
||||
if ctld.slingLoad then
|
||||
_crate = mist.utils.deepCopy(ctld.spawnableCratesModel_sling)
|
||||
_crate["canCargo"] = true
|
||||
else
|
||||
else
|
||||
_crate = mist.utils.deepCopy(ctld.spawnableCratesModel_load)
|
||||
_crate["canCargo"] = false
|
||||
end
|
||||
@@ -5172,54 +5173,55 @@ function ctld.addJTACRadioCommand(_side)
|
||||
|
||||
--make a copy of the JTAC group submenu's path to insert the target's list on as many pages as required. The JTAC's group submenu path only leads to the first page
|
||||
local jtacTargetPagePath = mist.utils.deepCopy(ctld.jtacGroupSubMenuPath[_jtacGroupName])
|
||||
--add a reset targeting option to revert to automatic JTAC unit targeting
|
||||
missionCommands.addCommandForGroup(_groupId, "Reset TGT Selection", jtacTargetPagePath, ctld.setJTACTarget, {jtacGroupName = _jtacGroupName, targetName = nil})
|
||||
--add a reset targeting option to revert to automatic JTAC unit targeting
|
||||
missionCommands.addCommandForGroup(_groupId, "Reset TGT Selection", jtacTargetPagePath, ctld.setJTACTarget, {jtacGroupName = _jtacGroupName, targetName = nil})
|
||||
|
||||
--counter to know when to add the next page submenu to fit all of the targets in the JTAC's group submenu
|
||||
--counter to know when to add the next page submenu to fit all of the targets in the JTAC's group submenu
|
||||
local itemCounter = 0
|
||||
|
||||
--indicator table to know which unitType was already added to the radio submenu
|
||||
local typeNameList = {}
|
||||
for _,target in pairs(ctld.jtacTargetsList[_jtacGroupName]) do
|
||||
local targetName = target.unit:getName()
|
||||
--check if the jtac has a current target before filtering it out if possible
|
||||
if (ctld.jtacCurrentTargets[_jtacGroupName] and targetName ~= ctld.jtacCurrentTargets[_jtacGroupName].name) then
|
||||
local targetType_name = target.unit:getTypeName()
|
||||
--indicator table to know which unitType was already added to the radio submenu
|
||||
local typeNameList = {}
|
||||
for _,target in pairs(ctld.jtacTargetsList[_jtacGroupName]) do
|
||||
local targetName = target.unit:getName()
|
||||
--check if the jtac has a current target before filtering it out if possible
|
||||
if (ctld.jtacCurrentTargets[_jtacGroupName] and targetName ~= ctld.jtacCurrentTargets[_jtacGroupName].name) then
|
||||
local targetType_name = target.unit:getTypeName()
|
||||
|
||||
if targetType_name then
|
||||
if typeNameList[targetType_name] then
|
||||
typeNameList[targetType_name].amount = typeNameList[targetType_name].amount + 1
|
||||
else
|
||||
typeNameList[targetType_name] = {}
|
||||
typeNameList[targetType_name].targetName = targetName --store the first targetName
|
||||
typeNameList[targetType_name].amount = 1
|
||||
end
|
||||
if targetType_name then
|
||||
if typeNameList[targetType_name] then
|
||||
typeNameList[targetType_name].amount = typeNameList[targetType_name].amount + 1
|
||||
else
|
||||
typeNameList[targetType_name] = {}
|
||||
typeNameList[targetType_name].targetName = targetName --store the first targetName
|
||||
typeNameList[targetType_name].amount = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for typeName,info in pairs(typeNameList) do
|
||||
local amount = info.amount
|
||||
local targetName = info.targetName
|
||||
itemCounter = itemCounter + 1
|
||||
for typeName,info in pairs(typeNameList) do
|
||||
local amount = info.amount
|
||||
local targetName = info.targetName
|
||||
itemCounter = itemCounter + 1
|
||||
|
||||
--F2 through F10 makes 9 entries possible per page, with one being the NextMenu submenu. Pages other than the first would have 10 entires but worse case scenario is considered
|
||||
if itemCounter%9 == 0 then
|
||||
jtacTargetPagePath = missionCommands.addSubMenuForGroup(_groupId, NextPageText, jtacTargetPagePath)
|
||||
end
|
||||
|
||||
missionCommands.addCommandForGroup(_groupId, string.format(typeName .. "(" .. amount .. ")"), jtacTargetPagePath, ctld.setJTACTarget, {jtacGroupName = _jtacGroupName, targetName = targetName})
|
||||
--F2 through F10 makes 9 entries possible per page, with one being the NextMenu submenu. Pages other than the first would have 10 entires but worse case scenario is considered
|
||||
if itemCounter%9 == 0 then
|
||||
jtacTargetPagePath = missionCommands.addSubMenuForGroup(_groupId, NextPageText, jtacTargetPagePath)
|
||||
end
|
||||
|
||||
missionCommands.addCommandForGroup(_groupId, string.format(typeName .. "(" .. amount .. ")"), jtacTargetPagePath, ctld.setJTACTarget, {jtacGroupName = _jtacGroupName, targetName = targetName})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if ctld.newJtac[_side] then
|
||||
ctld.newJtac[_side] = false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5444,8 +5446,8 @@ function ctld.JTACAutoLase(_jtacGroupName, _laserCode, _smoke, _lock, _colour, _
|
||||
--remove from smoke list
|
||||
ctld.jtacSmokeMarks[_tempUnitInfo.name] = nil
|
||||
|
||||
-- JTAC Unit: resume his route ------------
|
||||
trigger.action.groupContinueMoving(Group.getByName(_jtacGroupName))
|
||||
-- JTAC Unit: resume his route ------------
|
||||
trigger.action.groupContinueMoving(Group.getByName(_jtacGroupName))
|
||||
|
||||
-- remove from target list
|
||||
ctld.jtacCurrentTargets[_jtacGroupName] = nil
|
||||
@@ -5488,8 +5490,8 @@ function ctld.JTACAutoLase(_jtacGroupName, _laserCode, _smoke, _lock, _colour, _
|
||||
local fullMessage = message .. '. CODE: ' .. _laserCode .. ". POSITION: " .. ctld.getPositionString(_defaultEnemyUnit)
|
||||
ctld.notifyCoalition(fullMessage, 10, _jtacUnit:getCoalition(), _radio, message)
|
||||
|
||||
-- JTAC Unit stop his route -----------------
|
||||
trigger.action.groupStopMoving(Group.getByName(_jtacGroupName)) -- stop JTAC
|
||||
-- JTAC Unit stop his route -----------------
|
||||
trigger.action.groupStopMoving(Group.getByName(_jtacGroupName)) -- stop JTAC
|
||||
|
||||
-- create smoke
|
||||
if _smoke == true then
|
||||
|
||||
Reference in New Issue
Block a user