Skip to content

Commit b3db44f

Browse files
sapierPilzAdam
sapier
authored andcommittedJul 22, 2013
Fix bug in world creation
Add old style mod selection in worldconfig dialog
1 parent 4e2b394 commit b3db44f

File tree

3 files changed

+100
-25
lines changed

3 files changed

+100
-25
lines changed
 

‎builtin/mainmenu.lua

+7-4
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ function tabbuilder.handle_create_world_buttons(fields)
342342

343343
local message = nil
344344

345-
if not filterlist.uid_exists(worldlist,worldname) then
345+
if not filterlist.uid_exists_raw(worldlist,worldname) then
346346
engine.setting_set("mg_name",fields["dd_mapgen"])
347347
message = engine.create_world(worldname,gameindex)
348348
else
@@ -613,7 +613,6 @@ function tabbuilder.handle_settings_buttons(fields)
613613
if fields["cb_fancy_trees"] then
614614
engine.setting_setbool("new_style_leaves",tabbuilder.tobool(fields["cb_fancy_trees"]))
615615
end
616-
617616
if fields["cb_smooth_lighting"] then
618617
engine.setting_setbool("smooth_lighting",tabbuilder.tobool(fields["cb_smooth_lighting"]))
619618
end
@@ -623,7 +622,10 @@ function tabbuilder.handle_settings_buttons(fields)
623622
if fields["cb_opaque_water"] then
624623
engine.setting_setbool("opaque_water",tabbuilder.tobool(fields["cb_opaque_water"]))
625624
end
626-
625+
if fields["old_style_modselection"] then
626+
engine.setting_setbool("old_style_mod_selection",tabbuilder.tobool(fields["old_style_modselection"]))
627+
end
628+
627629
if fields["cb_mipmapping"] then
628630
engine.setting_setbool("mip_map",tabbuilder.tobool(fields["cb_mipmapping"]))
629631
end
@@ -908,6 +910,7 @@ function tabbuilder.tab_settings()
908910
"checkbox[1,1.25;cb_smooth_lighting;Smooth Lighting;".. dump(engine.setting_getbool("smooth_lighting")) .. "]"..
909911
"checkbox[1,1.75;cb_3d_clouds;3D Clouds;" .. dump(engine.setting_getbool("enable_3d_clouds")) .. "]"..
910912
"checkbox[1,2.25;cb_opaque_water;Opaque Water;" .. dump(engine.setting_getbool("opaque_water")) .. "]"..
913+
"checkbox[1,2.75;old_style_modselection;Old style modmgr;" .. dump(engine.setting_getbool("old_style_mod_selection")) .. "]"..
911914

912915
"checkbox[4,0.75;cb_mipmapping;Mip-Mapping;" .. dump(engine.setting_getbool("mip_map")) .. "]"..
913916
"checkbox[4,1.25;cb_anisotrophic;Anisotropic Filtering;".. dump(engine.setting_getbool("anisotropic_filter")) .. "]"..
@@ -919,7 +922,7 @@ function tabbuilder.tab_settings()
919922
"checkbox[7.5,1.75;cb_particles;Enable Particles;" .. dump(engine.setting_getbool("enable_particles")) .. "]"..
920923
"checkbox[7.5,2.25;cb_finite_liquid;Finite Liquid;" .. dump(engine.setting_getbool("liquid_finite")) .. "]"..
921924

922-
"button[1,3.75;2.25,0.5;btn_change_keys;Change keys]"
925+
"button[1,4.25;2.25,0.5;btn_change_keys;Change keys]"
923926
end
924927

925928
--------------------------------------------------------------------------------

‎builtin/modmgr.lua

