Skip to content

Commit

Permalink
Allow toggling of texture pack by double clicking
Browse files Browse the repository at this point in the history
  • Loading branch information
yamanq committed Feb 24, 2021
1 parent 9f6167f commit d51d0d7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions builtin/mainmenu/tab_content.lua
Expand Up @@ -145,11 +145,26 @@ local function get_formspec(tabview, name, tabdata)
return retval
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

Expand Down

0 comments on commit d51d0d7

Please sign in to comment.