Fixed new groups not getting the target lists quickly after spawn

This commit is contained in:
RexAttaque 2022-08-21 19:10:18 +02:00
parent f71649f4f0
commit 14066646e0

View File

@ -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