+92-21
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,47 @@ function modmgr.dialog_configure_world()
393393
"textlist[0,1.5;5,4.25;world_config_depends;" ..
394394
modmgr.get_dependencies(mod.path) .. ";0]" ..
395395
"button[9.25,6.35;2,0.5;btn_config_world_save;Save]" ..
396-
"button[7.4,6.35;2,0.5;btn_config_world_cancel;Cancel]" ..
397-
"button[5.5,-0.125;5.75,0.5;btn_all_mods;Enable all Mods]" ..
396+
"button[7.4,6.35;2,0.5;btn_config_world_cancel;Cancel]"
397+
398+
if engine.setting_get("old_style_mod_selection") == "true" then
399+
local selected = engine.get_textlist_index("world_config_modlist")
400+
local mod = filterlist.get_list(modmgr.modlist)[selected]
401+
402+
if mod ~= nil then
403+
if mod.is_modpack then
404+
local rawlist = filterlist.get_raw_list(modmgr.modlist)
405+
406+
local all_enabled = true
407+
for j=1,#rawlist,1 do
408+
if rawlist[j].modpack == mod.name and
409+
rawlist[j].enabled ~= true then
410+
all_enabled = false
411+
break
412+
end
413+
end
414+
415+
if all_enabled == false then
416+
retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_enable;Enable MP]"
417+
else
418+
retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_disable;Disable MP]"
419+
end
420+
else
421+
if mod.enabled then
422+
retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;true]"
423+
else
424+
retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;enabled;false]"
425+
end
426+
end
427+
428+
end
429+
430+
retval = retval ..
431+
"button[8.5,-0.125;2.5,0.5;btn_all_mods;Enable all]"
432+
else
433+
retval = retval ..
434+
"button[5.5,-0.125;5.75,0.5;btn_all_mods;Enable all Mods]"
435+
end
436+
retval = retval ..
398437
"textlist[5.5,0.5;5.5,5.75;world_config_modlist;"
399438

400439

@@ -627,33 +666,65 @@ function modmgr.handle_configure_world_buttons(fields)
627666
if fields["world_config_modlist"] ~= nil then
628667
local event = explode_textlist_event(fields["world_config_modlist"])
629668
modmgr.world_config_selected_mod = event.index
669+
670+
if engine.setting_get("old_style_mod_selection") ~= "true" then
671+
if event.typ == "DCL" then
672+
local mod = filterlist.get_list(modmgr.modlist)[event.index]
673+
674+
if mod.typ == "game_mod" then
675+
return nil
676+
end
677+
678+
if not mod.is_modpack then
679+
mod.enabled = not mod.enabled
680+
else
681+
local list = filterlist.get_raw_list(modmgr.modlist)
682+
local toset = nil
683+
684+
for i=1,#list,1 do
685+
if list[i].modpack == mod.name then
686+
if toset == nil then
687+
toset = not list[i].enabled
688+
end
689+
690+
list[i].enabled = toset
691+
end
692+
end
693+
end
694+
end
695+
end
696+
end
697+
698+
if engine.setting_get("old_style_mod_selection") == "true" then
699+
if fields["cb_mod_enable"] ~= nil then
700+
local mod = filterlist.get_list(modmgr.modlist)
701+
[engine.get_textlist_index("world_config_modlist")]
702+
if fields["cb_mod_enable"] == "true" then
703+
mod.enabled = true
704+
else
705+
mod.enabled = false
706+
end
707+
end
630708

631-
if event.typ == "DCL" then
632-
local mod = filterlist.get_list(modmgr.modlist)[event.index]
709+
if fields["btn_mp_enable"] ~= nil or
710+
fields["btn_mp_disable"] then
711+
local mod = filterlist.get_list(modmgr.modlist)
712+
[engine.get_textlist_index("world_config_modlist")]
633713

634-
if mod.typ == "game_mod" then
635-
return nil
714+
local toset=false
715+
if fields["btn_mp_enable"] ~= nil then
716+
toset = true
636717
end
718+
local list = filterlist.get_raw_list(modmgr.modlist)
637719

638-
if not mod.is_modpack then
639-
mod.enabled = not mod.enabled
640-
else
641-
local list = filterlist.get_raw_list(modmgr.modlist)
642-
local toset = nil
643-
644-
for i=1,#list,1 do
645-
if list[i].modpack == mod.name then
646-
if toset == nil then
647-
toset = not list[i].enabled
648-
end
649-
650-
list[i].enabled = toset
651-
end
720+
for i=1,#list,1 do
721+
if list[i].modpack == mod.name then
722+
list[i].enabled = toset
652723
end
653724
end
654725
end
655726
end
656-
727+
657728
if fields["cb_hide_gamemods"] ~= nil then
658729
local current = filterlist.get_filtercriteria(modmgr.modlist)
659730

‎src/defaultsettings.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ void set_default_settings(Settings *settings)
264264
settings->setDefault("ipv6_server", "false");
265265

266266
settings->setDefault("main_menu_mod_mgr","1");
267+
settings->setDefault("old_style_mod_selection","true");
267268
settings->setDefault("main_menu_game_mgr","1");
268269
settings->setDefault("modstore_download_url", "http://forum.minetest.net/media/");
269270
settings->setDefault("modstore_listmods_url", "http://forum.minetest.net/mmdb/mods/");

0 commit comments

Comments
 (0)
Please sign in to comment.