Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build menu hotkey is not working when loading the campaign game #6165

Open
forGGe opened this issue May 10, 2024 · 0 comments
Open

Build menu hotkey is not working when loading the campaign game #6165

forGGe opened this issue May 10, 2024 · 0 comments
Labels
area: ui Anything to do with the User Interface of the Game type: bug

Comments

@forGGe
Copy link

forGGe commented May 10, 2024

Describe the bug

Loading the saved campaign game in the offline mode results in the build menu hotkey not being functional.

bad.log

To Reproduce

  • Run the client with ./run-offline
  • Start any campaign map
  • Save the game
  • Load saved game
  • Hit "B" on your engies to activate build menu

Expected behavior

The build menu is supposed to be activated, and build hotkeys are supposed to be overlayed on top of build icons

Additional context

It looks like missing HandleEvent is the problem in the gamemain.lua module:

DEBUG: -> -> Loading module: /lua/ui/game/construction.lua
DEBUG: -> -> -> Loading module: /lua/ui/controls/specialgrid.lua
DEBUG: -> -> -> Loading module: /lua/maui/statusbar.lua
DEBUG: -> -> -> Loading module: /lua/maui/mauiutil.lua
DEBUG: -> -> -> Loading module: /lua/ui/game/build_templates.lua
DEBUG: -> -> -> Loading module: /lua/ui/game/buildmode.lua
DEBUG: -> -> -> -> Loading module: /lua/ui/game/tabs.lua
INFO: Hooked /lua/ui/game/tabs.lua with /mods/coop/hook/lua/ui/game/tabs.lua
DEBUG: -> -> -> Loading module: /lua/ui/game/unitviewdetail.lua
DEBUG: -> -> -> -> Loading module: /lua/ui/help/unitdescription.lua
DEBUG: -> -> -> -> Loading module: /lua/armordefinition.lua
INFO: Hooked /lua/armordefinition.lua with /mods/coop/hook/lua/armordefinition.lua
DEBUG: -> -> -> Loading module: /lua/ui/templates_factory.lua
DEBUG: -> -> -> Loading module: /lua/ui/game/straticons.lua
DEBUG: -> -> -> Loading module: /lua/ui/notify/enhancementqueue.lua
DEBUG: -> -> -> Loading module: /lua/keymap/hotkeylabelsui.lua
WARNING: ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(91): Attempt to set attribute 'HandleEvent' on nil
WARNING: stack traceback:
WARNING:         [C]: in function `error'
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\config.lua(14): in function <...ne\.faforever\gamedata\lua.nx2\lua\system\config.lua:13>
WARNING:         ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(91): in main chunk
WARNING:         [C]: in function `doscript'
WARNING:         [C]: ?
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(61): in function <...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua:41>
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(161): in function `import'
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(137): in function `import'
WARNING:         ...forever\gamedata\lua.nx2\lua\ui\game\commandmode.lua(12): in main chunk
WARNING:         [C]: in function `doscript'
WARNING:         [C]: ?
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(61): in function <...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua:41>
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(161): in function `import'
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(137): in function `import'
WARNING:         ...forever\gamedata\lua.nx2\lua\ui\game\objectives2.lua(26): in main chunk
WARNING:         [C]: in function `doscript'
WARNING:         [C]: ?
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(61): in function <...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua:41>
WARNING:         ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(161): in function `import'
WARNING:         ...axpayne\.faforever\gamedata\lua.nx2\lua\usersync.lua(286): in function <...axpayne\.faforever\gamedata\lua.nx2\lua\usersync.lua:53>
WARNING:         ...axpayne\.faforever\gamedata\lua.nx2\lua\usersync.lua(527): in function `OnSync'
WARNING:         [string "OnSync()"](1): in main chunk
WARNING: ...ne\.faforever\gamedata\lua.nx2\lua\system\import.lua(161): Error importing '/lua/ui/game/construction.lua'

construction.lua code in question:

if options.gui_draggable_queue ~= 0 then
    -- Add gameparent handleevent for if the drag ends outside the queue window
    local gameParent = import("/lua/ui/game/gamemain.lua").GetGameParent()
    local oldGameParentHandleEvent = gameParent.HandleEvent
    gameParent.HandleEvent = function(self, event)
        if event.Type == 'ButtonRelease' then
            import("/lua/ui/game/construction.lua").ButtonReleaseCallback()
        end
        oldGameParentHandleEvent(self, event)
    end
end

I can confirm that by disabling the "draggable queue" UI option in the option menu, it is possible to bring back the build mode hotkey functionality. Good enough as a workaround.

Among other things, "transmission log" feature is also missing if "draggable queue" is set.

@MrRowey MrRowey added type: bug area: ui Anything to do with the User Interface of the Game labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ui Anything to do with the User Interface of the Game type: bug
Projects
None yet
Development

No branches or pull requests

2 participants