mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2026-08-12 16:57:42 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c9270a0fd2 | |||
| def40f440c | |||
| 417c57f97c | |||
| dec5bf02b4 | |||
| 68693300dc | |||
| f7f603c486 | |||
| 290950a16b |
@@ -40,7 +40,7 @@ end
|
|||||||
ctld.Id = "CTLD - "
|
ctld.Id = "CTLD - "
|
||||||
|
|
||||||
--- Version.
|
--- Version.
|
||||||
ctld.Version = "1.5.0"
|
ctld.Version = "1.5.2"
|
||||||
|
|
||||||
-- To add debugging messages to dcs.log, change the following log levels to `true`; `Debug` is less detailed than `Trace`
|
-- To add debugging messages to dcs.log, change the following log levels to `true`; `Debug` is less detailed than `Trace`
|
||||||
ctld.Debug = false
|
ctld.Debug = false
|
||||||
@@ -491,8 +491,8 @@ ctld.JTAC_LIMIT_RED = 10 -- max number of JTAC Crates for the RED Si
|
|||||||
ctld.JTAC_LIMIT_BLUE = 10 -- max number of JTAC Crates for the BLUE Side
|
ctld.JTAC_LIMIT_BLUE = 10 -- max number of JTAC Crates for the BLUE Side
|
||||||
ctld.JTAC_dropEnabled = true -- allow JTAC Crate spawn from F10 menu
|
ctld.JTAC_dropEnabled = true -- allow JTAC Crate spawn from F10 menu
|
||||||
ctld.JTAC_maxDistance = 10000 -- How far a JTAC can "see" in meters (with Line of Sight)
|
ctld.JTAC_maxDistance = 10000 -- How far a JTAC can "see" in meters (with Line of Sight)
|
||||||
ctld.JTAC_smokeOn_RED = true -- enables marking of target with smoke for RED forces
|
ctld.JTAC_smokeOn_RED = false -- enables marking of target with smoke for RED forces
|
||||||
ctld.JTAC_smokeOn_BLUE = true -- enables marking of target with smoke for BLUE forces
|
ctld.JTAC_smokeOn_BLUE = false -- enables marking of target with smoke for BLUE forces
|
||||||
ctld.JTAC_smokeColour_RED = 4 -- RED side smoke colour -- Green = 0 , Red = 1, White = 2, Orange = 3, Blue = 4
|
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_smokeColour_BLUE = 1 -- BLUE side smoke colour -- Green = 0 , Red = 1, White = 2, Orange = 3, Blue = 4
|
||||||
ctld.JTAC_smokeMarginOfError = 50 -- error that the JTAC is allowed to make when popping a smoke (in meters)
|
ctld.JTAC_smokeMarginOfError = 50 -- error that the JTAC is allowed to make when popping a smoke (in meters)
|
||||||
@@ -1998,11 +1998,13 @@ function ctld.getNearbyUnits(_point, _radius, _coalition)
|
|||||||
local unitsByDistance = {}
|
local unitsByDistance = {}
|
||||||
local cpt = 1
|
local cpt = 1
|
||||||
local _units = {}
|
local _units = {}
|
||||||
local _unitList = mist.DBs.unitsByName
|
for _unitName, _ in pairs(mist.DBs.unitsByName) do
|
||||||
for _unitName, _unit in pairs(mist.DBs.unitsByName) do
|
|
||||||
local u = Unit.getByName(_unitName)
|
local u = Unit.getByName(_unitName)
|
||||||
if u and u:isExist() and (_coalition == 4 or u:getCoalition() == _coalition) then
|
local e = (u and u:isExist()) or false
|
||||||
--local _dist = ctld.getDistance(u:getPoint(), _point)
|
-- pcall is needed because getCoalition() fails if the unit is an object without coalition (like a smoke effect)
|
||||||
|
local c = nil
|
||||||
|
pcall(function() c = (u and e and u:getCoalition()) or nil end)
|
||||||
|
if u and e and (_coalition == 4 or c == _coalition) then
|
||||||
local _dist = mist.utils.get2DDist(u:getPoint(), _point)
|
local _dist = mist.utils.get2DDist(u:getPoint(), _point)
|
||||||
if _dist <= _radius then
|
if _dist <= _radius then
|
||||||
unitsByDistance[cpt] = {id =cpt, dist = _dist, unit = _unitName, typeName = u:getTypeName()}
|
unitsByDistance[cpt] = {id =cpt, dist = _dist, unit = _unitName, typeName = u:getTypeName()}
|
||||||
@@ -5864,208 +5866,203 @@ end
|
|||||||
-- Adds menuitem to a human unit
|
-- Adds menuitem to a human unit
|
||||||
function ctld.addTransportF10MenuOptions(_unitName)
|
function ctld.addTransportF10MenuOptions(_unitName)
|
||||||
ctld.logDebug("ctld.addTransportF10MenuOptions(_unitName=[%s])", ctld.p(_unitName))
|
ctld.logDebug("ctld.addTransportF10MenuOptions(_unitName=[%s])", ctld.p(_unitName))
|
||||||
local status, error = pcall(function()
|
local _unit = ctld.getTransportUnit(_unitName)
|
||||||
local _unit = ctld.getTransportUnit(_unitName)
|
ctld.logTrace("_unit = %s", ctld.p(_unit))
|
||||||
ctld.logTrace("_unit = %s", ctld.p(_unit))
|
|
||||||
|
|
||||||
if _unit then
|
if _unit then
|
||||||
local _unitTypename = _unit:getTypeName()
|
local _unitTypename = _unit:getTypeName()
|
||||||
local _groupId = ctld.getGroupId(_unit)
|
local _groupId = ctld.getGroupId(_unit)
|
||||||
if _groupId then
|
if _groupId then
|
||||||
-- ctld.logTrace("_groupId = %s", ctld.p(_groupId))
|
-- ctld.logTrace("_groupId = %s", ctld.p(_groupId))
|
||||||
-- ctld.logTrace("ctld.addedTo = %s", ctld.p(ctld.addedTo[tostring(_groupId)]))
|
-- ctld.logTrace("ctld.addedTo = %s", ctld.p(ctld.addedTo[tostring(_groupId)]))
|
||||||
if ctld.addedTo[tostring(_groupId)] == nil then
|
if ctld.addedTo[tostring(_groupId)] == nil then
|
||||||
ctld.logTrace("adding CTLD menu for _groupId = %s", ctld.p(_groupId))
|
ctld.logTrace("adding CTLD menu for _groupId = %s", ctld.p(_groupId))
|
||||||
local _rootPath = missionCommands.addSubMenuForGroup(_groupId, ctld.i18n_translate("CTLD"))
|
local _rootPath = missionCommands.addSubMenuForGroup(_groupId, ctld.i18n_translate("CTLD"))
|
||||||
local _unitActions = ctld.getUnitActions(_unitTypename)
|
local _unitActions = ctld.getUnitActions(_unitTypename)
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Check Cargo"), _rootPath, ctld.checkTroopStatus, { _unitName })
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Check Cargo"), _rootPath, ctld.checkTroopStatus, { _unitName })
|
||||||
if _unitActions.troops then
|
if _unitActions.troops then
|
||||||
local _troopCommandsPath = missionCommands.addSubMenuForGroup(_groupId,ctld.i18n_translate("Troop Transport"), _rootPath)
|
local _troopCommandsPath = missionCommands.addSubMenuForGroup(_groupId,ctld.i18n_translate("Troop Transport"), _rootPath)
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Unload / Extract Troops"),
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Unload / Extract Troops"),
|
||||||
_troopCommandsPath, ctld.unloadExtractTroops, { _unitName })
|
_troopCommandsPath, ctld.unloadExtractTroops, { _unitName })
|
||||||
|
|
||||||
-- local _loadPath = missionCommands.addSubMenuForGroup(_groupId, "Load From Zone", _troopCommandsPath)
|
-- local _loadPath = missionCommands.addSubMenuForGroup(_groupId, "Load From Zone", _troopCommandsPath)
|
||||||
local _transportLimit = ctld.getTransportLimit(_unitTypename)
|
local _transportLimit = ctld.getTransportLimit(_unitTypename)
|
||||||
local itemNb = 0
|
local itemNb = 0
|
||||||
local menuEntries = {}
|
local menuEntries = {}
|
||||||
local menuPath = _troopCommandsPath
|
local menuPath = _troopCommandsPath
|
||||||
for _, _loadGroup in pairs(ctld.loadableGroups) do
|
for _, _loadGroup in pairs(ctld.loadableGroups) do
|
||||||
if not _loadGroup.side or _loadGroup.side == _unit:getCoalition() then
|
if not _loadGroup.side or _loadGroup.side == _unit:getCoalition() then
|
||||||
-- check size & unit
|
-- check size & unit
|
||||||
if _transportLimit >= _loadGroup.total then
|
if _transportLimit >= _loadGroup.total then
|
||||||
table.insert(menuEntries,
|
table.insert(menuEntries,
|
||||||
{ text = ctld.i18n_translate("Load ") .. _loadGroup.name, group = _loadGroup })
|
{ text = ctld.i18n_translate("Load ") .. _loadGroup.name, group = _loadGroup })
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _i, _menu in ipairs(menuEntries) do
|
|
||||||
-- add the menu item
|
|
||||||
itemNb = itemNb + 1
|
|
||||||
if itemNb == 9 and _i < #menuEntries then -- page limit reached (first item is "unload")
|
|
||||||
menuPath = missionCommands.addSubMenuForGroup(_groupId, ctld.i18n_translate("Next page"),
|
|
||||||
menuPath)
|
|
||||||
itemNb = 1
|
|
||||||
end
|
|
||||||
missionCommands.addCommandForGroup(_groupId, _menu.text, menuPath, ctld.loadTroopsFromZone,
|
|
||||||
{ _unitName, true, _menu.group, false })
|
|
||||||
end
|
|
||||||
if ctld.unitCanCarryVehicles(_unit) then
|
|
||||||
local _vehicleCommandsPath = missionCommands.addSubMenuForGroup(_groupId,
|
|
||||||
ctld.i18n_translate("Vehicle / FOB Transport"), _rootPath)
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Unload Vehicles"),
|
|
||||||
_vehicleCommandsPath, ctld.unloadTroops, { _unitName, false })
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Load / Extract Vehicles"),
|
|
||||||
_vehicleCommandsPath, ctld.loadTroopsFromZone, { _unitName, false, "", true })
|
|
||||||
|
|
||||||
if ctld.enabledFOBBuilding and ctld.staticBugWorkaround == false then
|
|
||||||
missionCommands.addCommandForGroup(_groupId,
|
|
||||||
ctld.i18n_translate("Load / Unload FOB Crate"), _vehicleCommandsPath,
|
|
||||||
ctld.loadUnloadFOBCrate, { _unitName, false })
|
|
||||||
end
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Check Cargo"),
|
|
||||||
_vehicleCommandsPath, ctld.checkTroopStatus, { _unitName })
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
for _i, _menu in ipairs(menuEntries) do
|
||||||
|
-- add the menu item
|
||||||
|
itemNb = itemNb + 1
|
||||||
|
if itemNb == 9 and _i < #menuEntries then -- page limit reached (first item is "unload")
|
||||||
|
menuPath = missionCommands.addSubMenuForGroup(_groupId, ctld.i18n_translate("Next page"),
|
||||||
|
menuPath)
|
||||||
|
itemNb = 1
|
||||||
|
end
|
||||||
|
missionCommands.addCommandForGroup(_groupId, _menu.text, menuPath, ctld.loadTroopsFromZone,
|
||||||
|
{ _unitName, true, _menu.group, false })
|
||||||
|
end
|
||||||
|
if ctld.unitCanCarryVehicles(_unit) then
|
||||||
|
local _vehicleCommandsPath = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
|
ctld.i18n_translate("Vehicle / FOB Transport"), _rootPath)
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Unload Vehicles"),
|
||||||
|
_vehicleCommandsPath, ctld.unloadTroops, { _unitName, false })
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Load / Extract Vehicles"),
|
||||||
|
_vehicleCommandsPath, ctld.loadTroopsFromZone, { _unitName, false, "", true })
|
||||||
|
|
||||||
if ctld.enableCrates and _unitActions.crates then
|
if ctld.enabledFOBBuilding and ctld.staticBugWorkaround == false then
|
||||||
if ctld.unitCanCarryVehicles(_unit) == false then
|
missionCommands.addCommandForGroup(_groupId,
|
||||||
-- sort the crate categories alphabetically
|
ctld.i18n_translate("Load / Unload FOB Crate"), _vehicleCommandsPath,
|
||||||
local crateCategories = {}
|
ctld.loadUnloadFOBCrate, { _unitName, false })
|
||||||
for category, _ in pairs(ctld.spawnableCrates) do
|
end
|
||||||
table.insert(crateCategories, category)
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Check Cargo"),
|
||||||
|
_vehicleCommandsPath, ctld.checkTroopStatus, { _unitName })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ctld.enableCrates and _unitActions.crates then
|
||||||
|
if ctld.unitCanCarryVehicles(_unit) == false then
|
||||||
|
-- sort the crate categories alphabetically
|
||||||
|
local crateCategories = {}
|
||||||
|
for category, _ in pairs(ctld.spawnableCrates) do
|
||||||
|
table.insert(crateCategories, category)
|
||||||
|
end
|
||||||
|
table.sort(crateCategories)
|
||||||
|
--ctld.logTrace("crateCategories = [%s]", ctld.p(crateCategories))
|
||||||
|
|
||||||
|
-- add menu for spawning crates
|
||||||
|
local itemNbMain = 0
|
||||||
|
local _cratesMenuPath = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
|
ctld.i18n_translate("Crates: Vehicle / FOB / Drone"), _rootPath)
|
||||||
|
|
||||||
|
for _i, _category in ipairs(crateCategories) do
|
||||||
|
local _subMenuName = _category
|
||||||
|
local _crates = ctld.spawnableCrates[_subMenuName]
|
||||||
|
|
||||||
|
-- add the submenu item
|
||||||
|
itemNbMain = itemNbMain + 1
|
||||||
|
if itemNbMain == 10 and _i < #crateCategories then -- page limit reached
|
||||||
|
_cratesMenuPath = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
|
ctld.i18n_translate("Next page"), _cratesMenuPath)
|
||||||
|
itemNbMain = 1
|
||||||
end
|
end
|
||||||
table.sort(crateCategories)
|
local itemNbSubmenu = 0
|
||||||
--ctld.logTrace("crateCategories = [%s]", ctld.p(crateCategories))
|
local menuEntries = {}
|
||||||
|
local _subMenuPath = missionCommands.addSubMenuForGroup(_groupId, _subMenuName, _cratesMenuPath)
|
||||||
-- add menu for spawning crates
|
for _, _crate in pairs(_crates) do
|
||||||
local itemNbMain = 0
|
--ctld.logTrace("_crate = [%s]", ctld.p(_crate))
|
||||||
local _cratesMenuPath = missionCommands.addSubMenuForGroup(_groupId,
|
if not (_crate.multiple) or ctld.enableAllCrates then
|
||||||
ctld.i18n_translate("Crates: Vehicle / FOB / Drone"), _rootPath)
|
local isJTAC = ctld.isJTACUnitType(_crate.unit)
|
||||||
|
--ctld.logTrace("isJTAC = [%s]", ctld.p(isJTAC))
|
||||||
for _i, _category in ipairs(crateCategories) do
|
if not isJTAC or (isJTAC and ctld.JTAC_dropEnabled) then
|
||||||
local _subMenuName = _category
|
if _crate.side == nil or (_crate.side == _unit:getCoalition()) then
|
||||||
local _crates = ctld.spawnableCrates[_subMenuName]
|
local _crateRadioMsg = _crate.desc
|
||||||
|
--add in the number of crates required to build something
|
||||||
-- add the submenu item
|
if _crate.cratesRequired ~= nil and _crate.cratesRequired > 1 then
|
||||||
itemNbMain = itemNbMain + 1
|
_crateRadioMsg = _crateRadioMsg .. " (" .. _crate.cratesRequired ..
|
||||||
if itemNbMain == 10 and _i < #crateCategories then -- page limit reached
|
")"
|
||||||
_cratesMenuPath = missionCommands.addSubMenuForGroup(_groupId,
|
|
||||||
ctld.i18n_translate("Next page"), _cratesMenuPath)
|
|
||||||
itemNbMain = 1
|
|
||||||
end
|
|
||||||
local itemNbSubmenu = 0
|
|
||||||
local menuEntries = {}
|
|
||||||
local _subMenuPath = missionCommands.addSubMenuForGroup(_groupId, _subMenuName, _cratesMenuPath)
|
|
||||||
for _, _crate in pairs(_crates) do
|
|
||||||
--ctld.logTrace("_crate = [%s]", ctld.p(_crate))
|
|
||||||
if not (_crate.multiple) or ctld.enableAllCrates then
|
|
||||||
local isJTAC = ctld.isJTACUnitType(_crate.unit)
|
|
||||||
--ctld.logTrace("isJTAC = [%s]", ctld.p(isJTAC))
|
|
||||||
if not isJTAC or (isJTAC and ctld.JTAC_dropEnabled) then
|
|
||||||
if _crate.side == nil or (_crate.side == _unit:getCoalition()) then
|
|
||||||
local _crateRadioMsg = _crate.desc
|
|
||||||
--add in the number of crates required to build something
|
|
||||||
if _crate.cratesRequired ~= nil and _crate.cratesRequired > 1 then
|
|
||||||
_crateRadioMsg = _crateRadioMsg .. " (" .. _crate.cratesRequired ..
|
|
||||||
")"
|
|
||||||
end
|
|
||||||
if _crate.multiple then
|
|
||||||
_crateRadioMsg = "* " .. _crateRadioMsg
|
|
||||||
end
|
|
||||||
local _menuEntry = { text = _crateRadioMsg, crate = _crate }
|
|
||||||
--ctld.logTrace("_menuEntry = [%s]", ctld.p(_menuEntry))
|
|
||||||
table.insert(menuEntries, _menuEntry)
|
|
||||||
end
|
end
|
||||||
|
if _crate.multiple then
|
||||||
|
_crateRadioMsg = "* " .. _crateRadioMsg
|
||||||
|
end
|
||||||
|
local _menuEntry = { text = _crateRadioMsg, crate = _crate }
|
||||||
|
--ctld.logTrace("_menuEntry = [%s]", ctld.p(_menuEntry))
|
||||||
|
table.insert(menuEntries, _menuEntry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _i, _menu in ipairs(menuEntries) do
|
end
|
||||||
--ctld.logTrace("_menu = [%s]", ctld.p(_menu))
|
for _i, _menu in ipairs(menuEntries) do
|
||||||
-- add the submenu item
|
--ctld.logTrace("_menu = [%s]", ctld.p(_menu))
|
||||||
itemNbSubmenu = itemNbSubmenu + 1
|
-- add the submenu item
|
||||||
if itemNbSubmenu == 10 and _i < #menuEntries then -- page limit reached
|
itemNbSubmenu = itemNbSubmenu + 1
|
||||||
_subMenuPath = missionCommands.addSubMenuForGroup(_groupId,
|
if itemNbSubmenu == 10 and _i < #menuEntries then -- page limit reached
|
||||||
ctld.i18n_translate("Next page"), _subMenuPath)
|
_subMenuPath = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
itemNbSubmenu = 1
|
ctld.i18n_translate("Next page"), _subMenuPath)
|
||||||
end
|
itemNbSubmenu = 1
|
||||||
missionCommands.addCommandForGroup(_groupId, _menu.text, _subMenuPath,
|
|
||||||
ctld.spawnCrate, { _unitName, _menu.crate.weight })
|
|
||||||
end
|
end
|
||||||
|
missionCommands.addCommandForGroup(_groupId, _menu.text, _subMenuPath,
|
||||||
|
ctld.spawnCrate, { _unitName, _menu.crate.weight })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (ctld.enabledFOBBuilding or ctld.enableCrates) and _unitActions.crates then
|
|
||||||
local _crateCommands = missionCommands.addSubMenuForGroup(_groupId,
|
|
||||||
ctld.i18n_translate("CTLD Commands"), _rootPath)
|
|
||||||
if ctld.vehicleCommandsPath[_unitName] == nil then
|
|
||||||
ctld.vehicleCommandsPath[_unitName] = mist.utils.deepCopy(_crateCommands)
|
|
||||||
end
|
|
||||||
if ctld.hoverPickup == false or ctld.loadCrateFromMenu == true then
|
|
||||||
if ctld.loadCrateFromMenu then
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Load Nearby Crate(s)"),
|
|
||||||
_crateCommands, ctld.loadNearbyCrate, _unitName)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if ctld.loadCrateFromMenu or ctld.hoverPickup then
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Crate(s)"),
|
|
||||||
_crateCommands, ctld.dropSlingCrate, { _unitName })
|
|
||||||
end
|
|
||||||
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Unpack Any Crate"),
|
|
||||||
_crateCommands, ctld.unpackCrates, { _unitName })
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List Nearby Crates"),
|
|
||||||
_crateCommands, ctld.listNearbyCrates, { _unitName })
|
|
||||||
|
|
||||||
if ctld.enabledFOBBuilding then
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List FOBs"), _crateCommands,
|
|
||||||
ctld.listFOBS, { _unitName })
|
|
||||||
end
|
|
||||||
|
|
||||||
if ctld.enableRepackingVehicles == true then
|
|
||||||
ctld.updateRepackMenu( _unitName ) -- add repack menu
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if ctld.enableSmokeDrop then
|
|
||||||
local _smokeMenu = missionCommands.addSubMenuForGroup(_groupId,
|
|
||||||
ctld.i18n_translate("Smoke Markers"), _rootPath)
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Red Smoke"), _smokeMenu,
|
|
||||||
ctld.dropSmoke, { _unitName, trigger.smokeColor.Red })
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Blue Smoke"), _smokeMenu,
|
|
||||||
ctld.dropSmoke, { _unitName, trigger.smokeColor.Blue })
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Orange Smoke"), _smokeMenu,
|
|
||||||
ctld.dropSmoke, { _unitName, trigger.smokeColor.Orange })
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Green Smoke"), _smokeMenu,
|
|
||||||
ctld.dropSmoke, { _unitName, trigger.smokeColor.Green })
|
|
||||||
end
|
|
||||||
|
|
||||||
if ctld.enabledRadioBeaconDrop then
|
|
||||||
local _radioCommands = missionCommands.addSubMenuForGroup(_groupId,
|
|
||||||
ctld.i18n_translate("Radio Beacons"), _rootPath)
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List Beacons"), _radioCommands,
|
|
||||||
ctld.listRadioBeacons, { _unitName })
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Beacon"), _radioCommands,
|
|
||||||
ctld.dropRadioBeacon, { _unitName })
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Remove Closest Beacon"),
|
|
||||||
_radioCommands, ctld.removeRadioBeacon, { _unitName })
|
|
||||||
elseif ctld.deployedRadioBeacons ~= {} then
|
|
||||||
local _radioCommands = missionCommands.addSubMenuForGroup(_groupId,
|
|
||||||
ctld.i18n_translate("Radio Beacons"), _rootPath)
|
|
||||||
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List Beacons"), _radioCommands,
|
|
||||||
ctld.listRadioBeacons, { _unitName })
|
|
||||||
end
|
|
||||||
|
|
||||||
ctld.addedTo[tostring(_groupId)] = true
|
|
||||||
ctld.logTrace("ctld.addedTo = %s", ctld.p(ctld.addedTo))
|
|
||||||
ctld.logTrace("done adding CTLD menu for _groupId = %s", ctld.p(_groupId))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (ctld.enabledFOBBuilding or ctld.enableCrates) and _unitActions.crates then
|
||||||
|
local _crateCommands = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
|
ctld.i18n_translate("CTLD Commands"), _rootPath)
|
||||||
|
if ctld.vehicleCommandsPath[_unitName] == nil then
|
||||||
|
ctld.vehicleCommandsPath[_unitName] = mist.utils.deepCopy(_crateCommands)
|
||||||
|
end
|
||||||
|
if ctld.hoverPickup == false or ctld.loadCrateFromMenu == true then
|
||||||
|
if ctld.loadCrateFromMenu then
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Load Nearby Crate(s)"),
|
||||||
|
_crateCommands, ctld.loadNearbyCrate, _unitName)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ctld.loadCrateFromMenu or ctld.hoverPickup then
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Crate(s)"),
|
||||||
|
_crateCommands, ctld.dropSlingCrate, { _unitName })
|
||||||
|
end
|
||||||
|
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Unpack Any Crate"),
|
||||||
|
_crateCommands, ctld.unpackCrates, { _unitName })
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List Nearby Crates"),
|
||||||
|
_crateCommands, ctld.listNearbyCrates, { _unitName })
|
||||||
|
|
||||||
|
if ctld.enabledFOBBuilding then
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List FOBs"), _crateCommands,
|
||||||
|
ctld.listFOBS, { _unitName })
|
||||||
|
end
|
||||||
|
|
||||||
|
if ctld.enableRepackingVehicles == true then
|
||||||
|
ctld.updateRepackMenu( _unitName ) -- add repack menu
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ctld.enableSmokeDrop then
|
||||||
|
local _smokeMenu = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
|
ctld.i18n_translate("Smoke Markers"), _rootPath)
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Red Smoke"), _smokeMenu,
|
||||||
|
ctld.dropSmoke, { _unitName, trigger.smokeColor.Red })
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Blue Smoke"), _smokeMenu,
|
||||||
|
ctld.dropSmoke, { _unitName, trigger.smokeColor.Blue })
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Orange Smoke"), _smokeMenu,
|
||||||
|
ctld.dropSmoke, { _unitName, trigger.smokeColor.Orange })
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Green Smoke"), _smokeMenu,
|
||||||
|
ctld.dropSmoke, { _unitName, trigger.smokeColor.Green })
|
||||||
|
end
|
||||||
|
|
||||||
|
if ctld.enabledRadioBeaconDrop then
|
||||||
|
local _radioCommands = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
|
ctld.i18n_translate("Radio Beacons"), _rootPath)
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List Beacons"), _radioCommands,
|
||||||
|
ctld.listRadioBeacons, { _unitName })
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Drop Beacon"), _radioCommands,
|
||||||
|
ctld.dropRadioBeacon, { _unitName })
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("Remove Closest Beacon"),
|
||||||
|
_radioCommands, ctld.removeRadioBeacon, { _unitName })
|
||||||
|
elseif ctld.deployedRadioBeacons ~= {} then
|
||||||
|
local _radioCommands = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
|
ctld.i18n_translate("Radio Beacons"), _rootPath)
|
||||||
|
missionCommands.addCommandForGroup(_groupId, ctld.i18n_translate("List Beacons"), _radioCommands,
|
||||||
|
ctld.listRadioBeacons, { _unitName })
|
||||||
|
end
|
||||||
|
|
||||||
|
ctld.addedTo[tostring(_groupId)] = true
|
||||||
|
ctld.logTrace("ctld.addedTo = %s", ctld.p(ctld.addedTo))
|
||||||
|
ctld.logTrace("done adding CTLD menu for _groupId = %s", ctld.p(_groupId))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
if (not status) then
|
|
||||||
ctld.logError(string.format("Error adding f10 to transport: %s", error))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -7887,26 +7884,56 @@ function ctld.adjustRoute(_initialRouteTable, _firstWpOfNewRoute) -- create a r
|
|||||||
|
|
||||||
-- apply offset (_firstWpOfNewRoute) to SwitchWaypoint tasks
|
-- apply offset (_firstWpOfNewRoute) to SwitchWaypoint tasks
|
||||||
local lastWpAsAlreadySwitchWaypoint = false
|
local lastWpAsAlreadySwitchWaypoint = false
|
||||||
for idx = 1, #adjustedRoute do
|
for idx2 = 1, #adjustedRoute do
|
||||||
for j=1, #adjustedRoute[idx].task.params.tasks do
|
if #adjustedRoute[idx2] and
|
||||||
if adjustedRoute[idx].task.params.tasks[j].id ~= "ControlledTask" then
|
#adjustedRoute[idx2].task and
|
||||||
if adjustedRoute[idx].task.params.tasks[j].params.action.id == "SwitchWaypoint" then
|
#adjustedRoute[idx2].task.params and
|
||||||
local goToWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.action.params.goToWaypointIndex
|
#adjustedRoute[idx2].task.params.tasks then
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.action.params.fromWaypointIndex = idx
|
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
for j=1, #adjustedRoute[idx2].task.params.tasks do
|
||||||
if idx == #adjustedRoute then
|
if adjustedRoute[idx2].task.params.tasks[j].id and
|
||||||
lastWpAsAlreadySwitchWaypoint = true
|
adjustedRoute[idx2].task.params.tasks[j].id ~= "ControlledTask" then
|
||||||
|
|
||||||
|
if adjustedRoute[idx2].task.params.tasks[j].params and
|
||||||
|
adjustedRoute[idx2].task.params.tasks[j].params.action and
|
||||||
|
adjustedRoute[idx2].task.params.tasks[j].params.action.id and
|
||||||
|
adjustedRoute[idx2].task.params.tasks[j].params.action.id == "SwitchWaypoint" then
|
||||||
|
|
||||||
|
if adjustedRoute[idx2].task.params.tasks[j].params.action.params then
|
||||||
|
|
||||||
|
local goToWaypointIndex = adjustedRoute[idx2].task.params.tasks[j].params.action.params.goToWaypointIndex
|
||||||
|
adjustedRoute[idx2].task.params.tasks[j].params.action.params.fromWaypointIndex = idx2
|
||||||
|
adjustedRoute[idx2].task.params.tasks[j].params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
||||||
|
if idx2 == #adjustedRoute then
|
||||||
|
lastWpAsAlreadySwitchWaypoint = true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else -- for "ControlledTask"
|
else -- for "ControlledTask"
|
||||||
if adjustedRoute[idx].task.params.tasks[j].params.task.params.action.id == "SwitchWaypoint" then
|
if adjustedRoute[idx2].task.params.tasks[j].params and
|
||||||
local goToWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex
|
adjustedRoute[idx2].task.params.tasks[j].params.task and
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.fromWaypointIndex = idx
|
adjustedRoute[idx2].task.params.tasks[j].params.task.params and
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
adjustedRoute[idx2].task.params.tasks[j].params.task.params.action and
|
||||||
if idx == #adjustedRoute then
|
adjustedRoute[idx2].task.params.tasks[j].params.task.params.action.id and
|
||||||
lastWpAsAlreadySwitchWaypoint = true
|
adjustedRoute[idx2].task.params.tasks[j].params.task.params.action.id == "SwitchWaypoint" then
|
||||||
|
|
||||||
|
if adjustedRoute[idx2].task.params.tasks[j].params.task.params.action.params then
|
||||||
|
|
||||||
|
local goToWaypointIndex = adjustedRoute[idx2].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex
|
||||||
|
adjustedRoute[idx2].task.params.tasks[j].params.task.params.action.params.fromWaypointIndex = idx2
|
||||||
|
adjustedRoute[idx2].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
||||||
|
if idx2 == #adjustedRoute then
|
||||||
|
lastWpAsAlreadySwitchWaypoint = true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -7957,7 +7984,7 @@ ctld.reconMenuName = ctld.i18n_translate("RECON") --name of the
|
|||||||
ctld.reconRadioAdded = {} --stores the groups that have had the radio menu added
|
ctld.reconRadioAdded = {} --stores the groups that have had the radio menu added
|
||||||
ctld.reconLosSearchRadius = 2000 -- search radius in meters
|
ctld.reconLosSearchRadius = 2000 -- search radius in meters
|
||||||
ctld.reconLosMarkRadius = 100 -- mark radius dimension in meters
|
ctld.reconLosMarkRadius = 100 -- mark radius dimension in meters
|
||||||
ctld.reconAutoRefreshLosTargetMarks = true -- if true recon LOS marks are automaticaly refreshed on F10 map
|
ctld.reconAutoRefreshLosTargetMarks = false -- if true recon LOS marks are automaticaly refreshed on F10 map
|
||||||
ctld.reconLastScheduleIdAutoRefresh = 0
|
ctld.reconLastScheduleIdAutoRefresh = 0
|
||||||
|
|
||||||
---- F10 RECON Menus ------------------------------------------------------------------
|
---- F10 RECON Menus ------------------------------------------------------------------
|
||||||
@@ -8465,7 +8492,7 @@ end
|
|||||||
--- Handle world events.
|
--- Handle world events.
|
||||||
ctld.eventHandler = {}
|
ctld.eventHandler = {}
|
||||||
function ctld.eventHandler:onEvent(event)
|
function ctld.eventHandler:onEvent(event)
|
||||||
ctld.logTrace("ctld.eventHandler:onEvent()")
|
--ctld.logTrace("ctld.eventHandler:onEvent()")
|
||||||
if event == nil then
|
if event == nil then
|
||||||
ctld.logError("Event handler was called with a nil event!")
|
ctld.logError("Event handler was called with a nil event!")
|
||||||
return
|
return
|
||||||
@@ -8478,7 +8505,7 @@ function ctld.eventHandler:onEvent(event)
|
|||||||
elseif event.id == world.event.S_EVENT_BIRTH then
|
elseif event.id == world.event.S_EVENT_BIRTH then
|
||||||
eventName = "S_EVENT_BIRTH"
|
eventName = "S_EVENT_BIRTH"
|
||||||
else
|
else
|
||||||
ctld.logTrace("Ignoring event %s", ctld.p(event))
|
--ctld.logTrace("Ignoring event %s", ctld.p(event))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
ctld.logDebug("caught event %s: %s", ctld.p(eventName), ctld.p(event))
|
ctld.logDebug("caught event %s: %s", ctld.p(eventName), ctld.p(event))
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ It's open-source and free as in free beer (you don't have to pay to use it), and
|
|||||||
|
|
||||||
We're always looking for help, please reach out to [Zip on Discord](https://discordapp.com/users/421317390807203850) if you want to participate in maintenance or development.
|
We're always looking for help, please reach out to [Zip on Discord](https://discordapp.com/users/421317390807203850) if you want to participate in maintenance or development.
|
||||||
|
|
||||||
|
And if you'd like to support our work, you can [buy me a coffee](https://coff.ee/veaf_zip)!
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
This script is a rewrite of some of the functionality of the original Complete Combat Troop Transport Script (CTTS) by Geloxo (http://forums.eagle.ru/showthread.php?t=108523), as well as adding new features.
|
This script is a rewrite of some of the functionality of the original Complete Combat Troop Transport Script (CTTS) by Geloxo (http://forums.eagle.ru/showthread.php?t=108523), as well as adding new features.
|
||||||
@@ -865,10 +867,11 @@ For example, if the laser code is *1688*, the frequency will be *40.40Mhz*.
|
|||||||
JTAC frequency is available through the "JTAC Status" radio menu
|
JTAC frequency is available through the "JTAC Status" radio menu
|
||||||
|
|
||||||
#### Jtac-automatic-orbiting-over-lased-target
|
#### Jtac-automatic-orbiting-over-lased-target
|
||||||
By setting parameter ctld.enableAutoOrbitingFlyingJtacOnTarget = true, a script
|
|
||||||
dedicated script puts in orbit each flying JTAC over his detected target.
|
By setting parameter ctld.enableAutoOrbitingFlyingJtacOnTarget = true, a script dedicated script puts in orbit each flying JTAC over his detected target.
|
||||||
Associated with CTLD/JTAC functions, you can assign a fly route to the JTAC drone,
|
|
||||||
this one follow it, and start orbiting when he detects a target.
|
Associated with CTLD/JTAC functions, you can assign a fly route to the JTAC drone, this one follow it, and start orbiting when he detects a target.
|
||||||
|
|
||||||
As soon as it don't detect a target, it restart following its initial route at the nearest waypoint
|
As soon as it don't detect a target, it restart following its initial route at the nearest waypoint
|
||||||
|
|
||||||
# In Game
|
# In Game
|
||||||
@@ -927,11 +930,13 @@ ctld.JTAC_WEIGHT = 15 -- kg
|
|||||||
```
|
```
|
||||||
## Limit troop Loading
|
## Limit troop Loading
|
||||||
The number of Infantries units in mission can be limited by setting the table below :
|
The number of Infantries units in mission can be limited by setting the table below :
|
||||||
ctld.nbLimitSpwanedTroops = {0, 0} -- {redLimitInfantryCount, blueLimitInfantryCount}
|
|
||||||
|
`ctld.nbLimitSpawnedTroops = {0, 0} -- {redLimitInfantryCount, blueLimitInfantryCount}`
|
||||||
|
|
||||||
When this cumulative number of troops is reached for a coalition, no more troops can be loaded onboard, and a message is sent to player.
|
When this cumulative number of troops is reached for a coalition, no more troops can be loaded onboard, and a message is sent to player.
|
||||||
|
|
||||||
If ctld.nbLimitSpwanedTroops = {0, 0} (both values at 0) the limit control is disabled.
|
If set to `ctld.nbLimitSpawnedTroops = {0, 0}` (both values at 0) the limit control is disabled. This is the default.
|
||||||
|
|
||||||
If either value is non-zero, limit control becomes active for both coalitions.
|
If either value is non-zero, limit control becomes active for both coalitions.
|
||||||
|
|
||||||
## Cargo Spawning and Sling Loading
|
## Cargo Spawning and Sling Loading
|
||||||
@@ -1024,13 +1029,14 @@ Rearming:
|
|||||||
You can also repair a partially destroyed HAWK / BUK or KUB system by dropping a repair crate next to it and unpacking. A repair crate will also re-arm the system.
|
You can also repair a partially destroyed HAWK / BUK or KUB system by dropping a repair crate next to it and unpacking. A repair crate will also re-arm the system.
|
||||||
|
|
||||||
## Crate Repacking
|
## Crate Repacking
|
||||||
|
|
||||||
The F10 menu allows you to repack units having associated crate types in the "ctld.spawnableCrates" table.
|
The F10 menu allows you to repack units having associated crate types in the "ctld.spawnableCrates" table.
|
||||||
|
|
||||||
Simply land near the unit you wish to repack and select it from the list presented by the "CTLD//Vehicle/FOB transport...//Repack Vehicles" menu.
|
Simply land near the unit you wish to repack and select it from the list presented by the "CTLD//Vehicle/FOB transport...//Repack Vehicles" menu.
|
||||||
The defined radius of vehicles detection is specified by the parameter
|
|
||||||
|
|
||||||
ctld.maximumDistanceRepackableUnitsSearch = 200 -- max distance from transportUnit to search force repackable units in meters
|
The defined radius of vehicles detection is specified by the parameter `ctld.maximumDistanceRepackableUnitsSearch` (default 200 meters).
|
||||||
|
|
||||||
WARNING: Due to technical reasons related to the refresh time of the F10 menus, there may be inconsistencies between the type of vehicles requested and those provided. It is recommended to wait 5 to 10 seconds without moving after landing and opening the F10 menu for a packaging order.
|
*WARNING*: Due to technical reasons related to the refresh time of the F10 menus, there may be inconsistencies between the type of vehicles requested and those provided. It is recommended to wait 5 to 10 seconds without moving after landing and opening the F10 menu for a packaging order.
|
||||||
|
|
||||||
## Forward Operating Base (FOB) Construction
|
## Forward Operating Base (FOB) Construction
|
||||||
FOBs can be built by loading special FOB crates from a **Logistics** unit into a C-130 or other large aircraft configured in the script. To load the crate use the F10 - Troop Commands Menu. The idea behind FOBs is to make player vs player missions even more dynamic as these can be deployed in most locations. Once destroyed the FOB can no longer be used.
|
FOBs can be built by loading special FOB crates from a **Logistics** unit into a C-130 or other large aircraft configured in the script. To load the crate use the F10 - Troop Commands Menu. The idea behind FOBs is to make player vs player missions even more dynamic as these can be deployed in most locations. Once destroyed the FOB can no longer be used.
|
||||||
|
|||||||
Reference in New Issue
Block a user