@@ -118,6 +118,7 @@ local function handle_buttons(this, fields)
118
118
if fields [" world_config_modlist" ] ~= nil then
119
119
local event = core .explode_textlist_event (fields [" world_config_modlist" ])
120
120
this .data .selected_mod = event .index
121
+ core .setting_set (" world_config_selected_mod" , event .index )
121
122
122
123
if event .type == " DCL" then
123
124
enable_mod (this )
@@ -151,21 +152,29 @@ local function handle_buttons(this, fields)
151
152
if current == nil then
152
153
current = {}
153
154
end
154
-
155
- if core .is_yes (fields [" cb_hide_gamemods" ]) then
156
- current .hide_game = true
157
- this .data .hide_gamemods = true
158
- else
159
- current .hide_game = false
160
- this .data .hide_gamemods = false
161
- end
162
155
163
- if core .is_yes (fields [" cb_hide_mpcontent" ]) then
164
- current .hide_modpackcontents = true
165
- this .data .hide_modpackcontents = true
166
- else
167
- current .hide_modpackcontents = false
168
- this .data .hide_modpackcontents = false
156
+ if fields [" cb_hide_gamemods" ] ~= nil then
157
+ if core .is_yes (fields [" cb_hide_gamemods" ]) then
158
+ current .hide_game = true
159
+ this .data .hide_gamemods = true
160
+ core .setting_set (" world_config_hide_gamemods" , " true" )
161
+ else
162
+ current .hide_game = false
163
+ this .data .hide_gamemods = false
164
+ core .setting_set (" world_config_hide_gamemods" , " false" )
165
+ end
166
+ end
167
+
168
+ if fields [" cb_hide_mpcontent" ] ~= nil then
169
+ if core .is_yes (fields [" cb_hide_mpcontent" ]) then
170
+ current .hide_modpackcontents = true
171
+ this .data .hide_modpackcontents = true
172
+ core .setting_set (" world_config_hide_modpackcontents" , " true" )
173
+ else
174
+ current .hide_modpackcontents = false
175
+ this .data .hide_modpackcontents = false
176
+ core .setting_set (" world_config_hide_modpackcontents" , " false" )
177
+ end
169
178
end
170
179
171
180
this .data .list :set_filtercriteria (current )
@@ -237,10 +246,12 @@ function create_configure_world_dlg(worldidx)
237
246
handle_buttons ,
238
247
nil )
239
248
240
- -- TODO read from settings
241
- dlg .data .hide_gamemods = false
242
- dlg .data .hide_modpackcontents = false
243
- dlg .data .selected_mod = 0
249
+ dlg .data .hide_gamemods = core .setting_getbool (" world_config_hide_gamemods" )
250
+ dlg .data .hide_modpackcontents = core .setting_getbool (" world_config_hide_modpackcontents" )
251
+ dlg .data .selected_mod = tonumber (core .setting_get (" world_config_selected_mod" ))
252
+ if dlg .data .selected_mod == nil then
253
+ dlg .data .selected_mod = 0
254
+ end
244
255
245
256
dlg .data .worldspec = core .get_worlds ()[worldidx ]
246
257
if dlg .data .worldspec == nil then dlg :delete () return nil end
@@ -277,14 +288,19 @@ function create_configure_world_dlg(worldidx)
277
288
{ worldpath = dlg .data .worldspec .path ,
278
289
gameid = dlg .data .worldspec .gameid }
279
290
)
280
-
291
+
292
+
293
+ if dlg .data .selected_mod > dlg .data .list :size () then
294
+ dlg .data .selected_mod = 0
295
+ end
296
+
281
297
dlg .data .list :set_filtercriteria (
282
298
{
283
299
hide_game = dlg .data .hide_gamemods ,
284
300
hide_modpackcontents = dlg .data .hide_modpackcontents
285
301
})
286
302
dlg .data .list :add_sort_mechanism (" alphabetic" , sort_mod_list )
287
303
dlg .data .list :set_sortmode (" alphabetic" )
288
-
304
+
289
305
return dlg
290
306
end
0 commit comments