[6.20](511811) Issue when closing the Interact menu with hotkey

Ask here if you experience technical problems with X4: Foundations.

Moderator: Moderators for English X Forum

User avatar
Dj_FRedy
Posts: 246
Joined: Mon, 27. Jun 11, 05:58
x4

[6.20](511811) Issue when closing the Interact menu with hotkey

Post by Dj_FRedy »

From the update notes version: 6.20 (511811) - 2023-08-24
· 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
The comment at the end of the function describes the intent, to notify the system that the menu is hidden/closed.
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.

Return to “X4: Foundations - Technical Support”