diff options
author | Yaman Qalieh <ybq987@gmail.com> | 2021-02-24 05:50:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 11:50:19 +0100 |
commit | d51d0d77c4e88dec8f9670942e19595cbb3a0234 (patch) | |
tree | 5319c4e37525fcca4d2f1dece25661472621f2d5 /builtin/mainmenu | |
parent | 9f6167fc3bebb337ac065b638ba7222374c769d8 (diff) | |
download | minetest-d51d0d77c4e88dec8f9670942e19595cbb3a0234.tar.gz minetest-d51d0d77c4e88dec8f9670942e19595cbb3a0234.tar.bz2 minetest-d51d0d77c4e88dec8f9670942e19595cbb3a0234.zip |
Allow toggling of texture pack by double clicking
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r-- | builtin/mainmenu/tab_content.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua index 336730bf4..fb7f121f8 100644 --- a/builtin/mainmenu/tab_content.lua +++ b/builtin/mainmenu/tab_content.lua @@ -146,10 +146,25 @@ local function get_formspec(tabview, name, tabdata) end -------------------------------------------------------------------------------- +local function handle_doubleclick(pkg) + if pkg.type == "txp" then + if core.settings:get("texture_path") == pkg.path then + core.settings:set("texture_path", "") + else + core.settings:set("texture_path", pkg.path) + end + packages = nil + end +end + +-------------------------------------------------------------------------------- local function handle_buttons(tabview, fields, tabname, tabdata) if fields["pkglist"] ~= nil then local event = core.explode_table_event(fields["pkglist"]) tabdata.selected_pkg = event.row + if event.type == "DCL" then + handle_doubleclick(packages:get_list()[tabdata.selected_pkg]) + end return true end |