aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 22:12:00 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 22:12:00 +0200
commit21df26984da91143c15587f5a03c98d68c3adc4e (patch)
treeaaa707a628ad331f67890023dffe1b4f60dd01d3 /builtin
parentb09fc5de5cdb021f43ad32b7e3f50dc75c0bc622 (diff)
parenteabf05758e3ba5f6f4bb1b8d1d1f02179b84e410 (diff)
downloaddragonfireclient-21df26984da91143c15587f5a03c98d68c3adc4e.tar.xz
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'builtin')
-rw-r--r--builtin/async/game.lua46
-rw-r--r--builtin/async/mainmenu.lua (renamed from builtin/async/init.lua)4
-rw-r--r--builtin/client/register.lua1
-rw-r--r--builtin/common/after.lua9
-rw-r--r--builtin/common/chatcommands.lua89
-rw-r--r--builtin/common/information_formspecs.lua32
-rw-r--r--builtin/common/misc_helpers.lua2
-rw-r--r--builtin/common/strict.lua11
-rw-r--r--builtin/common/tests/misc_helpers_spec.lua1
-rw-r--r--builtin/common/tests/serialize_spec.lua1
-rw-r--r--builtin/common/tests/vector_spec.lua11
-rw-r--r--builtin/common/vector.lua16
-rw-r--r--builtin/fstk/ui.lua2
-rw-r--r--builtin/game/async.lua22
-rw-r--r--builtin/game/chat.lua42
-rw-r--r--builtin/game/features.lua1
-rw-r--r--builtin/game/init.lua3
-rw-r--r--builtin/game/item.lua200
-rw-r--r--builtin/game/item_entity.lua13
-rw-r--r--builtin/game/item_s.lua156
-rw-r--r--builtin/game/misc.lua116
-rw-r--r--builtin/game/misc_s.lua93
-rw-r--r--builtin/game/privileges.lua4
-rw-r--r--builtin/game/register.lua14
-rw-r--r--builtin/game/statbars.lua68
-rw-r--r--builtin/init.lua6
-rw-r--r--builtin/locale/__builtin.de.tr11
-rw-r--r--builtin/locale/__builtin.it.tr15
-rw-r--r--builtin/locale/template.txt11
-rw-r--r--builtin/mainmenu/common.lua28
-rw-r--r--builtin/mainmenu/dlg_config_world.lua30
-rw-r--r--builtin/mainmenu/dlg_contentstore.lua85
-rw-r--r--builtin/mainmenu/dlg_create_world.lua275
-rw-r--r--builtin/mainmenu/dlg_settings_advanced.lua69
-rw-r--r--builtin/mainmenu/game_theme.lua (renamed from builtin/mainmenu/textures.lua)98
-rw-r--r--builtin/mainmenu/generate_from_settingtypes.lua17
-rw-r--r--builtin/mainmenu/init.lua8
-rw-r--r--builtin/mainmenu/pkgmgr.lua205
-rw-r--r--builtin/mainmenu/tab_about.lua50
-rw-r--r--builtin/mainmenu/tab_content.lua35
-rw-r--r--builtin/mainmenu/tab_local.lua92
-rw-r--r--builtin/mainmenu/tab_settings.lua20
-rw-r--r--builtin/mainmenu/tests/serverlistmgr_spec.lua1
-rw-r--r--builtin/profiler/instrumentation.lua5
-rw-r--r--builtin/settingtypes.txt111
45 files changed, 1221 insertions, 908 deletions
diff --git a/builtin/async/game.lua b/builtin/async/game.lua
new file mode 100644
index 000000000..e3119d8cb
--- /dev/null
+++ b/builtin/async/game.lua
@@ -0,0 +1,46 @@
+core.log("info", "Initializing asynchronous environment (game)")
+
+local function pack2(...)
+ return {n=select('#', ...), ...}
+end
+
+-- Entrypoint to run async jobs, called by C++
+function core.job_processor(func, params)
+ local retval = pack2(func(unpack(params, 1, params.n)))
+
+ return retval
+end
+
+-- Import a bunch of individual files from builtin/game/
+local gamepath = core.get_builtin_path() .. "game" .. DIR_DELIM
+local commonpath = core.get_builtin_path() .. "common" .. DIR_DELIM
+
+dofile(gamepath .. "constants.lua")
+dofile(gamepath .. "item_s.lua")
+dofile(gamepath .. "misc_s.lua")
+dofile(gamepath .. "features.lua")
+dofile(commonpath .. "voxelarea.lua")
+
+-- Transfer of globals
+do
+ local all = assert(core.transferred_globals)
+ core.transferred_globals = nil
+
+ -- reassemble other tables
+ all.registered_nodes = {}
+ all.registered_craftitems = {}
+ all.registered_tools = {}
+ for k, v in pairs(all.registered_items) do
+ if v.type == "node" then
+ all.registered_nodes[k] = v
+ elseif v.type == "craftitem" then
+ all.registered_craftitems[k] = v
+ elseif v.type == "tool" then
+ all.registered_tools[k] = v
+ end
+ end
+
+ for k, v in pairs(all) do
+ core[k] = v
+ end
+end
diff --git a/builtin/async/init.lua b/builtin/async/mainmenu.lua
index 3803994d6..0e9c222d1 100644
--- a/builtin/async/init.lua
+++ b/builtin/async/mainmenu.lua
@@ -1,5 +1,4 @@
-
-core.log("info", "Initializing Asynchronous environment")
+core.log("info", "Initializing asynchronous environment")
function core.job_processor(func, serialized_param)
local param = core.deserialize(serialized_param)
@@ -8,4 +7,3 @@ function core.job_processor(func, serialized_param)
return retval or core.serialize(nil)
end
-
diff --git a/builtin/client/register.lua b/builtin/client/register.lua
index f17188b84..637a22556 100644
--- a/builtin/client/register.lua
+++ b/builtin/client/register.lua
@@ -1,4 +1,3 @@
-
core.callback_origins = {}
local getinfo = debug.getinfo
diff --git a/builtin/common/after.lua b/builtin/common/after.lua
index e20f292f0..bce262537 100644
--- a/builtin/common/after.lua
+++ b/builtin/common/after.lua
@@ -37,7 +37,14 @@ function core.after(after, func, ...)
arg = {...},
mod_origin = core.get_last_run_mod(),
}
+
jobs[#jobs + 1] = new_job
time_next = math.min(time_next, expire)
- return { cancel = function() new_job.func = function() end end }
+
+ return {
+ cancel = function()
+ new_job.func = function() end
+ new_job.args = {}
+ end
+ }
end
diff --git a/builtin/common/chatcommands.lua b/builtin/common/chatcommands.lua
index 62f9eacd0..817f1f526 100644
--- a/builtin/common/chatcommands.lua
+++ b/builtin/common/chatcommands.lua
@@ -6,6 +6,42 @@ local S = core.get_translator("__builtin")
core.registered_chatcommands = {}
+-- Interpret the parameters of a command, separating options and arguments.
+-- Input: command, param
+-- command: name of command
+-- param: parameters of command
+-- Returns: opts, args
+-- opts is a string of option letters, or false on error
+-- args is an array with the non-option arguments in order, or an error message
+-- Example: for this command line:
+-- /command a b -cd e f -g
+-- the function would receive:
+-- a b -cd e f -g
+-- and it would return:
+-- "cdg", {"a", "b", "e", "f"}
+-- Negative numbers are taken as arguments. Long options (--option) are
+-- currently rejected as reserved.
+local function getopts(command, param)
+ local opts = ""
+ local args = {}
+ for match in param:gmatch("%S+") do
+ if match:byte(1) == 45 then -- 45 = '-'
+ local second = match:byte(2)
+ if second == 45 then
+ return false, S("Invalid parameters (see /help @1).", command)
+ elseif second and (second < 48 or second > 57) then -- 48 = '0', 57 = '9'
+ opts = opts .. match:sub(2)
+ else
+ -- numeric, add it to args
+ args[#args + 1] = match
+ end
+ else
+ args[#args + 1] = match
+ end
+ end
+ return opts, args
+end
+
function core.register_chatcommand(cmd, def)
def = def or {}
def.params = def.params or ""
@@ -78,22 +114,30 @@ if INIT == "client" then
end
end
+local function format_help_line(cmd, def)
+ local cmd_marker = INIT == "client" and "." or "/"
+ local msg = core.colorize("#00ffff", cmd_marker .. cmd)
+ if def.params and def.params ~= "" then
+ msg = msg .. " " .. def.params
+ end
+ if def.description and def.description ~= "" then
+ msg = msg .. ": " .. def.description
+ end
+ return msg
+end
+
local function do_help_cmd(name, param)
- local function format_help_line(cmd, def)
- local cmd_marker = "/"
- if INIT == "client" then
- cmd_marker = "."
- end
- local msg = core.colorize("#00ffff", cmd_marker .. cmd)
- if def.params and def.params ~= "" then
- msg = msg .. " " .. def.params
- end
- if def.description and def.description ~= "" then
- msg = msg .. ": " .. def.description
- end
- return msg
+ local opts, args = getopts("help", param)
+ if not opts then
+ return false, args
+ end
+ if #args > 1 then
+ return false, S("Too many arguments, try using just /help <command>")
end
- if param == "" then
+ local use_gui = INIT ~= "client" and core.get_player_by_name(name)
+ use_gui = use_gui and not opts:find("t")
+
+ if #args == 0 and not use_gui then
local cmds = {}
for cmd, def in pairs(core.registered_chatcommands) do
if INIT == "client" or core.check_player_privs(name, def.privs) then
@@ -116,7 +160,10 @@ local function do_help_cmd(name, param)
.. "everything.")
end
return true, msg
- elseif param == "all" then
+ elseif #args == 0 or (args[1] == "all" and use_gui) then
+ core.show_general_help_formspec(name)
+ return true
+ elseif args[1] == "all" then
local cmds = {}
for cmd, def in pairs(core.registered_chatcommands) do
if INIT == "client" or core.check_player_privs(name, def.privs) then
@@ -131,7 +178,11 @@ local function do_help_cmd(name, param)
msg = core.gettext("Available commands:")
end
return true, msg.."\n"..table.concat(cmds, "\n")
- elseif INIT == "game" and param == "privs" then
+ elseif INIT == "game" and args[1] == "privs" then
+ if use_gui then
+ core.show_privs_help_formspec(name)
+ return true
+ end
local privs = {}
for priv, def in pairs(core.registered_privileges) do
privs[#privs + 1] = priv .. ": " .. def.description
@@ -139,7 +190,7 @@ local function do_help_cmd(name, param)
table.sort(privs)
return true, S("Available privileges:").."\n"..table.concat(privs, "\n")
else
- local cmd = param
+ local cmd = args[1]
local def = core.registered_chatcommands[cmd]
if not def then
local msg
@@ -165,8 +216,8 @@ if INIT == "client" then
})
else
core.register_chatcommand("help", {
- params = S("[all | privs | <cmd>]"),
- description = S("Get help for commands or list privileges"),
+ params = S("[all | privs | <cmd>] [-t]"),
+ description = S("Get help for commands or list privileges (-t: output in chat)"),
func = do_help_cmd,
})
end
diff --git a/builtin/common/information_formspecs.lua b/builtin/common/information_formspecs.lua
index e814b4c43..3405263bf 100644
--- a/builtin/common/information_formspecs.lua
+++ b/builtin/common/information_formspecs.lua
@@ -125,30 +125,12 @@ core.register_on_player_receive_fields(function(player, formname, fields)
end
end)
-
-local help_command = core.registered_chatcommands["help"]
-local old_help_func = help_command.func
-
-help_command.func = function(name, param)
- local admin = core.settings:get("name")
-
- -- If the admin ran help, put the output in the chat buffer as well to
- -- work with the server terminal
- if param == "privs" then
- core.show_formspec(name, "__builtin:help_privs",
- build_privs_formspec(name))
- if name ~= admin then
- return true
- end
- end
- if param == "" or param == "all" then
- core.show_formspec(name, "__builtin:help_cmds",
- build_chatcommands_formspec(name))
- if name ~= admin then
- return true
- end
- end
-
- return old_help_func(name, param)
+function core.show_general_help_formspec(name)
+ core.show_formspec(name, "__builtin:help_cmds",
+ build_chatcommands_formspec(name))
end
+function core.show_privs_help_formspec(name)
+ core.show_formspec(name, "__builtin:help_privs",
+ build_privs_formspec(name))
+end
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index e4bc056d9..542b2040d 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -543,7 +543,7 @@ if INIT == "mainmenu" then
end
end
-if INIT == "client" or INIT == "mainmenu" then
+if core.gettext then -- for client and mainmenu
function fgettext_ne(text, ...)
text = core.gettext(text)
local arg = {n=select('#', ...), ...}
diff --git a/builtin/common/strict.lua b/builtin/common/strict.lua
index ccde9676b..f46234dc6 100644
--- a/builtin/common/strict.lua
+++ b/builtin/common/strict.lua
@@ -1,8 +1,3 @@
-
--- Always warn when creating a global variable, even outside of a function.
--- This ignores mod namespaces (variables with the same name as the current mod).
-local WARN_INIT = false
-
local getinfo = debug.getinfo
function core.global_exists(name)
@@ -33,11 +28,6 @@ function meta:__newindex(name, value)
end
declared[name] = true
end
- -- Ignore mod namespaces
- if WARN_INIT and name ~= core.get_current_modname() then
- core.log("warning", ("Global variable %q created at %s.")
- :format(name, desc))
- end
rawset(self, name, value)
end
@@ -54,4 +44,3 @@ function meta:__index(name)
end
setmetatable(_G, meta)
-
diff --git a/builtin/common/tests/misc_helpers_spec.lua b/builtin/common/tests/misc_helpers_spec.lua
index b16987f0b..b11236860 100644
--- a/builtin/common/tests/misc_helpers_spec.lua
+++ b/builtin/common/tests/misc_helpers_spec.lua
@@ -1,4 +1,5 @@
_G.core = {}
+_G.vector = {metatable = {}}
dofile("builtin/common/vector.lua")
dofile("builtin/common/misc_helpers.lua")
diff --git a/builtin/common/tests/serialize_spec.lua b/builtin/common/tests/serialize_spec.lua
index e46b7dcc5..69b2b567c 100644
--- a/builtin/common/tests/serialize_spec.lua
+++ b/builtin/common/tests/serialize_spec.lua
@@ -1,4 +1,5 @@
_G.core = {}
+_G.vector = {metatable = {}}
_G.setfenv = require 'busted.compatibility'.setfenv
diff --git a/builtin/common/tests/vector_spec.lua b/builtin/common/tests/vector_spec.lua
index 2a50e2889..6a0b81a89 100644
--- a/builtin/common/tests/vector_spec.lua
+++ b/builtin/common/tests/vector_spec.lua
@@ -1,4 +1,4 @@
-_G.vector = {}
+_G.vector = {metatable = {}}
dofile("builtin/common/vector.lua")
describe("vector", function()
@@ -128,6 +128,14 @@ describe("vector", function()
assert.equal(vector.new(4.1, 5.9, 5.5), a:apply(f))
end)
+ it("combine()", function()
+ local a = vector.new(1, 2, 3)
+ local b = vector.new(3, 2, 1)
+ assert.equal(vector.add(a, b), vector.combine(a, b, function(x, y) return x + y end))
+ assert.equal(vector.new(3, 2, 3), vector.combine(a, b, math.max))
+ assert.equal(vector.new(1, 2, 1), vector.combine(a, b, math.min))
+ end)
+
it("equals()", function()
local function assertE(a, b)
assert.is_true(vector.equals(a, b))
@@ -300,6 +308,7 @@ describe("vector", function()
it("from_string()", function()
local v = vector.new(1, 2, 3.14)
+ assert.is_true(vector.check(vector.from_string("(1, 2, 3.14)")))
assert.same({v, 13}, {vector.from_string("(1, 2, 3.14)")})
assert.same({v, 12}, {vector.from_string("(1,2 ,3.14)")})
assert.same({v, 12}, {vector.from_string("(1,2,3.14,)")})
diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua
index 02fc1bdee..a08472e32 100644
--- a/builtin/common/vector.lua
+++ b/builtin/common/vector.lua
@@ -6,10 +6,8 @@ Note: The vector.*-functions must be able to accept old vectors that had no meta
-- localize functions
local setmetatable = setmetatable
-vector = {}
-
-local metatable = {}
-vector.metatable = metatable
+-- vector.metatable is set by C++.
+local metatable = vector.metatable
local xyz = {"x", "y", "z"}
@@ -61,7 +59,7 @@ function vector.from_string(s, init)
if not (x and y and z) then
return nil
end
- return {x = x, y = y, z = z}, np
+ return fast_new(x, y, z), np
end
function vector.to_string(v)
@@ -112,6 +110,14 @@ function vector.apply(v, func)
)
end
+function vector.combine(a, b, func)
+ return fast_new(
+ func(a.x, b.x),
+ func(a.y, b.y),
+ func(a.z, b.z)
+ )
+end
+
function vector.distance(a, b)
local x = a.x - b.x
local y = a.y - b.y
diff --git a/builtin/fstk/ui.lua b/builtin/fstk/ui.lua
index 976659ed3..13f9cbec2 100644
--- a/builtin/fstk/ui.lua
+++ b/builtin/fstk/ui.lua
@@ -63,7 +63,7 @@ function ui.update()
-- handle errors
if gamedata ~= nil and gamedata.reconnect_requested then
local error_message = core.formspec_escape(
- gamedata.errormessage or "<none available>")
+ gamedata.errormessage or fgettext("<none available>"))
formspec = {
"size[14,8]",
"real_coordinates[true]",
diff --git a/builtin/game/async.lua b/builtin/game/async.lua
new file mode 100644
index 000000000..469f179d7
--- /dev/null
+++ b/builtin/game/async.lua
@@ -0,0 +1,22 @@
+
+core.async_jobs = {}
+
+function core.async_event_handler(jobid, retval)
+ local callback = core.async_jobs[jobid]
+ assert(type(callback) == "function")
+ callback(unpack(retval, 1, retval.n))
+ core.async_jobs[jobid] = nil
+end
+
+function core.handle_async(func, callback, ...)
+ assert(type(func) == "function" and type(callback) == "function",
+ "Invalid minetest.handle_async invocation")
+ local args = {n = select("#", ...), ...}
+ local mod_origin = core.get_last_run_mod()
+
+ local jobid = core.do_async_callback(func, args, mod_origin)
+ core.async_jobs[jobid] = callback
+
+ return true
+end
+
diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua
index 99296f782..c4fb6314e 100644
--- a/builtin/game/chat.lua
+++ b/builtin/game/chat.lua
@@ -310,12 +310,7 @@ local function handle_revoke_command(caller, revokename, revokeprivstr)
and revokename == core.settings:get("name")
and revokename ~= ""
if revokeprivstr == "all" then
- revokeprivs = privs
- privs = {}
- else
- for priv, _ in pairs(revokeprivs) do
- privs[priv] = nil
- end
+ revokeprivs = table.copy(privs)
end
local privs_unknown = ""
@@ -332,7 +327,10 @@ local function handle_revoke_command(caller, revokename, revokeprivstr)
end
local def = core.registered_privileges[priv]
if not def then
- privs_unknown = privs_unknown .. S("Unknown privilege: @1", priv) .. "\n"
+ -- Old/removed privileges might still be granted to certain players
+ if not privs[priv] then
+ privs_unknown = privs_unknown .. S("Unknown privilege: @1", priv) .. "\n"
+ end
elseif is_singleplayer and def.give_to_singleplayer then
irrevokable[priv] = true
elseif is_admin and def.give_to_admin then
@@ -359,19 +357,22 @@ local function handle_revoke_command(caller, revokename, revokeprivstr)
end
local revokecount = 0
-
- core.set_player_privs(revokename, privs)
for priv, _ in pairs(revokeprivs) do
- -- call the on_revoke callbacks
- core.run_priv_callbacks(revokename, priv, caller, "revoke")
+ privs[priv] = nil
revokecount = revokecount + 1
end
- local new_privs = core.get_player_privs(revokename)
if revokecount == 0 then
return false, S("No privileges were revoked.")
end
+ core.set_player_privs(revokename, privs)
+ for priv, _ in pairs(revokeprivs) do
+ -- call the on_revoke callbacks
+ core.run_priv_callbacks(revokename, priv, caller, "revoke")
+ end
+ local new_privs = core.get_player_privs(revokename)
+
core.log("action", caller..' revoked ('
..core.privs_to_string(revokeprivs, ', ')
..') privileges from '..revokename)
@@ -524,7 +525,7 @@ end
-- Teleports player <name> to <p> if possible
local function teleport_to_pos(name, p)
- local lm = 31000
+ local lm = 31007 -- equals MAX_MAP_GENERATION_LIMIT in C++
if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm
or p.z < -lm or p.z > lm then
return false, S("Cannot teleport out of map bounds!")
@@ -621,6 +622,10 @@ core.register_chatcommand("set", {
setname, setvalue = string.match(param, "([^ ]+) (.+)")
if setname and setvalue then
+ if setname:sub(1, 7) == "secure." then
+ return false, S("Failed. Cannot modify secure settings. "
+ .. "Edit the settings file manually.")
+ end
if not core.settings:get(setname) then
return false, S("Failed. Use '/set -n <name> <value>' "
.. "to create a new setting.")
@@ -1034,12 +1039,11 @@ core.register_chatcommand("time", {
end
local hour, minute = param:match("^(%d+):(%d+)$")
if not hour then
- local new_time = tonumber(param)
- if not new_time then
- return false, S("Invalid time.")
+ local new_time = tonumber(param) or -1
+ if new_time ~= new_time or new_time < 0 or new_time > 24000 then
+ return false, S("Invalid time (must be between 0 and 24000).")
end
- -- Backward compatibility.
- core.set_timeofday((new_time % 24000) / 24000)
+ core.set_timeofday(new_time / 24000)
core.log("action", name .. " sets time to " .. new_time)
return true, S("Time of day changed.")
end
@@ -1283,7 +1287,7 @@ local function handle_kill_command(killer, victim)
return false, S("@1 is already dead.", victim)
end
end
- if not killer == victim then
+ if killer ~= victim then
core.log("action", string.format("%s killed %s", killer, victim))
end
-- Kill victim
diff --git a/builtin/game/features.lua b/builtin/game/features.lua
index 583ef5092..0d55bb01f 100644
--- a/builtin/game/features.lua
+++ b/builtin/game/features.lua
@@ -22,6 +22,7 @@ core.features = {
degrotate_240_steps = true,
abm_min_max_y = true,
dynamic_add_media_table = true,
+ get_sky_as_table = true,
}
function core.has_feature(arg)
diff --git a/builtin/game/init.lua b/builtin/game/init.lua
index 9a9966d7e..b9ab97b58 100644
--- a/builtin/game/init.lua
+++ b/builtin/game/init.lua
@@ -8,6 +8,7 @@ local gamepath = scriptpath .. "game".. DIR_DELIM
local builtin_shared = {}
dofile(gamepath .. "constants.lua")
+dofile(gamepath .. "item_s.lua")
assert(loadfile(gamepath .. "item.lua"))(builtin_shared)
dofile(gamepath .. "register.lua")
@@ -19,6 +20,7 @@ dofile(commonpath .. "after.lua")
dofile(commonpath .. "voxelarea.lua")
dofile(gamepath .. "item_entity.lua")
dofile(gamepath .. "deprecated.lua")
+dofile(gamepath .. "misc_s.lua")
dofile(gamepath .. "misc.lua")
dofile(gamepath .. "privileges.lua")
dofile(gamepath .. "auth.lua")
@@ -32,5 +34,6 @@ dofile(gamepath .. "features.lua")
dofile(gamepath .. "forceloading.lua")
dofile(gamepath .. "statbars.lua")
dofile(gamepath .. "knockback.lua")
+dofile(gamepath .. "async.lua")
profiler = nil
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index 92818b177..5543e9a3f 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -15,144 +15,19 @@ end
-- Item definition helpers
--
-function core.dir_to_facedir(dir, is6d)
- --account for y if requested
- if is6d and math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then
-
- --from above
- if dir.y < 0 then
- if math.abs(dir.x) > math.abs(dir.z) then
- if dir.x < 0 then
- return 19
- else
- return 13
- end
- else
- if dir.z < 0 then
- return 10
- else
- return 4
- end
- end
-
- --from below
- else
- if math.abs(dir.x) > math.abs(dir.z) then
- if dir.x < 0 then
- return 15
- else
- return 17
- end
- else
- if dir.z < 0 then
- return 6
- else
- return 8
- end
- end
- end
-
- --otherwise, place horizontally
- elseif math.abs(dir.x) > math.abs(dir.z) then
- if dir.x < 0 then
- return 3
- else
- return 1
- end
- else
- if dir.z < 0 then
- return 2
- else
- return 0
- end
- end
-end
-
--- Table of possible dirs
-local facedir_to_dir = {
- vector.new( 0, 0, 1),
- vector.new( 1, 0, 0),
- vector.new( 0, 0, -1),
- vector.new(-1, 0, 0),
- vector.new( 0, -1, 0),
- vector.new( 0, 1, 0),
-}
--- Mapping from facedir value to index in facedir_to_dir.
-local facedir_to_dir_map = {
- [0]=1, 2, 3, 4,
- 5, 2, 6, 4,
- 6, 2, 5, 4,
- 1, 5, 3, 6,
- 1, 6, 3, 5,
- 1, 4, 3, 2,
-}
-function core.facedir_to_dir(facedir)
- return facedir_to_dir[facedir_to_dir_map[facedir % 32]]
-end
-
-function core.dir_to_wallmounted(dir)
- if math.abs(dir.y) > math.max(math.abs(dir.x), math.abs(dir.z)) then
- if dir.y < 0 then
- return 1
- else
- return 0
- end
- elseif math.abs(dir.x) > math.abs(dir.z) then
- if dir.x < 0 then
- return 3
- else
- return 2
- end
- else
- if dir.z < 0 then
- return 5
- else
- return 4
+function core.get_pointed_thing_position(pointed_thing, above)
+ if pointed_thing.type == "node" then
+ if above then
+ -- The position where a node would be placed
+ return pointed_thing.above
end
+ -- The position where a node would be dug
+ return pointed_thing.under
+ elseif pointed_thing.type == "object" then
+ return pointed_thing.ref and pointed_thing.ref:get_pos()
end
end
--- table of dirs in wallmounted order
-local wallmounted_to_dir = {
- [0] = vector.new( 0, 1, 0),
- vector.new( 0, -1, 0),
- vector.new( 1, 0, 0),
- vector.new(-1, 0, 0),
- vector.new( 0, 0, 1),
- vector.new( 0, 0, -1),
-}
-function core.wallmounted_to_dir(wallmounted)
- return wallmounted_to_dir[wallmounted % 8]
-end
-
-function core.dir_to_yaw(dir)
- return -math.atan2(dir.x, dir.z)
-end
-
-function core.yaw_to_dir(yaw)
- return vector.new(-math.sin(yaw), 0, math.cos(yaw))
-end
-
-function core.is_colored_paramtype(ptype)
- return (ptype == "color") or (ptype == "colorfacedir") or
- (ptype == "colorwallmounted") or (ptype == "colordegrotate")
-end
-
-function core.strip_param2_color(param2, paramtype2)
- if not core.is_colored_paramtype(paramtype2) then
- return nil
- end
- if paramtype2 == "colorfacedir" then
- param2 = math.floor(param2 / 32) * 32
- elseif paramtype2 == "colorwallmounted" then
- param2 = math.floor(param2 / 8) * 8
- elseif paramtype2 == "colordegrotate" then
- param2 = math.floor(param2 / 32) * 32
- end
- -- paramtype2 == "color" requires no modification.
- return param2
-end
-
local function has_all_groups(tbl, required_groups)
if type(required_groups) == "string" then
return (tbl[required_groups] or 0) ~= 0
@@ -477,34 +352,41 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
return result
end
end
+ -- read definition before potentially emptying the stack
local def = itemstack:get_definition()
- if itemstack:take_item() ~= nil then
- user:set_hp(user:get_hp() + hp_change)
-
- if def and def.sound and def.sound.eat then
- core.sound_play(def.sound.eat, {
- pos = user:get_pos(),
- max_hear_distance = 16
- }, true)
- end
+ if itemstack:take_item():is_empty() then
+ return itemstack
+ end
+
+ if def and def.sound and def.sound.eat then
+ core.sound_play(def.sound.eat, {
+ pos = user:get_pos(),
+ max_hear_distance = 16
+ }, true)
+ end
- if replace_with_item then
- if itemstack:is_empty() then
- itemstack:add_item(replace_with_item)
+ -- Changing hp might kill the player causing mods to do who-knows-what to the
+ -- inventory, so do this before set_hp().
+ if replace_with_item then
+ if itemstack:is_empty() then
+ itemstack:add_item(replace_with_item)
+ else
+ local inv = user:get_inventory()
+ -- Check if inv is null, since non-players don't have one
+ if inv and inv:room_for_item("main", {name=replace_with_item}) then
+ inv:add_item("main", replace_with_item)
else
- local inv = user:get_inventory()
- -- Check if inv is null, since non-players don't have one
- if inv and inv:room_for_item("main", {name=replace_with_item}) then
- inv:add_item("main", replace_with_item)
- else
- local pos = user:get_pos()
- pos.y = math.floor(pos.y + 0.5)
- core.add_item(pos, replace_with_item)
- end
+ local pos = user:get_pos()
+ pos.y = math.floor(pos.y + 0.5)
+ core.add_item(pos, replace_with_item)
end
end
end
- return itemstack
+ user:set_wielded_item(itemstack)
+
+ user:set_hp(user:get_hp() + hp_change)
+
+ return nil -- don't overwrite wield item a second time
end
function core.item_eat(hp_change, replace_with_item)
@@ -585,7 +467,7 @@ function core.node_dig(pos, node, digger)
if wielded then
local wdef = wielded:get_definition()
local tp = wielded:get_tool_capabilities()
- local dp = core.get_dig_params(def and def.groups, tp)
+ local dp = core.get_dig_params(def and def.groups, tp, wielded:get_wear())
if wdef and wdef.after_use then
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
else
@@ -647,9 +529,7 @@ function core.node_dig(pos, node, digger)
-- Run script hook
for _, callback in ipairs(core.registered_on_dignodes) do
local origin = core.callback_origins[callback]
- if origin then
- core.set_last_run_mod(origin.mod)
- end
+ core.set_last_run_mod(origin.mod)
-- Copy pos and node because callback can modify them
local pos_copy = vector.new(pos)
diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua
index 9b1b23bfd..53f98a7c7 100644
--- a/builtin/game/item_entity.lua
+++ b/builtin/game/item_entity.lua
@@ -58,17 +58,21 @@ core.register_entity(":__builtin:item", {
local glow = def and def.light_source and
math.floor(def.light_source / 2 + 0.5)
+ local size_bias = 1e-3 * math.random() -- small random bias to counter Z-fighting
+ local c = {-size, -size, -size, size, size, size}
self.object:set_properties({
is_visible = true,
visual = "wielditem",
textures = {itemname},
- visual_size = {x = size, y = size},
- collisionbox = {-size, -size, -size, size, size, size},
+ visual_size = {x = size + size_bias, y = size + size_bias},
+ collisionbox = c,
automatic_rotate = math.pi * 0.5 * 0.2 / size,
wield_item = self.itemstring,
glow = glow,
})
+ -- cache for usage in on_step
+ self._collisionbox = c
end,
get_staticdata = function(self)
@@ -93,6 +97,7 @@ core.register_entity(":__builtin:item", {
self.object:set_armor_groups({immortal = 1})
self.object:set_velocity({x = 0, y = 2, z = 0})
self.object:set_acceleration({x = 0, y = -gravity, z = 0})
+ self._collisionbox = self.initial_properties.collisionbox
self:set_item()
end,
@@ -163,7 +168,7 @@ core.register_entity(":__builtin:item", {
local pos = self.object:get_pos()
local node = core.get_node_or_nil({
x = pos.x,
- y = pos.y + self.object:get_properties().collisionbox[2] - 0.05,
+ y = pos.y + self._collisionbox[2] - 0.05,
z = pos.z
})
-- Delete in 'ignore' nodes
@@ -176,7 +181,7 @@ core.register_entity(":__builtin:item", {
if self.force_out then
-- This code runs after the entity got a push from the is_stuck code.
-- It makes sure the entity is entirely outside the solid node
- local c = self.object:get_properties().collisionbox
+ local c = self._collisionbox
local s = self.force_out_start
local f = self.force_out
local ok = (f.x > 0 and pos.x + c[1] > s.x + 0.5) or
diff --git a/builtin/game/item_s.lua b/builtin/game/item_s.lua
new file mode 100644
index 000000000..a51cd0a1c
--- /dev/null
+++ b/builtin/game/item_s.lua
@@ -0,0 +1,156 @@
+-- Minetest: builtin/item_s.lua
+-- The distinction of what goes here is a bit tricky, basically it's everything
+-- that does not (directly or indirectly) need access to ServerEnvironment,
+-- Server or writable access to IGameDef on the engine side.
+-- (The '_s' stands for standalone.)
+
+--
+-- Item definition helpers
+--
+
+function core.inventorycube(img1, img2, img3)
+ img2 = img2 or img1
+ img3 = img3 or img1
+ return "[inventorycube"
+ .. "{" .. img1:gsub("%^", "&")
+ .. "{" .. img2:gsub("%^", "&")
+ .. "{" .. img3:gsub("%^", "&")
+end
+
+function core.dir_to_facedir(dir, is6d)
+ --account for y if requested
+ if is6d and math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then
+
+ --from above
+ if dir.y < 0 then
+ if math.abs(dir.x) > math.abs(dir.z) then
+ if dir.x < 0 then
+ return 19
+ else
+ return 13
+ end
+ else
+ if dir.z < 0 then
+ return 10
+ else
+ return 4
+ end
+ end
+
+ --from below
+ else
+ if math.abs(dir.x) > math.abs(dir.z) then
+ if dir.x < 0 then
+ return 15
+ else
+ return 17
+ end
+ else
+ if dir.z < 0 then
+ return 6
+ else
+ return 8
+ end
+ end
+ end
+
+ --otherwise, place horizontally
+ elseif math.abs(dir.x) > math.abs(dir.z) then
+ if dir.x < 0 then
+ return 3
+ else
+ return 1
+ end
+ else
+ if dir.z < 0 then
+ return 2
+ else
+ return 0
+ end
+ end
+end
+
+-- Table of possible dirs
+local facedir_to_dir = {
+ vector.new( 0, 0, 1),
+ vector.new( 1, 0, 0),
+ vector.new( 0, 0, -1),
+ vector.new(-1, 0, 0),
+ vector.new( 0, -1, 0),
+ vector.new( 0, 1, 0),
+}
+-- Mapping from facedir value to index in facedir_to_dir.
+local facedir_to_dir_map = {
+ [0]=1, 2, 3, 4,
+ 5, 2, 6, 4,
+ 6, 2, 5, 4,
+ 1, 5, 3, 6,
+ 1, 6, 3, 5,
+ 1, 4, 3, 2,
+}
+function core.facedir_to_dir(facedir)
+ return facedir_to_dir[facedir_to_dir_map[facedir % 32]]
+end
+
+function core.dir_to_wallmounted(dir)
+ if math.abs(dir.y) > math.max(math.abs(dir.x), math.abs(dir.z)) then
+ if dir.y < 0 then
+ return 1
+ else
+ return 0
+ end
+ elseif math.abs(dir.x) > math.abs(dir.z) then
+ if dir.x < 0 then
+ return 3
+ else
+ return 2
+ end
+ else
+ if dir.z < 0 then
+ return 5
+ else
+ return 4
+ end
+ end
+end
+
+-- table of dirs in wallmounted order
+local wallmounted_to_dir = {
+ [0] = vector.new( 0, 1, 0),
+ vector.new( 0, -1, 0),
+ vector.new( 1, 0, 0),
+ vector.new(-1, 0, 0),
+ vector.new( 0, 0, 1),
+ vector.new( 0, 0, -1),
+}
+function core.wallmounted_to_dir(wallmounted)
+ return wallmounted_to_dir[wallmounted % 8]
+end
+
+function core.dir_to_yaw(dir)
+ return -math.atan2(dir.x, dir.z)
+end
+
+function core.yaw_to_dir(yaw)
+ return vector.new(-math.sin(yaw), 0, math.cos(yaw))
+end
+
+function core.is_colored_paramtype(ptype)
+ return (ptype == "color") or (ptype == "colorfacedir") or
+ (ptype == "colorwallmounted") or (ptype == "colordegrotate")
+end
+
+function core.strip_param2_color(param2, paramtype2)
+ if not core.is_colored_paramtype(paramtype2) then
+ return nil
+ end
+ if paramtype2 == "colorfacedir" then
+ param2 = math.floor(param2 / 32) * 32
+ elseif paramtype2 == "colorwallmounted" then
+ param2 = math.floor(param2 / 8) * 8
+ elseif paramtype2 == "colordegrotate" then
+ param2 = math.floor(param2 / 32) * 32
+ end
+ -- paramtype2 == "color" requires no modification.
+ return param2
+end
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua
index 63d64817c..997b1894a 100644
--- a/builtin/game/misc.lua
+++ b/builtin/game/misc.lua
@@ -6,6 +6,16 @@ local S = core.get_translator("__builtin")
-- Misc. API functions
--
+-- @spec core.kick_player(String, String) :: Boolean
+function core.kick_player(player_name, reason)
+ if type(reason) == "string" then
+ reason = "Kicked: " .. reason
+ else
+ reason = "Kicked."
+ end
+ return core.disconnect_player(player_name, reason)
+end
+
function core.check_player_privs(name, ...)
if core.is_player(name) then
name = name:get_player_name()
@@ -111,53 +121,6 @@ function core.get_player_radius_area(player_name, radius)
end
-function core.hash_node_position(pos)
- return (pos.z + 32768) * 65536 * 65536
- + (pos.y + 32768) * 65536
- + pos.x + 32768
-end
-
-
-function core.get_position_from_hash(hash)
- local x = (hash % 65536) - 32768
- hash = math.floor(hash / 65536)
- local y = (hash % 65536) - 32768
- hash = math.floor(hash / 65536)
- local z = (hash % 65536) - 32768
- return vector.new(x, y, z)
-end
-
-
-function core.get_item_group(name, group)
- if not core.registered_items[name] or not
- core.registered_items[name].groups[group] then
- return 0
- end
- return core.registered_items[name].groups[group]
-end
-
-
-function core.get_node_group(name, group)
- core.log("deprecated", "Deprecated usage of get_node_group, use get_item_group instead")
- return core.get_item_group(name, group)
-end
-
-
-function core.setting_get_pos(name)
- local value = core.settings:get(name)
- if not value then
- return nil
- end
- return core.string_to_pos(value)
-end
-
-
--- See l_env.cpp for the other functions
-function core.get_artificial_light(param1)
- return math.floor(param1 / 16)
-end
-
-
-- To be overriden by protection mods
function core.is_protected(pos, name)
@@ -240,7 +203,7 @@ end
-- HTTP callback interface
-function core.http_add_fetch(httpenv)
+core.set_http_api_lua(function(httpenv)
httpenv.fetch = function(req, callback)
local handle = httpenv.fetch_async(req)
@@ -256,7 +219,8 @@ function core.http_add_fetch(httpenv)
end
return httpenv
-end
+end)
+core.set_http_api_lua = nil
function core.close_formspec(player_name, formname)
@@ -273,40 +237,30 @@ end
core.dynamic_media_callbacks = {}
--- PNG encoder safety wrapper
-
-local o_encode_png = core.encode_png
-function core.encode_png(width, height, data, compression)
- if type(width) ~= "number" then
- error("Incorrect type for 'width', expected number, got " .. type(width))
- end
- if type(height) ~= "number" then
- error("Incorrect type for 'height', expected number, got " .. type(height))
- end
-
- local expected_byte_count = width * height * 4
+-- Transfer of certain globals into async environment
+-- see builtin/async/game.lua for the other side
- if type(data) ~= "table" and type(data) ~= "string" then
- error("Incorrect type for 'height', expected table or string, got " .. type(height))
+local function copy_filtering(t, seen)
+ if type(t) == "userdata" or type(t) == "function" then
+ return true -- don't use nil so presence can still be detected
+ elseif type(t) ~= "table" then
+ return t
end
-
- local data_length = type(data) == "table" and #data * 4 or string.len(data)
-
- if data_length ~= expected_byte_count then
- error(string.format(
- "Incorrect length of 'data', width and height imply %d bytes but %d were provided",
- expected_byte_count,
- data_length
- ))
- end
-
- if type(data) == "table" then
- local dataBuf = {}
- for i = 1, #data do
- dataBuf[i] = core.colorspec_to_bytes(data[i])
- end
- data = table.concat(dataBuf)
+ local n = {}
+ seen = seen or {}
+ seen[t] = n
+ for k, v in pairs(t) do
+ local k_ = seen[k] or copy_filtering(k, seen)
+ local v_ = seen[v] or copy_filtering(v, seen)
+ n[k_] = v_
end
+ return n
+end
- return o_encode_png(width, height, data, compression or 6)
+function core.get_globals_to_transfer()
+ local all = {
+ registered_items = copy_filtering(core.registered_items),
+ registered_aliases = core.registered_aliases,
+ }
+ return all
end
diff --git a/builtin/game/misc_s.lua b/builtin/game/misc_s.lua
new file mode 100644
index 000000000..67a0ec684
--- /dev/null
+++ b/builtin/game/misc_s.lua
@@ -0,0 +1,93 @@
+-- Minetest: builtin/misc_s.lua
+-- The distinction of what goes here is a bit tricky, basically it's everything
+-- that does not (directly or indirectly) need access to ServerEnvironment,
+-- Server or writable access to IGameDef on the engine side.
+-- (The '_s' stands for standalone.)
+
+--
+-- Misc. API functions
+--
+
+function core.hash_node_position(pos)
+ return (pos.z + 32768) * 65536 * 65536
+ + (pos.y + 32768) * 65536
+ + pos.x + 32768
+end
+
+
+function core.get_position_from_hash(hash)
+ local x = (hash % 65536) - 32768
+ hash = math.floor(hash / 65536)
+ local y = (hash % 65536) - 32768
+ hash = math.floor(hash / 65536)
+ local z = (hash % 65536) - 32768
+ return vector.new(x, y, z)
+end
+
+
+function core.get_item_group(name, group)
+ if not core.registered_items[name] or not
+ core.registered_items[name].groups[group] then
+ return 0
+ end
+ return core.registered_items[name].groups[group]
+end
+
+
+function core.get_node_group(name, group)
+ core.log("deprecated", "Deprecated usage of get_node_group, use get_item_group instead")
+ return core.get_item_group(name, group)
+end
+
+
+function core.setting_get_pos(name)
+ local value = core.settings:get(name)
+ if not value then
+ return nil
+ end
+ return core.string_to_pos(value)
+end
+
+
+-- See l_env.cpp for the other functions
+function core.get_artificial_light(param1)
+ return math.floor(param1 / 16)
+end
+
+-- PNG encoder safety wrapper
+
+local o_encode_png = core.encode_png
+function core.encode_png(width, height, data, compression)
+ if type(width) ~= "number" then
+ error("Incorrect type for 'width', expected number, got " .. type(width))
+ end
+ if type(height) ~= "number" then
+ error("Incorrect type for 'height', expected number, got " .. type(height))
+ end
+
+ local expected_byte_count = width * height * 4
+
+ if type(data) ~= "table" and type(data) ~= "string" then
+ error("Incorrect type for 'data', expected table or string, got " .. type(data))
+ end
+
+ local data_length = type(data) == "table" and #data * 4 or string.len(data)
+
+ if data_length ~= expected_byte_count then
+ error(string.format(
+ "Incorrect length of 'data', width and height imply %d bytes but %d were provided",
+ expected_byte_count,
+ data_length
+ ))
+ end
+
+ if type(data) == "table" then
+ local dataBuf = {}
+ for i = 1, #data do
+ dataBuf[i] = core.colorspec_to_bytes(data[i])
+ end
+ data = table.concat(dataBuf)
+ end
+
+ return o_encode_png(width, height, data, compression or 6)
+end
diff --git a/builtin/game/privileges.lua b/builtin/game/privileges.lua
index 97681655e..2ff4c093c 100644
--- a/builtin/game/privileges.lua
+++ b/builtin/game/privileges.lua
@@ -97,10 +97,6 @@ core.register_privilege("rollback", {
description = S("Can use the rollback functionality"),
give_to_singleplayer = false,
})
-core.register_privilege("basic_debug", {
- description = S("Can view more debug info that might give a gameplay advantage"),
- give_to_singleplayer = false,
-})
core.register_privilege("debug", {
description = S("Can enable wireframe"),
give_to_singleplayer = false,
diff --git a/builtin/game/register.lua b/builtin/game/register.lua
index 56e40c75c..0be107c36 100644
--- a/builtin/game/register.lua
+++ b/builtin/game/register.lua
@@ -403,8 +403,14 @@ function core.override_item(name, redefinition)
register_item_raw(item)
end
-
-core.callback_origins = {}
+do
+ local default = {mod = "??", name = "??"}
+ core.callback_origins = setmetatable({}, {
+ __index = function()
+ return default
+ end
+ })
+end
function core.run_callbacks(callbacks, mode, ...)
assert(type(callbacks) == "table")
@@ -419,9 +425,7 @@ function core.run_callbacks(callbacks, mode, ...)
local ret = nil
for i = 1, cb_len do
local origin = core.callback_origins[callbacks[i]]
- if origin then
- core.set_last_run_mod(origin.mod)
- end
+ core.set_last_run_mod(origin.mod)
local cb_ret = callbacks[i](...)
if mode == 0 and i == 1 then
diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua
index db5087a16..cb7ff7b76 100644
--- a/builtin/game/statbars.lua
+++ b/builtin/game/statbars.lua
@@ -1,39 +1,39 @@
-- cache setting
local enable_damage = core.settings:get_bool("enable_damage")
-local health_bar_definition = {
- hud_elem_type = "statbar",
- position = {x = 0.5, y = 1},
- text = "heart.png",
- text2 = "heart_gone.png",
- number = core.PLAYER_MAX_HP_DEFAULT,
- item = core.PLAYER_MAX_HP_DEFAULT,
- direction = 0,
- size = {x = 24, y = 24},
- offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)},
-}
-
-local breath_bar_definition = {
- hud_elem_type = "statbar",
- position = {x = 0.5, y = 1},
- text = "bubble.png",
- text2 = "bubble_gone.png",
- number = core.PLAYER_MAX_BREATH_DEFAULT,
- item = core.PLAYER_MAX_BREATH_DEFAULT * 2,
- direction = 0,
- size = {x = 24, y = 24},
- offset = {x = 25, y= -(48 + 24 + 16)},
+local bar_definitions = {
+ hp = {
+ hud_elem_type = "statbar",
+ position = {x = 0.5, y = 1},
+ text = "heart.png",
+ text2 = "heart_gone.png",
+ number = core.PLAYER_MAX_HP_DEFAULT,
+ item = core.PLAYER_MAX_HP_DEFAULT,
+ direction = 0,
+ size = {x = 24, y = 24},
+ offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)},
+ },
+ breath = {
+ hud_elem_type = "statbar",
+ position = {x = 0.5, y = 1},
+ text = "bubble.png",
+ text2 = "bubble_gone.png",
+ number = core.PLAYER_MAX_BREATH_DEFAULT * 2,
+ item = core.PLAYER_MAX_BREATH_DEFAULT * 2,
+ direction = 0,
+ size = {x = 24, y = 24},
+ offset = {x = 25, y= -(48 + 24 + 16)},
+ },
}
local hud_ids = {}
-local function scaleToDefault(player, field)
- -- Scale "hp" or "breath" to the default dimensions
+local function scaleToHudMax(player, field)
+ -- Scale "hp" or "breath" to the hud maximum dimensions
local current = player["get_" .. field](player)
- local nominal = core["PLAYER_MAX_" .. field:upper() .. "_DEFAULT"]
- local max_display = math.max(nominal,
- math.max(player:get_properties()[field .. "_max"], current))
- return current / max_display * nominal
+ local nominal = bar_definitions[field].item
+ local max_display = math.max(player:get_properties()[field .. "_max"], current)
+ return math.ceil(current / max_display * nominal)
end
local function update_builtin_statbars(player)
@@ -55,9 +55,9 @@ local function update_builtin_statbars(player)
local immortal = player:get_armor_groups().immortal == 1
if flags.healthbar and enable_damage and not immortal then
- local number = scaleToDefault(player, "hp")
+ local number = scaleToHudMax(player, "hp")
if hud.id_healthbar == nil then
- local hud_def = table.copy(health_bar_definition)
+ local hud_def = table.copy(bar_definitions.hp)
hud_def.number = number
hud.id_healthbar = player:hud_add(hud_def)
else
@@ -73,9 +73,9 @@ local function update_builtin_statbars(player)
local breath = player:get_breath()
local breath_max = player:get_properties().breath_max
if show_breathbar and breath <= breath_max then
- local number = 2 * scaleToDefault(player, "breath")
+ local number = scaleToHudMax(player, "breath")
if not hud.id_breathbar and breath < breath_max then
- local hud_def = table.copy(breath_bar_definition)
+ local hud_def = table.copy(bar_definitions.breath)
hud_def.number = number
hud.id_breathbar = player:hud_add(hud_def)
elseif hud.id_breathbar then
@@ -145,7 +145,7 @@ function core.hud_replace_builtin(hud_name, definition)
end
if hud_name == "health" then
- health_bar_definition = definition
+ bar_definitions.hp = definition
for name, ids in pairs(hud_ids) do
local player = core.get_player_by_name(name)
@@ -159,7 +159,7 @@ function core.hud_replace_builtin(hud_name, definition)
end
if hud_name == "breath" then
- breath_bar_definition = definition
+ bar_definitions.breath = definition
for name, ids in pairs(hud_ids) do
local player = core.get_player_by_name(name)
diff --git a/builtin/init.lua b/builtin/init.lua
index 8bb69a33d..fd176e942 100644
--- a/builtin/init.lua
+++ b/builtin/init.lua
@@ -55,8 +55,10 @@ elseif INIT == "mainmenu" then
if not custom_loaded then
dofile(core.get_mainmenu_path() .. DIR_DELIM .. "init.lua")
end
-elseif INIT == "async" then
- dofile(asyncpath .. "init.lua")
+elseif INIT == "async" then
+ dofile(asyncpath .. "mainmenu.lua")
+elseif INIT == "async_game" then
+ dofile(asyncpath .. "game.lua")
elseif INIT == "client" then
dofile(clientpath .. "init.lua")
else
diff --git a/builtin/locale/__builtin.de.tr b/builtin/locale/__builtin.de.tr
index aa40ffc8d..1b29f81e7 100644
--- a/builtin/locale/__builtin.de.tr
+++ b/builtin/locale/__builtin.de.tr
@@ -139,7 +139,7 @@ This command was disabled by a mod or game.=Dieser Befehl wurde von einer Mod od
Show or set time of day=Tageszeit anzeigen oder setzen
Current time is @1:@2.=Es ist jetzt @1:@2 Uhr.
You don't have permission to run this command (missing privilege: @1).=Sie haben nicht die Erlaubnis, diesen Befehl auszuführen (fehlendes Privileg: @1).
-Invalid time.=Ungültige Zeit.
+Invalid time (must be between 0 and 24000).=Ungültige Zeit (muss zwischen 0 und 24000 liegen).
Time of day changed.=Tageszeit geändert.
Invalid hour (must be between 0 and 23 inclusive).=Ungültige Stunde (muss zwischen 0 und 23 inklusive liegen).
Invalid minute (must be between 0 and 59 inclusive).=Ungültige Minute (muss zwischen 0 und 59 inklusive liegen).
@@ -187,12 +187,14 @@ You are already dead.=Sie sind schon tot.
@1 is already dead.=@1 ist bereits tot.
@1 has been killed.=@1 wurde getötet.
Kill player or yourself=Einen Spieler oder Sie selbst töten
+Invalid parameters (see /help @1).=Ungültige Parameter (siehe „/help @1“).
+Too many arguments, try using just /help <command>=Zu viele Argumente. Probieren Sie es mit „/help <Befehl>“
Available commands: @1=Verfügbare Befehle: @1
Use '/help <cmd>' to get more information, or '/help all' to list everything.=„/help <Befehl>“ benutzen, um mehr Informationen zu erhalten, oder „/help all“, um alles aufzulisten.
Available commands:=Verfügbare Befehle:
Command not available: @1=Befehl nicht verfügbar: @1
-[all | privs | <cmd>]=[all | privs | <Befehl>]
-Get help for commands or list privileges=Hilfe für Befehle erhalten oder Privilegien auflisten
+[all | privs | <cmd>] [-t]=[all | privs | <Befehl>] [-t]
+Get help for commands or list privileges (-t: output in chat)=Hilfe für Befehle erhalten oder Privilegien auflisten (-t: Ausgabe im Chat)
Available privileges:=Verfügbare Privilegien:
Command=Befehl
Parameters=Parameter
@@ -230,7 +232,8 @@ Can use fly mode=Kann den Flugmodus benutzen
Can use fast mode=Kann den Schnellmodus benutzen
Can fly through solid nodes using noclip mode=Kann durch feste Blöcke mit dem Geistmodus fliegen
Can use the rollback functionality=Kann die Rollback-Funktionalität benutzen
-Allows enabling various debug options that may affect gameplay=Erlaubt die Aktivierung diverser Debugoptionen, die das Spielgeschehen beeinflussen könnten
+Can view more debug info that might give a gameplay advantage=Kann zusätzliche Debuginformationen betrachten, welche einen spielerischen Vorteil geben könnten
+Can enable wireframe=Kann Drahtmodell aktivieren
Unknown Item=Unbekannter Gegenstand
Air=Luft
Ignore=Ignorieren
diff --git a/builtin/locale/__builtin.it.tr b/builtin/locale/__builtin.it.tr
index 449c2b85e..77f85c766 100644
--- a/builtin/locale/__builtin.it.tr
+++ b/builtin/locale/__builtin.it.tr
@@ -139,7 +139,7 @@ This command was disabled by a mod or game.=Questo comando è stato disabilitato
Show or set time of day=Mostra o imposta l'orario della giornata
Current time is @1:@2.=Orario corrente: @1:@2.
You don't have permission to run this command (missing privilege: @1).=Non hai il permesso di eseguire questo comando (privilegio mancante: @1)
-Invalid time.=Orario non valido.
+Invalid time (must be between 0 and 24000).=
Time of day changed.=Orario della giornata cambiato.
Invalid hour (must be between 0 and 23 inclusive).=Ora non valida (deve essere tra 0 e 23 inclusi)
Invalid minute (must be between 0 and 59 inclusive).=Minuto non valido (deve essere tra 0 e 59 inclusi)
@@ -187,12 +187,14 @@ You are already dead.=Sei già mortǝ.
@1 is already dead.=@1 è già mortǝ.
@1 has been killed.=@1 è stato uccisǝ.
Kill player or yourself=Uccide un giocatore o te stessǝ
+Invalid parameters (see /help @1).=
+Too many arguments, try using just /help <command>=
Available commands: @1=Comandi disponibili: @1
Use '/help <cmd>' to get more information, or '/help all' to list everything.=Usa '/help <comando>' per ottenere più informazioni, o '/help all' per elencare tutti i comandi.
Available commands:=Comandi disponibili:
Command not available: @1=Comando non disponibile: @1
-[all | privs | <cmd>]=[all | privs | <comando>]
-Get help for commands or list privileges=Richiama la finestra d'aiuto dei comandi o dei privilegi
+[all | privs | <cmd>] [-t]=
+Get help for commands or list privileges (-t: output in chat)=
Available privileges:=Privilegi disponibili:
Command=Comando
Parameters=Parametri
@@ -230,7 +232,8 @@ Can use fly mode=Si può usare la modalità volo
Can use fast mode=Si può usare la modalità rapida
Can fly through solid nodes using noclip mode=Si può volare attraverso i nodi solidi con la modalità incorporea
Can use the rollback functionality=Si può usare la funzione di rollback
-Allows enabling various debug options that may affect gameplay=Permette di abilitare varie opzioni di debug che potrebbero influenzare l'esperienza di gioco
+Can view more debug info that might give a gameplay advantage=
+Can enable wireframe=
Unknown Item=Oggetto sconosciuto
Air=Aria
Ignore=Ignora
@@ -244,6 +247,10 @@ Profile saved to @1=
##### not used anymore #####
+Invalid time.=Orario non valido.
+[all | privs | <cmd>]=[all | privs | <comando>]
+Get help for commands or list privileges=Richiama la finestra d'aiuto dei comandi o dei privilegi
+Allows enabling various debug options that may affect gameplay=Permette di abilitare varie opzioni di debug che potrebbero influenzare l'esperienza di gioco
[<delay_in_seconds> | -1] [reconnect] [<message>]=[<ritardo_in_secondi> | -1] [reconnect] [<messaggio>]
Shutdown server (-1 cancels a delayed shutdown)=Arresta il server (-1 annulla un arresto programmato)
<name> (<privilege> | all)=<nome> (<privilegio> | all)
diff --git a/builtin/locale/template.txt b/builtin/locale/template.txt
index 7049dde36..308d17f37 100644
--- a/builtin/locale/template.txt
+++ b/builtin/locale/template.txt
@@ -139,7 +139,7 @@ This command was disabled by a mod or game.=
Show or set time of day=
Current time is @1:@2.=
You don't have permission to run this command (missing privilege: @1).=
-Invalid time.=
+Invalid time (must be between 0 and 24000).=
Time of day changed.=
Invalid hour (must be between 0 and 23 inclusive).=
Invalid minute (must be between 0 and 59 inclusive).=
@@ -187,12 +187,14 @@ You are already dead.=
@1 is already dead.=
@1 has been killed.=
Kill player or yourself=
+Invalid parameters (see /help @1).=
+Too many arguments, try using just /help <command>=
Available commands: @1=
Use '/help <cmd>' to get more information, or '/help all' to list everything.=
Available commands:=
Command not available: @1=
-[all | privs | <cmd>]=
-Get help for commands or list privileges=
+[all | privs | <cmd>] [-t]=
+Get help for commands or list privileges (-t: output in chat)=
Available privileges:=
Command=
Parameters=
@@ -230,7 +232,8 @@ Can use fly mode=
Can use fast mode=
Can fly through solid nodes using noclip mode=
Can use the rollback functionality=
-Allows enabling various debug options that may affect gameplay=
+Can view more debug info that might give a gameplay advantage=
+Can enable wireframe=
Unknown Item=
Air=
Ignore=
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index 6db351048..8db8bb8d1 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -119,31 +119,27 @@ function render_serverlist_row(spec)
return table.concat(details, ",")
end
-
---------------------------------------------------------------------------------
-os.tempfolder = function()
- local temp = core.get_temp_path()
- return temp .. DIR_DELIM .. "MT_" .. math.random(0, 10000)
-end
-
+---------------------------------------------------------------------------------
os.tmpname = function()
- local path = os.tempfolder()
- io.open(path, "w"):close()
- return path
+ error('do not use') -- instead use core.get_temp_path()
end
--------------------------------------------------------------------------------
-function menu_render_worldlist()
- local retval = ""
+function menu_render_worldlist(show_gameid)
+ local retval = {}
local current_worldlist = menudata.worldlist:get_list()
+ local row
for i, v in ipairs(current_worldlist) do
- if retval ~= "" then retval = retval .. "," end
- retval = retval .. core.formspec_escape(v.name) ..
- " \\[" .. core.formspec_escape(v.gameid) .. "\\]"
+ row = v.name
+ if show_gameid == nil or show_gameid == true then
+ row = row .. " [" .. v.gameid .. "]"
+ end
+ retval[#retval+1] = core.formspec_escape(row)
+
end
- return retval
+ return table.concat(retval, ",")
end
function menu_handle_key_up_down(fields, textlist, settingname)
diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua
index 9bdf92a74..f73256612 100644
--- a/builtin/mainmenu/dlg_config_world.lua
+++ b/builtin/mainmenu/dlg_config_world.lua
@@ -163,10 +163,13 @@ local function get_formspec(data)
"button[8.95,0.125;2.5,0.5;btn_enable_all_mods;" ..
fgettext("Enable all") .. "]"
end
+
+ local use_technical_names = core.settings:get_bool("show_technical_names")
+
return retval ..
"tablecolumns[color;tree;text]" ..
"table[5.5,0.75;5.75,6;world_config_modlist;" ..
- pkgmgr.render_packagelist(data.list) .. ";" .. data.selected_mod .."]"
+ pkgmgr.render_packagelist(data.list, use_technical_names) .. ";" .. data.selected_mod .."]"
end
local function handle_buttons(this, fields)
@@ -205,14 +208,19 @@ local function handle_buttons(this, fields)
local mods = worldfile:to_table()
local rawlist = this.data.list:get_raw_list()
+ local was_set = {}
for i = 1, #rawlist do
local mod = rawlist[i]
if not mod.is_modpack and
not mod.is_game_content then
if modname_valid(mod.name) then
- worldfile:set("load_mod_" .. mod.name,
- mod.enabled and "true" or "false")
+ if mod.enabled then
+ worldfile:set("load_mod_" .. mod.name, mod.virtual_path)
+ was_set[mod.name] = true
+ elseif not was_set[mod.name] then
+ worldfile:set("load_mod_" .. mod.name, "false")
+ end
elseif mod.enabled then
gamedata.errormessage = fgettext_ne("Failed to enable mo" ..
"d \"$1\" as it contains disallowed characters. " ..
@@ -256,12 +264,26 @@ local function handle_buttons(this, fields)
if fields.btn_enable_all_mods then
local list = this.data.list:get_raw_list()
+ -- When multiple copies of a mod are installed, we need to avoid enabling multiple of them
+ -- at a time. So lets first collect all the enabled mods, and then use this to exclude
+ -- multiple enables.
+
+ local was_enabled = {}
for i = 1, #list do
if not list[i].is_game_content
- and not list[i].is_modpack then
+ and not list[i].is_modpack and list[i].enabled then
+ was_enabled[list[i].name] = true
+ end
+ end
+
+ for i = 1, #list do
+ if not list[i].is_game_content and not list[i].is_modpack and
+ not was_enabled[list[i].name] then
list[i].enabled = true
+ was_enabled[list[i].name] = true
end
end
+
enabled_all = true
return true
end
diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua
index 790da03ba..ff32c8c9f 100644
--- a/builtin/mainmenu/dlg_contentstore.lua
+++ b/builtin/mainmenu/dlg_contentstore.lua
@@ -25,7 +25,7 @@ end
-- Unordered preserves the original order of the ContentDB API,
-- before the package list is ordered based on installed state.
-local store = { packages = {}, packages_full = {}, packages_full_unordered = {} }
+local store = { packages = {}, packages_full = {}, packages_full_unordered = {}, aliases = {} }
local http = core.get_http_api()
@@ -62,9 +62,19 @@ local REASON_UPDATE = "update"
local REASON_DEPENDENCY = "dependency"
+-- encodes for use as URL parameter or path component
+local function urlencode(str)
+ return str:gsub("[^%a%d()._~-]", function(char)
+ return string.format("%%%02X", string.byte(char))
+ end)
+end
+assert(urlencode("sample text?") == "sample%20text%3F")
+
+
local function get_download_url(package, reason)
local base_url = core.settings:get("contentdb_url")
- local ret = base_url .. ("/packages/%s/%s/releases/%d/download/"):format(package.author, package.name, package.release)
+ local ret = base_url .. ("/packages/%s/releases/%d/download/"):format(
+ package.url_part, package.release)
if reason then
ret = ret .. "?reason=" .. reason
end
@@ -72,34 +82,52 @@ local function get_download_url(package, reason)
end
-local function download_package(param)
- if core.download_file(param.url, param.filename) then
+local function download_and_extract(param)
+ local package = param.package
+
+ local filename = core.get_temp_path(true)
+ if filename == "" or not core.download_file(param.url, filename) then
+ core.log("error", "Downloading " .. dump(param.url) .. " failed")
return {
- filename = param.filename,
- successful = true,
+ msg = fgettext("Failed to download $1", package.name)
}
+ end
+
+ local tempfolder = core.get_temp_path()
+ if tempfolder ~= "" then
+ tempfolder = tempfolder .. DIR_DELIM .. "MT_" .. math.random(1, 1024000)
+ if not core.extract_zip(filename, tempfolder) then
+ tempfolder = nil
+ end
else
- core.log("error", "downloading " .. dump(param.url) .. " failed")
+ tempfolder = nil
+ end
+ os.remove(filename)
+ if not tempfolder then
return {
- successful = false,
+ msg = fgettext("Install: Unsupported file type or broken archive"),
}
end
+
+ return {
+ path = tempfolder
+ }
end
local function start_install(package, reason)
local params = {
package = package,
url = get_download_url(package, reason),
- filename = os.tempfolder() .. "_MODNAME_" .. package.name .. ".zip",
}
number_downloading = number_downloading + 1
local function callback(result)
- if result.successful then
- local path, msg = pkgmgr.install(package.type,
- result.filename, package.name,
- package.path)
+ if result.msg then
+ gamedata.errormessage = result.msg
+ else
+ local path, msg = pkgmgr.install_dir(package.type, result.path, package.name, package.path)
+ core.delete_dir(result.path)
if not path then
gamedata.errormessage = msg
else
@@ -137,9 +165,6 @@ local function start_install(package, reason)
conf:write()
end
end
- os.remove(result.filename)
- else
- gamedata.errormessage = fgettext("Failed to download $1", package.name)
end
package.downloading = false
@@ -159,7 +184,7 @@ local function start_install(package, reason)
package.queued = false
package.downloading = true
- if not core.handle_async(download_package, params, callback) then
+ if not core.handle_async(download_and_extract, params, callback) then
core.log("error", "ERROR: async event failed")
gamedata.errormessage = fgettext("Failed to download $1", package.name)
return
@@ -184,7 +209,7 @@ local function get_raw_dependencies(package)
local url_fmt = "/api/packages/%s/dependencies/?only_hard=1&protocol_version=%s&engine_version=%s"
local version = core.get_version()
local base_url = core.settings:get("contentdb_url")
- local url = base_url .. url_fmt:format(package.id, core.get_max_supp_proto(), version.string)
+ local url = base_url .. url_fmt:format(package.url_part, core.get_max_supp_proto(), urlencode(version.string))
local response = http.fetch_sync({ url = url })
if not response.succeeded then
@@ -559,17 +584,16 @@ function store.load()
local base_url = core.settings:get("contentdb_url")
local url = base_url ..
"/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
- core.get_max_supp_proto() .. "&engine_version=" .. version.string
+ core.get_max_supp_proto() .. "&engine_version=" .. urlencode(version.string)
for _, item in pairs(core.settings:get("contentdb_flag_blacklist"):split(",")) do
item = item:trim()
if item ~= "" then
- url = url .. "&hide=" .. item
+ url = url .. "&hide=" .. urlencode(item)
end
end
- local timeout = tonumber(core.settings:get("curl_file_download_timeout"))
- local response = http.fetch_sync({ url = url, timeout = timeout })
+ local response = http.fetch_sync({ url = url })
if not response.succeeded then
return
end
@@ -579,12 +603,16 @@ function store.load()
for _, package in pairs(store.packages_full) do
local name_len = #package.name
+ -- This must match what store.update_paths() does!
+ package.id = package.author:lower() .. "/"
if package.type == "game" and name_len > 5 and package.name:sub(name_len - 4) == "_game" then
- package.id = package.author:lower() .. "/" .. package.name:sub(1, name_len - 5)
+ package.id = package.id .. package.name:sub(1, name_len - 5)
else
- package.id = package.author:lower() .. "/" .. package.name
+ package.id = package.id .. package.name
end
+ package.url_part = urlencode(package.author) .. "/" .. urlencode(package.name)
+
if package.aliases then
for _, alias in ipairs(package.aliases) do
-- We currently don't support name changing
@@ -834,8 +862,7 @@ function store.get_formspec(dlgdata)
formspec[#formspec + 1] = "cdb_downloading.png;3;400;]"
elseif package.queued then
formspec[#formspec + 1] = left_base
- formspec[#formspec + 1] = core.formspec_escape(defaulttexturedir)
- formspec[#formspec + 1] = "cdb_queued.png;queued]"
+ formspec[#formspec + 1] = "cdb_queued.png;queued;]"
elseif not package.path then
local elem_name = "install_" .. i .. ";"
formspec[#formspec + 1] = "style[" .. elem_name .. "bgcolor=#71aa34]"
@@ -998,9 +1025,9 @@ function store.handle_submit(this, fields)
end
if fields["view_" .. i] then
- local url = ("%s/packages/%s/%s?protocol_version=%d"):format(
- core.settings:get("contentdb_url"),
- package.author, package.name, core.get_max_supp_proto())
+ local url = ("%s/packages/%s?protocol_version=%d"):format(
+ core.settings:get("contentdb_url"), package.url_part,
+ core.get_max_supp_proto())
core.open_url(url)
return true
end
diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua
index 1938747fe..76ceb0f16 100644
--- a/builtin/mainmenu/dlg_create_world.lua
+++ b/builtin/mainmenu/dlg_create_world.lua
@@ -15,7 +15,8 @@
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-local worldname = ""
+-- cf. tab_local, the gamebar already provides game selection so we hide the list from here
+local hide_gamelist = PLATFORM ~= "Android"
local function table_to_flags(ftable)
-- Convert e.g. { jungles = true, caves = false } to "jungles,nocaves"
@@ -31,9 +32,8 @@ local function strflag(flags, flag)
return (flags[flag] == true) and "true" or "false"
end
-local cb_caverns = { "caverns", fgettext("Caverns"), "caverns",
+local cb_caverns = { "caverns", fgettext("Caverns"),
fgettext("Very large caverns deep in the underground") }
-local tt_sea_rivers = fgettext("Sea level rivers")
local flag_checkboxes = {
v5 = {
@@ -41,39 +41,38 @@ local flag_checkboxes = {
},
v7 = {
cb_caverns,
- { "ridges", fgettext("Rivers"), "ridges", tt_sea_rivers },
- { "mountains", fgettext("Mountains"), "mountains" },
- { "floatlands", fgettext("Floatlands (experimental)"), "floatlands",
+ { "ridges", fgettext("Rivers"), fgettext("Sea level rivers") },
+ { "mountains", fgettext("Mountains") },
+ { "floatlands", fgettext("Floatlands (experimental)"),
fgettext("Floating landmasses in the sky") },
},
carpathian = {
cb_caverns,
- { "rivers", fgettext("Rivers"), "rivers", tt_sea_rivers },
+ { "rivers", fgettext("Rivers"), fgettext("Sea level rivers") },
},
valleys = {
- { "altitude-chill", fgettext("Altitude chill"), "altitude_chill",
+ { "altitude_chill", fgettext("Altitude chill"),
fgettext("Reduces heat with altitude") },
- { "altitude-dry", fgettext("Altitude dry"), "altitude_dry",
+ { "altitude_dry", fgettext("Altitude dry"),
fgettext("Reduces humidity with altitude") },
- { "humid-rivers", fgettext("Humid rivers"), "humid_rivers",
+ { "humid_rivers", fgettext("Humid rivers"),
fgettext("Increases humidity around rivers") },
- { "vary-river-depth", fgettext("Vary river depth"), "vary_river_depth",
+ { "vary_river_depth", fgettext("Vary river depth"),
fgettext("Low humidity and high heat causes shallow or dry rivers") },
},
flat = {
cb_caverns,
- { "hills", fgettext("Hills"), "hills" },
- { "lakes", fgettext("Lakes"), "lakes" },
+ { "hills", fgettext("Hills") },
+ { "lakes", fgettext("Lakes") },
},
fractal = {
- { "terrain", fgettext("Additional terrain"), "terrain",
+ { "terrain", fgettext("Additional terrain"),
fgettext("Generate non-fractal terrain: Oceans and underground") },
},
v6 = {
- { "trees", fgettext("Trees and jungle grass"), "trees" },
- { "flat", fgettext("Flat terrain"), "flat" },
- { "mudflow", fgettext("Mud flow"), "mudflow",
- fgettext("Terrain surface erosion") },
+ { "trees", fgettext("Trees and jungle grass") },
+ { "flat", fgettext("Flat terrain") },
+ { "mudflow", fgettext("Mud flow"), fgettext("Terrain surface erosion") },
-- Biome settings are in mgv6_biomes below
},
}
@@ -105,38 +104,26 @@ local function create_world_formspec(dialogdata)
"button[4.75,2.5;3,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
end
+ local current_mg = dialogdata.mg
local mapgens = core.get_mapgen_names()
- local current_seed = core.settings:get("fixed_map_seed") or ""
- local current_mg = core.settings:get("mg_name")
local gameid = core.settings:get("menu_last_game")
- local flags = {
- main = core.settings:get_flags("mg_flags"),
- v5 = core.settings:get_flags("mgv5_spflags"),
- v6 = core.settings:get_flags("mgv6_spflags"),
- v7 = core.settings:get_flags("mgv7_spflags"),
- fractal = core.settings:get_flags("mgfractal_spflags"),
- carpathian = core.settings:get_flags("mgcarpathian_spflags"),
- valleys = core.settings:get_flags("mgvalleys_spflags"),
- flat = core.settings:get_flags("mgflat_spflags"),
- }
-
- local gameidx = 0
- if gameid ~= nil then
- local _
- _, gameidx = pkgmgr.find_by_gameid(gameid)
+ local flags = dialogdata.flags
- if gameidx == nil then
- gameidx = 0
- end
+ local game, gameidx = pkgmgr.find_by_gameid(gameid)
+ if game == nil and hide_gamelist then
+ -- should never happen but just pick the first game
+ game = pkgmgr.get_game(1)
+ gameidx = 1
+ core.settings:set("menu_last_game", game.id)
+ elseif game == nil then
+ gameidx = 0
end
- local game_by_gameidx = core.get_game(gameidx)
local disallowed_mapgen_settings = {}
- if game_by_gameidx ~= nil then
- local gamepath = game_by_gameidx.path
- local gameconfig = Settings(gamepath.."/game.conf")
+ if game ~= nil then
+ local gameconfig = Settings(game.path.."/game.conf")
local allowed_mapgens = (gameconfig:get("allowed_mapgens") or ""):split()
for key, value in pairs(allowed_mapgens) do
@@ -156,7 +143,7 @@ local function create_world_formspec(dialogdata)
end
end
- if disallowed_mapgens then
+ if #disallowed_mapgens > 0 then
for i = #mapgens, 1, -1 do
if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then
table.remove(mapgens, i)
@@ -172,23 +159,29 @@ local function create_world_formspec(dialogdata)
local mglist = ""
local selindex
- local i = 1
- local first_mg
- for k,v in pairs(mapgens) do
- if not first_mg then
- first_mg = v
+ do -- build the list of mapgens
+ local i = 1
+ local first_mg
+ for k, v in pairs(mapgens) do
+ if not first_mg then
+ first_mg = v
+ end
+ if current_mg == v then
+ selindex = i
+ end
+ i = i + 1
+ mglist = mglist .. core.formspec_escape(v) .. ","
end
- if current_mg == v then
- selindex = i
+ if not selindex then
+ selindex = 1
+ current_mg = first_mg
end
- i = i + 1
- mglist = mglist .. v .. ","
- end
- if not selindex then
- selindex = 1
- current_mg = first_mg
+ mglist = mglist:sub(1, -2)
end
- mglist = mglist:sub(1, -2)
+
+ -- The logic of the flag element IDs is as follows:
+ -- "flag_main_foo-bar-baz" controls dialogdata.flags["main"]["foo_bar_baz"]
+ -- see the buttonhandler for the implementation of this
local mg_main_flags = function(mapgen, y)
if mapgen == "singlenode" then
@@ -198,11 +191,11 @@ local function create_world_formspec(dialogdata)
return "", y
end
- local form = "checkbox[0," .. y .. ";flag_mg_caves;" ..
+ local form = "checkbox[0," .. y .. ";flag_main_caves;" ..
fgettext("Caves") .. ";"..strflag(flags.main, "caves").."]"
y = y + 0.5
- form = form .. "checkbox[0,"..y..";flag_mg_dungeons;" ..
+ form = form .. "checkbox[0,"..y..";flag_main_dungeons;" ..
fgettext("Dungeons") .. ";"..strflag(flags.main, "dungeons").."]"
y = y + 0.5
@@ -213,7 +206,7 @@ local function create_world_formspec(dialogdata)
else
d_tt = fgettext("Structures appearing on the terrain, typically trees and plants")
end
- form = form .. "checkbox[0,"..y..";flag_mg_decorations;" ..
+ form = form .. "checkbox[0,"..y..";flag_main_decorations;" ..
d_name .. ";" ..
strflag(flags.main, "decorations").."]" ..
"tooltip[flag_mg_decorations;" ..
@@ -221,7 +214,7 @@ local function create_world_formspec(dialogdata)
"]"
y = y + 0.5
- form = form .. "tooltip[flag_mg_caves;" ..
+ form = form .. "tooltip[flag_main_caves;" ..
fgettext("Network of tunnels and caves")
.. "]"
return form, y
@@ -235,13 +228,13 @@ local function create_world_formspec(dialogdata)
return "", y
end
local form = ""
- for _,tab in pairs(flag_checkboxes[mapgen]) do
- local id = "flag_mg"..mapgen.."_"..tab[1]
+ for _, tab in pairs(flag_checkboxes[mapgen]) do
+ local id = "flag_"..mapgen.."_"..tab[1]:gsub("_", "-")
form = form .. ("checkbox[0,%f;%s;%s;%s]"):
- format(y, id, tab[2], strflag(flags[mapgen], tab[3]))
+ format(y, id, tab[2], strflag(flags[mapgen], tab[1]))
- if tab[4] then
- form = form .. "tooltip["..id..";"..tab[4].."]"
+ if tab[3] then
+ form = form .. "tooltip["..id..";"..tab[3].."]"
end
y = y + 0.5
end
@@ -277,16 +270,14 @@ local function create_world_formspec(dialogdata)
-- biomeblend
y = y + 0.55
- form = form .. "checkbox[0,"..y..";flag_mgv6_biomeblend;" ..
+ form = form .. "checkbox[0,"..y..";flag_v6_biomeblend;" ..
fgettext("Biome blending") .. ";"..strflag(flags.v6, "biomeblend").."]" ..
- "tooltip[flag_mgv6_biomeblend;" ..
+ "tooltip[flag_v6_biomeblend;" ..
fgettext("Smooth transition between biomes") .. "]"
return form, y
end
- current_seed = core.formspec_escape(current_seed)
-
local y_start = 0.0
local y = y_start
local str_flags, str_spflags
@@ -323,21 +314,32 @@ local function create_world_formspec(dialogdata)
"container[0,0]"..
"field[0.3,0.6;6,0.5;te_world_name;" ..
fgettext("World name") ..
- ";" .. core.formspec_escape(worldname) .. "]" ..
+ ";" .. core.formspec_escape(dialogdata.worldname) .. "]" ..
+ "set_focus[te_world_name;false]"
+
+ if not disallowed_mapgen_settings["seed"] then
- "field[0.3,1.7;6,0.5;te_seed;" ..
- fgettext("Seed") ..
- ";".. current_seed .. "]" ..
+ retval = retval .. "field[0.3,1.7;6,0.5;te_seed;" ..
+ fgettext("Seed") ..
+ ";".. core.formspec_escape(dialogdata.seed) .. "]"
+
+ end
+ retval = retval ..
"label[0,2;" .. fgettext("Mapgen") .. "]"..
- "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" ..
+ "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]"
+
+ if not hide_gamelist or devtest_only ~= "" then
+ retval = retval ..
+ "label[0,3.35;" .. fgettext("Game") .. "]"..
+ "textlist[0,3.85;5.8,"..gamelist_height..";games;" ..
+ pkgmgr.gamelist() .. ";" .. gameidx .. ";false]" ..
+ "container[0,4.5]" ..
+ devtest_only ..
+ "container_end[]"
+ end
- "label[0,3.35;" .. fgettext("Game") .. "]"..
- "textlist[0,3.85;5.8,"..gamelist_height..";games;" ..
- pkgmgr.gamelist() .. ";" .. gameidx .. ";false]" ..
- "container[0,4.5]" ..
- devtest_only ..
- "container_end[]" ..
+ retval = retval ..
"container_end[]" ..
-- Right side
@@ -360,9 +362,20 @@ local function create_world_buttonhandler(this, fields)
fields["key_enter"] then
local worldname = fields["te_world_name"]
- local gameindex = core.get_textlist_index("games")
+ local game, gameindex
+ if hide_gamelist then
+ game, gameindex = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))
+ else
+ gameindex = core.get_textlist_index("games")
+ game = pkgmgr.get_game(gameindex)
+ end
+
+ local message
+ if game == nil then
+ message = fgettext("No game selected")
+ end
- if gameindex ~= nil then
+ if message == nil then
-- For unnamed worlds use the generated name 'world<number>',
-- where the number increments: it is set to 1 larger than the largest
-- generated name number found.
@@ -377,36 +390,48 @@ local function create_world_buttonhandler(this, fields)
worldname = "world" .. worldnum_max + 1
end
- 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)
- else
+ if menudata.worldlist:uid_exists_raw(worldname) then
message = fgettext("A world named \"$1\" already exists", worldname)
end
+ end
- if message ~= nil then
- gamedata.errormessage = message
- else
- core.settings:set("menu_last_game",pkgmgr.games[gameindex].id)
- if this.data.update_worldlist_filter then
- menudata.worldlist:set_filtercriteria(pkgmgr.games[gameindex].id)
- mm_texture.update("singleplayer", pkgmgr.games[gameindex].id)
- end
- menudata.worldlist:refresh()
- core.settings:set("mainmenu_last_selected_world",
- menudata.worldlist:raw_index_by_uid(worldname))
+ if message == nil then
+ this.data.seed = fields["te_seed"] or ""
+ this.data.mg = fields["dd_mapgen"]
+
+ -- actual names as used by engine
+ local settings = {
+ fixed_map_seed = this.data.seed,
+ mg_name = this.data.mg,
+ mg_flags = table_to_flags(this.data.flags.main),
+ mgv5_spflags = table_to_flags(this.data.flags.v5),
+ mgv6_spflags = table_to_flags(this.data.flags.v6),
+ mgv7_spflags = table_to_flags(this.data.flags.v7),
+ mgfractal_spflags = table_to_flags(this.data.flags.fractal),
+ mgcarpathian_spflags = table_to_flags(this.data.flags.carpathian),
+ mgvalleys_spflags = table_to_flags(this.data.flags.valleys),
+ mgflat_spflags = table_to_flags(this.data.flags.flat),
+ }
+ message = core.create_world(worldname, gameindex, settings)
+ end
+
+ if message == nil then
+ core.settings:set("menu_last_game", game.id)
+ if this.data.update_worldlist_filter then
+ menudata.worldlist:set_filtercriteria(game.id)
end
- else
- gamedata.errormessage = fgettext("No game selected")
+ menudata.worldlist:refresh()
+ core.settings:set("mainmenu_last_selected_world",
+ menudata.worldlist:raw_index_by_uid(worldname))
end
+
+ gamedata.errormessage = message
this:delete()
return true
end
- worldname = fields.te_world_name
+ this.data.worldname = fields["te_world_name"]
+ this.data.seed = fields["te_seed"] or ""
if fields["games"] then
local gameindex = core.get_textlist_index("games")
@@ -417,22 +442,11 @@ local function create_world_buttonhandler(this, fields)
for k,v in pairs(fields) do
local split = string.split(k, "_", nil, 3)
if split and split[1] == "flag" then
- local setting
- if split[2] == "mg" then
- setting = "mg_flags"
- else
- setting = split[2].."_spflags"
- end
-- We replaced the underscore of flag names with a dash.
local flag = string.gsub(split[3], "-", "_")
- local ftable = core.settings:get_flags(setting)
- if v == "true" then
- ftable[flag] = true
- else
- ftable[flag] = false
- end
- local flags = table_to_flags(ftable)
- core.settings:set(setting, flags)
+ local ftable = this.data.flags[split[2]]
+ assert(ftable)
+ ftable[flag] = v == "true"
return true
end
end
@@ -446,18 +460,16 @@ local function create_world_buttonhandler(this, fields)
local entry = core.formspec_escape(fields["mgv6_biomes"])
for b=1, #mgv6_biomes do
if entry == mgv6_biomes[b][1] then
- local ftable = core.settings:get_flags("mgv6_spflags")
+ local ftable = this.data.flags.v6
ftable.jungles = mgv6_biomes[b][2].jungles
ftable.snowbiomes = mgv6_biomes[b][2].snowbiomes
- local flags = table_to_flags(ftable)
- core.settings:set("mgv6_spflags", flags)
return true
end
end
end
if fields["dd_mapgen"] then
- core.settings:set("mg_name", fields["dd_mapgen"])
+ this.data.mg = fields["dd_mapgen"]
return true
end
@@ -466,12 +478,27 @@ end
function create_create_world_dlg(update_worldlistfilter)
- worldname = ""
local retval = dialog_create("sp_create_world",
create_world_formspec,
create_world_buttonhandler,
nil)
- retval.update_worldlist_filter = update_worldlistfilter
+ retval.data = {
+ update_worldlist_filter = update_worldlistfilter,
+ worldname = "",
+ -- settings the world is created with:
+ seed = core.settings:get("fixed_map_seed") or "",
+ mg = core.settings:get("mg_name"),
+ flags = {
+ main = core.settings:get_flags("mg_flags"),
+ v5 = core.settings:get_flags("mgv5_spflags"),
+ v6 = core.settings:get_flags("mgv6_spflags"),
+ v7 = core.settings:get_flags("mgv7_spflags"),
+ fractal = core.settings:get_flags("mgfractal_spflags"),
+ carpathian = core.settings:get_flags("mgcarpathian_spflags"),
+ valleys = core.settings:get_flags("mgvalleys_spflags"),
+ flat = core.settings:get_flags("mgflat_spflags"),
+ }
+ }
return retval
end
diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua
index 38a658969..d6f485cf7 100644
--- a/builtin/mainmenu/dlg_settings_advanced.lua
+++ b/builtin/mainmenu/dlg_settings_advanced.lua
@@ -378,7 +378,7 @@ local function parse_config_file(read_all, parse_mods)
-- Parse mods
local mods_category_initialized = false
local mods = {}
- get_mods(core.get_modpath(), mods)
+ get_mods(core.get_modpath(), "mods", mods)
for _, mod in ipairs(mods) do
local path = mod.path .. DIR_DELIM .. FILENAME
local file = io.open(path, "r")
@@ -395,6 +395,7 @@ local function parse_config_file(read_all, parse_mods)
table.insert(settings, {
name = mod.name,
+ readable_name = mod.title,
level = 1,
type = "category",
})
@@ -408,7 +409,7 @@ local function parse_config_file(read_all, parse_mods)
-- Parse clientmods
local clientmods_category_initialized = false
local clientmods = {}
- get_mods(core.get_clientmodpath(), clientmods)
+ get_mods(core.get_clientmodpath(), "clientmods", clientmods)
for _, clientmod in ipairs(clientmods) do
local path = clientmod.path .. DIR_DELIM .. FILENAME
local file = io.open(path, "r")
@@ -527,44 +528,40 @@ end
local function get_current_np_group(setting)
local value = core.settings:get_np_group(setting.name)
- local t = {}
if value == nil then
- t = setting.values
- else
- table.insert(t, value.offset)
- table.insert(t, value.scale)
- table.insert(t, value.spread.x)
- table.insert(t, value.spread.y)
- table.insert(t, value.spread.z)
- table.insert(t, value.seed)
- table.insert(t, value.octaves)
- table.insert(t, value.persistence)
- table.insert(t, value.lacunarity)
- table.insert(t, value.flags)
+ return setting.values
end
- return t
+ local p = "%g"
+ return {
+ p:format(value.offset),
+ p:format(value.scale),
+ p:format(value.spread.x),
+ p:format(value.spread.y),
+ p:format(value.spread.z),
+ p:format(value.seed),
+ p:format(value.octaves),
+ p:format(value.persistence),
+ p:format(value.lacunarity),
+ value.flags
+ }
end
local function get_current_np_group_as_string(setting)
local value = core.settings:get_np_group(setting.name)
- local t
if value == nil then
- t = setting.default
- else
- t = value.offset .. ", " ..
- value.scale .. ", (" ..
- value.spread.x .. ", " ..
- value.spread.y .. ", " ..
- value.spread.z .. "), " ..
- value.seed .. ", " ..
- value.octaves .. ", " ..
- value.persistence .. ", " ..
- value.lacunarity
- if value.flags ~= "" then
- t = t .. ", " .. value.flags
- end
+ return setting.default
end
- return t
+ return ("%g, %g, (%g, %g, %g), %g, %g, %g, %g"):format(
+ value.offset,
+ value.scale,
+ value.spread.x,
+ value.spread.y,
+ value.spread.z,
+ value.seed,
+ value.octaves,
+ value.persistence,
+ value.lacunarity
+ ) .. (value.flags ~= "" and (", " .. value.flags) or "")
end
local checkboxes = {} -- handle checkboxes events
@@ -697,7 +694,7 @@ local function create_change_setting_formspec(dialogdata)
elseif setting.type == "v3f" then
local val = get_current_value(setting)
local v3f = {}
- for line in val:gmatch("[+-]?[%d.-e]+") do -- All numeric characters
+ for line in val:gmatch("[+-]?[%d.+-eE]+") do -- All numeric characters
table.insert(v3f, line)
end
@@ -990,7 +987,7 @@ local function create_settings_formspec(tabview, _, tabdata)
local current_level = 0
for _, entry in ipairs(settings) do
local name
- if not core.settings:get_bool("main_menu_technical_settings") and entry.readable_name then
+ if not core.settings:get_bool("show_technical_names") and entry.readable_name then
name = fgettext_ne(entry.readable_name)
else
name = entry.name
@@ -1031,7 +1028,7 @@ local function create_settings_formspec(tabview, _, tabdata)
"button[10,4.9;2,1;btn_edit;" .. fgettext("Edit") .. "]" ..
"button[7,4.9;3,1;btn_restore;" .. fgettext("Restore Default") .. "]" ..
"checkbox[0,4.3;cb_tech_settings;" .. fgettext("Show technical names") .. ";"
- .. dump(core.settings:get_bool("main_menu_technical_settings")) .. "]"
+ .. dump(core.settings:get_bool("show_technical_names")) .. "]"
return formspec
end
@@ -1114,7 +1111,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
end
if fields["cb_tech_settings"] then
- core.settings:set("main_menu_technical_settings", fields["cb_tech_settings"])
+ core.settings:set("show_technical_names", fields["cb_tech_settings"])
core.settings:write()
core.update_formspec(this:get_formspec())
return true
diff --git a/builtin/mainmenu/textures.lua b/builtin/mainmenu/game_theme.lua
index a3acbbdec..89e1b66c8 100644
--- a/builtin/mainmenu/textures.lua
+++ b/builtin/mainmenu/game_theme.lua
@@ -16,23 +16,25 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-mm_texture = {}
+mm_game_theme = {}
--------------------------------------------------------------------------------
-function mm_texture.init()
- mm_texture.defaulttexturedir = core.get_texturepath() .. DIR_DELIM .. "base" ..
+function mm_game_theme.init()
+ mm_game_theme.defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM
- mm_texture.basetexturedir = mm_texture.defaulttexturedir
+ mm_game_theme.basetexturedir = mm_game_theme.defaulttexturedir
- mm_texture.texturepack = core.settings:get("texture_path")
+ mm_game_theme.texturepack = core.settings:get("texture_path")
- mm_texture.gameid = nil
+ mm_game_theme.gameid = nil
+
+ mm_game_theme.music_handle = nil
end
--------------------------------------------------------------------------------
-function mm_texture.update(tab,gamedetails)
+function mm_game_theme.update(tab,gamedetails)
if tab ~= "singleplayer" then
- mm_texture.reset()
+ mm_game_theme.reset()
return
end
@@ -40,50 +42,54 @@ function mm_texture.update(tab,gamedetails)
return
end
- mm_texture.update_game(gamedetails)
+ mm_game_theme.update_game(gamedetails)
end
--------------------------------------------------------------------------------
-function mm_texture.reset()
- mm_texture.gameid = nil
+function mm_game_theme.reset()
+ mm_game_theme.gameid = nil
local have_bg = false
- local have_overlay = mm_texture.set_generic("overlay")
+ local have_overlay = mm_game_theme.set_generic("overlay")
if not have_overlay then
- have_bg = mm_texture.set_generic("background")
+ have_bg = mm_game_theme.set_generic("background")
end
- mm_texture.clear("header")
- mm_texture.clear("footer")
+ mm_game_theme.clear("header")
+ mm_game_theme.clear("footer")
core.set_clouds(false)
- mm_texture.set_generic("footer")
- mm_texture.set_generic("header")
+ mm_game_theme.set_generic("footer")
+ mm_game_theme.set_generic("header")
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
- mm_texture.set_dirt_bg()
+ mm_game_theme.set_dirt_bg()
end
end
+
+ if mm_game_theme.music_handle ~= nil then
+ core.sound_stop(mm_game_theme.music_handle)
+ end
end
--------------------------------------------------------------------------------
-function mm_texture.update_game(gamedetails)
- if mm_texture.gameid == gamedetails.id then
+function mm_game_theme.update_game(gamedetails)
+ if mm_game_theme.gameid == gamedetails.id then
return
end
local have_bg = false
- local have_overlay = mm_texture.set_game("overlay",gamedetails)
+ local have_overlay = mm_game_theme.set_game("overlay",gamedetails)
if not have_overlay then
- have_bg = mm_texture.set_game("background",gamedetails)
+ have_bg = mm_game_theme.set_game("background",gamedetails)
end
- mm_texture.clear("header")
- mm_texture.clear("footer")
+ mm_game_theme.clear("header")
+ mm_game_theme.clear("footer")
core.set_clouds(false)
if not have_bg then
@@ -91,34 +97,34 @@ function mm_texture.update_game(gamedetails)
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
- mm_texture.set_dirt_bg()
+ mm_game_theme.set_dirt_bg()
end
end
- mm_texture.set_game("footer",gamedetails)
- mm_texture.set_game("header",gamedetails)
+ mm_game_theme.set_game("footer",gamedetails)
+ mm_game_theme.set_game("header",gamedetails)
- mm_texture.gameid = gamedetails.id
+ mm_game_theme.gameid = gamedetails.id
end
--------------------------------------------------------------------------------
-function mm_texture.clear(identifier)
+function mm_game_theme.clear(identifier)
core.set_background(identifier,"")
end
--------------------------------------------------------------------------------
-function mm_texture.set_generic(identifier)
+function mm_game_theme.set_generic(identifier)
--try texture pack first
- if mm_texture.texturepack ~= nil then
- local path = mm_texture.texturepack .. DIR_DELIM .."menu_" ..
+ if mm_game_theme.texturepack ~= nil then
+ local path = mm_game_theme.texturepack .. DIR_DELIM .."menu_" ..
identifier .. ".png"
if core.set_background(identifier,path) then
return true
end
end
- if mm_texture.defaulttexturedir ~= nil then
- local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
+ if mm_game_theme.defaulttexturedir ~= nil then
+ local path = mm_game_theme.defaulttexturedir .. DIR_DELIM .."menu_" ..
identifier .. ".png"
if core.set_background(identifier,path) then
return true
@@ -129,14 +135,16 @@ function mm_texture.set_generic(identifier)
end
--------------------------------------------------------------------------------
-function mm_texture.set_game(identifier, gamedetails)
+function mm_game_theme.set_game(identifier, gamedetails)
if gamedetails == nil then
return false
end
- if mm_texture.texturepack ~= nil then
- local path = mm_texture.texturepack .. DIR_DELIM ..
+ mm_game_theme.set_music(gamedetails)
+
+ if mm_game_theme.texturepack ~= nil then
+ local path = mm_game_theme.texturepack .. DIR_DELIM ..
gamedetails.id .. "_menu_" .. identifier .. ".png"
if core.set_background(identifier, path) then
return true
@@ -171,9 +179,10 @@ function mm_texture.set_game(identifier, gamedetails)
return false
end
-function mm_texture.set_dirt_bg()
- if mm_texture.texturepack ~= nil then
- local path = mm_texture.texturepack .. DIR_DELIM .."default_dirt.png"
+--------------------------------------------------------------------------------
+function mm_game_theme.set_dirt_bg()
+ if mm_game_theme.texturepack ~= nil then
+ local path = mm_game_theme.texturepack .. DIR_DELIM .."default_dirt.png"
if core.set_background("background", path, true, 128) then
return true
end
@@ -183,3 +192,12 @@ function mm_texture.set_dirt_bg()
local minimalpath = defaulttexturedir .. "menu_bg.png"
core.set_background("background", minimalpath, true, 128)
end
+
+--------------------------------------------------------------------------------
+function mm_game_theme.set_music(gamedetails)
+ if mm_game_theme.music_handle ~= nil then
+ core.sound_stop(mm_game_theme.music_handle)
+ end
+ local music_path = gamedetails.path .. DIR_DELIM .. "menu" .. DIR_DELIM .. "theme"
+ mm_game_theme.music_handle = core.sound_play(music_path, true)
+end
diff --git a/builtin/mainmenu/generate_from_settingtypes.lua b/builtin/mainmenu/generate_from_settingtypes.lua
index 43fc57bb9..0f551fbb1 100644
--- a/builtin/mainmenu/generate_from_settingtypes.lua
+++ b/builtin/mainmenu/generate_from_settingtypes.lua
@@ -31,7 +31,7 @@ local group_format_template = [[
# octaves = %s,
# persistence = %s,
# lacunarity = %s,
-# flags = %s
+# flags =%s
# }
]]
@@ -55,7 +55,11 @@ local function create_minetest_conf_example()
end
if entry.comment ~= "" then
for _, comment_line in ipairs(entry.comment:split("\n", true)) do
- insert(result, "# " .. comment_line .. "\n")
+ if comment_line == "" then
+ insert(result, "#\n")
+ else
+ insert(result, "# " .. comment_line .. "\n")
+ end
end
end
insert(result, "# type: " .. entry.type)
@@ -73,10 +77,14 @@ local function create_minetest_conf_example()
end
insert(result, "\n")
if group_format == true then
+ local flags = entry.values[10]
+ if flags ~= "" then
+ flags = " "..flags
+ end
insert(result, sprintf(group_format_template, entry.name, entry.values[1],
entry.values[2], entry.values[3], entry.values[4], entry.values[5],
entry.values[6], entry.values[7], entry.values[8], entry.values[9],
- entry.values[10]))
+ flags))
else
local append
if entry.default ~= "" then
@@ -91,7 +99,7 @@ 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
+// It contains 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() {]]
@@ -126,4 +134,3 @@ file = assert(io.open("src/settings_translation_file.cpp", "w"))
--file = assert(io.open("settings_translation_file.cpp", "w"))
file:write(create_translation_file())
file:close()
-
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index 2481078e2..943454677 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -35,7 +35,7 @@ dofile(menupath .. DIR_DELIM .. "async_event.lua")
dofile(menupath .. DIR_DELIM .. "common.lua")
dofile(menupath .. DIR_DELIM .. "pkgmgr.lua")
dofile(menupath .. DIR_DELIM .. "serverlistmgr.lua")
-dofile(menupath .. DIR_DELIM .. "textures.lua")
+dofile(menupath .. DIR_DELIM .. "game_theme.lua")
dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
@@ -87,7 +87,7 @@ local function init_globals()
core.settings:set("menu_last_game", default_game)
end
- mm_texture.init()
+ mm_game_theme.init()
-- Create main tabview
local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0})
@@ -113,7 +113,7 @@ local function init_globals()
if tv_main.current_tab == "local" then
local game = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))
if game == nil then
- mm_texture.reset()
+ mm_game_theme.reset()
end
end
@@ -121,8 +121,6 @@ local function init_globals()
tv_main:show()
ui.update()
-
- core.sound_play("main_menu", true)
end
init_globals()
diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua
index 58a4ed8c1..072c41f0c 100644
--- a/builtin/mainmenu/pkgmgr.lua
+++ b/builtin/mainmenu/pkgmgr.lua
@@ -78,34 +78,35 @@ local function load_texture_packs(txtpath, retval)
for _, item in ipairs(list) do
if item ~= "base" then
- local name = item
-
local path = txtpath .. DIR_DELIM .. item .. DIR_DELIM
- if path == current_texture_path then
- name = fgettext("$1 (Enabled)", name)
- end
-
local conf = Settings(path .. "texture_pack.conf")
+ local enabled = path == current_texture_path
+
+ local title = conf:get("title") or item
+ -- list_* is only used if non-nil, else the regular versions are used.
retval[#retval + 1] = {
name = item,
+ title = title,
+ list_name = enabled and fgettext("$1 (Enabled)", item) or nil,
+ list_title = enabled and fgettext("$1 (Enabled)", title) or nil,
author = conf:get("author"),
release = tonumber(conf:get("release")) or 0,
- list_name = name,
type = "txp",
path = path,
- enabled = path == current_texture_path,
+ enabled = enabled,
}
end
end
end
-function get_mods(path,retval,modpack)
+function get_mods(path, virtual_path, retval, modpack)
local mods = core.get_dir_list(path, true)
for _, name in ipairs(mods) do
if name:sub(1, 1) ~= "." then
- local prefix = path .. DIR_DELIM .. name
+ local mod_path = path .. DIR_DELIM .. name
+ local mod_virtual_path = virtual_path .. "/" .. name
local toadd = {
dir_name = name,
parent_dir = path,
@@ -114,18 +115,18 @@ function get_mods(path,retval,modpack)
-- Get config file
local mod_conf
- local modpack_conf = io.open(prefix .. DIR_DELIM .. "modpack.conf")
+ local modpack_conf = io.open(mod_path .. DIR_DELIM .. "modpack.conf")
if modpack_conf then
toadd.is_modpack = true
modpack_conf:close()
- mod_conf = Settings(prefix .. DIR_DELIM .. "modpack.conf"):to_table()
+ mod_conf = Settings(mod_path .. DIR_DELIM .. "modpack.conf"):to_table()
if mod_conf.name then
name = mod_conf.name
toadd.is_name_explicit = true
end
else
- mod_conf = Settings(prefix .. DIR_DELIM .. "mod.conf"):to_table()
+ mod_conf = Settings(mod_path .. DIR_DELIM .. "mod.conf"):to_table()
if mod_conf.name then
name = mod_conf.name
toadd.is_name_explicit = true
@@ -134,14 +135,16 @@ function get_mods(path,retval,modpack)
-- Read from config
toadd.name = name
+ toadd.title = mod_conf.title
toadd.author = mod_conf.author
toadd.release = tonumber(mod_conf.release) or 0
- toadd.path = prefix
+ toadd.path = mod_path
+ toadd.virtual_path = mod_virtual_path
toadd.type = "mod"
-- Check modpack.txt
-- Note: modpack.conf is already checked above
- local modpackfile = io.open(prefix .. DIR_DELIM .. "modpack.txt")
+ local modpackfile = io.open(mod_path .. DIR_DELIM .. "modpack.txt")
if modpackfile then
modpackfile:close()
toadd.is_modpack = true
@@ -153,7 +156,7 @@ function get_mods(path,retval,modpack)
elseif toadd.is_modpack then
toadd.type = "modpack"
toadd.is_modpack = true
- get_mods(prefix, retval, name)
+ get_mods(mod_path, mod_virtual_path, retval, name)
end
end
end
@@ -181,21 +184,6 @@ function pkgmgr.get_texture_packs()
end
--------------------------------------------------------------------------------
-function pkgmgr.extract(modfile)
- if modfile.type == "zip" then
- local tempfolder = os.tempfolder()
-
- if tempfolder ~= nil and
- tempfolder ~= "" then
- core.create_dir(tempfolder)
- if core.extract_zip(modfile.name,tempfolder) then
- return tempfolder
- end
- end
- end
- return nil
-end
-
function pkgmgr.get_folder_type(path)
local testfile = io.open(path .. DIR_DELIM .. "init.lua","r")
if testfile ~= nil then
@@ -349,7 +337,7 @@ function pkgmgr.identify_modname(modpath,filename)
return nil
end
--------------------------------------------------------------------------------
-function pkgmgr.render_packagelist(render_list)
+function pkgmgr.render_packagelist(render_list, use_technical_names)
if not render_list then
if not pkgmgr.global_mods then
pkgmgr.refresh_globals()
@@ -385,7 +373,12 @@ function pkgmgr.render_packagelist(render_list)
else
retval[#retval + 1] = "0"
end
- retval[#retval + 1] = core.formspec_escape(v.list_name or v.name)
+
+ if use_technical_names then
+ retval[#retval + 1] = core.formspec_escape(v.list_name or v.name)
+ else
+ retval[#retval + 1] = core.formspec_escape(v.list_title or v.list_name or v.title or v.name)
+ end
end
return table.concat(retval, ",")
@@ -412,6 +405,14 @@ function pkgmgr.is_modpack_entirely_enabled(data, name)
return true
end
+local function disable_all_by_name(list, name, except)
+ for i=1, #list do
+ if list[i].name == name and list[i] ~= except then
+ list[i].enabled = false
+ end
+ end
+end
+
---------- toggles or en/disables a mod or modpack and its dependencies --------
local function toggle_mod_or_modpack(list, toggled_mods, enabled_mods, toset, mod)
if not mod.is_modpack then
@@ -420,13 +421,16 @@ local function toggle_mod_or_modpack(list, toggled_mods, enabled_mods, toset, mo
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
+
+ -- Disable other mods with the same name
+ disable_all_by_name(list, mod.name, mod)
end
+ mod.enabled = toset
else
-- Toggle or en/disable every mod in the modpack,
-- interleaved unsupported
@@ -451,7 +455,7 @@ function pkgmgr.enable_mod(this, toset)
local enabled_mods = {}
toggle_mod_or_modpack(list, toggled_mods, enabled_mods, toset, mod)
- if not toset then
+ if next(enabled_mods) == nil then
-- Mod(s) were disabled, so no dependencies need to be enabled
table.sort(toggled_mods)
core.log("info", "Following mods were disabled: " ..
@@ -461,11 +465,16 @@ function pkgmgr.enable_mod(this, toset)
-- Enable mods' depends after activation
- -- Make a list of mod ids indexed by their names
+ -- Make a list of mod ids indexed by their names. Among mods with the
+ -- same name, enabled mods take precedence, after which game mods take
+ -- precedence, being last in the mod list.
local mod_ids = {}
for id, mod2 in pairs(list) do
if mod2.type == "mod" and not mod2.is_modpack then
- mod_ids[mod2.name] = id
+ local prev_id = mod_ids[mod2.name]
+ if not prev_id or not list[prev_id].enabled then
+ mod_ids[mod2.name] = id
+ end
end
end
@@ -482,6 +491,7 @@ function pkgmgr.enable_mod(this, toset)
end
end
end
+
-- If sp is 0, every dependency is already activated
while sp > 0 do
local name = to_enable[sp]
@@ -494,14 +504,14 @@ function pkgmgr.enable_mod(this, toset)
core.log("warning", "Mod dependency \"" .. name ..
"\" not found!")
else
- if mod_to_enable.enabled == false then
+ if not mod_to_enable.enabled then
mod_to_enable.enabled = true
toggled_mods[#toggled_mods+1] = mod_to_enable.name
end
-- Push the dependencies of the dependency onto the stack
local depends = pkgmgr.get_dependencies(mod_to_enable.path)
for i = 1, #depends do
- if not enabled_mods[name] then
+ if not enabled_mods[depends[i]] then
sp = sp+1
to_enable[sp] = depends[i]
end
@@ -561,11 +571,10 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
local from = basefolder and basefolder.path or path
if targetpath then
core.delete_dir(targetpath)
- core.create_dir(targetpath)
else
targetpath = core.get_texturepath() .. DIR_DELIM .. basename
end
- if not core.copy_dir(from, targetpath) then
+ if not core.copy_dir(from, targetpath, false) then
return nil,
fgettext("Failed to install $1 to $2", basename, targetpath)
end
@@ -586,7 +595,6 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
-- Get destination name for modpack
if targetpath then
core.delete_dir(targetpath)
- core.create_dir(targetpath)
else
local clean_path = nil
if basename ~= nil then
@@ -610,7 +618,6 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
if targetpath then
core.delete_dir(targetpath)
- core.create_dir(targetpath)
else
local targetfolder = basename
if targetfolder == nil then
@@ -636,14 +643,13 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
if targetpath then
core.delete_dir(targetpath)
- core.create_dir(targetpath)
else
targetpath = core.get_gamepath() .. DIR_DELIM .. basename
end
end
-- Copy it
- if not core.copy_dir(basefolder.path, targetpath) then
+ if not core.copy_dir(basefolder.path, targetpath, false) then
return nil,
fgettext("Failed to install $1 to $2", basename, targetpath)
end
@@ -658,23 +664,6 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
end
--------------------------------------------------------------------------------
-function pkgmgr.install(type, modfilename, basename, dest)
- local archive_info = pkgmgr.identify_filetype(modfilename)
- local path = pkgmgr.extract(archive_info)
-
- if path == nil then
- return nil,
- fgettext("Install: file: \"$1\"", archive_info.name) .. "\n" ..
- fgettext("Install: Unsupported file type \"$1\" or broken archive",
- archive_info.type)
- end
-
- local targetpath, msg = pkgmgr.install_dir(type, path, basename, dest)
- core.delete_dir(path)
- return targetpath, msg
-end
-
---------------------------------------------------------------------------------
function pkgmgr.prepareclientmodlist(data)
local retval = {}
@@ -683,9 +672,8 @@ function pkgmgr.prepareclientmodlist(data)
--read clientmods
local modpath = core.get_clientmodpath()
- if modpath ~= nil and
- modpath ~= "" then
- get_mods(modpath,clientmods)
+ if modpath ~= nil and modpath ~= "" then
+ get_mods(modpath, "clientmods", clientmods)
end
for i=1,#clientmods,1 do
@@ -730,16 +718,15 @@ function pkgmgr.preparemodlist(data)
local game_mods = {}
--read global mods
- local modpath = core.get_modpath()
-
- if modpath ~= nil and
- modpath ~= "" then
- get_mods(modpath,global_mods)
+ local modpaths = core.get_modpaths()
+ for key, modpath in pairs(modpaths) do
+ get_mods(modpath, key, global_mods)
end
for i=1,#global_mods,1 do
global_mods[i].type = "mod"
global_mods[i].loc = "global"
+ global_mods[i].enabled = false
retval[#retval + 1] = global_mods[i]
end
@@ -773,22 +760,37 @@ function pkgmgr.preparemodlist(data)
DIR_DELIM .. "world.mt"
local worldfile = Settings(filename)
-
- for key,value in pairs(worldfile:to_table()) do
+ for key, value in pairs(worldfile:to_table()) do
if key:sub(1, 9) == "load_mod_" then
key = key:sub(10)
- local element = nil
- for i=1,#retval,1 do
+ local mod_found = false
+
+ local fallback_found = false
+ local fallback_mod = nil
+
+ for i=1, #retval do
if retval[i].name == key and
- not retval[i].is_modpack then
- element = retval[i]
- break
+ not retval[i].is_modpack then
+ if core.is_yes(value) or retval[i].virtual_path == value then
+ retval[i].enabled = true
+ mod_found = true
+ break
+ elseif fallback_found then
+ -- Only allow fallback if only one mod matches
+ fallback_mod = nil
+ else
+ fallback_found = true
+ fallback_mod = retval[i]
+ end
end
end
- if element ~= nil then
- element.enabled = value ~= "false" and value ~= "nil" and value
- else
- core.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
+
+ if not mod_found then
+ if fallback_mod and value:find("/") then
+ fallback_mod.enabled = true
+ else
+ core.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
+ end
end
end
end
@@ -872,45 +874,6 @@ function pkgmgr.refresh_globals()
end
--------------------------------------------------------------------------------
-function pkgmgr.identify_filetype(name)
-
- if name:sub(-3):lower() == "zip" then
- return {
- name = name,
- type = "zip"
- }
- end
-
- if name:sub(-6):lower() == "tar.gz" or
- name:sub(-3):lower() == "tgz"then
- return {
- name = name,
- type = "tgz"
- }
- end
-
- if name:sub(-6):lower() == "tar.bz2" then
- return {
- name = name,
- type = "tbz"
- }
- end
-
- if name:sub(-2):lower() == "7z" then
- return {
- name = name,
- type = "7z"
- }
- end
-
- return {
- name = name,
- type = "ukn"
- }
-end
-
-
---------------------------------------------------------------------------------
function pkgmgr.find_by_gameid(gameid)
for i=1,#pkgmgr.games,1 do
if pkgmgr.games[i].id == gameid then
@@ -925,7 +888,7 @@ function pkgmgr.get_game_mods(gamespec, retval)
if gamespec ~= nil and
gamespec.gamemods_path ~= nil and
gamespec.gamemods_path ~= "" then
- get_mods(gamespec.gamemods_path, retval)
+ get_mods(gamespec.gamemods_path, ("games/%s/mods"):format(gamespec.id), retval)
end
end
diff --git a/builtin/mainmenu/tab_about.lua b/builtin/mainmenu/tab_about.lua
index cb566f773..3336786ba 100644
--- a/builtin/mainmenu/tab_about.lua
+++ b/builtin/mainmenu/tab_about.lua
@@ -38,32 +38,35 @@ local core_developers = {
"Lars Hofhansl <larsh@apache.org>",
"Pierre-Yves Rollo <dev@pyrollo.com>",
"v-rob <robinsonvincent89@gmail.com>",
+ "hecks",
+ "Hugues Ross <hugues.ross@gmail.com>",
+ "Dmitry Kostenko (x2048) <codeforsmile@gmail.com>",
}
-- For updating active/previous contributors, see the script in ./util/gather_git_credits.py
local active_contributors = {
- "Wuzzy [devtest game, visual corrections]",
- "Zughy [Visual improvements, various fixes]",
- "Maksim (MoNTE48) [Android]",
+ "Wuzzy [I18n for builtin, liquid features, fixes]",
+ "Zughy [Various features and fixes]",
"numzero [Graphics and rendering]",
- "appgurueu [Various internal fixes]",
- "Desour [Formspec and vector API changes]",
- "HybridDog [Rendering fixes and documentation]",
- "Hugues Ross [Graphics-related improvements]",
- "ANAND (ClobberXD) [Mouse buttons rebinding]",
- "luk3yx [Fixes]",
- "hecks [Audiovisuals, Lua API]",
- "LoneWolfHT [Object crosshair, documentation fixes]",
- "Lejo [Server-related improvements]",
- "EvidenceB [Compass HUD element]",
- "Paul Ouellette (pauloue) [Lua API, documentation]",
- "TheTermos [Collision detection, physics]",
+ "Desour [Internal fixes, Clipboard on X11]",
+ "Lars Müller [Various internal fixes]",
+ "JosiahWI [CMake, cleanups and fixes]",
+ "HybridDog [builtin, documentation]",
+ "Jude Melton-Houghton [Database implementation]",
+ "savilli [Fixes]",
+ "Liso [Shadow Mapping]",
+ "MoNTE48 [Build fix]",
+ "Jean-Patrick Guerrero (kilbith) [Fixes]",
+ "ROllerozxa [Code cleanups]",
+ "Lejo [bitop library integration]",
+ "LoneWolfHT [Build fixes]",
+ "NeroBurner [Joystick]",
+ "Elias Fleckenstein [Internal fixes]",
"David CARLIER [Unix & Haiku build fixes]",
- "dcbrwn [Object shading]",
- "Elias Fleckenstein [API features/fixes]",
- "Jean-Patrick Guerrero (kilbith) [model element, visual fixes]",
- "k.h.lai [Memory leak fixes, documentation]",
+ "pecksin [Clickable web links]",
+ "srfqi [Android & rendering fixes]",
+ "EvidenceB [Formspec]",
}
local previous_core_developers = {
@@ -80,6 +83,7 @@ local previous_core_developers = {
"Zeno",
"ShadowNinja <shadowninja@minetest.net>",
"Auke Kok (sofar) <sofar@foo-projects.org>",
+ "Aaron Suen <warr1024@gmail.com>",
}
local previous_contributors = {
@@ -90,10 +94,10 @@ local previous_contributors = {
"MirceaKitsune <mirceakitsune@gmail.com>",
"Constantin Wenger (SpeedProg)",
"Ciaran Gultnieks (CiaranG)",
- "stujones11 [Android UX improvements]",
- "Rogier <rogier777@gmail.com> [Fixes]",
- "Gregory Currie (gregorycu) [optimisation]",
- "srifqi [Fixes]",
+ "Paul Ouellette (pauloue)",
+ "stujones11",
+ "Rogier <rogier777@gmail.com>",
+ "Gregory Currie (gregorycu)",
"JacobF",
"Jeija <jeija@mesecons.net> [HTTP, particles]",
}
diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua
index 1bffeeb22..a366d4ab4 100644
--- a/builtin/mainmenu/tab_content.lua
+++ b/builtin/mainmenu/tab_content.lua
@@ -88,12 +88,14 @@ local function get_formspec(tabview, name, tabdata)
tabdata.selected_pkg = 1
end
+ local use_technical_names = core.settings:get_bool("show_technical_names")
+
local retval =
"label[0.05,-0.25;".. fgettext("Installed Packages:") .. "]" ..
"tablecolumns[color;tree;text]" ..
"table[0,0.25;5.1,4.3;pkglist;" ..
- pkgmgr.render_packagelist(packages) ..
+ pkgmgr.render_packagelist(packages, use_technical_names) ..
";" .. tabdata.selected_pkg .. "]" ..
"button[0,4.85;5.25,0.5;btn_contentdb;".. fgettext("Browse online content") .. "]"
@@ -124,9 +126,17 @@ local function get_formspec(tabview, name, tabdata)
desc = info.description
end
+ local title_and_name
+ if selected_pkg.type == "game" then
+ title_and_name = selected_pkg.name
+ else
+ title_and_name = (selected_pkg.title or selected_pkg.name) .. "\n" ..
+ core.colorize("#BFBFBF", selected_pkg.name)
+ end
+
retval = retval ..
"image[5.5,0;3,2;" .. core.formspec_escape(modscreenshot) .. "]" ..
- "label[8.25,0.6;" .. core.formspec_escape(selected_pkg.name) .. "]" ..
+ "label[8.25,0.6;" .. core.formspec_escape(title_and_name) .. "]" ..
"box[5.5,2.2;6.15,2.35;#000]"
if selected_pkg.type == "mod" then
@@ -214,6 +224,9 @@ local function handle_doubleclick(pkg, pkg_name)
core.settings:set("texture_path", pkg.path)
end
packages = nil
+
+ mm_game_theme.init()
+ mm_game_theme.reset()
elseif pkg.is_clientside then
pkgmgr.enable_mod({data = {list = packages, selected_mod = pkg_name}})
packages = nil
@@ -276,17 +289,17 @@ local function handle_buttons(tabview, fields, tabname, tabdata)
return true
end
- if fields.btn_mod_mgr_use_txp then
- local txp = packages:get_list()[tabdata.selected_pkg]
- core.settings:set("texture_path", txp.path)
- packages = nil
- return true
- end
-
+ if fields.btn_mod_mgr_use_txp or fields.btn_mod_mgr_disable_txp then
+ local txp_path = ""
+ if fields.btn_mod_mgr_use_txp then
+ txp_path = packages:get_list()[tabdata.selected_pkg].path
+ end
- if fields.btn_mod_mgr_disable_txp then
- core.settings:set("texture_path", "")
+ core.settings:set("texture_path", txp_path)
packages = nil
+
+ mm_game_theme.init()
+ mm_game_theme.reset()
return true
end
diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua
index be5f905ac..e77c6f04d 100644
--- a/builtin/mainmenu/tab_local.lua
+++ b/builtin/mainmenu/tab_local.lua
@@ -33,10 +33,30 @@ if enable_gamebar then
return game
end
+ -- Apply menu changes from given game
+ function apply_game(game)
+ core.set_topleft_text(game.name)
+ core.settings:set("menu_last_game", game.id)
+ menudata.worldlist:set_filtercriteria(game.id)
+
+ mm_game_theme.update("singleplayer", game) -- this refreshes the formspec
+
+ local index = filterlist.get_current_index(menudata.worldlist,
+ 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
+ index = selected
+ else
+ index = #menudata.worldlist:get_list()
+ end
+ end
+ menu_worldmt_legacy(index)
+ end
+
function singleplayer_refresh_gamebar()
local old_bar = ui.find_by_name("game_button_bar")
-
if old_bar ~= nil then
old_bar:delete()
end
@@ -51,26 +71,10 @@ if enable_gamebar then
return true
end
- for key,value in pairs(fields) do
- for j=1,#pkgmgr.games,1 do
- if ("game_btnbar_" .. pkgmgr.games[j].id == key) then
- mm_texture.update("singleplayer", pkgmgr.games[j])
- core.set_topleft_text(pkgmgr.games[j].name)
- core.settings:set("menu_last_game",pkgmgr.games[j].id)
- menudata.worldlist:set_filtercriteria(pkgmgr.games[j].id)
- local index = filterlist.get_current_index(menudata.worldlist,
- 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
- index = selected
- else
- index = #menudata.worldlist:get_list()
- end
- end
- menu_worldmt_legacy(index)
- return true
- end
+ for _, game in ipairs(pkgmgr.games) do
+ if fields["game_btnbar_" .. game.id] then
+ apply_game(game)
+ return true
end
end
end
@@ -79,25 +83,22 @@ if enable_gamebar then
game_buttonbar_button_handler,
{x=-0.3,y=5.9}, "horizontal", {x=12.4,y=1.15})
- for i=1,#pkgmgr.games,1 do
- local btn_name = "game_btnbar_" .. pkgmgr.games[i].id
+ for _, game in ipairs(pkgmgr.games) do
+ local btn_name = "game_btnbar_" .. game.id
local image = nil
local text = nil
- local tooltip = core.formspec_escape(pkgmgr.games[i].name)
+ local tooltip = core.formspec_escape(game.name)
- if pkgmgr.games[i].menuicon_path ~= nil and
- pkgmgr.games[i].menuicon_path ~= "" then
- image = core.formspec_escape(pkgmgr.games[i].menuicon_path)
+ if (game.menuicon_path or "") ~= "" then
+ image = core.formspec_escape(game.menuicon_path)
else
-
- local part1 = pkgmgr.games[i].id:sub(1,5)
- local part2 = pkgmgr.games[i].id:sub(6,10)
- local part3 = pkgmgr.games[i].id:sub(11)
+ local part1 = game.id:sub(1,5)
+ local part2 = game.id:sub(6,10)
+ local part3 = game.id:sub(11)
text = part1 .. "\n" .. part2
- if part3 ~= nil and
- part3 ~= "" then
+ if part3 ~= "" then
text = text .. "\n" .. part3
end
end
@@ -147,8 +148,12 @@ local function get_formspec(tabview, name, tabdata)
tonumber(core.settings:get("mainmenu_last_selected_world")))
local list = menudata.worldlist:get_list()
local world = list and index and list[index]
- local gameid = world and world.gameid
- local game = gameid and pkgmgr.find_by_gameid(gameid)
+ local game
+ if world then
+ game = pkgmgr.find_by_gameid(world.gameid)
+ else
+ game = current_game()
+ end
local disabled_settings = get_disabled_settings(game)
local creative, damage, host = "", "", ""
@@ -182,7 +187,7 @@ local function get_formspec(tabview, name, tabdata)
damage ..
host ..
"textlist[3.9,0.4;7.9,3.45;sp_worlds;" ..
- menu_render_worldlist() ..
+ menu_render_worldlist(not enable_gamebar) ..
";" .. index .. "]"
if core.settings:get_bool("enable_server") and disabled_settings["enable_server"] == nil then
@@ -319,11 +324,11 @@ local function main_button_handler(this, fields, name, tabdata)
end
if fields["world_create"] ~= nil then
- local create_world_dlg = create_create_world_dlg(true)
+ local create_world_dlg = create_create_world_dlg(enable_gamebar)
create_world_dlg:set_parent(this)
this:hide()
create_world_dlg:show()
- mm_texture.update("singleplayer", current_game())
+ mm_game_theme.update("singleplayer", current_game())
return true
end
@@ -340,7 +345,7 @@ local function main_button_handler(this, fields, name, tabdata)
delete_world_dlg:set_parent(this)
this:hide()
delete_world_dlg:show()
- mm_texture.update("singleplayer",current_game())
+ mm_game_theme.update("singleplayer",current_game())
end
end
@@ -358,7 +363,7 @@ local function main_button_handler(this, fields, name, tabdata)
configdialog:set_parent(this)
this:hide()
configdialog:show()
- mm_texture.update("singleplayer",current_game())
+ mm_game_theme.update("singleplayer",current_game())
end
end
@@ -371,11 +376,8 @@ if enable_gamebar then
function on_change(type, old_tab, new_tab)
if (type == "ENTER") then
local game = current_game()
-
if game then
- menudata.worldlist:set_filtercriteria(game.id)
- core.set_topleft_text(game.name)
- mm_texture.update("singleplayer",game)
+ apply_game(game)
end
singleplayer_refresh_gamebar()
@@ -387,7 +389,7 @@ if enable_gamebar then
gamebar:hide()
end
core.set_topleft_text("")
- mm_texture.update(new_tab,nil)
+ mm_game_theme.update(new_tab,nil)
end
end
end
diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua
index f06e35872..0e761d324 100644
--- a/builtin/mainmenu/tab_settings.lua
+++ b/builtin/mainmenu/tab_settings.lua
@@ -247,7 +247,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
adv_settings_dlg:set_parent(this)
this:hide()
adv_settings_dlg:show()
- --mm_texture.update("singleplayer", current_game())
+ --mm_game_theme.update("singleplayer", current_game())
return true
end
if fields["cb_smooth_lighting"] then
@@ -275,13 +275,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
return true
end
if fields["cb_shaders"] then
- 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.settings:set("enable_shaders", fields["cb_shaders"])
- end
+ core.settings:set("enable_shaders", fields["cb_shaders"])
return true
end
if fields["cb_tonemapping"] then
@@ -370,11 +364,11 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
core.settings:set("enable_dynamic_shadows", "false")
else
local shadow_presets = {
- [2] = { 80, 512, "true", 0, "false" },
- [3] = { 120, 1024, "true", 1, "false" },
- [4] = { 350, 2048, "true", 1, "false" },
- [5] = { 350, 2048, "true", 2, "true" },
- [6] = { 450, 4096, "true", 2, "true" },
+ [2] = { 55, 512, "true", 0, "false" },
+ [3] = { 82, 1024, "true", 1, "false" },
+ [4] = { 240, 2048, "true", 1, "false" },
+ [5] = { 240, 2048, "true", 2, "true" },
+ [6] = { 300, 4096, "true", 2, "true" },
}
local s = shadow_presets[table.indexof(labels.shadow_levels, fields["dd_shadows"])]
if s then
diff --git a/builtin/mainmenu/tests/serverlistmgr_spec.lua b/builtin/mainmenu/tests/serverlistmgr_spec.lua
index a091959fb..ab7a6c60c 100644
--- a/builtin/mainmenu/tests/serverlistmgr_spec.lua
+++ b/builtin/mainmenu/tests/serverlistmgr_spec.lua
@@ -1,4 +1,5 @@
_G.core = {}
+_G.vector = {metatable = {}}
_G.unpack = table.unpack
_G.serverlistmgr = {}
diff --git a/builtin/profiler/instrumentation.lua b/builtin/profiler/instrumentation.lua
index 6b951a2c2..f80314b32 100644
--- a/builtin/profiler/instrumentation.lua
+++ b/builtin/profiler/instrumentation.lua
@@ -102,8 +102,9 @@ local function instrument(def)
-- also called https://en.wikipedia.org/wiki/Continuation_passing_style
-- Compared to table creation and unpacking it won't lose `nil` returns
-- and is expected to be faster
- -- `measure` will be executed after time() and func(...)
- return measure(modname, instrument_name, time(), func(...))
+ -- `measure` will be executed after func(...)
+ local start = time()
+ return measure(modname, instrument_name, start, func(...))
end
end
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index e023aeab7..2e0bb560a 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -146,17 +146,17 @@ enable_joysticks (Enable joysticks) bool false
joystick_id (Joystick ID) int 0
# The type of joystick
-joystick_type (Joystick type) enum auto auto,generic,xbox
+joystick_type (Joystick type) enum auto auto,generic,xbox,dragonrise_gamecube
# The time in seconds it takes between repeated events
# when holding down a joystick button combination.
repeat_joystick_button_time (Joystick button repetition interval) float 0.17 0.001
-# The deadzone of the joystick
-joystick_deadzone (Joystick deadzone) int 2048
+# The dead zone of the joystick
+joystick_deadzone (Joystick dead zone) int 2048
# The sensitivity of the joystick axes for moving the
-# ingame view frustum around.
+# in-game view frustum around.
joystick_frustum_sensitivity (Joystick frustum sensitivity) float 170
# Key for moving the player forward.
@@ -463,9 +463,9 @@ keymap_decrease_viewing_range_min (View range decrease key) key -
[**Basic]
-# Whether nametag backgrounds should be shown by default.
+# Whether name tag backgrounds should be shown by default.
# Mods may still set a background.
-show_nametag_backgrounds (Show nametag backgrounds by default) bool true
+show_nametag_backgrounds (Show name tag backgrounds by default) bool true
# Enable vertex buffer objects.
# This should greatly improve graphics performance.
@@ -487,6 +487,10 @@ connected_glass (Connect glass) bool false
# Disable for speed or for different looks.
smooth_lighting (Smooth lighting) bool true
+# Enables tradeoffs that reduce CPU load or increase rendering performance
+# at the expense of minor visual glitches that do not impact game playability.
+performance_tradeoffs (Tradeoffs for performance) bool false
+
# Clouds are a client side effect.
enable_clouds (Clouds) bool true
@@ -501,7 +505,7 @@ enable_particles (Digging particles) bool true
[**Filtering]
-# Use mip mapping to scale textures. May slightly increase performance,
+# Use mipmapping to scale textures. May slightly increase performance,
# especially when using a high resolution texture pack.
# Gamma correct downscaling is not supported.
mip_map (Mipmapping) bool false
@@ -600,9 +604,10 @@ enable_waving_plants (Waving plants) bool false
# Requires shaders to be enabled.
enable_dynamic_shadows (Dynamic shadows) bool false
-# Set the shadow strength.
+# Set the shadow strength gamma.
+# Adjusts the intensity of in-game dynamic shadows.
# Lower value means lighter shadows, higher value means darker shadows.
-shadow_strength (Shadow strength) float 0.2 0.05 1.0
+shadow_strength_gamma (Shadow strength gamma) float 1.0 0.1 10.0
# Maximum distance to render shadows.
shadow_map_max_distance (Shadow map max distance in nodes to render shadows) float 120.0 10.0 1000.0
@@ -621,12 +626,12 @@ shadow_map_texture_32bit (Shadow map texture in 32 bits) bool true
# On true uses Poisson disk to make "soft shadows". Otherwise uses PCF filtering.
shadow_poisson_filter (Poisson filtering) bool true
-# Define shadow filtering quality
+# Define shadow filtering quality.
# This simulates the soft shadows effect by applying a PCF or Poisson disk
# but also uses more resources.
shadow_filters (Shadow filter quality) enum 1 0,1,2
-# Enable colored shadows.
+# Enable colored shadows.
# On true translucent nodes cast colored shadows. This is expensive.
shadow_map_color (Colored shadows) bool false
@@ -638,10 +643,10 @@ shadow_update_frames (Map shadows update frames) int 8 1 16
# Set the soft shadow radius size.
# Lower values mean sharper shadows, bigger values mean softer shadows.
-# Minimum value: 1.0; maxiumum value: 10.0
+# Minimum value: 1.0; maximum value: 10.0
shadow_soft_radius (Soft shadow radius) float 1.0 1.0 10.0
-# Set the tilt of Sun/Moon orbit in degrees
+# Set the tilt of Sun/Moon orbit in degrees.
# Value of 0 means no tilt / vertical orbit.
# Minimum value: 0.0; maximum value: 60.0
shadow_sky_body_orbit_tilt (Sky Body Orbit Tilt) float 0.0 0.0 60.0
@@ -801,7 +806,7 @@ desynchronize_mapblock_texture_animation (Desynchronize block animation) bool tr
# Useful if there's something to be displayed right or left of hotbar.
hud_hotbar_max_width (Maximum hotbar width) float 1.0
-# Modifies the size of the hudbar elements.
+# Modifies the size of the HUD elements.
hud_scaling (HUD scale factor) float 1.0
# Enables caching of facedir rotated meshes.
@@ -865,6 +870,10 @@ autoscale_mode (Autoscaling mode) enum disable disable,enable,force
# A restart is required after changing this.
show_entity_selectionbox (Show entity selection boxes) bool false
+# Distance in nodes at which transparency depth sorting is enabled
+# Use this to limit the performance impact of transparency depth sorting
+transparency_sorting_distance (Transparency Sorting Distance) int 16 0 128
+
[*Menus]
# Use a cloud animation for the main menu background.
@@ -894,10 +903,6 @@ tooltip_show_delay (Tooltip delay) int 400
# Append item name to tooltip.
tooltip_append_itemname (Append item name) bool false
-# Whether FreeType fonts are used, requires FreeType support to be compiled in.
-# If disabled, bitmap and XML vectors fonts are used instead.
-freetype (FreeType fonts) bool true
-
font_bold (Font bold by default) bool false
font_italic (Font italic by default) bool false
@@ -908,12 +913,16 @@ font_shadow (Font shadow) int 1
# Opaqueness (alpha) of the shadow behind the default font, between 0 and 255.
font_shadow_alpha (Font shadow alpha) int 127 0 255
-# Font size of the default font in point (pt).
+# Font size of the default font where 1 unit = 1 pixel at 96 DPI
font_size (Font size) int 16 1
-# Path to the default font.
-# If “freetype” setting is enabled: Must be a TrueType font.
-# If “freetype” setting is disabled: Must be a bitmap or XML vectors font.
+# For pixel-style fonts that do not scale well, this ensures that font sizes used
+# with this font will always be divisible by this value, in pixels. For instance,
+# a pixel font 16 pixels tall should have this set to 16, so it will only ever be
+# sized 16, 32, 48, etc., so a mod requesting a size of 25 will get 32.
+font_size_divisible_by (Font size divisible by) int 1 1
+
+# Path to the default font. Must be a TrueType font.
# The fallback font will be used if the font cannot be loaded.
font_path (Regular font path) filepath fonts/Arimo-Regular.ttf
@@ -921,12 +930,16 @@ font_path_bold (Bold font path) filepath fonts/Arimo-Bold.ttf
font_path_italic (Italic font path) filepath fonts/Arimo-Italic.ttf
font_path_bold_italic (Bold and italic font path) filepath fonts/Arimo-BoldItalic.ttf
-# Font size of the monospace font in point (pt).
-mono_font_size (Monospace font size) int 15 1
+# Font size of the monospace font where 1 unit = 1 pixel at 96 DPI
+mono_font_size (Monospace font size) int 16 1
-# Path to the monospace font.
-# If “freetype” setting is enabled: Must be a TrueType font.
-# If “freetype” setting is disabled: Must be a bitmap or XML vectors font.
+# For pixel-style fonts that do not scale well, this ensures that font sizes used
+# with this font will always be divisible by this value, in pixels. For instance,
+# a pixel font 16 pixels tall should have this set to 16, so it will only ever be
+# sized 16, 32, 48, etc., so a mod requesting a size of 25 will get 32.
+mono_font_size_divisible_by (Monospace font size divisible by) int 1 1
+
+# Path to the monospace font. Must be a TrueType font.
# This font is used for e.g. the console and profiler screen.
mono_font_path (Monospace font path) filepath fonts/Cousine-Regular.ttf
@@ -934,9 +947,7 @@ mono_font_path_bold (Bold monospace font path) filepath fonts/Cousine-Bold.ttf
mono_font_path_italic (Italic monospace font path) filepath fonts/Cousine-Italic.ttf
mono_font_path_bold_italic (Bold and italic monospace font path) filepath fonts/Cousine-BoldItalic.ttf
-# Path of the fallback font.
-# If “freetype” setting is enabled: Must be a TrueType font.
-# If “freetype” setting is disabled: Must be a bitmap or XML vectors font.
+# Path of the fallback font. Must be a TrueType font.
# This font will be used for certain languages or if the default font is unavailable.
fallback_font_path (Fallback font path) filepath fonts/DroidSansFallbackFull.ttf
@@ -949,7 +960,7 @@ chat_font_size (Chat font size) int 0
screenshot_path (Screenshot folder) path screenshots
# Format of screenshots.
-screenshot_format (Screenshot format) enum png png,jpg,bmp,pcx,ppm,tga
+screenshot_format (Screenshot format) enum png png,jpg
# Screenshot quality. Only used for JPEG format.
# 1 means worst quality; 100 means best quality.
@@ -961,6 +972,9 @@ screenshot_quality (Screenshot quality) int 0 0 100
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.
screen_dpi (DPI) int 72 1
+# Adjust the detected display density, used for scaling UI elements.
+display_density_factor (Display Density Scaling Factor) float 1
+
# Windows systems only: Start Minetest with the command line window in the background.
# Contains the same information as the file debug.txt (default name).
enable_console (Enable console window) bool false
@@ -985,8 +999,8 @@ mute_sound (Mute sound) bool false
[Client]
-# Clickable weblinks (middle-click or ctrl-left-click) enabled in chat console output.
-clickable_chat_weblinks (Chat weblinks) bool false
+# Clickable weblinks (middle-click or Ctrl+left-click) enabled in chat console output.
+clickable_chat_weblinks (Chat weblinks) bool true
# Optional override for chat weblink color.
chat_weblink_color (Weblink color) string
@@ -1044,6 +1058,12 @@ client_unload_unused_data_timeout (Mapblock unload timeout) int 600
# Set to -1 for unlimited amount.
client_mapblock_limit (Mapblock limit) int 7500
+# Whether to show technical names.
+# Affects mods and texture packs in the Content and Select Mods menus, as well as
+# setting names in All Settings.
+# Controlled by the checkbox in the "All settings" menu.
+show_technical_names (Show technical names) bool false
+
# Whether to show the client debug info (has the same effect as hitting F5).
show_debug (Show debug info) bool false
@@ -1114,7 +1134,7 @@ max_packets_per_iteration (Max. packets per iteration) int 1024
# Compression level to use when sending mapblocks to the client.
# -1 - use default compression level
-# 0 - least compresson, fastest
+# 0 - least compression, fastest
# 9 - best compression, slowest
map_compression_level_net (Map Compression Level for Network Transfer) int -1 -1 9
@@ -1178,7 +1198,7 @@ enable_mod_channels (Mod channels) bool false
# If this is set, players will always (re)spawn at the given position.
static_spawnpoint (Static spawnpoint) string
-# If enabled, new players cannot join with an empty password.
+# If enabled, players cannot join without a password or change theirs to an empty password.
disallow_empty_password (Disallow empty passwords) bool false
# If enabled, disable cheat prevention in multiplayer.
@@ -1300,7 +1320,7 @@ movement_gravity (Gravity) float 9.81
deprecated_lua_api_handling (Deprecated Lua API handling) enum log none,log,error
# Number of extra blocks that can be loaded by /clearobjects at once.
-# This is a trade-off between sqlite transaction overhead and
+# This is a trade-off between SQLite transaction overhead and
# memory consumption (4096=100MB, as a rule of thumb).
max_clearobjects_extra_loaded_blocks (Max. clearobjects extra blocks) int 4096
@@ -1309,14 +1329,14 @@ max_clearobjects_extra_loaded_blocks (Max. clearobjects extra blocks) int 4096
server_unload_unused_data_timeout (Unload unused server data) int 29
# Maximum number of statically stored objects in a block.
-max_objects_per_block (Maximum objects per block) int 64
+max_objects_per_block (Maximum objects per block) int 256
# See https://www.sqlite.org/pragma.html#pragma_synchronous
sqlite_synchronous (Synchronous SQLite) enum 2 0,1,2
# Compression level to use when saving mapblocks to disk.
# -1 - use default compression level
-# 0 - least compresson, fastest
+# 0 - least compression, fastest
# 9 - best compression, slowest
map_compression_level_disk (Map Compression Level for Disk Storage) int -1 -1 9
@@ -1423,8 +1443,8 @@ instrument.abm (Active Block Modifiers) bool true
# Instrument the action function of Loading Block Modifiers on registration.
instrument.lbm (Loading Block Modifiers) bool true
-# Instrument chatcommands on registration.
-instrument.chatcommand (Chatcommands) bool true
+# Instrument chat commands on registration.
+instrument.chatcommand (Chat commands) bool true
# Instrument global callback functions on registration.
# (anything you pass to a minetest.register_*() function)
@@ -1460,7 +1480,8 @@ language (Language) enum ,be,bg,ca,cs,da,de,el,en,eo,es,et,eu,fi,fr,gd,gl,hu,i
# - action
# - info
# - verbose
-debug_log_level (Debug log level) enum action ,none,error,warning,action,info,verbose
+# - trace
+debug_log_level (Debug log level) enum action ,none,error,warning,action,info,verbose,trace
# If the file size of debug.txt exceeds the number of megabytes specified in
# this setting when it is opened, the file is moved to debug.txt.1,
@@ -1469,7 +1490,7 @@ debug_log_level (Debug log level) enum action ,none,error,warning,action,info,ve
debug_log_size_max (Debug log file size threshold) int 50
# Minimal level of logging to be written to chat.
-chat_log_level (Chat log level) enum error ,none,error,warning,action,info,verbose
+chat_log_level (Chat log level) enum error ,none,error,warning,action,info,verbose,trace
# Enable IPv6 support (for both client and server).
# Required for IPv6 connections to work at all.
@@ -1514,11 +1535,11 @@ max_block_generate_distance (Max block generate distance) int 10
# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0).
# Only mapchunks completely within the mapgen limit are generated.
# Value is stored per-world.
-mapgen_limit (Map generation limit) int 31000 0 31000
+mapgen_limit (Map generation limit) int 31007 0 31007
# Global map generation attributes.
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
-# and junglegrass, in all other mapgens this flag controls all decorations.
+# and jungle grass, in all other mapgens this flag controls all decorations.
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes,ores caves,dungeons,light,decorations,biomes,ores,nocaves,nodungeons,nolight,nodecorations,nobiomes,noores
[*Biome API temperature and humidity noise parameters]
@@ -2270,7 +2291,7 @@ contentdb_max_concurrent_downloads (ContentDB Max Concurrent Downloads) int 3
[Cheat Menu]
# Font to use for cheat menu
-cheat_menu_font (MenuFont) enum FM_Mono FM_Standard,FM_Mono,FM_Fallback,FM_Simple,FM_SimpleMono,FM_MaxMode,FM_Unspecified
+cheat_menu_font (MenuFont) enum FM_Mono FM_Standard,FM_Mono,FM_Fallback,FM_MaxMode,FM_Unspecified
# (RGB value)
cheat_menu_bg_color (Cell background color) v3f 255, 145, 88