Differentiate types of on_gui_closed
Posted: Mon Nov 30, 2020 2:51 pm
With 1.1, the game now treats pressing 'E' on a GUI interface with a confirm-button as confirmation, which is fine. An issue arises though when mods try to emulate that behavior. What you want to do as a mod is to confirm your current dialog if possible, and close it if it doesn't have a submit-button. So, you listen to on_gui_closed and run through that logic.
The problem is that on_gui_closed also fires when the user presses Escape. Mods have no way to differentiate which of the two buttons was pressed, which means that we'd submit dialogs when the user presses Escape, which is almost certainly not their intention. The base game handles this correctly because it can differentiate the two.
I'm asking for some way for mods to emulate vanilla behavior. One way I can think of is to add a field to on_gui_closed indicating the intention ('close' for Escape, 'try-to-confirm' for E), but I'm open to other solutions that solve the problem.
The problem is that on_gui_closed also fires when the user presses Escape. Mods have no way to differentiate which of the two buttons was pressed, which means that we'd submit dialogs when the user presses Escape, which is almost certainly not their intention. The base game handles this correctly because it can differentiate the two.
I'm asking for some way for mods to emulate vanilla behavior. One way I can think of is to add a field to on_gui_closed indicating the intention ('close' for Escape, 'try-to-confirm' for E), but I'm open to other solutions that solve the problem.