Skip to content

Commit 75c0d84

Browse files
committedJun 23, 2014
Fix mod tab
1 parent c7486f9 commit 75c0d84

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed
 

‎builtin/mainmenu/modmgr.lua

+36-36
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
--------------------------------------------------------------------------------
1919
function get_mods(path,retval,modpack)
2020

21-
local mods = engine.get_dirlist(path,true)
21+
local mods = core.get_dirlist(path,true)
2222
for i=1,#mods,1 do
2323
local toadd = {}
2424
local modpackfile = nil
@@ -55,8 +55,8 @@ function modmgr.extract(modfile)
5555

5656
if tempfolder ~= nil and
5757
tempfolder ~= "" then
58-
engine.create_dir(tempfolder)
59-
if engine.extract_zip(modfile.name,tempfolder) then
58+
core.create_dir(tempfolder)
59+
if core.extract_zip(modfile.name,tempfolder) then
6060
return tempfolder
6161
end
6262
end
@@ -92,7 +92,7 @@ function modmgr.getbasefolder(temppath)
9292
}
9393
end
9494

95-
local subdirs = engine.get_dirlist(temppath,true)
95+
local subdirs = core.get_dirlist(temppath,true)
9696

9797
--only single mod or modpack allowed
9898
if #subdirs ~= 1 then
@@ -260,7 +260,7 @@ function modmgr.tab()
260260
end
261261

262262
retval = retval
263-
.. "image[6.5,5;3,2;" .. engine.formspec_escape(modscreenshot) .. "]"
263+
.. "image[6.5,5;3,2;" .. core.formspec_escape(modscreenshot) .. "]"
264264
.. "label[9.5,5.6;" .. selected_mod.name .. "]"
265265

266266
local descriptionlines = nil
@@ -270,7 +270,7 @@ function modmgr.tab()
270270
if error == nil then
271271
descriptiontext = descriptionfile:read("*all")
272272

273-
descriptionlines = engine.splittext(descriptiontext,42)
273+
descriptionlines = core.splittext(descriptiontext,42)
274274
descriptionfile:close()
275275
else
276276
descriptionlines = {}
@@ -282,7 +282,7 @@ function modmgr.tab()
282282
"textlist[6.5,7.2;8,2.4;description;"
283283

284284
for i=1,#descriptionlines,1 do
285-
retval = retval .. engine.formspec_escape(descriptionlines[i]) .. ","
285+
retval = retval .. core.formspec_escape(descriptionlines[i]) .. ","
286286
end
287287

288288

@@ -408,7 +408,7 @@ end
408408
function modmgr.dialog_configure_world()
409409
modmgr.precheck()
410410

411-
local worldspec = engine.get_worlds()[modmgr.world_config_selected_world]
411+
local worldspec = core.get_worlds()[modmgr.world_config_selected_world]
412412
local mod = filterlist.get_list(modmgr.modlist)[modmgr.world_config_selected_mod]
413413

414414
local retval =
@@ -543,7 +543,7 @@ function modmgr.get_worldconfig(worldpath)
543543
if key == "gameid" then
544544
worldconfig.id = value
545545
else
546-
worldconfig.global_mods[key] = engine.is_yes(value)
546+
worldconfig.global_mods[key] = core.is_yes(value)
547547
end
548548
end
549549

@@ -562,12 +562,12 @@ function modmgr.handle_modmgr_buttons(fields)
562562
}
563563

564564
if fields["modlist"] ~= nil then
565-
local event = engine.explode_textlist_event(fields["modlist"])
565+
local event = core.explode_textlist_event(fields["modlist"])
566566
modmgr.selected_mod = event.index
567567
end
568568

569569
if fields["btn_mod_mgr_install_local"] ~= nil then
570-
engine.show_file_open_dialog("mod_mgt_open_dlg",fgettext("Select Mod File:"))
570+
core.show_file_open_dialog("mod_mgt_open_dlg",fgettext("Select Mod File:"))
571571
end
572572

