aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/common.lua10
-rw-r--r--builtin/mainmenu/dlg_config_world.lua48
-rw-r--r--builtin/mainmenu/dlg_settings_advanced.lua108
-rw-r--r--builtin/mainmenu/generate_from_settingtypes.lua99
-rw-r--r--builtin/mainmenu/modmgr.lua18
-rw-r--r--builtin/mainmenu/tab_credits.lua17
-rw-r--r--builtin/mainmenu/tab_mods.lua24
-rw-r--r--builtin/mainmenu/tab_texturepacks.lua6
8 files changed, 192 insertions, 138 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index 1fd89ff77..da3667828 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -248,14 +248,18 @@ end
--------------------------------------------------------------------------------
function is_server_protocol_compat(server_proto_min, server_proto_max)
- return min_supp_proto <= (server_proto_max or 24) and max_supp_proto >= (server_proto_min or 13)
+ if (not server_proto_min) or (not server_proto_max) then
+ -- There is no info. Assume the best and act as if we would be compatible.
+ return true
+ end
+ return min_supp_proto <= server_proto_max and max_supp_proto >= server_proto_min
end
--------------------------------------------------------------------------------
function is_server_protocol_compat_or_error(server_proto_min, server_proto_max)
if not is_server_protocol_compat(server_proto_min, server_proto_max) then
local server_prot_ver_info, client_prot_ver_info
- local s_p_min = server_proto_min or 13
- local s_p_max = server_proto_max or 24
+ local s_p_min = server_proto_min
+ local s_p_max = server_proto_max
if s_p_min ~= s_p_max then
server_prot_ver_info = fgettext_ne("Server supports protocol versions between $1 and $2. ",
diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua
index eb0319ba0..7b3ab9852 100644
--- a/builtin/mainmenu/dlg_config_world.lua
+++ b/builtin/mainmenu/dlg_config_world.lua
@@ -16,6 +16,9 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------------
+
+local enabled_all = false
+
local function modname_valid(name)
return not name:find("[^a-z0-9_]")
end
@@ -44,13 +47,18 @@ local function get_formspec(data)
if mod == nil then
mod = {name=""}
end
+
+ local hard_deps, soft_deps = modmgr.get_dependencies(mod.path)
retval = retval ..
"label[0,0.7;" .. fgettext("Mod:") .. "]" ..
"label[0.75,0.7;" .. mod.name .. "]" ..
- "label[0,1.25;" .. fgettext("Depends:") .. "]" ..
- "textlist[0,1.75;5,4.25;world_config_depends;" ..
- modmgr.get_dependencies(mod.path) .. ";0]" ..
+ "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]" ..
"button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" ..
"button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]"
@@ -80,11 +88,15 @@ local function get_formspec(data)
end
end
end
-
- retval = retval ..
- "button[8.75,0.125;2.5,0.5;btn_all_mods;" .. fgettext("Enable all") .. "]" ..
- "textlist[5.5,0.75;5.75,5.25;world_config_modlist;"
-
+ if enabled_all then
+ retval = retval ..
+ "button[8.75,0.125;2.5,0.5;btn_disable_all_mods;" .. fgettext("Disable all") .. "]" ..
+ "textlist[5.5,0.75;5.75,5.4;world_config_modlist;"
+ else
+ retval = retval ..
+ "button[8.75,0.125;2.5,0.5;btn_enable_all_mods;" .. fgettext("Enable all") .. "]" ..
+ "textlist[5.5,0.75;5.75,5.4;world_config_modlist;"
+ end
retval = retval .. modmgr.render_modlist(data.list)
retval = retval .. ";" .. data.selected_mod .."]"
@@ -229,15 +241,27 @@ local function handle_buttons(this, fields)
return true
end
- if fields["btn_all_mods"] then
+ if fields.btn_enable_all_mods then
local list = this.data.list:get_raw_list()
- for i=1,#list,1 do
- if list[i].typ ~= "game_mod" and
- not list[i].is_modpack then
+ for i = 1, #list do
+ if list[i].typ ~= "game_mod" and not list[i].is_modpack then
list[i].enabled = true
end
end
+ enabled_all = true
+ return true
+ end
+
+ if fields.btn_disable_all_mods then
+ local list = this.data.list:get_raw_list()
+
+ for i = 1, #list do
+ if list[i].typ ~= "game_mod" and not list[i].is_modpack then
+ list[i].enabled = false
+ end
+ end
+ enabled_all = false
return true
end
diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua
index f5e80c252..b0d923768 100644
--- a/builtin/mainmenu/dlg_settings_advanced.lua
+++ b/builtin/mainmenu/dlg_settings_advanced.lua
@@ -479,13 +479,13 @@ local function handle_change_setting_buttons(this, fields)
return true
end
if setting.min and new_value < setting.min then
- this.data.error_message = fgettext_ne("The value must be greater than $1.", setting.min)
+ this.data.error_message = fgettext_ne("The value must be at least $1.", setting.min)
this.data.entered_text = fields["te_setting_value"]
core.update_formspec(this:get_formspec())
return true
end
if setting.max and new_value > setting.max then
- this.data.error_message = fgettext_ne("The value must be lower than $1.", setting.max)
+ this.data.error_message = fgettext_ne("The value must not be larger than $1.", setting.max)
this.data.entered_text = fields["te_setting_value"]
core.update_formspec(this:get_formspec())
return true
@@ -659,102 +659,12 @@ function create_adv_settings_dlg()
return dlg
end
-local function create_minetest_conf_example()
- local result = "# This file contains a list of all available settings and their default value for minetest.conf\n" ..
- "\n" ..
- "# By default, all the settings are commented and not functional.\n" ..
- "# Uncomment settings by removing the preceding #.\n" ..
- "\n" ..
- "# minetest.conf is read by default from:\n" ..
- "# ../minetest.conf\n" ..
- "# ../../minetest.conf\n" ..
- "# Any other path can be chosen by passing the path as a parameter\n" ..
- "# to the program, eg. \"minetest.exe --config ../minetest.conf.example\".\n" ..
- "\n" ..
- "# Further documentation:\n" ..
- "# http://wiki.minetest.net/\n" ..
- "\n"
-
- local settings = parse_config_file(true, false)
- for _, entry in ipairs(settings) do
- if entry.type == "category" then
- if entry.level == 0 then
- result = result .. "#\n# " .. entry.name .. "\n#\n\n"
- else
- for i = 1, entry.level do
- result = result .. "#"
- end
- result = result .. "# " .. entry.name .. "\n\n"
- end
- else
- if entry.comment ~= "" then
- for _, comment_line in ipairs(entry.comment:split("\n", true)) do
- result = result .."# " .. comment_line .. "\n"
- end
- end
- result = result .. "# type: " .. entry.type
- if entry.min then
- result = result .. " min: " .. entry.min
- end
- if entry.max then
- result = result .. " max: " .. entry.max
- end
- if entry.values then
- result = result .. " values: " .. table.concat(entry.values, ", ")
- end
- if entry.possible then
- result = result .. " possible values: " .. entry.possible:gsub(",", ", ")
- end
- result = result .. "\n"
- local append = ""
- if entry.default ~= "" then
- append = " " .. entry.default
- end
- result = result .. "# " .. entry.name .. " =" .. append .. "\n\n"
- end
- end
- return result
-end
+-- Generate minetest.conf.example and settings_translation_file.cpp
-local function create_translation_file()
- local result = "// This file is automatically generated\n" ..
- "// It conatins a bunch of fake gettext calls, to tell xgettext about the strings in config files\n" ..
- "// To update it, refer to the bottom of builtin/mainmenu/tab_settings.lua\n\n" ..
- "fake_function() {\n"
+-- *** Please note ***
+-- There is text in minetest.conf.example that will not be generated from
+-- settingtypes.txt but must be preserved:
+-- The documentation of mapgen noise parameter formats (title plus 16 lines)
+-- Noise parameter 'mgv5_np_ground' in group format (13 lines)
- local settings = parse_config_file(true, false)
- for _, entry in ipairs(settings) do
- if entry.type == "category" then
- local name_escaped = entry.name:gsub("\"", "\\\"")
- result = result .. "\tgettext(\"" .. name_escaped .. "\");\n"
- else
- if entry.readable_name then
- local readable_name_escaped = entry.readable_name:gsub("\"", "\\\"")
- result = result .. "\tgettext(\"" .. readable_name_escaped .. "\");\n"
- end
- if entry.comment ~= "" then
- local comment_escaped = entry.comment:gsub("\n", "\\n")
- comment_escaped = comment_escaped:gsub("\"", "\\\"")
- result = result .. "\tgettext(\"" .. comment_escaped .. "\");\n"
- end
- end
- end
- result = result .. "}\n"
- return result
-end
-
-if false then
- local file = io.open("minetest.conf.example", "w")
- if file then
- file:write(create_minetest_conf_example())
- file:close()
- end
-end
-
-if false then
- local file = io.open("src/settings_translation_file.cpp", "w")
- if file then
- file:write(create_translation_file())
- file:close()
- end
-end
+--assert(loadfile(core.get_mainmenu_path()..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
diff --git a/builtin/mainmenu/generate_from_settingtypes.lua b/builtin/mainmenu/generate_from_settingtypes.lua
new file mode 100644
index 000000000..6c9ba27fb
--- /dev/null
+++ b/builtin/mainmenu/generate_from_settingtypes.lua
@@ -0,0 +1,99 @@
+local settings = ...
+
+local concat = table.concat
+local insert = table.insert
+local sprintf = string.format
+local rep = string.rep
+
+local minetest_example_header = [[
+# This file contains a list of all available settings and their default value for minetest.conf
+
+# By default, all the settings are commented and not functional.
+# Uncomment settings by removing the preceding #.
+
+# minetest.conf is read by default from:
+# ../minetest.conf
+# ../../minetest.conf
+# Any other path can be chosen by passing the path as a parameter
+# to the program, eg. "minetest.exe --config ../minetest.conf.example".
+
+# Further documentation:
+# http://wiki.minetest.net/
+
+]]
+
+local function create_minetest_conf_example()
+ local result = { minetest_example_header }
+ for _, entry in ipairs(settings) do
+ if entry.type == "category" then
+ if entry.level == 0 then
+ insert(result, "#\n# " .. entry.name .. "\n#\n\n")
+ else
+ insert(result, rep("#", entry.level))
+ insert(result, "# " .. entry.name .. "\n\n")
+ end
+ else
+ if entry.comment ~= "" then
+ for _, comment_line in ipairs(entry.comment:split("\n", true)) do
+ insert(result, "# " .. comment_line .. "\n")
+ end
+ end
+ insert(result, "# type: " .. entry.type)
+ if entry.min then
+ insert(result, " min: " .. entry.min)
+ end
+ if entry.max then
+ insert(result, " max: " .. entry.max)
+ end
+ if entry.values then
+ insert(result, " values: " .. concat(entry.values, ", "))
+ end
+ if entry.possible then
+ insert(result, " possible values: " .. entry.possible:gsub(",", ", "))
+ end
+ insert(result, "\n")
+ local append
+ if entry.default ~= "" then
+ append = " " .. entry.default
+ end
+ insert(result, sprintf("# %s =%s\n\n", entry.name, append or ""))
+ end
+ end
+ return concat(result)
+end
+
+local translation_file_header = [[
+// This file is automatically generated
+// It conatins a bunch of fake gettext calls, to tell xgettext about the strings in config files
+// To update it, refer to the bottom of builtin/mainmenu/dlg_settings_advanced.lua
+
+fake_function() {]]
+
+local function create_translation_file()
+ local result = { translation_file_header }
+ for _, entry in ipairs(settings) do
+ if entry.type == "category" then
+ insert(result, sprintf("\tgettext(%q);", entry.name))
+ else
+ if entry.readable_name then
+ insert(result, sprintf("\tgettext(%q);", entry.readable_name))
+ end
+ if entry.comment ~= "" then
+ local comment_escaped = entry.comment:gsub("\n", "\\n")
+ comment_escaped = comment_escaped:gsub("\"", "\\\"")
+ insert(result, "\tgettext(\"" .. comment_escaped .. "\");")
+ end
+ end
+ end
+ insert(result, "}\n")
+ return concat(result, "\n")
+end
+
+local file = assert(io.open("minetest.conf.example", "w"))
+file:write(create_minetest_conf_example())
+file:close()
+
+file = assert(io.open("src/settings_translation_file.cpp", "w"))
+file:write(create_translation_file())
+file:close()
+
diff --git a/builtin/mainmenu/modmgr.lua b/builtin/mainmenu/modmgr.lua
index f996df7ba..2b7b371bf 100644
--- a/builtin/mainmenu/modmgr.lua
+++ b/builtin/mainmenu/modmgr.lua
@@ -284,27 +284,33 @@ end
--------------------------------------------------------------------------------
function modmgr.get_dependencies(modfolder)
- local toadd = ""
+ local toadd_hard = ""
+ local toadd_soft = ""
if modfolder ~= nil then
local filename = modfolder ..
DIR_DELIM .. "depends.txt"
+ local hard_dependencies = {}
+ local soft_dependencies = {}
local dependencyfile = io.open(filename,"r")
-
if dependencyfile then
local dependency = dependencyfile:read("*l")
while dependency do
- if toadd ~= "" then
- toadd = toadd .. ","
+ dependency = dependency:gsub("\r", "")
+ if string.sub(dependency, -1, -1) == "?" then
+ table.insert(soft_dependencies, string.sub(dependency, 1, -2))
+ else
+ table.insert(hard_dependencies, dependency)
end
- toadd = toadd .. dependency
dependency = dependencyfile:read()
end
dependencyfile:close()
end
+ toadd_hard = table.concat(hard_dependencies, ",")
+ toadd_soft = table.concat(soft_dependencies, ",")
end
- return toadd
+ return toadd_hard, toadd_soft
end
--------------------------------------------------------------------------------
diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua
index 4d2ffd7f4..c2ad19183 100644
--- a/builtin/mainmenu/tab_credits.lua
+++ b/builtin/mainmenu/tab_credits.lua
@@ -29,20 +29,23 @@ local core_developers = {
"Loic Blot (nerzhul/nrz) <loic.blot@unix-experience.fr>",
"Matt Gregory (paramat)",
"est31 <MTest31@outlook.com>",
- "Craig Robbins (Zeno)",
+ "Craig Robbins (Zeno) <craig.d.robbins@gmail.com>",
+ "Auke Kok (sofar) <sofar@foo-projects.org>",
+ "Andrew Ward (rubenwardy) <rubenwardy@gmail.com>",
}
local active_contributors = {
- "Auke Kok (sofar) <sofar@foo-projects.org>",
"Duane Robertson <duane@duanerobertson.com>",
"SmallJoker <mk939@ymail.com>",
- "Andrew Ward (rubenwardy) <rubenwardy@gmail.com>",
+ "Lars Hofhansl <larsh@apache.org>",
"Jeija <jeija@mesecons.net>",
"Gregory Currie (gregorycu)",
"Sokomine <wegwerf@anarres.dyndns.org>",
"TeTpaAka",
"Jean-Patrick G (kilbith) <jeanpatrick.guerrero@gmail.com>",
"Diego Martínez (kaeza) <kaeza@users.sf.net>",
+ "Dániel Juhász (juhdanad) <juhdanad@gmail.com>",
+ "Rogier <rogier777@gmail.com>",
}
local previous_core_developers = {
@@ -76,17 +79,13 @@ return {
caption = fgettext("Credits"),
cbf_formspec = function(tabview, name, tabdata)
local logofile = defaulttexturedir .. "logo.png"
+ local version = core.get_version()
return "image[0.5,1;" .. core.formspec_escape(logofile) .. "]" ..
- "label[0.5,3.2;Minetest " .. core.get_version() .. "]" ..
+ "label[0.5,3.2;" .. version.project .. " " .. version.string .. "]" ..
"label[0.5,3.5;http://minetest.net]" ..
"tablecolumns[color;text]" ..
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
"table[3.5,-0.25;8.5,5.8;list_credits;" ..
- "#FFFF00," .. "Dedication of the current release" .. ",," ..
- "The 0.4.14 release is dedicated to the memory of" .. ",," ..
- "Minetest developer Maciej Kasatkin (RealBadAngel)" .. ",," ..
- "who died on March 24 2016." .. ",," ..
- "Our thoughts are with his family and friends." .. ",,," ..
"#FFFF00," .. fgettext("Core Developers") .. ",," ..
table.concat(core_developers, ",,") .. ",,," ..
"#FFFF00," .. fgettext("Active Contributors") .. ",," ..
diff --git a/builtin/mainmenu/tab_mods.lua b/builtin/mainmenu/tab_mods.lua
index 5b59aa110..4a5b6c041 100644
--- a/builtin/mainmenu/tab_mods.lua
+++ b/builtin/mainmenu/tab_mods.lua
@@ -98,12 +98,24 @@ local function get_formspec(tabview, name, tabdata)
.. fgettext("Uninstall selected modpack") .. "]"
else
--show dependencies
-
- retval = retval .. "," .. fgettext("Depends:") .. ","
-
- local toadd = modmgr.get_dependencies(selected_mod.path)
-
- retval = retval .. toadd .. ";0]"
+ local toadd_hard, toadd_soft = modmgr.get_dependencies(selected_mod.path)
+ if toadd_hard == "" and toadd_soft == "" then
+ retval = retval .. "," .. fgettext("No dependencies.")
+ else
+ if toadd_hard ~= "" then
+ retval = retval .. "," .. fgettext("Dependencies:") .. ","
+ retval = retval .. toadd_hard
+ end
+ if toadd_soft ~= "" then
+ if toadd_hard ~= "" then
+ retval = retval .. ","
+ end
+ retval = retval .. "," .. fgettext("Optional dependencies:") .. ","
+ retval = retval .. toadd_soft
+ end
+ end
+
+ retval = retval .. ";0]"
retval = retval .. "button[5.5,4.85;4.5,0.5;btn_mod_mgr_delete_mod;"
.. fgettext("Uninstall selected mod") .. "]"
diff --git a/builtin/mainmenu/tab_texturepacks.lua b/builtin/mainmenu/tab_texturepacks.lua
index a102fd61d..4638beaa1 100644
--- a/builtin/mainmenu/tab_texturepacks.lua
+++ b/builtin/mainmenu/tab_texturepacks.lua
@@ -73,7 +73,7 @@ local function get_formspec(tabview, name, tabdata)
if not file_exists(infofile) then
infofile = current_texture_path .. DIR_DELIM .. "info.txt"
if file_exists(infofile) then
- core.log("info.txt is depreciated. description.txt should be used instead.")
+ core.log("deprecated", "info.txt is deprecated. description.txt should be used instead.")
end
end
@@ -96,8 +96,8 @@ local function get_formspec(tabview, name, tabdata)
return retval ..
render_texture_pack_list(list) ..
";" .. index .. "]" ..
- "image[0.25,0.25;4.0,3.7;" .. core.formspec_escape(screenfile or no_screenshot) .. "]" ..
- "textarea[0.6,3.5;3.7,1.5;;" .. core.formspec_escape(infotext or "") .. ";]"
+ "image[0.25,0.25;4.05,2.7;" .. core.formspec_escape(screenfile or no_screenshot) .. "]" ..
+ "textarea[0.6,2.85;3.7,1.5;;" .. core.formspec_escape(infotext or "") .. ";]"
end
--------------------------------------------------------------------------------