aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/common.lua5
-rw-r--r--builtin/mainmenu/dlg_config_world.lua47
-rw-r--r--builtin/mainmenu/dlg_contentstore.lua30
-rw-r--r--builtin/mainmenu/dlg_create_world.lua13
-rw-r--r--builtin/mainmenu/dlg_delete_content.lua1
-rw-r--r--builtin/mainmenu/dlg_delete_world.lua1
-rw-r--r--builtin/mainmenu/dlg_settings_advanced.lua94
-rw-r--r--builtin/mainmenu/pkgmgr.lua119
-rw-r--r--builtin/mainmenu/tab_content.lua21
-rw-r--r--builtin/mainmenu/tab_local.lua4
-rw-r--r--builtin/mainmenu/tab_online.lua6
-rw-r--r--builtin/mainmenu/tab_settings.lua6
-rw-r--r--builtin/mainmenu/tab_simple_main.lua8
-rw-r--r--builtin/mainmenu/textures.lua40
14 files changed, 253 insertions, 142 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index cc61fe0ad..782d6973f 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -93,9 +93,9 @@ function render_serverlist_row(spec, is_favorite)
end
end
- local details = ""
local grey_out = not is_server_protocol_compat(spec.proto_min, spec.proto_max)
+ local details
if is_favorite then
details = "1,"
else
@@ -118,11 +118,11 @@ function render_serverlist_row(spec, is_favorite)
end
if spec.clients and spec.clients_max then
- local clients_color = ''
local clients_percent = 100 * spec.clients / spec.clients_max
-- Choose a color depending on how many clients are connected
-- (relatively to clients_max)
+ local clients_color
if grey_out then clients_color = '#aaaaaa'
elseif spec.clients == 0 then clients_color = '' -- 0 players: default/white
elseif clients_percent <= 60 then clients_color = '#a1e587' -- 0-60%: green
@@ -171,6 +171,7 @@ os.tempfolder = function()
local filetocheck = os.tmpname()
os.remove(filetocheck)
+ -- luacheck: ignore
-- https://blogs.msdn.microsoft.com/vcblog/2014/06/18/c-runtime-crt-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1/
-- The C runtime (CRT) function called by os.tmpname is tmpnam.
-- Microsofts tmpnam implementation in older CRT / MSVC releases is defective.
diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua
index daa8099c4..97218df9c 100644
--- a/builtin/mainmenu/dlg_config_world.lua
+++ b/builtin/mainmenu/dlg_config_world.lua
@@ -31,8 +31,6 @@ local function get_formspec(data)
"label[0.5,0;" .. fgettext("World:") .. "]" ..
"label[1.75,0;" .. data.worldspec.name .. "]"
- local hard_deps, soft_deps = pkgmgr.get_dependencies(mod.path)
-
if mod.is_modpack or mod.type == "game" then
local info = minetest.formspec_escape(
core.get_content_info(mod.path).description)
@@ -46,15 +44,46 @@ local function get_formspec(data)
retval = retval ..
"textarea[0.25,0.7;5.75,7.2;;" .. info .. ";]"
else
+ local hard_deps, soft_deps = pkgmgr.get_dependencies(mod.path)
+ local hard_deps_str = table.concat(hard_deps, ",")
+ local soft_deps_str = table.concat(soft_deps, ",")
+
retval = retval ..
"label[0,0.7;" .. fgettext("Mod:") .. "]" ..
- "label[0.75,0.7;" .. mod.name .. "]" ..
- "label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
- "textlist[0,1.75;5,2.125;world_config_depends;" .. hard_deps ..
- ";0]" ..
- "label[0,3.875;" .. fgettext("Optional dependencies:") .. "]" ..
- "textlist[0,4.375;5,1.8;world_config_optdepends;" ..
- soft_deps .. ";0]"
+ "label[0.75,0.7;" .. mod.name .. "]"
+
+ if hard_deps_str == "" then
+ if soft_deps_str == "" then
+ retval = retval ..
+ "label[0,1.25;" ..
+ fgettext("No (optional) dependencies") .. "]"
+ else
+ retval = retval ..
+ "label[0,1.25;" .. fgettext("No hard dependencies") ..
+ "]" ..
+ "label[0,1.75;" .. fgettext("Optional dependencies:") ..
+ "]" ..
+ "textlist[0,2.25;5,4;world_config_optdepends;" ..
+ soft_deps_str .. ";0]"
+ end
+ else
+ if soft_deps_str == "" then
+ retval = retval ..
+ "label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
+ "textlist[0,1.75;5,4;world_config_depends;" ..
+ hard_deps_str .. ";0]" ..
+ "label[0,6;" .. fgettext("No optional dependencies") .. "]"
+ else
+ retval = retval ..
+ "label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
+ "textlist[0,1.75;5,2.125;world_config_depends;" ..
+ hard_deps_str .. ";0]" ..
+ "label[0,3.9;" .. fgettext("Optional dependencies:") ..
+ "]" ..
+ "textlist[0,4.375;5,1.8;world_config_optdepends;" ..
+ soft_deps_str .. ";0]"
+ end
+ end
end
retval = retval ..
"button[3.25,7;2.5,0.5;btn_config_world_save;" ..
diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua
index 384bee36c..3bc5f60bb 100644
--- a/builtin/mainmenu/dlg_contentstore.lua
+++ b/builtin/mainmenu/dlg_contentstore.lua
@@ -96,19 +96,16 @@ local function start_install(calling_dialog, package)
if conf_path then
local conf = Settings(conf_path)
- local function set_def(key, value)
- if conf:get(key) == nil then
- conf:set(key, value)
- end
- end
if name_is_title then
- set_def("name", result.package.title)
+ conf:set("name", result.package.title)
else
- set_def("title", result.package.title)
- set_def("name", result.package.name)
+ conf:set("title", result.package.title)
+ conf:set("name", result.package.name)
+ end
+ if not conf:get("description") then
+ conf:set("description", result.package.short_description)
end
- set_def("description", result.package.short_description)
- set_def("author", result.package.author)
+ conf:set("author", result.package.author)
conf:set("release", result.package.release)
conf:write()
end
@@ -273,7 +270,6 @@ function store.load()
assert(core.create_dir(tmpdir))
local base_url = core.settings:get("contentdb_url")
- local show_nonfree = core.settings:get_bool("show_nonfree_packages")
local url = base_url ..
"/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
core.get_max_supp_proto()
@@ -299,9 +295,9 @@ function store.load()
local name_len = #package.name
if package.type == "game" and name_len > 5 and package.name:sub(name_len - 4) == "_game" then
- package.id = package.author .. "/" .. package.name:sub(1, name_len - 5)
+ package.id = package.author:lower() .. "/" .. package.name:sub(1, name_len - 5)
else
- package.id = package.author .. "/" .. package.name
+ package.id = package.author:lower() .. "/" .. package.name
end
end
@@ -317,22 +313,22 @@ function store.update_paths()
pkgmgr.refresh_globals()
for _, mod in pairs(pkgmgr.global_mods:get_list()) do
if mod.author then
- mod_hash[mod.author .. "/" .. mod.name] = mod
+ mod_hash[mod.author:lower() .. "/" .. mod.name] = mod
end
end
local game_hash = {}
pkgmgr.update_gamelist()
for _, game in pairs(pkgmgr.games) do
- if game.author then
- game_hash[game.author .. "/" .. game.id] = game
+ if game.author ~= "" then
+ game_hash[game.author:lower() .. "/" .. game.id] = game
end
end
local txp_hash = {}
for _, txp in pairs(pkgmgr.get_texture_packs()) do
if txp.author then
- txp_hash[txp.author .. "/" .. txp.name] = txp
+ txp_hash[txp.author:lower() .. "/" .. txp.name] = txp
end
end
diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua
index c701f094e..31d41d693 100644
--- a/builtin/mainmenu/dlg_create_world.lua
+++ b/builtin/mainmenu/dlg_create_world.lua
@@ -24,10 +24,11 @@ local function create_world_formspec(dialogdata)
local current_mg = core.settings:get("mg_name")
local gameid = core.settings:get("menu_last_game")
- local game, gameidx = nil , 0
+ local gameidx = 0
if gameid ~= nil then
- game, gameidx = pkgmgr.find_by_gameid(gameid)
-
+ local _
+ _, gameidx = pkgmgr.find_by_gameid(gameid)
+
if gameidx == nil then
gameidx = 0
end
@@ -82,7 +83,7 @@ local function create_world_formspec(dialogdata)
"button[3.25,6;2.5,0.5;world_create_confirm;" .. fgettext("Create") .. "]" ..
"button[5.75,6;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
-
+
if #pkgmgr.games == 0 then
retval = retval .. "box[2,4;8,1;#ff8800]label[2.25,4;" ..
fgettext("You have no games installed.") .. "]label[2.25,4.4;" ..
@@ -111,10 +112,10 @@ local function create_world_buttonhandler(this, fields)
local random_world_name = "Unnamed" .. random_number
worldname = random_world_name
end
- local message = nil
core.settings:set("fixed_map_seed", fields["te_seed"])
+ local message
if not menudata.worldlist:uid_exists_raw(worldname) then
core.settings:set("mg_name",fields["dd_mapgen"])
message = core.create_world(worldname,gameindex)
@@ -165,6 +166,6 @@ function create_create_world_dlg(update_worldlistfilter)
create_world_buttonhandler,
nil)
retval.update_worldlist_filter = update_worldlistfilter
-
+
return retval
end
diff --git a/builtin/mainmenu/dlg_delete_content.lua b/builtin/mainmenu/dlg_delete_content.lua
index 9d89316a0..a24171541 100644
--- a/builtin/mainmenu/dlg_delete_content.lua
+++ b/builtin/mainmenu/dlg_delete_content.lua
@@ -22,6 +22,7 @@ local function delete_content_formspec(dialogdata)
"size[11.5,4.5,true]" ..
"label[2,2;" ..
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.content.name) .. "]"..
+ "style[dlg_delete_content_confirm;bgcolor=red]" ..
"button[3.25,3.5;2.5,0.5;dlg_delete_content_confirm;" .. fgettext("Delete") .. "]" ..
"button[5.75,3.5;2.5,0.5;dlg_delete_content_cancel;" .. fgettext("Cancel") .. "]"
diff --git a/builtin/mainmenu/dlg_delete_world.lua b/builtin/mainmenu/dlg_delete_world.lua
index df1091033..33e7bc945 100644
--- a/builtin/mainmenu/dlg_delete_world.lua
+++ b/builtin/mainmenu/dlg_delete_world.lua
@@ -21,6 +21,7 @@ local function delete_world_formspec(dialogdata)
"size[10,2.5,true]" ..
"label[0.5,0.5;" ..
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" ..
+ "style[world_delete_confirm;bgcolor=red]" ..
"button[0.5,1.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
"button[7.0,1.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
return retval
diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua
index bff36d8cb..24b71d957 100644
--- a/builtin/mainmenu/dlg_settings_advanced.lua
+++ b/builtin/mainmenu/dlg_settings_advanced.lua
@@ -148,9 +148,9 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
local values = {}
local ti = 1
local index = 1
- for line in default:gmatch("[+-]?[%d.-e]+") do -- All numeric characters
- index = default:find("[+-]?[%d.-e]+", index) + line:len()
- table.insert(values, line)
+ for match in default:gmatch("[+-]?[%d.-e]+") do -- All numeric characters
+ index = default:find("[+-]?[%d.-e]+", index) + match:len()
+ table.insert(values, match)
ti = ti + 1
if ti > 9 then
break
@@ -322,17 +322,20 @@ end
-- read_all: whether to ignore certain setting types for GUI or not
-- parse_mods: whether to parse settingtypes.txt in mods and games
local function parse_config_file(read_all, parse_mods)
- local builtin_path = core.get_builtin_path() .. FILENAME
- local file = io.open(builtin_path, "r")
local settings = {}
- if not file then
- core.log("error", "Can't load " .. FILENAME)
- return settings
- end
- parse_single_file(file, builtin_path, read_all, settings, 0, true)
+ do
+ local builtin_path = core.get_builtin_path() .. FILENAME
+ local file = io.open(builtin_path, "r")
+ if not file then
+ core.log("error", "Can't load " .. FILENAME)
+ return settings
+ end
+
+ parse_single_file(file, builtin_path, read_all, settings, 0, true)
- file:close()
+ file:close()
+ end
if parse_mods then
-- Parse games
@@ -344,7 +347,7 @@ local function parse_config_file(read_all, parse_mods)
local file = io.open(path, "r")
if file then
if not games_category_initialized then
- local translation = fgettext_ne("Games"), -- not used, but needed for xgettext
+ fgettext_ne("Games") -- not used, but needed for xgettext
table.insert(settings, {
name = "Games",
level = 0,
@@ -377,7 +380,7 @@ local function parse_config_file(read_all, parse_mods)
local file = io.open(path, "r")
if file then
if not mods_category_initialized then
- local translation = fgettext_ne("Mods"), -- not used, but needed for xgettext
+ fgettext_ne("Mods") -- not used, but needed for xgettext
table.insert(settings, {
name = "Mods",
level = 0,
@@ -667,34 +670,42 @@ local function create_change_setting_formspec(dialogdata)
height = height + 1.1
elseif setting.type == "flags" then
- local enabled_flags = flags_to_table(get_current_value(setting))
+ local current_flags = flags_to_table(get_current_value(setting))
local flags = {}
- for _, name in ipairs(enabled_flags) do
+ for _, name in ipairs(current_flags) do
-- Index by name, to avoid iterating over all enabled_flags for every possible flag.
- flags[name] = true
+ if name:sub(1, 2) == "no" then
+ flags[name:sub(3)] = false
+ else
+ flags[name] = true
+ end
end
- local flags_count = #setting.possible
- local max_height = flags_count / 4
+ local flags_count = #setting.possible / 2
+ local max_height = math.ceil(flags_count / 2) / 2
-- More space for flags
description_height = description_height - 1
height = height - 1
local fields = {} -- To build formspec
- for i, name in ipairs(setting.possible) do
- local x = 0.5
- local y = height + i / 2 - 0.75
- if i - 1 >= flags_count / 2 then -- 2nd column
- x = 5
- y = y - max_height
+ local j = 1
+ for _, name in ipairs(setting.possible) do
+ if name:sub(1, 2) ~= "no" then
+ local x = 0.5
+ local y = height + j / 2 - 0.75
+ if j - 1 >= flags_count / 2 then -- 2nd column
+ x = 5
+ y = y - max_height
+ end
+ j = j + 1;
+ local checkbox_name = "cb_" .. name
+ local is_enabled = flags[name] == true -- to get false if nil
+ checkboxes[checkbox_name] = is_enabled
+
+ fields[#fields + 1] = ("checkbox[%f,%f;%s;%s;%s]"):format(
+ x, y, checkbox_name, name, tostring(is_enabled)
+ )
end
- local checkbox_name = "cb_" .. name
- local is_enabled = flags[name] == true -- to get false if nil
- checkboxes[checkbox_name] = is_enabled
-
- fields[#fields + 1] = ("checkbox[%f,%f;%s;%s;%s]"):format(
- x, y, checkbox_name, name, tostring(is_enabled)
- )
end
formspec = table.concat(fields)
height = height + max_height + 0.25
@@ -753,7 +764,7 @@ local function create_change_setting_formspec(dialogdata)
" (" .. setting.name .. ")"
end
- local comment_text = ""
+ local comment_text
if setting.comment == "" then
comment_text = fgettext_ne("(No description of setting given)")
else
@@ -830,8 +841,12 @@ local function handle_change_setting_buttons(this, fields)
elseif setting.type == "flags" then
local values = {}
for _, name in ipairs(setting.possible) do
- if checkboxes["cb_" .. name] then
- table.insert(values, name)
+ if name:sub(1, 2) ~= "no" then
+ if checkboxes["cb_" .. name] then
+ table.insert(values, name)
+ else
+ table.insert(values, "no" .. name)
+ end
end
end
@@ -918,7 +933,7 @@ local function handle_change_setting_buttons(this, fields)
return false
end
-local function create_settings_formspec(tabview, name, tabdata)
+local function create_settings_formspec(tabview, _, tabdata)
local formspec = "size[12,5.4;true]" ..
"tablecolumns[color;tree;text,width=28;text]" ..
"tableoptions[background=#00000000;border=false]" ..
@@ -950,7 +965,7 @@ local function create_settings_formspec(tabview, name, tabdata)
formspec = formspec .. "," .. (current_level + 1) .. "," .. core.formspec_escape(name) .. ","
.. value .. ","
- elseif entry.type == "key" then
+ elseif entry.type == "key" then --luacheck: ignore
-- ignore key settings, since we have a special dialog for them
elseif entry.type == "noise_params_2d" or entry.type == "noise_params_3d" then
@@ -1029,8 +1044,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
if fields["btn_edit"] or list_enter then
local setting = settings[selected_setting]
if setting and setting.type ~= "category" then
- local edit_dialog = dialog_create("change_setting", create_change_setting_formspec,
- handle_change_setting_buttons)
+ local edit_dialog = dialog_create("change_setting",
+ create_change_setting_formspec, handle_change_setting_buttons)
edit_dialog:set_parent(this)
this:hide()
edit_dialog:show()
@@ -1076,4 +1091,5 @@ end
-- For RUN_IN_PLACE the generated files may appear in the 'bin' folder.
-- See comment and alternative line at the end of 'generate_from_settingtypes.lua'.
---assert(loadfile(core.get_builtin_path().."mainmenu"..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
+--assert(loadfile(core.get_builtin_path().."mainmenu"..DIR_DELIM..
+-- "generate_from_settingtypes.lua"))(parse_config_file(true, false))
diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua
index 60a496093..f87367689 100644
--- a/builtin/mainmenu/pkgmgr.lua
+++ b/builtin/mainmenu/pkgmgr.lua
@@ -285,17 +285,14 @@ function pkgmgr.identify_modname(modpath,filename)
end
--------------------------------------------------------------------------------
function pkgmgr.render_packagelist(render_list)
- local retval = ""
-
- if render_list == nil then
- if pkgmgr.global_mods == nil then
+ if not render_list then
+ if not pkgmgr.global_mods then
pkgmgr.refresh_globals()
end
render_list = pkgmgr.global_mods
end
local list = render_list:get_list()
- local last_modpack = nil
local retval = {}
for i, v in ipairs(list) do
local color = ""
@@ -332,11 +329,11 @@ end
--------------------------------------------------------------------------------
function pkgmgr.get_dependencies(path)
if path == nil then
- return "", ""
+ return {}, {}
end
local info = core.get_content_info(path)
- return table.concat(info.depends or {}, ","), table.concat(info.optional_depends or {}, ",")
+ return info.depends or {}, info.optional_depends or {}
end
----------- tests whether all of the mods in the modpack are enabled -----------
@@ -350,35 +347,113 @@ function pkgmgr.is_modpack_entirely_enabled(data, name)
return true
end
----------- toggles or en/disables a mod or modpack -----------------------------
+---------- toggles or en/disables a mod or modpack and its dependencies --------
function pkgmgr.enable_mod(this, toset)
- local mod = this.data.list:get_list()[this.data.selected_mod]
+ local list = this.data.list:get_list()
+ local mod = list[this.data.selected_mod]
- -- game mods can't be enabled or disabled
+ -- Game mods can't be enabled or disabled
if mod.is_game_content then
return
end
- -- toggle or en/disable the mod
+ local toggled_mods = {}
+
+ local enabled_mods = {}
if not mod.is_modpack then
+ -- Toggle or en/disable the mod
if toset == nil then
- mod.enabled = not mod.enabled
- else
+ toset = not mod.enabled
+ end
+ if mod.enabled ~= toset then
mod.enabled = toset
+ toggled_mods[#toggled_mods+1] = mod.name
+ end
+ if toset then
+ -- Mark this mod for recursive dependency traversal
+ enabled_mods[mod.name] = true
+ end
+ else
+ -- Toggle or en/disable every mod in the modpack,
+ -- interleaved unsupported
+ for i = 1, #list do
+ if list[i].modpack == mod.name then
+ if toset == nil then
+ toset = not list[i].enabled
+ end
+ if list[i].enabled ~= toset then
+ list[i].enabled = toset
+ toggled_mods[#toggled_mods+1] = list[i].name
+ end
+ if toset then
+ enabled_mods[list[i].name] = true
+ end
+ end
end
+ end
+ if not toset then
+ -- Mod(s) were disabled, so no dependencies need to be enabled
+ table.sort(toggled_mods)
+ minetest.log("info", "Following mods were disabled: " ..
+ table.concat(toggled_mods, ", "))
return
end
- -- toggle or en/disable every mod in the modpack, interleaved unsupported
- local list = this.data.list:get_raw_list()
- for i = 1, #list do
- if list[i].modpack == mod.name then
- if toset == nil then
- toset = not list[i].enabled
+ -- Enable mods' depends after activation
+
+ -- Make a list of mod ids indexed by their names
+ local mod_ids = {}
+ for id, mod in pairs(list) do
+ if mod.type == "mod" and not mod.is_modpack then
+ mod_ids[mod.name] = id
+ end
+ end
+
+ -- to_enable is used as a DFS stack with sp as stack pointer
+ local to_enable = {}
+ local sp = 0
+ for name in pairs(enabled_mods) do
+ local depends = pkgmgr.get_dependencies(list[mod_ids[name]].path)
+ for i = 1, #depends do
+ local dependency_name = depends[i]
+ if not enabled_mods[dependency_name] then
+ sp = sp+1
+ to_enable[sp] = dependency_name
+ end
+ end
+ end
+ -- If sp is 0, every dependency is already activated
+ while sp > 0 do
+ local name = to_enable[sp]
+ sp = sp-1
+
+ if not enabled_mods[name] then
+ enabled_mods[name] = true
+ local mod = list[mod_ids[name]]
+ if not mod then
+ minetest.log("warning", "Mod dependency \"" .. name ..
+ "\" not found!")
+ else
+ if mod.enabled == false then
+ mod.enabled = true
+ toggled_mods[#toggled_mods+1] = mod.name
+ end
+ -- Push the dependencies of the dependency onto the stack
+ local depends = pkgmgr.get_dependencies(mod.path)
+ for i = 1, #depends do
+ if not enabled_mods[name] then
+ sp = sp+1
+ to_enable[sp] = depends[i]
+ end
+ end
end
- list[i].enabled = toset
end
end
+
+ -- Log the list of enabled mods
+ table.sort(toggled_mods)
+ minetest.log("info", "Following mods were enabled: " ..
+ table.concat(toggled_mods, ", "))
end
--------------------------------------------------------------------------------
@@ -465,7 +540,7 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
else
return nil,
fgettext("Install Mod: Unable to find suitable folder name for modpack $1",
- modfilename)
+ path)
end
end
elseif basefolder.type == "mod" then
@@ -490,7 +565,7 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
if targetfolder ~= nil and pkgmgr.isValidModname(targetfolder) then
targetpath = core.get_modpath() .. DIR_DELIM .. targetfolder
else
- return nil, fgettext("Install Mod: Unable to find real mod name for: $1", modfilename)
+ return nil, fgettext("Install Mod: Unable to find real mod name for: $1", path)
end
end
diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua
index d8e2c9753..336730bf4 100644
--- a/builtin/mainmenu/tab_content.lua
+++ b/builtin/mainmenu/tab_content.lua
@@ -134,9 +134,13 @@ local function get_formspec(tabview, name, tabdata)
end
retval = retval .. "textarea[5.85,2.2;6.35,2.9;;" ..
- fgettext("Information:") .. ";" .. desc .. "]" ..
- "button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;" ..
- fgettext("Uninstall Package") .. "]"
+ fgettext("Information:") .. ";" .. desc .. "]"
+
+ if core.may_modify_path(selected_pkg.path) then
+ retval = retval ..
+ "button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;" ..
+ fgettext("Uninstall Package") .. "]"
+ end
end
return retval
end
@@ -149,11 +153,6 @@ local function handle_buttons(tabview, fields, tabname, tabdata)
return true
end
- if fields["btn_mod_mgr_install_local"] ~= nil then
- core.show_file_open_dialog("mod_mgt_open_dlg", fgettext("Select Package File:"))
- return true
- end
-
if fields["btn_contentdb"] ~= nil then
local dlg = create_store_dlg()
dlg:set_parent(tabview)
@@ -197,12 +196,6 @@ local function handle_buttons(tabview, fields, tabname, tabdata)
return true
end
- if fields["mod_mgt_open_dlg_accepted"] and
- fields["mod_mgt_open_dlg_accepted"] ~= "" then
- pkgmgr.install_mod(fields["mod_mgt_open_dlg_accepted"],nil)
- return true
- end
-
return false
end
diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua
index 15ef96dc8..0969bccfb 100644
--- a/builtin/mainmenu/tab_local.lua
+++ b/builtin/mainmenu/tab_local.lua
@@ -21,7 +21,7 @@ local current_game, singleplayer_refresh_gamebar
if enable_gamebar then
function current_game()
local last_game_id = core.settings:get("menu_last_game")
- local game, index = pkgmgr.find_by_gameid(last_game_id)
+ local game = pkgmgr.find_by_gameid(last_game_id)
return game
end
@@ -222,7 +222,7 @@ local function main_button_handler(this, fields, name, tabdata)
--update last game
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
if world then
- local game, index = pkgmgr.find_by_gameid(world.gameid)
+ local game = pkgmgr.find_by_gameid(world.gameid)
core.settings:set("menu_last_game", game.id)
end
diff --git a/builtin/mainmenu/tab_online.lua b/builtin/mainmenu/tab_online.lua
index c632039fc..8733f7618 100644
--- a/builtin/mainmenu/tab_online.lua
+++ b/builtin/mainmenu/tab_online.lua
@@ -20,7 +20,7 @@ local function get_formspec(tabview, name, tabdata)
-- Update the cached supported proto info,
-- it may have changed after a change by the settings menu.
common_update_cached_supp_proto()
- local fav_selected = nil
+ local fav_selected
if menudata.search_result then
fav_selected = menudata.search_result[tabdata.fav_selected]
else
@@ -273,8 +273,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
for k = 1, #keywords do
local keyword = keywords[k]
if server.name then
- local name = server.name:lower()
- local _, count = name:gsub(keyword, keyword)
+ local sername = server.name:lower()
+ local _, count = sername:gsub(keyword, keyword)
found = found + count * 4
end
diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua
index 71b2d88fa..1e5264904 100644
--- a/builtin/mainmenu/tab_settings.lua
+++ b/builtin/mainmenu/tab_settings.lua
@@ -148,11 +148,9 @@ local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
core.create_world("singleplayerworld", 1)
worldlist = core.get_worlds()
- found_singleplayerworld = false
for i = 1, #worldlist do
if worldlist[i].name == "singleplayerworld" then
- found_singleplayerworld = true
gamedata.worldindex = i
end
end
@@ -254,7 +252,7 @@ local function formspec(tabview, name, tabdata)
.. dump(core.settings:get_bool("generate_normalmaps")) .. "]" ..
"checkbox[8.25,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
.. dump(core.settings:get_bool("enable_parallax_occlusion")) .. "]" ..
- "checkbox[8.25,2.5;cb_waving_water;" .. fgettext("Waving Water") .. ";"
+ "checkbox[8.25,2.5;cb_waving_water;" .. fgettext("Waving Liquids") .. ";"
.. dump(core.settings:get_bool("enable_waving_water")) .. "]" ..
"checkbox[8.25,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
.. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
@@ -271,7 +269,7 @@ local function formspec(tabview, name, tabdata)
"label[8.38,2.2;" .. core.colorize("#888888",
fgettext("Parallax Occlusion")) .. "]" ..
"label[8.38,2.7;" .. core.colorize("#888888",
- fgettext("Waving Water")) .. "]" ..
+ fgettext("Waving Liquids")) .. "]" ..
"label[8.38,3.2;" .. core.colorize("#888888",
fgettext("Waving Leaves")) .. "]" ..
"label[8.38,3.7;" .. core.colorize("#888888",
diff --git a/builtin/mainmenu/tab_simple_main.lua b/builtin/mainmenu/tab_simple_main.lua
index de4ae1751..7ec95158a 100644
--- a/builtin/mainmenu/tab_simple_main.lua
+++ b/builtin/mainmenu/tab_simple_main.lua
@@ -188,10 +188,10 @@ local function main_button_handler(tabview, fields, name, tabdata)
core.settings:set("address", fields.te_address)
core.settings:set("remote_port", fields.te_port)
-
- core.start()
- return true
- end
+
+ core.start()
+ return true
+ end
if fields.btn_config_sp_world then
local configdialog = create_configure_world_dlg(1)
diff --git a/builtin/mainmenu/textures.lua b/builtin/mainmenu/textures.lua
index 68b05dc18..a3acbbdec 100644
--- a/builtin/mainmenu/textures.lua
+++ b/builtin/mainmenu/textures.lua
@@ -23,9 +23,9 @@ function mm_texture.init()
mm_texture.defaulttexturedir = core.get_texturepath() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM
mm_texture.basetexturedir = mm_texture.defaulttexturedir
-
+
mm_texture.texturepack = core.settings:get("texture_path")
-
+
mm_texture.gameid = nil
end
@@ -39,7 +39,7 @@ function mm_texture.update(tab,gamedetails)
if gamedetails == nil then
return
end
-
+
mm_texture.update_game(gamedetails)
end
@@ -48,18 +48,18 @@ function mm_texture.reset()
mm_texture.gameid = nil
local have_bg = false
local have_overlay = mm_texture.set_generic("overlay")
-
+
if not have_overlay then
have_bg = mm_texture.set_generic("background")
end
-
+
mm_texture.clear("header")
mm_texture.clear("footer")
core.set_clouds(false)
-
+
mm_texture.set_generic("footer")
mm_texture.set_generic("header")
-
+
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
@@ -74,30 +74,30 @@ function mm_texture.update_game(gamedetails)
if mm_texture.gameid == gamedetails.id then
return
end
-
+
local have_bg = false
local have_overlay = mm_texture.set_game("overlay",gamedetails)
-
+
if not have_overlay then
have_bg = mm_texture.set_game("background",gamedetails)
end
-
+
mm_texture.clear("header")
mm_texture.clear("footer")
core.set_clouds(false)
-
+
if not have_bg then
-
+
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
mm_texture.set_dirt_bg()
end
end
-
+
mm_texture.set_game("footer",gamedetails)
mm_texture.set_game("header",gamedetails)
-
+
mm_texture.gameid = gamedetails.id
end
@@ -116,7 +116,7 @@ function mm_texture.set_generic(identifier)
return true
end
end
-
+
if mm_texture.defaulttexturedir ~= nil then
local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
identifier .. ".png"
@@ -124,13 +124,13 @@ function mm_texture.set_generic(identifier)
return true
end
end
-
+
return false
end
--------------------------------------------------------------------------------
function mm_texture.set_game(identifier, gamedetails)
-
+
if gamedetails == nil then
return false
end
@@ -142,7 +142,7 @@ function mm_texture.set_game(identifier, gamedetails)
return true
end
end
-
+
-- Find out how many randomized textures the game provides
local n = 0
local filename
@@ -167,7 +167,7 @@ function mm_texture.set_game(identifier, gamedetails)
if core.set_background(identifier, path) then
return true
end
-
+
return false
end
@@ -178,7 +178,7 @@ function mm_texture.set_dirt_bg()
return true
end
end
-
+
-- Use universal fallback texture in textures/base/pack
local minimalpath = defaulttexturedir .. "menu_bg.png"
core.set_background("background", minimalpath, true, 128)