573573
if fields["btn_mod_mgr_download"] ~= nil then
@@ -626,8 +626,8 @@ function modmgr.installmod(modfilename,basename)
626626
end
627627

628628
if clean_path ~= nil then
629-
local targetpath = engine.get_modpath() .. DIR_DELIM .. clean_path
630-
if not engine.copy_dir(basefolder.path,targetpath) then
629+
local targetpath = core.get_modpath() .. DIR_DELIM .. clean_path
630+
if not core.copy_dir(basefolder.path,targetpath) then
631631
gamedata.errormessage = fgettext("Failed to install $1 to $2", basename, targetpath)
632632
end
633633
else
@@ -648,14 +648,14 @@ function modmgr.installmod(modfilename,basename)
648648
end
649649

650650
if targetfolder ~= nil and modmgr.isValidModname(targetfolder) then
651-
local targetpath = engine.get_modpath() .. DIR_DELIM .. targetfolder
652-
engine.copy_dir(basefolder.path,targetpath)
651+
local targetpath = core.get_modpath() .. DIR_DELIM .. targetfolder
652+
core.copy_dir(basefolder.path,targetpath)
653653
else
654654
gamedata.errormessage = fgettext("Install Mod: unable to find real modname for: $1", modfilename)
655655
end
656656
end
657657

658-
engine.delete_dir(modpath)
658+
core.delete_dir(modpath)
659659

660660
modmgr.refresh_globals()
661661

@@ -666,9 +666,9 @@ function modmgr.handle_rename_modpack_buttons(fields)
666666

667667
if fields["dlg_rename_modpack_confirm"] ~= nil then
668668
local mod = filterlist.get_list(modmgr.global_mods)[modmgr.selected_mod]
669-
local oldpath = engine.get_modpath() .. DIR_DELIM .. mod.name
670-
local targetpath = engine.get_modpath() .. DIR_DELIM .. fields["te_modpack_name"]
671-
engine.copy_dir(oldpath,targetpath,false)
669+
local oldpath = core.get_modpath() .. DIR_DELIM .. mod.name
670+
local targetpath = core.get_modpath() .. DIR_DELIM .. fields["te_modpack_name"]
671+
core.copy_dir(oldpath,targetpath,false)
672672
modmgr.refresh_globals()
673673
modmgr.selected_mod = filterlist.get_current_index(modmgr.global_mods,
674674
filterlist.raw_index_by_uid(modmgr.global_mods, fields["te_modpack_name"]))
@@ -677,13 +677,13 @@ function modmgr.handle_rename_modpack_buttons(fields)
677677
return {
678678
is_dialog = false,
679679
show_buttons = true,
680-
current_tab = engine.setting_get("main_menu_tab")
680+
current_tab = core.setting_get("main_menu_tab")
681681
}
682682
end
683683
--------------------------------------------------------------------------------
684684
function modmgr.handle_configure_world_buttons(fields)
685685
if fields["world_config_modlist"] ~= nil then
686-
local event = engine.explode_textlist_event(fields["world_config_modlist"])
686+
local event = core.explode_textlist_event(fields["world_config_modlist"])
687687
modmgr.world_config_selected_mod = event.index
688688

689689
if event.type == "DCL" then
@@ -696,7 +696,7 @@ function modmgr.handle_configure_world_buttons(fields)
696696
end
697697

698698
if fields["cb_mod_enable"] ~= nil then
699-
local toset = engine.is_yes(fields["cb_mod_enable"])
699+
local toset = core.is_yes(fields["cb_mod_enable"])
700700
modmgr.world_config_enable_mod(toset)
701701
end
702702

@@ -713,7 +713,7 @@ function modmgr.handle_configure_world_buttons(fields)
713713
current = {}
714714
end
715715

716-
if engine.is_yes(fields["cb_hide_gamemods"]) then
716+
if core.is_yes(fields["cb_hide_gamemods"]) then
717717
current.hide_game = true
718718
modmgr.hide_gamemods = true
719719
else
@@ -731,7 +731,7 @@ function modmgr.handle_configure_world_buttons(fields)
731731
current = {}
732732
end
733733

