@@ -23,7 +23,49 @@ local function modname_valid(name)
23
23
return not name :find (" [^a-z0-9_]" )
24
24
end
25
25
26
+ local function init_data (data )
27
+ data .list = filterlist .create (
28
+ pkgmgr .preparemodlist ,
29
+ pkgmgr .comparemod ,
30
+ function (element , uid )
31
+ if element .name == uid then
32
+ return true
33
+ end
34
+ end ,
35
+ function (element , criteria )
36
+ if criteria .hide_game and
37
+ element .is_game_content then
38
+ return false
39
+ end
40
+
41
+ if criteria .hide_modpackcontents and
42
+ element .modpack ~= nil then
43
+ return false
44
+ end
45
+ return true
46
+ end ,
47
+ {
48
+ worldpath = data .worldspec .path ,
49
+ gameid = data .worldspec .gameid
50
+ })
51
+
52
+ if data .selected_mod > data .list :size () then
53
+ data .selected_mod = 0
54
+ end
55
+
56
+ data .list :set_filtercriteria ({
57
+ hide_game = data .hide_gamemods ,
58
+ hide_modpackcontents = data .hide_modpackcontents
59
+ })
60
+ data .list :add_sort_mechanism (" alphabetic" , sort_mod_list )
61
+ data .list :set_sortmode (" alphabetic" )
62
+ end
63
+
26
64
local function get_formspec (data )
65
+ if not data .list then
66
+ init_data (data )
67
+ end
68
+
27
69
local mod = data .list :get_list ()[data .selected_mod ] or {name = " " }
28
70
29
71
local retval =
@@ -85,11 +127,14 @@ local function get_formspec(data)
85
127
end
86
128
end
87
129
end
130
+
88
131
retval = retval ..
89
132
" button[3.25,7;2.5,0.5;btn_config_world_save;" ..
90
133
fgettext (" Save" ) .. " ]" ..
91
134
" button[5.75,7;2.5,0.5;btn_config_world_cancel;" ..
92
- fgettext (" Cancel" ) .. " ]"
135
+ fgettext (" Cancel" ) .. " ]" ..
136
+ " button[9,7;2.5,0.5;btn_config_world_cdb;" ..
137
+ fgettext (" Find More Mods" ) .. " ]"
93
138
94
139
if mod .name ~= " " and not mod .is_game_content then
95
140
if mod .is_modpack then
@@ -198,6 +243,16 @@ local function handle_buttons(this, fields)
198
243
return true
199
244
end
200
245
246
+ if fields .btn_config_world_cdb then
247
+ this .data .list = nil
248
+
249
+ local dlg = create_store_dlg (" mod" )
250
+ dlg :set_parent (this )
251
+ this :hide ()
252
+ dlg :show ()
253
+ return true
254
+ end
255
+
201
256
if fields .btn_enable_all_mods then
202
257
local list = this .data .list :get_raw_list ()
203
258
@@ -247,43 +302,5 @@ function create_configure_world_dlg(worldidx)
247
302
return
248
303
end
249
304
250
- dlg .data .list = filterlist .create (
251
- pkgmgr .preparemodlist ,
252
- pkgmgr .comparemod ,
253
- function (element , uid )
254
- if element .name == uid then
255
- return true
256
- end
257
- end ,
258
- function (element , criteria )
259
- if criteria .hide_game and
260
- element .is_game_content then
261
- return false
262
- end
263
-
264
- if criteria .hide_modpackcontents and
265
- element .modpack ~= nil then
266
- return false
267
- end
268
- return true
269
- end ,
270
- {
271
- worldpath = dlg .data .worldspec .path ,
272
- gameid = dlg .data .worldspec .gameid
273
- }
274
- )
275
-
276
-
277
- if dlg .data .selected_mod > dlg .data .list :size () then
278
- dlg .data .selected_mod = 0
279
- end
280
-
281
- dlg .data .list :set_filtercriteria ({
282
- hide_game = dlg .data .hide_gamemods ,
283
- hide_modpackcontents = dlg .data .hide_modpackcontents
284
- })
285
- dlg .data .list :add_sort_mechanism (" alphabetic" , sort_mod_list )
286
- dlg .data .list :set_sortmode (" alphabetic" )
287
-
288
305
return dlg
289
306
end
0 commit comments