1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

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
This commit is contained in:
Muhammad Rifqi Priyo Susanto 2023-01-17 02:16:08 +07:00 committed by GitHub
parent 2f9f0c0900
commit a2a280691c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -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"))