diff options
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r-- | builtin/mainmenu/common.lua | 14 | ||||
-rw-r--r-- | builtin/mainmenu/dlg_config_world.lua | 4 | ||||
-rw-r--r-- | builtin/mainmenu/dlg_create_world.lua | 14 | ||||
-rw-r--r-- | builtin/mainmenu/dlg_settings_advanced.lua | 32 | ||||
-rw-r--r-- | builtin/mainmenu/init.lua | 8 | ||||
-rw-r--r-- | builtin/mainmenu/store.lua | 6 | ||||
-rw-r--r-- | builtin/mainmenu/tab_multiplayer.lua | 32 | ||||
-rw-r--r-- | builtin/mainmenu/tab_server.lua | 34 | ||||
-rw-r--r-- | builtin/mainmenu/tab_settings.lua | 120 | ||||
-rw-r--r-- | builtin/mainmenu/tab_simple_main.lua | 30 | ||||
-rw-r--r-- | builtin/mainmenu/tab_singleplayer.lua | 18 | ||||
-rw-r--r-- | builtin/mainmenu/tab_texturepacks.lua | 8 | ||||
-rw-r--r-- | builtin/mainmenu/textures.lua | 6 |
13 files changed, 161 insertions, 165 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua index 57950c62c..294e1a621 100644 --- a/builtin/mainmenu/common.lua +++ b/builtin/mainmenu/common.lua @@ -43,10 +43,10 @@ end local function configure_selected_world_params(idx) local worldconfig = modmgr.get_worldconfig(menudata.worldlist:get_list()[idx].path) if worldconfig.creative_mode then - core.setting_set("creative_mode", worldconfig.creative_mode) + core.settings:set("creative_mode", worldconfig.creative_mode) end if worldconfig.enable_damage then - core.setting_set("enable_damage", worldconfig.enable_damage) + core.settings:set("enable_damage", worldconfig.enable_damage) end end @@ -164,8 +164,8 @@ end -------------------------------------------------------------------------------- os.tempfolder = function() - if core.setting_get("TMPFolder") then - return core.setting_get("TMPFolder") .. DIR_DELIM .. "MT_" .. math.random(0,10000) + if core.settings:get("TMPFolder") then + return core.settings:get("TMPFolder") .. DIR_DELIM .. "MT_" .. math.random(0,10000) end local filetocheck = os.tmpname() @@ -206,7 +206,7 @@ function menu_handle_key_up_down(fields, textlist, settingname) oldidx < menudata.worldlist:size() then newidx = oldidx + 1 end - core.setting_set(settingname, menudata.worldlist:get_raw_index(newidx)) + core.settings:set(settingname, menudata.worldlist:get_raw_index(newidx)) configure_selected_world_params(newidx) return true end @@ -328,9 +328,9 @@ function menu_worldmt_legacy(selected) for _, mode_name in pairs(modes_names) do local mode_val = menu_worldmt(selected, mode_name) if mode_val then - core.setting_set(mode_name, mode_val) + core.settings:set(mode_name, mode_val) else - menu_worldmt(selected, mode_name, core.setting_get(mode_name)) + menu_worldmt(selected, mode_name, core.settings:get(mode_name)) end end end diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua index 619c927c5..3e5ba16eb 100644 --- a/builtin/mainmenu/dlg_config_world.lua +++ b/builtin/mainmenu/dlg_config_world.lua @@ -123,7 +123,7 @@ local function handle_buttons(this, fields) if fields["world_config_modlist"] ~= nil then local event = core.explode_table_event(fields["world_config_modlist"]) this.data.selected_mod = event.row - core.setting_set("world_config_selected_mod", event.row) + core.settings:set("world_config_selected_mod", event.row) if event.type == "DCL" then enable_mod(this) @@ -227,7 +227,7 @@ function create_configure_world_dlg(worldidx) handle_buttons, nil) - dlg.data.selected_mod = tonumber(core.setting_get("world_config_selected_mod")) + dlg.data.selected_mod = tonumber(core.settings:get("world_config_selected_mod")) if dlg.data.selected_mod == nil then dlg.data.selected_mod = 0 end diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 477b8bcb9..e9ca7799f 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -18,8 +18,8 @@ local function create_world_formspec(dialogdata) local mapgens = core.get_mapgen_names() - local current_seed = core.setting_get("fixed_map_seed") or "" - local current_mg = core.setting_get("mg_name") + local current_seed = core.settings:get("fixed_map_seed") or "" + local current_mg = core.settings:get("mg_name") local mglist = "" local selindex = 1 @@ -33,7 +33,7 @@ local function create_world_formspec(dialogdata) end mglist = mglist:sub(1, -2) - local gameid = core.setting_get("menu_last_game") + local gameid = core.settings:get("menu_last_game") local game, gameidx = nil , 0 if gameid ~= nil then @@ -90,10 +90,10 @@ local function create_world_buttonhandler(this, fields) local message = nil - core.setting_set("fixed_map_seed", fields["te_seed"]) + core.settings:set("fixed_map_seed", fields["te_seed"]) if not menudata.worldlist:uid_exists_raw(worldname) then - core.setting_set("mg_name",fields["dd_mapgen"]) + core.settings:set("mg_name",fields["dd_mapgen"]) message = core.create_world(worldname,gameindex) else message = fgettext("A world named \"$1\" already exists", worldname) @@ -102,13 +102,13 @@ local function create_world_buttonhandler(this, fields) if message ~= nil then gamedata.errormessage = message else - core.setting_set("menu_last_game",gamemgr.games[gameindex].id) + core.settings:set("menu_last_game",gamemgr.games[gameindex].id) if this.data.update_worldlist_filter then menudata.worldlist:set_filtercriteria(gamemgr.games[gameindex].id) mm_texture.update("singleplayer", gamemgr.games[gameindex].id) end menudata.worldlist:refresh() - core.setting_set("mainmenu_last_selected_world", + core.settings:set("mainmenu_last_selected_world", menudata.worldlist:raw_index_by_uid(worldname)) end else diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua index c63eb972e..206ce1620 100644 --- a/builtin/mainmenu/dlg_settings_advanced.lua +++ b/builtin/mainmenu/dlg_settings_advanced.lua @@ -423,7 +423,7 @@ local settings = full_settings local selected_setting = 1 local function get_current_value(setting) - local value = core.setting_get(setting.name) + local value = core.settings:get(setting.name) if value == nil then value = setting.default end @@ -539,11 +539,11 @@ local function handle_change_setting_buttons(this, fields) if setting.type == "bool" then local new_value = fields["dd_setting_value"] -- Note: new_value is the actual (translated) value shown in the dropdown - core.setting_setbool(setting.name, new_value == fgettext("Enabled")) + core.settings:set_bool(setting.name, new_value == fgettext("Enabled")) elseif setting.type == "enum" then local new_value = fields["dd_setting_value"] - core.setting_set(setting.name, new_value) + core.settings:set(setting.name, new_value) elseif setting.type == "int" then local new_value = tonumber(fields["te_setting_value"]) @@ -565,7 +565,7 @@ local function handle_change_setting_buttons(this, fields) core.update_formspec(this:get_formspec()) return true end - core.setting_set(setting.name, new_value) + core.settings:set(setting.name, new_value) elseif setting.type == "float" then local new_value = tonumber(fields["te_setting_value"]) @@ -575,7 +575,7 @@ local function handle_change_setting_buttons(this, fields) core.update_formspec(this:get_formspec()) return true end - core.setting_set(setting.name, new_value) + core.settings:set(setting.name, new_value) elseif setting.type == "flags" then local new_value = fields["te_setting_value"] @@ -589,13 +589,13 @@ local function handle_change_setting_buttons(this, fields) return true end end - core.setting_set(setting.name, new_value) + core.settings:set(setting.name, new_value) else local new_value = fields["te_setting_value"] - core.setting_set(setting.name, new_value) + core.settings:set(setting.name, new_value) end - core.setting_save() + core.settings:write() this:delete() return true end @@ -629,7 +629,7 @@ local function create_settings_formspec(tabview, name, tabdata) local current_level = 0 for _, entry in ipairs(settings) do local name - if not core.setting_getbool("main_menu_technical_settings") and entry.readable_name then + if not core.settings:get_bool("main_menu_technical_settings") and entry.readable_name then name = fgettext_ne(entry.readable_name) else name = entry.name @@ -666,7 +666,7 @@ local function create_settings_formspec(tabview, name, tabdata) "button[10,6;2,1;btn_edit;" .. fgettext("Edit") .. "]" .. "button[7,6;3,1;btn_restore;" .. fgettext("Restore Default") .. "]" .. "checkbox[0,5.3;cb_tech_settings;" .. fgettext("Show technical names") .. ";" - .. dump(core.setting_getbool("main_menu_technical_settings")) .. "]" + .. dump(core.settings:get_bool("main_menu_technical_settings")) .. "]" return formspec end @@ -680,8 +680,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) local setting = settings[selected_setting] if setting and setting.type == "bool" then local current_value = get_current_value(setting) - core.setting_setbool(setting.name, not core.is_yes(current_value)) - core.setting_save() + core.settings:set_bool(setting.name, not core.is_yes(current_value)) + core.settings:write() return true else list_enter = true @@ -736,8 +736,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) if fields["btn_restore"] then local setting = settings[selected_setting] if setting and setting.type ~= "category" then - core.setting_set(setting.name, setting.default) - core.setting_save() + core.settings:set(setting.name, setting.default) + core.settings:write() core.update_formspec(this:get_formspec()) end return true @@ -749,8 +749,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) end if fields["cb_tech_settings"] then - core.setting_set("main_menu_technical_settings", fields["cb_tech_settings"]) - core.setting_save() + core.settings:set("main_menu_technical_settings", fields["cb_tech_settings"]) + core.settings:write() core.update_formspec(this:get_formspec()) return true end diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua index 79e6d5c02..492bb22d6 100644 --- a/builtin/mainmenu/init.lua +++ b/builtin/mainmenu/init.lua @@ -119,9 +119,9 @@ local function init_globals() menudata.worldlist:add_sort_mechanism("alphabetic", sort_worlds_alphabetic) menudata.worldlist:set_sortmode("alphabetic") - if not core.setting_get("menu_last_game") then - local default_game = core.setting_get("default_game") or "minetest" - core.setting_set("menu_last_game", default_game) + if not core.settings:get("menu_last_game") then + local default_game = core.settings:get("default_game") or "minetest" + core.settings:set("menu_last_game", default_game) end mm_texture.init() @@ -149,7 +149,7 @@ local function init_globals() tv_main:set_fixed_size(false) if PLATFORM ~= "Android" then - tv_main:set_tab(core.setting_get("maintab_LAST")) + tv_main:set_tab(core.settings:get("maintab_LAST")) end ui.set_default("maintab") tv_main:show() diff --git a/builtin/mainmenu/store.lua b/builtin/mainmenu/store.lua index ad861082d..59391f8bc 100644 --- a/builtin/mainmenu/store.lua +++ b/builtin/mainmenu/store.lua @@ -233,14 +233,14 @@ function modstore.handle_buttons(parent, fields, name, data) if not core.handle_async( function(param) - local fullurl = core.setting_get("modstore_download_url") .. + local fullurl = core.settings:get("modstore_download_url") .. param.moddetails.download_url if param.version ~= nil then local found = false for i=1,#param.moddetails.versions, 1 do if param.moddetails.versions[i].date:sub(1,10) == param.version then - fullurl = core.setting_get("modstore_download_url") .. + fullurl = core.settings:get("modstore_download_url") .. param.moddetails.versions[i].download_url found = true end @@ -400,7 +400,7 @@ function modstore.getscreenshot(ypos,listentry) listentry.texturename = "in progress" --prepare url and filename - local fullurl = core.setting_get("modstore_download_url") .. + local fullurl = core.settings:get("modstore_download_url") .. listentry.details.screenshot_url local filename = os.tempfolder() .. "_MID_" .. listentry.id diff --git a/builtin/mainmenu/tab_multiplayer.lua b/builtin/mainmenu/tab_multiplayer.lua index 0f4921b03..a9b2b35fe 100644 --- a/builtin/mainmenu/tab_multiplayer.lua +++ b/builtin/mainmenu/tab_multiplayer.lua @@ -39,14 +39,14 @@ local function get_formspec(tabview, name, tabdata) -- Address / Port "label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" .. "field[8,0.65;3.25,0.5;te_address;;" .. - core.formspec_escape(core.setting_get("address")) .. "]" .. + core.formspec_escape(core.settings:get("address")) .. "]" .. "field[11.1,0.65;1.4,0.5;te_port;;" .. - core.formspec_escape(core.setting_get("remote_port")) .. "]" .. + core.formspec_escape(core.settings:get("remote_port")) .. "]" .. -- Name / Password "label[7.75,0.95;" .. fgettext("Name / Password") .. "]" .. "field[8,1.85;2.9,0.5;te_name;;" .. - core.formspec_escape(core.setting_get("name")) .. "]" .. + core.formspec_escape(core.settings:get("name")) .. "]" .. "pwdfield[10.73,1.85;1.77,0.5;te_pwd;]" .. -- Description Background @@ -135,7 +135,7 @@ local function main_button_handler(tabview, fields, name, tabdata) if fields.te_name then gamedata.playername = fields.te_name - core.setting_set("name", fields.te_name) + core.settings:set("name", fields.te_name) end if fields.favourites then @@ -163,8 +163,8 @@ local function main_button_handler(tabview, fields, name, tabdata) gamedata.serverdescription = fav.description if gamedata.address and gamedata.port then - core.setting_set("address", gamedata.address) - core.setting_set("remote_port", gamedata.port) + core.settings:set("address", gamedata.address) + core.settings:set("remote_port", gamedata.port) core.start() end end @@ -187,8 +187,8 @@ local function main_button_handler(tabview, fields, name, tabdata) end if address and port then - core.setting_set("address", address) - core.setting_set("remote_port", port) + core.settings:set("address", address) + core.settings:set("remote_port", port) end tabdata.fav_selected = event.row end @@ -219,8 +219,8 @@ local function main_button_handler(tabview, fields, name, tabdata) local port = fav.port gamedata.serverdescription = fav.description if address and port then - core.setting_set("address", address) - core.setting_set("remote_port", port) + core.settings:set("address", address) + core.settings:set("remote_port", port) end tabdata.fav_selected = fav_idx @@ -235,8 +235,8 @@ local function main_button_handler(tabview, fields, name, tabdata) asyncOnlineFavourites() tabdata.fav_selected = nil - core.setting_set("address", "") - core.setting_set("remote_port", "30000") + core.settings:set("address", "") + core.settings:set("remote_port", "30000") return true end @@ -293,8 +293,8 @@ local function main_button_handler(tabview, fields, name, tabdata) end) menudata.search_result = search_result local first_server = search_result[1] - core.setting_set("address", first_server.address) - core.setting_set("remote_port", first_server.port) + core.settings:set("address", first_server.address) + core.settings:set("remote_port", first_server.port) end return true end @@ -325,8 +325,8 @@ local function main_button_handler(tabview, fields, name, tabdata) gamedata.serverdescription = "" end - core.setting_set("address", fields.te_address) - core.setting_set("remote_port", fields.te_port) + core.settings:set("address", fields.te_address) + core.settings:set("remote_port", fields.te_port) core.start() return true diff --git a/builtin/mainmenu/tab_server.lua b/builtin/mainmenu/tab_server.lua index be57ad7ef..8f25ce871 100644 --- a/builtin/mainmenu/tab_server.lua +++ b/builtin/mainmenu/tab_server.lua @@ -19,7 +19,7 @@ local function get_formspec(tabview, name, tabdata) local index = menudata.worldlist:get_current_index( - tonumber(core.setting_get("mainmenu_last_selected_world")) + tonumber(core.settings:get("mainmenu_last_selected_world")) ) local retval = @@ -29,29 +29,29 @@ local function get_formspec(tabview, name, tabdata) "button[8.5,5;3.25,0.5;start_server;" .. fgettext("Start Game") .. "]" .. "label[4,-0.25;" .. fgettext("Select World:") .. "]" .. "checkbox[0.25,0.25;cb_creative_mode;" .. fgettext("Creative Mode") .. ";" .. - dump(core.setting_getbool("creative_mode")) .. "]" .. + dump(core.settings:get_bool("creative_mode")) .. "]" .. "checkbox[0.25,0.7;cb_enable_damage;" .. fgettext("Enable Damage") .. ";" .. - dump(core.setting_getbool("enable_damage")) .. "]" .. + dump(core.settings:get_bool("enable_damage")) .. "]" .. "checkbox[0.25,1.15;cb_server_announce;" .. fgettext("Public") .. ";" .. - dump(core.setting_getbool("server_announce")) .. "]" .. + dump(core.settings:get_bool("server_announce")) .. "]" .. "label[0.25,2.2;" .. fgettext("Name/Password") .. "]" .. "field[0.55,3.2;3.5,0.5;te_playername;;" .. - core.formspec_escape(core.setting_get("name")) .. "]" .. + core.formspec_escape(core.settings:get("name")) .. "]" .. "pwdfield[0.55,4;3.5,0.5;te_passwd;]" - local bind_addr = core.setting_get("bind_address") + local bind_addr = core.settings:get("bind_address") if bind_addr ~= nil and bind_addr ~= "" then retval = retval .. "field[0.55,5.2;2.25,0.5;te_serveraddr;" .. fgettext("Bind Address") .. ";" .. - core.formspec_escape(core.setting_get("bind_address")) .. "]" .. + core.formspec_escape(core.settings:get("bind_address")) .. "]" .. "field[2.8,5.2;1.25,0.5;te_serverport;" .. fgettext("Port") .. ";" .. - core.formspec_escape(core.setting_get("port")) .. "]" + core.formspec_escape(core.settings:get("port")) .. "]" else retval = retval .. "field[0.55,5.2;3.5,0.5;te_serverport;" .. fgettext("Server Port") .. ";" .. - core.formspec_escape(core.setting_get("port")) .. "]" + core.formspec_escape(core.settings:get("port")) .. "]" end - + retval = retval .. "textlist[4,0.25;7.5,3.7;srv_worlds;" .. menu_render_worldlist() .. @@ -75,7 +75,7 @@ local function main_button_handler(this, fields, name, tabdata) world_doubleclick = true end if event.type == "CHG" then - core.setting_set("mainmenu_last_selected_world", + core.settings:set("mainmenu_last_selected_world", menudata.worldlist:get_raw_index(core.get_textlist_index("srv_worlds"))) return true end @@ -86,7 +86,7 @@ local function main_button_handler(this, fields, name, tabdata) end if fields["cb_creative_mode"] then - core.setting_set("creative_mode", fields["cb_creative_mode"]) + core.settings:set("creative_mode", fields["cb_creative_mode"]) local selected = core.get_textlist_index("srv_worlds") menu_worldmt(selected, "creative_mode", fields["cb_creative_mode"]) @@ -94,7 +94,7 @@ local function main_button_handler(this, fields, name, tabdata) end if fields["cb_enable_damage"] then - core.setting_set("enable_damage", fields["cb_enable_damage"]) + core.settings:set("enable_damage", fields["cb_enable_damage"]) local selected = core.get_textlist_index("srv_worlds") menu_worldmt(selected, "enable_damage", fields["cb_enable_damage"]) @@ -102,7 +102,7 @@ local function main_button_handler(this, fields, name, tabdata) end if fields["cb_server_announce"] then - core.setting_set("server_announce", fields["cb_server_announce"]) + core.settings:set("server_announce", fields["cb_server_announce"]) local selected = core.get_textlist_index("srv_worlds") menu_worldmt(selected, "server_announce", fields["cb_server_announce"]) @@ -120,16 +120,16 @@ local function main_button_handler(this, fields, name, tabdata) gamedata.port = fields["te_serverport"] gamedata.address = "" - core.setting_set("port",gamedata.port) + core.settings:set("port",gamedata.port) if fields["te_serveraddr"] ~= nil then - core.setting_set("bind_address",fields["te_serveraddr"]) + core.settings:set("bind_address",fields["te_serveraddr"]) end --update last game local world = menudata.worldlist:get_raw_element(gamedata.selected_world) if world then local game, index = gamemgr.find_by_gameid(world.gameid) - core.setting_set("menu_last_game", game.id) + core.settings:set("menu_last_game", game.id) end core.start() diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua index 8a97d8334..69683eaa3 100644 --- a/builtin/mainmenu/tab_settings.lua +++ b/builtin/mainmenu/tab_settings.lua @@ -70,39 +70,39 @@ local dd_options = { local getSettingIndex = { Leaves = function() - local style = core.setting_get("leaves_style") + local style = core.settings:get("leaves_style") for idx, name in pairs(dd_options.leaves[2]) do if style == name then return idx end end return 1 end, NodeHighlighting = function() - local style = core.setting_get("node_highlighting") + local style = core.settings:get("node_highlighting") for idx, name in pairs(dd_options.node_highlighting[2]) do if style == name then return idx end end return 1 end, Filter = function() - if core.setting_get(dd_options.filters[2][3]) == "true" then + if core.settings:get(dd_options.filters[2][3]) == "true" then return 3 - elseif core.setting_get(dd_options.filters[2][3]) == "false" and - core.setting_get(dd_options.filters[2][2]) == "true" then + elseif core.settings:get(dd_options.filters[2][3]) == "false" and + core.settings:get(dd_options.filters[2][2]) == "true" then return 2 end return 1 end, Mipmap = function() - if core.setting_get(dd_options.mipmap[2][3]) == "true" then + if core.settings:get(dd_options.mipmap[2][3]) == "true" then return 3 - elseif core.setting_get(dd_options.mipmap[2][3]) == "false" and - core.setting_get(dd_options.mipmap[2][2]) == "true" then + elseif core.settings:get(dd_options.mipmap[2][3]) == "false" and + core.settings:get(dd_options.mipmap[2][2]) == "true" then return 2 end return 1 end, Antialiasing = function() - local antialiasing_setting = core.setting_get("fsaa") + local antialiasing_setting = core.settings:get("fsaa") for i = 1, #dd_options.antialiasing[2] do if antialiasing_setting == dd_options.antialiasing[2][i] then return i @@ -177,15 +177,15 @@ local function formspec(tabview, name, tabdata) local tab_string = "box[0,0;3.5,4.5;#999999]" .. "checkbox[0.25,0;cb_smooth_lighting;" .. fgettext("Smooth Lighting") .. ";" - .. dump(core.setting_getbool("smooth_lighting")) .. "]" .. + .. dump(core.settings:get_bool("smooth_lighting")) .. "]" .. "checkbox[0.25,0.5;cb_particles;" .. fgettext("Particles") .. ";" - .. dump(core.setting_getbool("enable_particles")) .. "]" .. + .. dump(core.settings:get_bool("enable_particles")) .. "]" .. "checkbox[0.25,1;cb_3d_clouds;" .. fgettext("3D Clouds") .. ";" - .. dump(core.setting_getbool("enable_3d_clouds")) .. "]" .. + .. dump(core.settings:get_bool("enable_3d_clouds")) .. "]" .. "checkbox[0.25,1.5;cb_opaque_water;" .. fgettext("Opaque Water") .. ";" - .. dump(core.setting_getbool("opaque_water")) .. "]" .. + .. dump(core.settings:get_bool("opaque_water")) .. "]" .. "checkbox[0.25,2.0;cb_connected_glass;" .. fgettext("Connected Glass") .. ";" - .. dump(core.setting_getbool("connected_glass")) .. "]" .. + .. dump(core.settings:get_bool("connected_glass")) .. "]" .. "dropdown[0.25,2.8;3.3;dd_node_highlighting;" .. dd_options.node_highlighting[1] .. ";" .. getSettingIndex.NodeHighlighting() .. "]" .. "dropdown[0.25,3.6;3.3;dd_leaves_style;" .. dd_options.leaves[1] .. ";" @@ -201,10 +201,10 @@ local function formspec(tabview, name, tabdata) .. getSettingIndex.Antialiasing() .. "]" .. "label[3.85,3.45;" .. fgettext("Screen:") .. "]" .. "checkbox[3.85,3.6;cb_autosave_screensize;" .. fgettext("Autosave screen size") .. ";" - .. dump(core.setting_getbool("autosave_screensize")) .. "]" .. + .. dump(core.settings:get_bool("autosave_screensize")) .. "]" .. "box[7.75,0;4,4.4;#999999]" .. "checkbox[8,0;cb_shaders;" .. fgettext("Shaders") .. ";" - .. dump(core.setting_getbool("enable_shaders")) .. "]" + .. dump(core.settings:get_bool("enable_shaders")) .. "]" if PLATFORM == "Android" then tab_string = tab_string .. @@ -221,29 +221,29 @@ local function formspec(tabview, name, tabdata) .. fgettext("Advanced Settings") .. "]" - if core.setting_get("touchscreen_threshold") ~= nil then + if core.settings:get("touchscreen_threshold") ~= nil then tab_string = tab_string .. "label[4.3,4.1;" .. fgettext("Touchthreshold (px)") .. "]" .. "dropdown[3.85,4.55;3.85;dd_touchthreshold;0,10,20,30,40,50;" .. - ((tonumber(core.setting_get("touchscreen_threshold")) / 10) + 1) .. "]" + ((tonumber(core.settings:get("touchscreen_threshold")) / 10) + 1) .. "]" end - if core.setting_getbool("enable_shaders") then + if core.settings:get_bool("enable_shaders") then tab_string = tab_string .. "checkbox[8,0.5;cb_bumpmapping;" .. fgettext("Bump Mapping") .. ";" - .. dump(core.setting_getbool("enable_bumpmapping")) .. "]" .. + .. dump(core.settings:get_bool("enable_bumpmapping")) .. "]" .. "checkbox[8,1;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";" - .. dump(core.setting_getbool("tone_mapping")) .. "]" .. + .. dump(core.settings:get_bool("tone_mapping")) .. "]" .. "checkbox[8,1.5;cb_generate_normalmaps;" .. fgettext("Normal Mapping") .. ";" - .. dump(core.setting_getbool("generate_normalmaps")) .. "]" .. + .. dump(core.settings:get_bool("generate_normalmaps")) .. "]" .. "checkbox[8,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";" - .. dump(core.setting_getbool("enable_parallax_occlusion")) .. "]" .. + .. dump(core.settings:get_bool("enable_parallax_occlusion")) .. "]" .. "checkbox[8,2.5;cb_waving_water;" .. fgettext("Waving Water") .. ";" - .. dump(core.setting_getbool("enable_waving_water")) .. "]" .. + .. dump(core.settings:get_bool("enable_waving_water")) .. "]" .. "checkbox[8,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";" - .. dump(core.setting_getbool("enable_waving_leaves")) .. "]" .. + .. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" .. "checkbox[8,3.5;cb_waving_plants;" .. fgettext("Waving Plants") .. ";" - .. dump(core.setting_getbool("enable_waving_plants")) .. "]" + .. dump(core.settings:get_bool("enable_waving_plants")) .. "]" else tab_string = tab_string .. "tablecolumns[color;text]" .. @@ -274,64 +274,64 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) return true end if fields["cb_smooth_lighting"] then - core.setting_set("smooth_lighting", fields["cb_smooth_lighting"]) + core.settings:set("smooth_lighting", fields["cb_smooth_lighting"]) return true end if fields["cb_particles"] then - core.setting_set("enable_particles", fields["cb_particles"]) + core.settings:set("enable_particles", fields["cb_particles"]) return true end if fields["cb_3d_clouds"] then - core.setting_set("enable_3d_clouds", fields["cb_3d_clouds"]) + core.settings:set("enable_3d_clouds", fields["cb_3d_clouds"]) return true end if fields["cb_opaque_water"] then - core.setting_set("opaque_water", fields["cb_opaque_water"]) + core.settings:set("opaque_water", fields["cb_opaque_water"]) return true end if fields["cb_connected_glass"] then - core.setting_set("connected_glass", fields["cb_connected_glass"]) + core.settings:set("connected_glass", fields["cb_connected_glass"]) return true end if fields["cb_autosave_screensize"] then - core.setting_set("autosave_screensize", fields["cb_autosave_screensize"]) + core.settings:set("autosave_screensize", fields["cb_autosave_screensize"]) return true end if fields["cb_shaders"] then - if (core.setting_get("video_driver") == "direct3d8" or - core.setting_get("video_driver") == "direct3d9") then - core.setting_set("enable_shaders", "false") + if (core.settings:get("video_driver") == "direct3d8" or + core.settings:get("video_driver") == "direct3d9") then + core.settings:set("enable_shaders", "false") gamedata.errormessage = fgettext("To enable shaders the OpenGL driver needs to be used.") else - core.setting_set("enable_shaders", fields["cb_shaders"]) + core.settings:set("enable_shaders", fields["cb_shaders"]) end return true end if fields["cb_bumpmapping"] then - core.setting_set("enable_bumpmapping", fields["cb_bumpmapping"]) + core.settings:set("enable_bumpmapping", fields["cb_bumpmapping"]) return true end if fields["cb_tonemapping"] then - core.setting_set("tone_mapping", fields["cb_tonemapping"]) + core.settings:set("tone_mapping", fields["cb_tonemapping"]) return true end if fields["cb_generate_normalmaps"] then - core.setting_set("generate_normalmaps", fields["cb_generate_normalmaps"]) + core.settings:set("generate_normalmaps", fields["cb_generate_normalmaps"]) return true end if fields["cb_parallax"] then - core.setting_set("enable_parallax_occlusion", fields["cb_parallax"]) + core.settings:set("enable_parallax_occlusion", fields["cb_parallax"]) return true end if fields["cb_waving_water"] then - core.setting_set("enable_waving_water", fields["cb_waving_water"]) + core.settings:set("enable_waving_water", fields["cb_waving_water"]) return true end if fields["cb_waving_leaves"] then - core.setting_set("enable_waving_leaves", fields["cb_waving_leaves"]) + core.settings:set("enable_waving_leaves", fields["cb_waving_leaves"]) end if fields["cb_waving_plants"] then - core.setting_set("enable_waving_plants", fields["cb_waving_plants"]) + core.settings:set("enable_waving_plants", fields["cb_waving_plants"]) return true end if fields["btn_change_keys"] then @@ -339,7 +339,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) return true end if fields["cb_touchscreen_target"] then - core.setting_set("touchtarget", fields["cb_touchscreen_target"]) + core.settings:set("touchtarget", fields["cb_touchscreen_target"]) return true end if fields["btn_reset_singleplayer"] then @@ -352,49 +352,49 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) for i = 1, #labels.leaves do if fields["dd_leaves_style"] == labels.leaves[i] then - core.setting_set("leaves_style", dd_options.leaves[2][i]) + core.settings:set("leaves_style", dd_options.leaves[2][i]) ddhandled = true end end for i = 1, #labels.node_highlighting do if fields["dd_node_highlighting"] == labels.node_highlighting[i] then - core.setting_set("node_highlighting", dd_options.node_highlighting[2][i]) + core.settings:set("node_highlighting", dd_options.node_highlighting[2][i]) ddhandled = true end end if fields["dd_filters"] == labels.filters[1] then - core.setting_set("bilinear_filter", "false") - core.setting_set("trilinear_filter", "false") + core.settings:set("bilinear_filter", "false") + core.settings:set("trilinear_filter", "false") ddhandled = true elseif fields["dd_filters"] == labels.filters[2] then - core.setting_set("bilinear_filter", "true") - core.setting_set("trilinear_filter", "false") + core.settings:set("bilinear_filter", "true") + core.settings:set("trilinear_filter", "false") ddhandled = true elseif fields["dd_filters"] == labels.filters[3] then - core.setting_set("bilinear_filter", "false") - core.setting_set("trilinear_filter", "true") + core.settings:set("bilinear_filter", "false") + core.settings:set("trilinear_filter", "true") ddhandled = true end if fields["dd_mipmap"] == labels.mipmap[1] then - core.setting_set("mip_map", "false") - core.setting_set("anisotropic_filter", "false") + core.settings:set("mip_map", "false") + core.settings:set("anisotropic_filter", "false") ddhandled = true elseif fields["dd_mipmap"] == labels.mipmap[2] then - core.setting_set("mip_map", "true") - core.setting_set("anisotropic_filter", "false") + core.settings:set("mip_map", "true") + core.settings:set("anisotropic_filter", "false") ddhandled = true elseif fields["dd_mipmap"] == labels.mipmap[3] then - core.setting_set("mip_map", "true") - core.setting_set("anisotropic_filter", "true") + core.settings:set("mip_map", "true") + core.settings:set("anisotropic_filter", "true") ddhandled = true end if fields["dd_antialiasing"] then - core.setting_set("fsaa", + core.settings:set("fsaa", antialiasing_fname_to_name(fields["dd_antialiasing"])) ddhandled = true end if fields["dd_touchthreshold"] then - core.setting_set("touchscreen_threshold", fields["dd_touchthreshold"]) + core.settings:set("touchscreen_threshold", fields["dd_touchthreshold"]) ddhandled = true end diff --git a/builtin/mainmenu/tab_simple_main.lua b/builtin/mainmenu/tab_simple_main.lua index 23820aab7..90a743f68 100644 --- a/builtin/mainmenu/tab_simple_main.lua +++ b/builtin/mainmenu/tab_simple_main.lua @@ -25,12 +25,12 @@ local function get_formspec(tabview, name, tabdata) local retval = "label[9.5,0;".. fgettext("Name / Password") .. "]" .. "field[0.25,3.35;5.5,0.5;te_address;;" .. - core.formspec_escape(core.setting_get("address")) .."]" .. + core.formspec_escape(core.settings:get("address")) .."]" .. "field[5.75,3.35;2.25,0.5;te_port;;" .. - core.formspec_escape(core.setting_get("remote_port")) .."]" .. + core.formspec_escape(core.settings:get("remote_port")) .."]" .. "button[10,2.6;2,1.5;btn_mp_connect;".. fgettext("Connect") .. "]" .. "field[9.8,1;2.6,0.5;te_name;;" .. - core.formspec_escape(core.setting_get("name")) .."]" .. + core.formspec_escape(core.settings:get("name")) .."]" .. "pwdfield[9.8,2;2.6,0.5;te_pwd;]" @@ -89,9 +89,9 @@ local function get_formspec(tabview, name, tabdata) -- checkboxes retval = retval .. "checkbox[8.0,3.9;cb_creative;".. fgettext("Creative Mode") .. ";" .. - dump(core.setting_getbool("creative_mode")) .. "]".. + dump(core.settings:get_bool("creative_mode")) .. "]".. "checkbox[8.0,4.4;cb_damage;".. fgettext("Enable Damage") .. ";" .. - dump(core.setting_getbool("enable_damage")) .. "]" + dump(core.settings:get_bool("enable_damage")) .. "]" -- buttons retval = retval .. "button[0,3.7;8,1.5;btn_start_singleplayer;" .. fgettext("Start Singleplayer") .. "]" .. @@ -128,8 +128,8 @@ local function main_button_handler(tabview, fields, name, tabdata) end if address and port then - core.setting_set("address", address) - core.setting_set("remote_port", port) + core.settings:set("address", address) + core.settings:set("remote_port", port) end tabdata.fav_selected = event.row end @@ -145,18 +145,18 @@ local function main_button_handler(tabview, fields, name, tabdata) asyncOnlineFavourites() tabdata.fav_selected = nil - core.setting_set("address", "") - core.setting_set("remote_port", "30000") + core.settings:set("address", "") + core.settings:set("remote_port", "30000") return true end if fields.cb_creative then - core.setting_set("creative_mode", fields.cb_creative) + core.settings:set("creative_mode", fields.cb_creative) return true end if fields.cb_damage then - core.setting_set("enable_damage", fields.cb_damage) + core.settings:set("enable_damage", fields.cb_damage) return true end @@ -186,12 +186,8 @@ local function main_button_handler(tabview, fields, name, tabdata) gamedata.selected_world = 0 - core.setting_set("address", fields.te_address) - core.setting_set("remote_port", fields.te_port) - - core.start() - return true - end + core.settings:set("address", fields.te_address) + core.settings:set("remote_port", fields.te_port) if fields.btn_config_sp_world then local configdialog = create_configure_world_dlg(1) diff --git a/builtin/mainmenu/tab_singleplayer.lua b/builtin/mainmenu/tab_singleplayer.lua index 236de763c..c58ad4164 100644 --- a/builtin/mainmenu/tab_singleplayer.lua +++ b/builtin/mainmenu/tab_singleplayer.lua @@ -16,7 +16,7 @@ --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. local function current_game() - local last_game_id = core.setting_get("menu_last_game") + local last_game_id = core.settings:get("menu_last_game") local game, index = gamemgr.find_by_gameid(last_game_id) return game @@ -36,10 +36,10 @@ local function singleplayer_refresh_gamebar() if ("game_btnbar_" .. gamemgr.games[j].id == key) then mm_texture.update("singleplayer", gamemgr.games[j]) core.set_topleft_text(gamemgr.games[j].name) - core.setting_set("menu_last_game",gamemgr.games[j].id) + core.settings:set("menu_last_game",gamemgr.games[j].id) menudata.worldlist:set_filtercriteria(gamemgr.games[j].id) local index = filterlist.get_current_index(menudata.worldlist, - tonumber(core.setting_get("mainmenu_last_selected_world"))) + tonumber(core.settings:get("mainmenu_last_selected_world"))) if not index or index < 1 then local selected = core.get_textlist_index("sp_worlds") if selected ~= nil and selected < #menudata.worldlist:get_list() then @@ -89,7 +89,7 @@ local function get_formspec(tabview, name, tabdata) local retval = "" local index = filterlist.get_current_index(menudata.worldlist, - tonumber(core.setting_get("mainmenu_last_selected_world")) + tonumber(core.settings:get("mainmenu_last_selected_world")) ) retval = retval .. @@ -99,9 +99,9 @@ local function get_formspec(tabview, name, tabdata) "button[8.5,5;3.25,0.5;play;".. fgettext("Play") .. "]" .. "label[4,-0.25;".. fgettext("Select World:") .. "]".. "checkbox[0.25,0.25;cb_creative_mode;".. fgettext("Creative Mode") .. ";" .. - dump(core.setting_getbool("creative_mode")) .. "]".. + dump(core.settings:get_bool("creative_mode")) .. "]".. "checkbox[0.25,0.7;cb_enable_damage;".. fgettext("Enable Damage") .. ";" .. - dump(core.setting_getbool("enable_damage")) .. "]".. + dump(core.settings:get_bool("enable_damage")) .. "]".. "textlist[4,0.25;7.5,3.7;sp_worlds;" .. menu_render_worldlist() .. ";" .. index .. "]" @@ -125,7 +125,7 @@ local function main_button_handler(this, fields, name, tabdata) end if event.type == "CHG" and selected ~= nil then - core.setting_set("mainmenu_last_selected_world", + core.settings:set("mainmenu_last_selected_world", menudata.worldlist:get_raw_index(selected)) return true end @@ -136,7 +136,7 @@ local function main_button_handler(this, fields, name, tabdata) end if fields["cb_creative_mode"] then - core.setting_set("creative_mode", fields["cb_creative_mode"]) + core.settings:set("creative_mode", fields["cb_creative_mode"]) local selected = core.get_textlist_index("sp_worlds") menu_worldmt(selected, "creative_mode", fields["cb_creative_mode"]) @@ -144,7 +144,7 @@ local function main_button_handler(this, fields, name, tabdata) end if fields["cb_enable_damage"] then - core.setting_set("enable_damage", fields["cb_enable_damage"]) + core.settings:set("enable_damage", fields["cb_enable_damage"]) local selected = core.get_textlist_index("sp_worlds") menu_worldmt(selected, "enable_damage", fields["cb_enable_damage"]) diff --git a/builtin/mainmenu/tab_texturepacks.lua b/builtin/mainmenu/tab_texturepacks.lua index 4638beaa1..2957481cf 100644 --- a/builtin/mainmenu/tab_texturepacks.lua +++ b/builtin/mainmenu/tab_texturepacks.lua @@ -54,9 +54,9 @@ local function get_formspec(tabview, name, tabdata) local retval = "label[4,-0.25;" .. fgettext("Select texture pack:") .. "]" .. "textlist[4,0.25;7.5,5.0;TPs;" - local current_texture_path = core.setting_get("texture_path") + local current_texture_path = core.settings:get("texture_path") local list = filter_texture_pack_list(core.get_dir_list(core.get_texturepath(), true)) - local index = tonumber(core.setting_get("mainmenu_last_selected_TP")) + local index = tonumber(core.settings:get("mainmenu_last_selected_TP")) if not index then index = 1 end @@ -106,7 +106,7 @@ local function main_button_handler(tabview, fields, name, tabdata) local event = core.explode_textlist_event(fields["TPs"]) if event.type == "CHG" or event.type == "DCL" then local index = core.get_textlist_index("TPs") - core.setting_set("mainmenu_last_selected_TP", index) + core.settings:set("mainmenu_last_selected_TP", index) local list = filter_texture_pack_list(core.get_dir_list(core.get_texturepath(), true)) local current_index = core.get_textlist_index("TPs") if current_index and #list >= current_index then @@ -114,7 +114,7 @@ local function main_button_handler(tabview, fields, name, tabdata) if list[current_index] == fgettext("None") then new_path = "" end - core.setting_set("texture_path", new_path) + core.settings:set("texture_path", new_path) end end return true diff --git a/builtin/mainmenu/textures.lua b/builtin/mainmenu/textures.lua index dadbb093e..9ba4ade7e 100644 --- a/builtin/mainmenu/textures.lua +++ b/builtin/mainmenu/textures.lua @@ -24,7 +24,7 @@ function mm_texture.init() DIR_DELIM .. "pack" .. DIR_DELIM mm_texture.basetexturedir = mm_texture.defaulttexturedir - mm_texture.texturepack = core.setting_get("texture_path") + mm_texture.texturepack = core.settings:get("texture_path") mm_texture.gameid = nil end @@ -61,7 +61,7 @@ function mm_texture.reset() mm_texture.set_generic("header") if not have_bg then - if core.setting_getbool("menu_clouds") then + if core.settings:get_bool("menu_clouds") then core.set_clouds(true) else mm_texture.set_dirt_bg() @@ -88,7 +88,7 @@ function mm_texture.update_game(gamedetails) if not have_bg then - if core.setting_getbool("menu_clouds") then + if core.settings:get_bool("menu_clouds") then core.set_clouds(true) else mm_texture.set_dirt_bg() |