aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorPilzAdam <pilzadam@minetest.net>2013-08-16 00:12:10 +0200
committerPilzAdam <pilzadam@minetest.net>2013-08-16 01:04:37 +0200
commitd52185c43e7fa96174bb9e0d6d7a38f894b3a356 (patch)
treed71ce713c918c04e5a021c6eb96c82b28d5536a8 /builtin
parent5e312dc40ddcd8d1e2846c3c2cf5030a6405a056 (diff)
downloadminetest-d52185c43e7fa96174bb9e0d6d7a38f894b3a356.tar.gz
minetest-d52185c43e7fa96174bb9e0d6d7a38f894b3a356.tar.bz2
minetest-d52185c43e7fa96174bb9e0d6d7a38f894b3a356.zip
Add ability to activate mods with doubleclick (remove old_style_mod_selection)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mainmenu.lua4
-rw-r--r--builtin/modmgr.lua145
2 files changed, 67 insertions, 82 deletions
diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua
index 5eb1a73db..bbf591ca6 100644
--- a/builtin/mainmenu.lua
+++ b/builtin/mainmenu.lua
@@ -654,9 +654,6 @@ function tabbuilder.handle_settings_buttons(fields)
if fields["cb_opaque_water"] then
engine.setting_setbool("opaque_water",tabbuilder.tobool(fields["cb_opaque_water"]))
end
- if fields["old_style_modselection"] then
- engine.setting_setbool("old_style_mod_selection",tabbuilder.tobool(fields["old_style_modselection"]))
- end
if fields["cb_mipmapping"] then
engine.setting_setbool("mip_map",tabbuilder.tobool(fields["cb_mipmapping"]))
@@ -964,7 +961,6 @@ function tabbuilder.tab_settings()
"checkbox[1,1.25;cb_smooth_lighting;Smooth Lighting;".. dump(engine.setting_getbool("smooth_lighting")) .. "]"..
"checkbox[1,1.75;cb_3d_clouds;3D Clouds;" .. dump(engine.setting_getbool("enable_3d_clouds")) .. "]"..
"checkbox[1,2.25;cb_opaque_water;Opaque Water;" .. dump(engine.setting_getbool("opaque_water")) .. "]"..
- "checkbox[1,2.75;old_style_modselection;Old style modmgr;" .. dump(engine.setting_getbool("old_style_mod_selection")) .. "]"..
"checkbox[4,0.75;cb_mipmapping;Mip-Mapping;" .. dump(engine.setting_getbool("mip_map")) .. "]"..
"checkbox[4,1.25;cb_anisotrophic;Anisotropic Filtering;".. dump(engine.setting_getbool("anisotropic_filter")) .. "]"..
diff --git a/builtin/modmgr.lua b/builtin/modmgr.lua
index e7f028f6e..58ffb1530 100644
--- a/builtin/modmgr.lua
+++ b/builtin/modmgr.lua
@@ -395,47 +395,40 @@ function modmgr.dialog_configure_world()
"button[9.25,6.35;2,0.5;btn_config_world_save;Save]" ..
"button[7.4,6.35;2,0.5;btn_config_world_cancel;Cancel]"
- if engine.setting_get("old_style_mod_selection") == "true" then
- if mod ~= nil and mod.name ~= "" then
- if mod.is_modpack then
- local rawlist = filterlist.get_raw_list(modmgr.modlist)
-
- local all_enabled = true
- for j=1,#rawlist,1 do
- if rawlist[j].modpack == mod.name and
- rawlist[j].enabled ~= true then
- all_enabled = false
- break
- end
- end
-
- if all_enabled == false then
- retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_enable;Enable MP]"
- else
- retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_disable;Disable MP]"
+ if mod ~= nil and mod.name ~= "" then
+ if mod.is_modpack then
+ local rawlist = filterlist.get_raw_list(modmgr.modlist)
+
+ local all_enabled = true
+ for j=1,#rawlist,1 do
+ if rawlist[j].modpack == mod.name and
+ rawlist[j].enabled ~= true then
+ all_enabled = false
+ break
end
+ end
+
+ if all_enabled == false then
+ retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_enable;Enable MP]"
else
- if mod.enabled then
- retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;true]"
- else
- retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;false]"
- end
+ retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_disable;Disable MP]"
+ end
+ else
+ if mod.enabled then
+ retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;true]"
+ else
+ retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;false]"
end
-
end
-
- retval = retval ..
- "button[8.5,-0.125;2.5,0.5;btn_all_mods;Enable all]"
- else
- retval = retval ..
- "button[5.5,-0.125;5.75,0.5;btn_all_mods;Enable all Mods]"
+
end
- retval = retval ..
+
+ retval = retval ..
+ "button[8.5,-0.125;2.5,0.5;btn_all_mods;Enable all]" ..
"textlist[5.5,0.5;5.5,5.75;world_config_modlist;"
-
-
+
retval = retval .. modmgr.render_modlist(modmgr.modlist)
-
+
retval = retval .. ";" .. modmgr.world_config_selected_mod .."]"
return retval
@@ -665,60 +658,56 @@ function modmgr.handle_configure_world_buttons(fields)
local event = explode_textlist_event(fields["world_config_modlist"])
modmgr.world_config_selected_mod = event.index
- if engine.setting_get("old_style_mod_selection") ~= "true" then
- if event.typ == "DCL" then
- local mod = filterlist.get_list(modmgr.modlist)[event.index]
-
- if mod.typ == "game_mod" then
- return nil
- end
+ if event.typ == "DCL" then
+ local mod = filterlist.get_list(modmgr.modlist)[event.index]
+
+ if mod.typ == "game_mod" then
+ return nil
+ end
+
+ if not mod.is_modpack then
+ mod.enabled = not mod.enabled
+ else
+ local list = filterlist.get_raw_list(modmgr.modlist)
+ local toset = nil
- if not mod.is_modpack then
- mod.enabled = not mod.enabled
- else
- local list = filterlist.get_raw_list(modmgr.modlist)
- local toset = nil
-
- for i=1,#list,1 do
- if list[i].modpack == mod.name then
- if toset == nil then
- toset = not list[i].enabled
- end
-
- list[i].enabled = toset
+ for i=1,#list,1 do
+ if list[i].modpack == mod.name then
+ if toset == nil then
+ toset = not list[i].enabled
end
+
+ list[i].enabled = toset
end
end
end
end
end
- if engine.setting_get("old_style_mod_selection") == "true" then
- if fields["cb_mod_enable"] ~= nil then
- local mod = filterlist.get_list(modmgr.modlist)
- [engine.get_textlist_index("world_config_modlist")]
- if fields["cb_mod_enable"] == "true" then
- mod.enabled = true
- else
- mod.enabled = false
- end
+ if fields["cb_mod_enable"] ~= nil then
+ local mod = filterlist.get_list(modmgr.modlist)
+ [engine.get_textlist_index("world_config_modlist")]
+ if fields["cb_mod_enable"] == "true" then
+ mod.enabled = true
+ else
+ mod.enabled = false
end
+ end
+
+ if fields["btn_mp_enable"] ~= nil or
+ fields["btn_mp_disable"] then
+ local mod = filterlist.get_list(modmgr.modlist)
+ [engine.get_textlist_index("world_config_modlist")]
- if fields["btn_mp_enable"] ~= nil or
- fields["btn_mp_disable"] then
- local mod = filterlist.get_list(modmgr.modlist)
- [engine.get_textlist_index("world_config_modlist")]
-
- local toset=false
- if fields["btn_mp_enable"] ~= nil then
- toset = true
- end
- local list = filterlist.get_raw_list(modmgr.modlist)
-
- for i=1,#list,1 do
- if list[i].modpack == mod.name then
- list[i].enabled = toset
- end
+ local toset=false
+ if fields["btn_mp_enable"] ~= nil then
+ toset = true
+ end
+ local list = filterlist.get_raw_list(modmgr.modlist)
+
+ for i=1,#list,1 do
+ if list[i].modpack == mod.name then
+ list[i].enabled = toset
end
end
end