· Added functionality to Interact menu hotkey to also now close Interact menu again.
Closing the 'Interact' menu with the hotkey causes the target to not be deselected by clicking outside the box, among other problems derived from the action of clicking, such as the 'Top Level' menu not being displayed as the system is not notified that the menu has been closed, as I point out below.
Way to reproduce:
While in space mode, sitting in the pilot's chair, where the default hotkey can be used to open the 'Interact Menu', select a object and open the menu, no matter how, right click or hotkey. Now press the hotkey, by default 'F', to close the menu. Now try deselecting the object clicking outside the box, cannot be deselected.
As I always say, the developer always knows best what steps to take to fix problems, here I'm just laying out what works for me, so in my interest, a closer look on my part at 'targetsystem.lua':
Code: Select all
function startSofttargetInteraction()
local targetElement = private.currentSofttarget
if targetElement == nil then
return -- no softtarget atm -> nothing to interact with right now
end
if targetElement.instantAction then
-- note: we must do a hasPossibleActions-check here, since startSofttargetInteraction() is also called by pressing the interact hotkey ("F").
-- That does not perform a pre-check of whether the action is actually possible or not and could ultimately incorrectly call PerformAction() on an
-- impossible action which then might result in errors. (fixes XT-141)
if hasPossibleActions(targetElement) then
PerformAction(targetElement.messageID, 1)
end
return -- done / instant actions are performed directly without displaying the menu at all
end
-- + Dj_FRedy
-- startSofttargetInteraction() is also called when pressing the interact hotkey, by default 'F', with the interact menu open to close this, notify that the menu will be hidden, if applicable
if targetElement.interactMenuOpen then
C.NotifyInteractMenuHidden(targetElement.messageID, true)
end
-- - Dj_FRedy
C.ShowInteractMenu(targetElement.componentID, targetElement.connectionName, targetElement.messageID)
end