When handler of a custom-input with linked_game_control = "rotate-active-quick-bars" shows the quickbar, previously hidden using player.game_view_settings.show_quickbar = false, the displayed selected quickbar page is incorrect.
Steps:
0. (Use the attached mod for ease of demonstration)
1. Add custom-input with linked_game_control = "rotate-active-quick-bars" (as in the attached demo mod).
2. Implement event handler of the custom input to show quickbar: game.get_player(event.player_index).game_view_settings.show_quickbar = true.
3. Start new Freeplay game. (Expected: selected quickbar is #1)
4. Hide quickbar using /c game.players[1].game_view_settings.show_quickbar = false (Or with Alt + H hotkey provided by the attached demo mod).
5. Press "Rotate active quickbars" hotkey.
Expected: quickbar shows quickbar #2 as selected.
Actual: quickbar shows quickbar #1 as selected.
6. Again hide quickbar (using console or attached demo mod hotkey) and then show it back.
Actual: quickbar correctly shows quickbar #2 as selected.
Use case:
I'm making a mod that hides quickbar most of the time and only temporarily shows it when related hotkeys are pressed, so that player can see the effect of his actions.
[2.0.76] Hidden quickbar shows incorrect selected quickbar when shown in response to its rotation
[2.0.76] Hidden quickbar shows incorrect selected quickbar when shown in response to its rotation
- Attachments
-
- hidden-quickbar-appearance-bug.log
- factorio-current.log
- (10.9 KiB) Downloaded 12 times
-
- hidden-quickbar-appearance-bug.zip
- demonstration mod
- (1.35 KiB) Downloaded 13 times
Re: [2.0.76] Hidden quickbar shows incorrect selected quickbar when shown in response to its rotation
Thanks for the report however I don't believe this is addressable. The issue is: rotating the quickbar is applied to the GUI the instant the hotkey is pressed - UNLESS - the GUI isn't visible. When the actual action applies to the game it never retroactively goes to the GUI and changes it since this would result in annoying and unpredictable behavior in multiplayer games where the action takes an unknown amount of time from pressing to it applying to the real game.
Because the action is always sent but you've set the GUI to not be visible it means it doesn't apply the rotation to the GUI at the time of generating the action. However, when the mod-hotkey runs it sets the GUI to be visible - and since mod-hotkey actions run before the corresponding linked game control - the GUI is shown with the old values and then instantly the rotation is applied using the already-sent game action.
If it didn't work this way you would see the following happen in multiplayer games:
* Press rotate quick bar -> it visually rotates
* Press rotate quick bar -> it visually rotates
* Game-rotate-quickbar runs and forces the GUI to "1 rotation" (effectively rolling back the most-recent rotate key press)
* Game-rotate-quickbar runs and forces the GUI to "2 rotations" and now it's back to where it should have been the whole time
OR
* Press rotate quick bar -> it doesn't visually change
* Press rotate quick bar -> it doesn't visually change
* Game-rotate-quickbar runs and forces the GUI to "1 rotation"
* Game-rotate-quickbar runs and forces the GUI to "2 rotations"
Because the action is always sent but you've set the GUI to not be visible it means it doesn't apply the rotation to the GUI at the time of generating the action. However, when the mod-hotkey runs it sets the GUI to be visible - and since mod-hotkey actions run before the corresponding linked game control - the GUI is shown with the old values and then instantly the rotation is applied using the already-sent game action.
If it didn't work this way you would see the following happen in multiplayer games:
* Press rotate quick bar -> it visually rotates
* Press rotate quick bar -> it visually rotates
* Game-rotate-quickbar runs and forces the GUI to "1 rotation" (effectively rolling back the most-recent rotate key press)
* Game-rotate-quickbar runs and forces the GUI to "2 rotations" and now it's back to where it should have been the whole time
OR
* Press rotate quick bar -> it doesn't visually change
* Press rotate quick bar -> it doesn't visually change
* Game-rotate-quickbar runs and forces the GUI to "1 rotation"
* Game-rotate-quickbar runs and forces the GUI to "2 rotations"
If you want to get ahold of me I'm almost always on Discord.
Re: [2.0.76] Hidden quickbar shows incorrect selected quickbar when shown in response to its rotation
I see.
My current workaround is to wait a tick before showing the quickbar. Fortunately its simple enough (unlike the workaround for non-working hotkeys
)
My current workaround is to wait a tick before showing the quickbar. Fortunately its simple enough (unlike the workaround for non-working hotkeys

