mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
Compare commits
4 Commits
202412.01R
...
202412.01
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a26c0f6a5d | ||
|
|
76a6dca72a | ||
|
|
55846e3109 | ||
|
|
ebf72aaa44 |
11
CTLD.lua
11
CTLD.lua
@@ -5276,12 +5276,13 @@ function ctld.addTransportF10MenuOptions(_unitName)
|
|||||||
local status, error = pcall(function()
|
local status, error = pcall(function()
|
||||||
|
|
||||||
local _unit = ctld.getTransportUnit(_unitName)
|
local _unit = ctld.getTransportUnit(_unitName)
|
||||||
|
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))
|
||||||
if ctld.addedTo[tostring(_groupId)] == nil then
|
if ctld.addedTo[tostring(_groupId)] == nil then
|
||||||
|
|
||||||
local _rootPath = missionCommands.addSubMenuForGroup(_groupId, "CTLD")
|
local _rootPath = missionCommands.addSubMenuForGroup(_groupId, "CTLD")
|
||||||
@@ -6770,9 +6771,7 @@ function ctld.setGrpROE(_grp, _ROE)
|
|||||||
_ROE = AI.Option.Ground.val.ROE.OPEN_FIRE
|
_ROE = AI.Option.Ground.val.ROE.OPEN_FIRE
|
||||||
end
|
end
|
||||||
|
|
||||||
_grp = ctld.getAliveGroup(_grp)
|
if _grp and _grp:isExist() == true and #_grp:getUnits() > 0 then -- check if the group truly exists
|
||||||
|
|
||||||
if _grp ~= nil then
|
|
||||||
local _controller = _grp:getController();
|
local _controller = _grp:getController();
|
||||||
Controller.setOption(_controller, AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.AUTO)
|
Controller.setOption(_controller, AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.AUTO)
|
||||||
Controller.setOption(_controller, AI.Option.Ground.id.ROE, _ROE)
|
Controller.setOption(_controller, AI.Option.Ground.id.ROE, _ROE)
|
||||||
@@ -7367,6 +7366,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(), event = %s", ctld.p(event))
|
||||||
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
|
||||||
@@ -7384,6 +7384,7 @@ function ctld.eventHandler:onEvent(event)
|
|||||||
local unitName = nil
|
local unitName = nil
|
||||||
if event.initiator ~= nil and event.initiator.getName then
|
if event.initiator ~= nil and event.initiator.getName then
|
||||||
unitName = event.initiator:getName()
|
unitName = event.initiator:getName()
|
||||||
|
ctld.logTrace("unitName = %s", ctld.p(unitName))
|
||||||
end
|
end
|
||||||
if not unitName then
|
if not unitName then
|
||||||
ctld.logWarning("no unitname found in event %s", ctld.p(event))
|
ctld.logWarning("no unitname found in event %s", ctld.p(event))
|
||||||
@@ -7404,6 +7405,7 @@ function ctld.eventHandler:onEvent(event)
|
|||||||
if ctld.addPlayerAircraftByType then
|
if ctld.addPlayerAircraftByType then
|
||||||
for _,aircraftType in pairs(ctld.aircraftTypeTable) do
|
for _,aircraftType in pairs(ctld.aircraftTypeTable) do
|
||||||
if aircraftType == playerTypeName then
|
if aircraftType == playerTypeName then
|
||||||
|
ctld.logTrace("adding by aircraft type, unitName = %s", ctld.p(unitName))
|
||||||
-- add transport unit to the list
|
-- add transport unit to the list
|
||||||
table.insert(ctld.transportPilotNames, unitName)
|
table.insert(ctld.transportPilotNames, unitName)
|
||||||
-- add transport radio menu
|
-- add transport radio menu
|
||||||
@@ -7414,6 +7416,7 @@ function ctld.eventHandler:onEvent(event)
|
|||||||
else
|
else
|
||||||
for _, _unitName in pairs(ctld.transportPilotNames) do
|
for _, _unitName in pairs(ctld.transportPilotNames) do
|
||||||
if _unitName == unitName then
|
if _unitName == unitName then
|
||||||
|
ctld.logTrace("adding by transportPilotNames, unitName = %s", ctld.p(unitName))
|
||||||
-- add transport radio menu
|
-- add transport radio menu
|
||||||
ctld.addTransportF10MenuOptions(unitName)
|
ctld.addTransportF10MenuOptions(unitName)
|
||||||
break
|
break
|
||||||
|
|||||||
BIN
test-mission.miz
BIN
test-mission.miz
Binary file not shown.
Reference in New Issue
Block a user