aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu/dlg_create_world.lua
diff options
context:
space:
mode:
authorMuhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>2023-01-17 02:16:08 +0700
committerGitHub <noreply@github.com>2023-01-16 20:16:08 +0100
commita2a280691c76d37ab1cbceb9571364d7551c0dea (patch)
treeee3ff0e869eef02d22275df3cbf0df5626a3df06 /builtin/mainmenu/dlg_create_world.lua
parent2f9f0c09001b8fbc6f4559cbfdccf0261f1377a4 (diff)
downloadminetest-a2a280691c76d37ab1cbceb9571364d7551c0dea.tar.xz
Fix Enter key after creating a new world (#12997)
Prevents Enter key or "double-click" event to play the world just after creating a new world
Diffstat (limited to 'builtin/mainmenu/dlg_create_world.lua')
-rw-r--r--builtin/mainmenu/dlg_create_world.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua
index 2f3ef596c..eb7a596a0 100644
--- a/builtin/mainmenu/dlg_create_world.lua
+++ b/builtin/mainmenu/dlg_create_world.lua
@@ -352,6 +352,12 @@ local function create_world_buttonhandler(this, fields)
if fields["world_create_confirm"] or
fields["key_enter"] then
+ if fields["key_enter"] then
+ -- HACK: This timestamp prevents double-triggering when pressing Enter on an input box
+ -- and releasing it on a button[] or textlist[] due to instant formspec updates.
+ this.parent.dlg_create_world_closed_at = core.get_us_time()
+ end
+
local worldname = fields["te_world_name"]
local game, _ = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))