Skip to content

Commit d52185c

Browse files
committedAug 15, 2013
Add ability to activate mods with doubleclick (remove old_style_mod_selection)
1 parent 5e312dc commit d52185c

File tree

3 files changed

+67
-83
lines changed

3 files changed

+67
-83
lines changed
 

‎builtin/mainmenu.lua

-4
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,6 @@ function tabbuilder.handle_settings_buttons(fields)
654654
if fields["cb_opaque_water"] then
655655
engine.setting_setbool("opaque_water",tabbuilder.tobool(fields["cb_opaque_water"]))
656656
end
657-
if fields["old_style_modselection"] then
658-
engine.setting_setbool("old_style_mod_selection",tabbuilder.tobool(fields["old_style_modselection"]))
659-
end
660657

661658
if fields["cb_mipmapping"] then
662659
engine.setting_setbool("mip_map",tabbuilder.tobool(fields["cb_mipmapping"]))
@@ -964,7 +961,6 @@ function tabbuilder.tab_settings()
964961
"checkbox[1,1.25;cb_smooth_lighting;Smooth Lighting;".. dump(engine.setting_getbool("smooth_lighting")) .. "]"..
965962
"checkbox[1,1.75;cb_3d_clouds;3D Clouds;" .. dump(engine.setting_getbool("enable_3d_clouds")) .. "]"..
966963
"checkbox[1,2.25;cb_opaque_water;Opaque Water;" .. dump(engine.setting_getbool("opaque_water")) .. "]"..
967-
"checkbox[1,2.75;old_style_modselection;Old style modmgr;" .. dump(engine.setting_getbool("old_style_mod_selection")) .. "]"..
968964

969965
"checkbox[4,0.75;cb_mipmapping;Mip-Mapping;" .. dump(engine.setting_getbool("mip_map")) .. "]"..
970966
"checkbox[4,1.25;cb_anisotrophic;Anisotropic Filtering;".. dump(engine.setting_getbool("anisotropic_filter")) .. "]"..

‎builtin/modmgr.lua

+67-78
Original file line numberDiff line numberDiff line change
@@ -395,47 +395,40 @@ function modmgr.dialog_configure_world()
395395
"button[9.25,6.35;2,0.5;btn_config_world_save;Save]" ..
396396
"button[7.4,6.35;2,0.5;btn_config_world_cancel;Cancel]"
397397

398-
if engine.setting_get("old_style_mod_selection") == "true" then
399-
if mod ~= nil and mod.name ~= "" then
400-
if mod.is_modpack then
401-
local rawlist = filterlist.get_raw_list(modmgr.modlist)
402-
403-
local all_enabled = true
404-
for j=1,#rawlist,1 do
405-
if rawlist[j].modpack == mod.name and
406-
rawlist[j].enabled ~= true then
407-
all_enabled = false
408-
break
409-
end
410-
end
411-
412-
if all_enabled == false then
413-
retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_enable;Enable MP]"
414-
else
415-
retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_disable;Disable MP]"
398+
if mod ~= nil and mod.name ~= "" then
399+
if mod.is_modpack then
400+
local rawlist = filterlist.get_raw_list(modmgr.modlist)
401+
402+
local all_enabled = true
403+
for j=1,#rawlist,1 do
404+
if rawlist[j].modpack == mod.name and
405+
rawlist[j].enabled ~= true then
406+
all_enabled = false
407+
break
416408
end
409+
end
410+
411+
if all_enabled == false then
412+
retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_enable;Enable MP]"
417413
else
418-
if mod.enabled then
419-
retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;true]"
420-
else
421-
retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;false]"
422-
end
414+
retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_disable;Disable MP]"
415+
end
416+
else
417+
if mod.enabled then
418+
retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;true]"
419+
else
420+
retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;false]"
423421
end
424-
425422
end
426-
427-
retval = retval ..
428-
"button[8.5,-0.125;2.5,0.5;btn_all_mods;Enable all]"
429-
else
430-
retval = retval ..
431-
"button[5.5,-0.125;5.75,0.5;btn_all_mods;Enable all Mods]"
423+
432424
end
433-
retval = retval ..
425+
426+
retval = retval ..
427+
"button[8.5,-0.125;2.5,0.5;btn_all_mods;Enable all]" ..
434428
"textlist[5.5,0.5;5.5,5.75;world_config_modlist;"
435-
436-
429+
437430
retval = retval .. modmgr.render_modlist(modmgr.modlist)
438-
431+
439432
retval = retval .. ";" .. modmgr.world_config_selected_mod .."]"
440433