734-
if engine.is_yes(fields["cb_hide_mpcontent"]) then
734+
if core.is_yes(fields["cb_hide_mpcontent"]) then
735735
current.hide_modpackcontents = true
736736
modmgr.hide_modpackcontents = true
737737
else
@@ -743,7 +743,7 @@ function modmgr.handle_configure_world_buttons(fields)
743743
end
744744

745745
if fields["btn_config_world_save"] then
746-
local worldspec = engine.get_worlds()[modmgr.world_config_selected_world]
746+
local worldspec = core.get_worlds()[modmgr.world_config_selected_world]
747747

748748
local filename = worldspec.path ..
749749
DIR_DELIM .. "world.mt"
@@ -774,7 +774,7 @@ function modmgr.handle_configure_world_buttons(fields)
774774
end
775775

776776
if not worldfile:write() then
777-
engine.log("error", "Failed to write world config file")
777+
core.log("error", "Failed to write world config file")
778778
end
779779

780780
modmgr.modlist = nil
@@ -783,7 +783,7 @@ function modmgr.handle_configure_world_buttons(fields)
783783
return {
784784
is_dialog = false,
785785
show_buttons = true,
786-
current_tab = engine.setting_get("main_menu_tab")
786+
current_tab = core.setting_get("main_menu_tab")
787787
}
788788
end
789789

@@ -794,7 +794,7 @@ function modmgr.handle_configure_world_buttons(fields)
794794
return {
795795
is_dialog = false,
796796
show_buttons = true,
797-
current_tab = engine.setting_get("main_menu_tab")
797+
current_tab = core.setting_get("main_menu_tab")
798798
}
799799
end
800800

@@ -814,7 +814,7 @@ end
814814
--------------------------------------------------------------------------------
815815
function modmgr.world_config_enable_mod(toset)
816816
local mod = filterlist.get_list(modmgr.modlist)
817-
[engine.get_textlist_index("world_config_modlist")]
817+
[core.get_textlist_index("world_config_modlist")]
818818

819819
if mod.typ == "game_mod" then
820820
-- game mods can't be enabled or disabled
@@ -844,8 +844,8 @@ function modmgr.handle_delete_mod_buttons(fields)
844844

845845
if mod.path ~= nil and
846846
mod.path ~= "" and
847-
mod.path ~= engine.get_modpath() then
848-
if not engine.delete_dir(mod.path) then
847+
mod.path ~= core.get_modpath() then
848+
if not core.delete_dir(mod.path) then
849849
gamedata.errormessage = fgettext("Modmgr: failed to delete \"$1\"", mod.path)
850850
end
851851
modmgr.refresh_globals()
@@ -857,7 +857,7 @@ function modmgr.handle_delete_mod_buttons(fields)
857857
return {
858858
is_dialog = false,
859859
show_buttons = true,
860-
current_tab = engine.setting_get("main_menu_tab")
860+
current_tab = core.setting_get("main_menu_tab")
861861
}
862862
end
863863

@@ -882,7 +882,7 @@ function modmgr.preparemodlist(data)
882882
local game_mods = {}
883883

884884
--read global mods
885-
local modpath = engine.get_modpath()
885+
local modpath = core.get_modpath()
886886

887887
if modpath ~= nil and
888888
modpath ~= "" then
@@ -924,9 +924,9 @@ function modmgr.preparemodlist(data)
924924
end
925925
end
926926
if element ~= nil then
927-
element.enabled = engine.is_yes(value)
927+
element.enabled = core.is_yes(value)
928928
else
929-
engine.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
929+
core.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
930930
end
931931
end
932932
end
@@ -937,7 +937,7 @@ end
937937
--------------------------------------------------------------------------------
938938
function modmgr.init_worldconfig()
939939
modmgr.precheck()
940-
local worldspec = engine.get_worlds()[modmgr.world_config_selected_world]
940+
local worldspec = core.get_worlds()[modmgr.world_config_selected_world]
941941

942942
if worldspec ~= nil then
943943
--read worldconfig

0 commit comments

Comments
 (0)