18
18
---- ----------------------------------------------------------------------------
19
19
function get_mods (path ,retval ,modpack )
20
20
21
- local mods = engine .get_dirlist (path ,true )
21
+ local mods = core .get_dirlist (path ,true )
22
22
for i = 1 ,# mods ,1 do
23
23
local toadd = {}
24
24
local modpackfile = nil
@@ -55,8 +55,8 @@ function modmgr.extract(modfile)
55
55
56
56
if tempfolder ~= nil and
57
57
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
60
60
return tempfolder
61
61
end
62
62
end
@@ -92,7 +92,7 @@ function modmgr.getbasefolder(temppath)
92
92
}
93
93
end
94
94
95
- local subdirs = engine .get_dirlist (temppath ,true )
95
+ local subdirs = core .get_dirlist (temppath ,true )
96
96
97
97
-- only single mod or modpack allowed
98
98
if # subdirs ~= 1 then
@@ -260,7 +260,7 @@ function modmgr.tab()
260
260
end
261
261
262
262
retval = retval
263
- .. " image[6.5,5;3,2;" .. engine .formspec_escape (modscreenshot ) .. " ]"
263
+ .. " image[6.5,5;3,2;" .. core .formspec_escape (modscreenshot ) .. " ]"
264
264
.. " label[9.5,5.6;" .. selected_mod .name .. " ]"
265
265
266
266
local descriptionlines = nil
@@ -270,7 +270,7 @@ function modmgr.tab()
270
270
if error == nil then
271
271
descriptiontext = descriptionfile :read (" *all" )
272
272
273
- descriptionlines = engine .splittext (descriptiontext ,42 )
273
+ descriptionlines = core .splittext (descriptiontext ,42 )
274
274
descriptionfile :close ()
275
275
else
276
276
descriptionlines = {}
@@ -282,7 +282,7 @@ function modmgr.tab()
282
282
" textlist[6.5,7.2;8,2.4;description;"
283
283
284
284
for i = 1 ,# descriptionlines ,1 do
285
- retval = retval .. engine .formspec_escape (descriptionlines [i ]) .. " ,"
285
+ retval = retval .. core .formspec_escape (descriptionlines [i ]) .. " ,"
286
286
end
287
287
288
288
408
408
function modmgr .dialog_configure_world ()
409
409
modmgr .precheck ()
410
410
411
- local worldspec = engine .get_worlds ()[modmgr .world_config_selected_world ]
411
+ local worldspec = core .get_worlds ()[modmgr .world_config_selected_world ]
412
412
local mod = filterlist .get_list (modmgr .modlist )[modmgr .world_config_selected_mod ]
413
413
414
414
local retval =
@@ -543,7 +543,7 @@ function modmgr.get_worldconfig(worldpath)
543
543
if key == " gameid" then
544
544
worldconfig .id = value
545
545
else
546
- worldconfig .global_mods [key ] = engine .is_yes (value )
546
+ worldconfig .global_mods [key ] = core .is_yes (value )
547
547
end
548
548
end
549
549
@@ -562,12 +562,12 @@ function modmgr.handle_modmgr_buttons(fields)
562
562
}
563
563
564
564
if fields [" modlist" ] ~= nil then
565
- local event = engine .explode_textlist_event (fields [" modlist" ])
565
+ local event = core .explode_textlist_event (fields [" modlist" ])
566
566
modmgr .selected_mod = event .index
567
567
end
568
568
569
569
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:" ))
571
571
end
572
572
573
573
if fields [" btn_mod_mgr_download" ] ~= nil then
@@ -626,8 +626,8 @@ function modmgr.installmod(modfilename,basename)
626
626
end
627
627
628
628
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
631
631
gamedata .errormessage = fgettext (" Failed to install $1 to $2" , basename , targetpath )
632
632
end
633
633
else
@@ -648,14 +648,14 @@ function modmgr.installmod(modfilename,basename)
648
648
end
649
649
650
650
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 )
653
653
else
654
654
gamedata .errormessage = fgettext (" Install Mod: unable to find real modname for: $1" , modfilename )
655
655
end
656
656
end
657
657
658
- engine .delete_dir (modpath )
658
+ core .delete_dir (modpath )
659
659
660
660
modmgr .refresh_globals ()
661
661
@@ -666,9 +666,9 @@ function modmgr.handle_rename_modpack_buttons(fields)
666
666
667
667
if fields [" dlg_rename_modpack_confirm" ] ~= nil then
668
668
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 )
672
672
modmgr .refresh_globals ()
673
673
modmgr .selected_mod = filterlist .get_current_index (modmgr .global_mods ,
674
674
filterlist .raw_index_by_uid (modmgr .global_mods , fields [" te_modpack_name" ]))
@@ -677,13 +677,13 @@ function modmgr.handle_rename_modpack_buttons(fields)
677
677
return {
678
678
is_dialog = false ,
679
679
show_buttons = true ,
680
- current_tab = engine .setting_get (" main_menu_tab" )
680
+ current_tab = core .setting_get (" main_menu_tab" )
681
681
}
682
682
end
683
683
---- ----------------------------------------------------------------------------
684
684
function modmgr .handle_configure_world_buttons (fields )
685
685
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" ])
687
687
modmgr .world_config_selected_mod = event .index
688
688
689
689
if event .type == " DCL" then
@@ -696,7 +696,7 @@ function modmgr.handle_configure_world_buttons(fields)
696
696
end
697
697
698
698
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" ])
700
700
modmgr .world_config_enable_mod (toset )
701
701
end
702
702
@@ -713,7 +713,7 @@ function modmgr.handle_configure_world_buttons(fields)
713
713
current = {}
714
714
end
715
715
716
- if engine .is_yes (fields [" cb_hide_gamemods" ]) then
716
+ if core .is_yes (fields [" cb_hide_gamemods" ]) then
717
717
current .hide_game = true
718
718
modmgr .hide_gamemods = true
719
719
else
@@ -731,7 +731,7 @@ function modmgr.handle_configure_world_buttons(fields)
731
731
current = {}
732
732
end
733
733
734
- if engine .is_yes (fields [" cb_hide_mpcontent" ]) then
734
+ if core .is_yes (fields [" cb_hide_mpcontent" ]) then
735
735
current .hide_modpackcontents = true
736
736
modmgr .hide_modpackcontents = true
737
737
else
@@ -743,7 +743,7 @@ function modmgr.handle_configure_world_buttons(fields)
743
743
end
744
744
745
745
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 ]
747
747
748
748
local filename = worldspec .path ..
749
749
DIR_DELIM .. " world.mt"
@@ -774,7 +774,7 @@ function modmgr.handle_configure_world_buttons(fields)
774
774
end
775
775
776
776
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" )
778
778
end
779
779
780
780
modmgr .modlist = nil
@@ -783,7 +783,7 @@ function modmgr.handle_configure_world_buttons(fields)
783
783
return {
784
784
is_dialog = false ,
785
785
show_buttons = true ,
786
- current_tab = engine .setting_get (" main_menu_tab" )
786
+ current_tab = core .setting_get (" main_menu_tab" )
787
787
}
788
788
end
789
789
@@ -794,7 +794,7 @@ function modmgr.handle_configure_world_buttons(fields)
794
794
return {
795
795
is_dialog = false ,
796
796
show_buttons = true ,
797
- current_tab = engine .setting_get (" main_menu_tab" )
797
+ current_tab = core .setting_get (" main_menu_tab" )
798
798
}
799
799
end
800
800
814
814
---- ----------------------------------------------------------------------------
815
815
function modmgr .world_config_enable_mod (toset )
816
816
local mod = filterlist .get_list (modmgr .modlist )
817
- [engine .get_textlist_index (" world_config_modlist" )]
817
+ [core .get_textlist_index (" world_config_modlist" )]
818
818
819
819
if mod .typ == " game_mod" then
820
820
-- game mods can't be enabled or disabled
@@ -844,8 +844,8 @@ function modmgr.handle_delete_mod_buttons(fields)
844
844
845
845
if mod .path ~= nil and
846
846
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
849
849
gamedata .errormessage = fgettext (" Modmgr: failed to delete \" $1\" " , mod .path )
850
850
end
851
851
modmgr .refresh_globals ()
@@ -857,7 +857,7 @@ function modmgr.handle_delete_mod_buttons(fields)
857
857
return {
858
858
is_dialog = false ,
859
859
show_buttons = true ,
860
- current_tab = engine .setting_get (" main_menu_tab" )
860
+ current_tab = core .setting_get (" main_menu_tab" )
861
861
}
862
862
end
863
863
@@ -882,7 +882,7 @@ function modmgr.preparemodlist(data)
882
882
local game_mods = {}
883
883
884
884
-- read global mods
885
- local modpath = engine .get_modpath ()
885
+ local modpath = core .get_modpath ()
886
886
887
887
if modpath ~= nil and
888
888
modpath ~= " " then
@@ -924,9 +924,9 @@ function modmgr.preparemodlist(data)
924
924
end
925
925
end
926
926
if element ~= nil then
927
- element .enabled = engine .is_yes (value )
927
+ element .enabled = core .is_yes (value )
928
928
else
929
- engine .log (" info" , " Mod: " .. key .. " " .. dump (value ) .. " but not found" )
929
+ core .log (" info" , " Mod: " .. key .. " " .. dump (value ) .. " but not found" )
930
930
end
931
931
end
932
932
end
937
937
---- ----------------------------------------------------------------------------
938
938
function modmgr .init_worldconfig ()
939
939
modmgr .precheck ()
940
- local worldspec = engine .get_worlds ()[modmgr .world_config_selected_world ]
940
+ local worldspec = core .get_worlds ()[modmgr .world_config_selected_world ]
941
941
942
942
if worldspec ~= nil then
943
943
-- read worldconfig
0 commit comments