441434
return retval
@@ -665,60 +658,56 @@ function modmgr.handle_configure_world_buttons(fields)
665658
local event = explode_textlist_event(fields["world_config_modlist"])
666659
modmgr.world_config_selected_mod = event.index
667660

668-
if engine.setting_get("old_style_mod_selection") ~= "true" then
669-
if event.typ == "DCL" then
670-
local mod = filterlist.get_list(modmgr.modlist)[event.index]
671-
672-
if mod.typ == "game_mod" then
673-
return nil
674-
end
661+
if event.typ == "DCL" then
662+
local mod = filterlist.get_list(modmgr.modlist)[event.index]
663+
664+
if mod.typ == "game_mod" then
665+
return nil
666+
end
667+
668+
if not mod.is_modpack then
669+
mod.enabled = not mod.enabled
670+
else
671+
local list = filterlist.get_raw_list(modmgr.modlist)
672+
local toset = nil
675673

676-
if not mod.is_modpack then
677-
mod.enabled = not mod.enabled
678-
else
679-
local list = filterlist.get_raw_list(modmgr.modlist)
680-
local toset = nil
681-
682-
for i=1,#list,1 do
683-
if list[i].modpack == mod.name then
684-
if toset == nil then
685-
toset = not list[i].enabled
686-
end
687-
688-
list[i].enabled = toset
674+
for i=1,#list,1 do
675+
if list[i].modpack == mod.name then
676+
if toset == nil then
677+
toset = not list[i].enabled
689678
end
679+
680+
list[i].enabled = toset
690681
end
691682
end
692683
end
693684
end
694685
end
695686

696-
if engine.setting_get("old_style_mod_selection") == "true" then
697-
if fields["cb_mod_enable"] ~= nil then
698-
local mod = filterlist.get_list(modmgr.modlist)
699-
[engine.get_textlist_index("world_config_modlist")]
700-
if fields["cb_mod_enable"] == "true" then
701-
mod.enabled = true
702-
else
703-
mod.enabled = false
704-
end
687+
if fields["cb_mod_enable"] ~= nil then
688+
local mod = filterlist.get_list(modmgr.modlist)
689+
[engine.get_textlist_index("world_config_modlist")]
690+
if fields["cb_mod_enable"] == "true" then
691+
mod.enabled = true
692+
else
693+
mod.enabled = false
705694
end
695+
end
696+
697+
if fields["btn_mp_enable"] ~= nil or
698+
fields["btn_mp_disable"] then
699+
local mod = filterlist.get_list(modmgr.modlist)
700+
[engine.get_textlist_index("world_config_modlist")]
706701

707-
if fields["btn_mp_enable"] ~= nil or
708-
fields["btn_mp_disable"] then
709-
local mod = filterlist.get_list(modmgr.modlist)
710-
[engine.get_textlist_index("world_config_modlist")]
711-
712-
local toset=false
713-
if fields["btn_mp_enable"] ~= nil then
714-
toset = true
715-
end
716-
local list = filterlist.get_raw_list(modmgr.modlist)
717-
718-
for i=1,#list,1 do
719-
if list[i].modpack == mod.name then
720-
list[i].enabled = toset
721-
end
702+
local toset=false
703+
if fields["btn_mp_enable"] ~= nil then
704+
toset = true
705+
end
706+
local list = filterlist.get_raw_list(modmgr.modlist)
707+
708+
for i=1,#list,1 do
709+
if list[i].modpack == mod.name then
710+
list[i].enabled = toset
722711
end
723712
end
724713
end

‎src/defaultsettings.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ void set_default_settings(Settings *settings)
275275

276276
settings->setDefault("main_menu_script","");
277277
settings->setDefault("main_menu_mod_mgr","1");
278-
settings->setDefault("old_style_mod_selection","true");
279278
settings->setDefault("main_menu_game_mgr","0");
280279
settings->setDefault("modstore_download_url", "https://forum.minetest.net/media/");
281280
settings->setDefault("modstore_listmods_url", "https://forum.minetest.net/mmdb/mods/");

0 commit comments

Comments
 (0)
Please sign in to comment.