From 14066646e0d533604f35b2668ba3fc480a29364e Mon Sep 17 00:00:00 2001 From: RexAttaque Date: Sun, 21 Aug 2022 19:10:18 +0200 Subject: [PATCH] Fixed new groups not getting the target lists quickly after spawn --- CTLD.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CTLD.lua b/CTLD.lua index 29c7299..ba0cfed 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -5082,9 +5082,12 @@ function ctld.addJTACRadioCommand(_side) local _groupId = ctld.getGroupId(_playerUnit) if _groupId then + + local newGroup = false -- env.info("adding command for "..index) if ctld.jtacRadioAdded[tostring(_groupId)] == nil then -- env.info("about command for "..index) + newGroup = true local JTACpath = missionCommands.addSubMenuForGroup(_groupId, ctld.jtacMenuName) missionCommands.addCommandForGroup(_groupId, "JTAC Status", JTACpath, ctld.getJTACStatus, { _playerUnit:getName() }) ctld.jtacRadioAdded[tostring(_groupId)] = true @@ -5094,8 +5097,8 @@ function ctld.addJTACRadioCommand(_side) --fetch the time to check for a regular refresh local time = timer.getTime() - --depending on the multiplier, this part of the radio menu will be refreshed less often or as often as the static JTAC status command, this is for better reliability for the user when navigating through the menus. New groups will get the lists regardless and if a new JTAC is added all lists will be refreshed regardless of the multiplier. - if ctld.jtacLastRadioRefresh + ctld.jtacRadioRefreshDelay <= time or ctld.newJtac or ctld.jtacRadioAdded[tostring(_groupId)] == nil then + --depending on the delay, this part of the radio menu will be refreshed less often or as often as the static JTAC status command, this is for better reliability for the user when navigating through the menus. New groups will get the lists regardless and if a new JTAC is added all lists will be refreshed regardless of the delay. + if ctld.jtacLastRadioRefresh + ctld.jtacRadioRefreshDelay <= time or ctld.newJtac or newGroup then ctld.jtacLastRadioRefresh = time @@ -5183,7 +5186,7 @@ function ctld.addJTACRadioCommand(_side) end end end - + if ctld.newJtac then ctld.newJtac = false end