aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/client/chatcommands.lua8
-rw-r--r--builtin/common/after.lua20
-rw-r--r--builtin/common/filterlist.lua1
-rw-r--r--builtin/common/information_formspecs.lua152
-rw-r--r--builtin/common/misc_helpers.lua31
-rw-r--r--builtin/common/serialize.lua1
-rw-r--r--builtin/common/vector.lua19
-rw-r--r--builtin/fstk/ui.lua69
-rw-r--r--builtin/game/chat.lua (renamed from builtin/game/chatcommands.lua)94
-rw-r--r--builtin/game/falling.lua23
-rw-r--r--builtin/game/features.lua3
-rw-r--r--builtin/game/forceloading.lua35
-rw-r--r--builtin/game/init.lua42
-rw-r--r--builtin/game/item.lua15
-rw-r--r--builtin/game/item_entity.lua91
-rw-r--r--builtin/game/knockback.lua46
-rw-r--r--builtin/game/misc.lua2
-rw-r--r--builtin/game/privileges.lua2
-rw-r--r--builtin/game/register.lua39
-rw-r--r--builtin/game/statbars.lua29
-rw-r--r--builtin/mainmenu/common.lua5
-rw-r--r--builtin/mainmenu/dlg_config_world.lua47
-rw-r--r--builtin/mainmenu/dlg_contentstore.lua30
-rw-r--r--builtin/mainmenu/dlg_create_world.lua13
-rw-r--r--builtin/mainmenu/dlg_delete_content.lua1
-rw-r--r--builtin/mainmenu/dlg_delete_world.lua1
-rw-r--r--builtin/mainmenu/dlg_settings_advanced.lua94
-rw-r--r--builtin/mainmenu/pkgmgr.lua119
-rw-r--r--builtin/mainmenu/tab_content.lua21
-rw-r--r--builtin/mainmenu/tab_local.lua4
-rw-r--r--builtin/mainmenu/tab_online.lua6
-rw-r--r--builtin/mainmenu/tab_settings.lua6
-rw-r--r--builtin/mainmenu/tab_simple_main.lua8
-rw-r--r--builtin/mainmenu/textures.lua40
-rw-r--r--builtin/profiler/instrumentation.lua3
-rw-r--r--builtin/settingtypes.txt146
36 files changed, 929 insertions, 337 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua
index 201ca4a9b..5cb1b40bb 100644
--- a/builtin/client/chatcommands.lua
+++ b/builtin/client/chatcommands.lua
@@ -16,7 +16,7 @@ core.register_on_sending_chat_message(function(message)
end
local cmd, param = string.match(message, "^%.([^ ]+) *(.*)")
- param = param or ""
+ param = param or ""
if not cmd then
core.display_chat_message(core.gettext("-!- Empty command"))
@@ -26,9 +26,9 @@ core.register_on_sending_chat_message(function(message)
local cmd_def = core.registered_chatcommands[cmd]
if cmd_def then
core.set_last_run_mod(cmd_def.mod_origin)
- local _, message = cmd_def.func(param)
- if message then
- core.display_chat_message(message)
+ local _, result = cmd_def.func(param)
+ if result then
+ core.display_chat_message(result)
end
else
core.display_chat_message(core.gettext("-!- Invalid command: ") .. cmd)
diff --git a/builtin/common/after.lua b/builtin/common/after.lua
index cdfaaab86..b314711c9 100644
--- a/builtin/common/after.lua
+++ b/builtin/common/after.lua
@@ -1,33 +1,41 @@
local jobs = {}
local time = 0.0
+local time_next = math.huge
core.register_globalstep(function(dtime)
time = time + dtime
- if #jobs < 1 then
+ if time < time_next then
return
end
+ time_next = math.huge
+
-- Iterate backwards so that we miss any new timers added by
- -- a timer callback, and so that we don't skip the next timer
- -- in the list if we remove one.
+ -- a timer callback.
for i = #jobs, 1, -1 do
local job = jobs[i]
if time >= job.expire then
core.set_last_run_mod(job.mod_origin)
job.func(unpack(job.arg))
- table.remove(jobs, i)
+ local jobs_l = #jobs
+ jobs[i] = jobs[jobs_l]
+ jobs[jobs_l] = nil
+ elseif job.expire < time_next then
+ time_next = job.expire
end
end
end)
function core.after(after, func, ...)
assert(tonumber(after) and type(func) == "function",
- "Invalid core.after invocation")
+ "Invalid minetest.after invocation")
+ local expire = time + after
jobs[#jobs + 1] = {
func = func,
- expire = time + after,
+ expire = expire,
arg = {...},
mod_origin = core.get_last_run_mod()
}
+ time_next = math.min(time_next, expire)
end
diff --git a/builtin/common/filterlist.lua b/builtin/common/filterlist.lua
index 1ba1d8741..e30379f2f 100644
--- a/builtin/common/filterlist.lua
+++ b/builtin/common/filterlist.lua
@@ -250,7 +250,6 @@ end
--------------------------------------------------------------------------------
function compare_worlds(world1,world2)
-
if world1.path ~= world2.path then
return false
end
diff --git a/builtin/common/information_formspecs.lua b/builtin/common/information_formspecs.lua
new file mode 100644
index 000000000..b977e2656
--- /dev/null
+++ b/builtin/common/information_formspecs.lua
@@ -0,0 +1,152 @@
+local COLOR_BLUE = "#7AF"
+local COLOR_GREEN = "#7F7"
+local COLOR_GRAY = "#BBB"
+
+local LIST_FORMSPEC = [[
+ size[13,6.5]
+ label[0,-0.1;%s]
+ tablecolumns[color;tree;text;text]
+ table[0,0.5;12.8,5.5;list;%s;0]
+ button_exit[5,6;3,1;quit;%s]
+ ]]
+
+local LIST_FORMSPEC_DESCRIPTION = [[
+ size[13,7.5]
+ label[0,-0.1;%s]
+ tablecolumns[color;tree;text;text]
+ table[0,0.5;12.8,4.8;list;%s;%i]
+ box[0,5.5;12.8,1.5;#000]
+ textarea[0.3,5.5;13.05,1.9;;;%s]
+ button_exit[5,7;3,1;quit;%s]
+ ]]
+
+local formspec_escape = core.formspec_escape
+local check_player_privs = core.check_player_privs
+
+
+-- CHAT COMMANDS FORMSPEC
+
+local mod_cmds = {}
+
+local function load_mod_command_tree()
+ mod_cmds = {}
+
+ for name, def in pairs(core.registered_chatcommands) do
+ mod_cmds[def.mod_origin] = mod_cmds[def.mod_origin] or {}
+ local cmds = mod_cmds[def.mod_origin]
+
+ -- Could be simplified, but avoid the priv checks whenever possible
+ cmds[#cmds + 1] = { name, def }
+ end
+ local sorted_mod_cmds = {}
+ for modname, cmds in pairs(mod_cmds) do
+ table.sort(cmds, function(a, b) return a[1] < b[1] end)
+ sorted_mod_cmds[#sorted_mod_cmds + 1] = { modname, cmds }
+ end
+ table.sort(sorted_mod_cmds, function(a, b) return a[1] < b[1] end)
+ mod_cmds = sorted_mod_cmds
+end
+
+core.after(0, load_mod_command_tree)
+
+local function build_chatcommands_formspec(name, sel, copy)
+ local rows = {}
+ rows[1] = "#FFF,0,Command,Parameters"
+
+ local description = "For more information, click on any entry in the list.\n" ..
+ "Double-click to copy the entry to the chat history."
+
+ for i, data in ipairs(mod_cmds) do
+ rows[#rows + 1] = COLOR_BLUE .. ",0," .. formspec_escape(data[1]) .. ","
+ for j, cmds in ipairs(data[2]) do
+ local has_priv = check_player_privs(name, cmds[2].privs)
+ rows[#rows + 1] = ("%s,1,%s,%s"):format(
+ has_priv and COLOR_GREEN or COLOR_GRAY,
+ cmds[1], formspec_escape(cmds[2].params))
+ if sel == #rows then
+ description = cmds[2].description
+ if copy then
+ core.chat_send_player(name, ("Command: %s %s"):format(
+ core.colorize("#0FF", "/" .. cmds[1]), cmds[2].params))
+ end
+ end
+ end
+ end
+
+ return LIST_FORMSPEC_DESCRIPTION:format(
+ "Available commands: (see also: /help <cmd>)",
+ table.concat(rows, ","), sel or 0,
+ description, "Close"
+ )
+end
+
+
+-- PRIVILEGES FORMSPEC
+
+local function build_privs_formspec(name)
+ local privs = {}
+ for priv_name, def in pairs(core.registered_privileges) do
+ privs[#privs + 1] = { priv_name, def }
+ end
+ table.sort(privs, function(a, b) return a[1] < b[1] end)
+
+ local rows = {}
+ rows[1] = "#FFF,0,Privilege,Description"
+
+ local player_privs = core.get_player_privs(name)
+ for i, data in ipairs(privs) do
+ rows[#rows + 1] = ("%s,0,%s,%s"):format(
+ player_privs[data[1]] and COLOR_GREEN or COLOR_GRAY,
+ data[1], formspec_escape(data[2].description))
+ end
+
+ return LIST_FORMSPEC:format(
+ "Available privileges:",
+ table.concat(rows, ","),
+ "Close"
+ )
+end
+
+
+-- DETAILED CHAT COMMAND INFORMATION
+
+core.register_on_player_receive_fields(function(player, formname, fields)
+ if formname ~= "__builtin:help_cmds" or fields.quit then
+ return
+ end
+
+ local event = minetest.explode_table_event(fields.list)
+ if event.type ~= "INV" then
+ local name = player:get_player_name()
+ core.show_formspec(name, "__builtin:help_cmds",
+ build_chatcommands_formspec(name, event.row, event.type == "DCL"))
+ 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
+ end
+ end
+ if param == "" or param == "all" then
+ core.show_formspec(name, "__builtin:help_cmds",
+ build_chatcommands_formspec(name))
+ if name ~= admin then
+ return
+ end
+ end
+
+ return old_help_func(name, param)
+end
+
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index e250b0ed1..d6673a691 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -128,6 +128,7 @@ function dump(o, indent, nested, level)
if t ~= "table" then
return basic_dump(o)
end
+
-- Contains table -> true/nil of currently nested tables
nested = nested or {}
if nested[o] then
@@ -136,10 +137,11 @@ function dump(o, indent, nested, level)
nested[o] = true
indent = indent or "\t"
level = level or 1
- local t = {}
+
+ local ret = {}
local dumped_indexes = {}
for i, v in ipairs(o) do
- t[#t + 1] = dump(v, indent, nested, level + 1)
+ ret[#ret + 1] = dump(v, indent, nested, level + 1)
dumped_indexes[i] = true
end
for k, v in pairs(o) do
@@ -148,7 +150,7 @@ function dump(o, indent, nested, level)
k = "["..dump(k, indent, nested, level + 1).."]"
end
v = dump(v, indent, nested, level + 1)
- t[#t + 1] = k.." = "..v
+ ret[#ret + 1] = k.." = "..v
end
end
nested[o] = nil
@@ -157,10 +159,10 @@ function dump(o, indent, nested, level)
local end_indent_str = "\n"..string.rep(indent, level - 1)
return string.format("{%s%s%s}",
indent_str,
- table.concat(t, ","..indent_str),
+ table.concat(ret, ","..indent_str),
end_indent_str)
end
- return "{"..table.concat(t, ", ").."}"
+ return "{"..table.concat(ret, ", ").."}"
end
--------------------------------------------------------------------------------
@@ -244,6 +246,20 @@ function math.sign(x, tolerance)
end
--------------------------------------------------------------------------------
+function math.factorial(x)
+ assert(x % 1 == 0 and x >= 0, "factorial expects a non-negative integer")
+ if x >= 171 then
+ -- 171! is greater than the biggest double, no need to calculate
+ return math.huge
+ end
+ local v = 1
+ for k = 2, x do
+ v = v * k
+ end
+ return v
+end
+
+--------------------------------------------------------------------------------
function get_last_folder(text,count)
local parts = text:split(DIR_DELIM)
@@ -393,9 +409,8 @@ if INIT == "game" then
end
local old_itemstack = ItemStack(itemstack)
- local new_itemstack, removed = core.item_place_node(
- itemstack, placer, pointed_thing, param2, prevent_after_place
- )
+ local new_itemstack = core.item_place_node(itemstack, placer,
+ pointed_thing, param2, prevent_after_place)
return infinitestacks and old_itemstack or new_itemstack
end
diff --git a/builtin/common/serialize.lua b/builtin/common/serialize.lua
index 692ddd5f0..c91d2d5ce 100644
--- a/builtin/common/serialize.lua
+++ b/builtin/common/serialize.lua
@@ -218,4 +218,3 @@ test_in = {escape_chars="\n\r\t\v\\\"\'", non_european="θשׁ٩∂"}
test_out = core.deserialize(core.serialize(test_in))
assert(test_in.escape_chars == test_out.escape_chars)
assert(test_in.non_european == test_out.non_european)
-
diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua
index c3d380ed3..ca6541eb4 100644
--- a/builtin/common/vector.lua
+++ b/builtin/common/vector.lua
@@ -70,6 +70,25 @@ function vector.direction(pos1, pos2)
})
end
+function vector.angle(a, b)
+ local dotp = vector.dot(a, b)
+ local cp = vector.cross(a, b)
+ local crossplen = vector.length(cp)
+ return math.atan2(crossplen, dotp)
+end
+
+function vector.dot(a, b)
+ return a.x * b.x + a.y * b.y + a.z * b.z
+end
+
+function vector.cross(a, b)
+ return {
+ x = a.y * b.z - a.z * b.y,
+ y = a.z * b.x - a.x * b.z,
+ z = a.x * b.y - a.y * b.x
+ }
+end
+
function vector.add(a, b)
if type(b) == "table" then
return {x = a.x + b.x,
diff --git a/builtin/fstk/ui.lua b/builtin/fstk/ui.lua
index a3e3a092a..884100543 100644
--- a/builtin/fstk/ui.lua
+++ b/builtin/fstk/ui.lua
@@ -54,52 +54,39 @@ end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-local function wordwrap_quickhack(str)
- local res = ""
- local ar = str:split("\n")
- for i = 1, #ar do
- local text = ar[i]
- -- Hack to add word wrapping.
- -- TODO: Add engine support for wrapping in formspecs
- while #text > 80 do
- if res ~= "" then
- res = res .. ","
- end
- res = res .. core.formspec_escape(string.sub(text, 1, 79))
- text = string.sub(text, 80, #text)
- end
- if res ~= "" then
- res = res .. ","
- end
- res = res .. core.formspec_escape(text)
- end
- return res
-end
-
---------------------------------------------------------------------------------
function ui.update()
- local formspec = ""
+ local formspec = {}
-- handle errors
if gamedata ~= nil and gamedata.reconnect_requested then
- formspec = wordwrap_quickhack(gamedata.errormessage or "")
- formspec = "size[12,5]" ..
- "label[0.5,0;" .. fgettext("The server has requested a reconnect:") ..
- "]textlist[0.2,0.8;11.5,3.5;;" .. formspec ..
- "]button[6,4.6;3,0.5;btn_reconnect_no;" .. fgettext("Main menu") .. "]" ..
- "button[3,4.6;3,0.5;btn_reconnect_yes;" .. fgettext("Reconnect") .. "]"
+ local error_message = core.formspec_escape(
+ gamedata.errormessage or "<none available>")
+ formspec = {
+ "size[14,8]",
+ "real_coordinates[true]",
+ "box[0.5,1.2;13,5;#000]",
+ ("textarea[0.5,1.2;13,5;;%s;%s]"):format(
+ fgettext("The server has requested a reconnect:"), error_message),
+ "button[2,6.6;4,1;btn_reconnect_yes;" .. fgettext("Reconnect") .. "]",
+ "button[8,6.6;4,1;btn_reconnect_no;" .. fgettext("Main menu") .. "]"
+ }
elseif gamedata ~= nil and gamedata.errormessage ~= nil then
- formspec = wordwrap_quickhack(gamedata.errormessage)
+ local error_message = core.formspec_escape(gamedata.errormessage)
+
local error_title
if string.find(gamedata.errormessage, "ModError") then
- error_title = fgettext("An error occurred in a Lua script, such as a mod:")
+ error_title = fgettext("An error occurred in a Lua script:")
else
error_title = fgettext("An error occurred:")
end
- formspec = "size[12,5]" ..
- "label[0.5,0;" .. error_title ..
- "]textlist[0.2,0.8;11.5,3.5;;" .. formspec ..
- "]button[4.5,4.6;3,0.5;btn_error_confirm;" .. fgettext("Ok") .. "]"
+ formspec = {
+ "size[14,8]",
+ "real_coordinates[true]",
+ "box[0.5,1.2;13,5;#000]",
+ ("textarea[0.5,1.2;13,5;;%s;%s]"):format(
+ error_title, error_message),
+ "button[5,6.6;4,1;btn_error_confirm;" .. fgettext("Ok") .. "]"
+ }
else
local active_toplevel_ui_elements = 0
for key,value in pairs(ui.childlist) do
@@ -107,8 +94,8 @@ function ui.update()
local retval = value:get_formspec()
if retval ~= nil and retval ~= "" then
- active_toplevel_ui_elements = active_toplevel_ui_elements +1
- formspec = formspec .. retval
+ active_toplevel_ui_elements = active_toplevel_ui_elements + 1
+ table.insert(formspec, retval)
end
end
end
@@ -120,7 +107,7 @@ function ui.update()
local retval = value:get_formspec()
if retval ~= nil and retval ~= "" then
- formspec = formspec .. retval
+ table.insert(formspec, retval)
end
end
end
@@ -135,10 +122,10 @@ function ui.update()
core.log("warning", "no toplevel ui element "..
"active; switching to default")
ui.childlist[ui.default]:show()
- formspec = ui.childlist[ui.default]:get_formspec()
+ formspec = {ui.childlist[ui.default]:get_formspec()}
end
end
- core.update_formspec(formspec)
+ core.update_formspec(table.concat(formspec))
end
--------------------------------------------------------------------------------
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chat.lua
index 60d5d4788..ad703b94c 100644
--- a/builtin/game/chatcommands.lua
+++ b/builtin/game/chat.lua
@@ -1,4 +1,29 @@
--- Minetest: builtin/game/chatcommands.lua
+-- Minetest: builtin/game/chat.lua
+
+--
+-- Chat message formatter
+--
+
+-- Implemented in Lua to allow redefinition
+function core.format_chat_message(name, message)
+ local str = core.settings:get("chat_message_format")
+ local error_str = "Invalid chat message format - missing %s"
+ local i
+
+ str, i = str:gsub("@name", name, 1)
+ if i == 0 then
+ error(error_str:format("@name"), 2)
+ end
+
+ str, i = str:gsub("@message", message, 1)
+ if i == 0 then
+ error(error_str:format("@message"), 2)
+ end
+
+ str = str:gsub("@timestamp", os.date("%H:%M:%S", os.time()), 1)
+
+ return str
+end
--
-- Chat command handler
@@ -27,9 +52,9 @@ core.register_on_chat_message(function(name, message)
local has_privs, missing_privs = core.check_player_privs(name, cmd_def.privs)
if has_privs then
core.set_last_run_mod(cmd_def.mod_origin)
- local success, message = cmd_def.func(name, param)
- if message then
- core.chat_send_player(name, message)
+ local _, result = cmd_def.func(name, param)
+ if result then
+ core.chat_send_player(name, result)
end
else
core.chat_send_player(name, "You don't have permission"
@@ -125,10 +150,10 @@ core.register_chatcommand("haspriv", {
if core.check_player_privs(player_name, privs) then
table.insert(players_with_priv, player_name)
end
- end
+ end
return true, "Players online with the \"" .. param .. "\" privilege: " ..
table.concat(players_with_priv, ", ")
- end
+ end
})
local function handle_grant_command(caller, grantname, grantprivstr)
@@ -161,6 +186,7 @@ local function handle_grant_command(caller, grantname, grantprivstr)
return false, privs_unknown
end
for priv, _ in pairs(grantprivs) do
+ -- call the on_grant callbacks
core.run_priv_callbacks(grantname, priv, caller, "grant")
end
core.set_player_privs(grantname, privs)
@@ -233,6 +259,7 @@ core.register_chatcommand("revoke", {
end
for priv, _ in pairs(revoke_privs) do
+ -- call the on_revoke callbacks
core.run_priv_callbacks(revoke_name, priv, name, "revoke")
end
@@ -261,11 +288,12 @@ core.register_chatcommand("setpassword", {
toname = param:match("^([^ ]+) *$")
raw_password = nil
end
+
if not toname then
return false, "Name field required"
end
- local act_str_past = "?"
- local act_str_pres = "?"
+
+ local act_str_past, act_str_pres
if not raw_password then
core.set_player_password(toname, "")
act_str_past = "cleared"
@@ -277,13 +305,14 @@ core.register_chatcommand("setpassword", {
act_str_past = "set"
act_str_pres = "sets"
end
+
if toname ~= name then
core.chat_send_player(toname, "Your password was "
.. act_str_past .. " by " .. name)
end
- core.log("action", name .. " " .. act_str_pres
- .. " password of " .. toname .. ".")
+ core.log("action", name .. " " .. act_str_pres ..
+ " password of " .. toname .. ".")
return true, "Password of player \"" .. toname .. "\" " .. act_str_past
end,
@@ -367,35 +396,35 @@ core.register_chatcommand("teleport", {
return pos, false
end
- local teleportee = nil
local p = {}
p.x, p.y, p.z = string.match(param, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
p.x = tonumber(p.x)
p.y = tonumber(p.y)
p.z = tonumber(p.z)
if p.x and p.y and p.z then
+
local lm = 31000
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, "Cannot teleport out of map bounds!"
end
- teleportee = core.get_player_by_name(name)
+ local teleportee = core.get_player_by_name(name)
if teleportee then
teleportee:set_pos(p)
return true, "Teleporting to "..core.pos_to_string(p)
end
end
- local teleportee = nil
- local p = nil
- local target_name = nil
- target_name = param:match("^([^ ]+)$")
- teleportee = core.get_player_by_name(name)
+ local target_name = param:match("^([^ ]+)$")
+ local teleportee = core.get_player_by_name(name)
+
+ p = nil
if target_name then
local target = core.get_player_by_name(target_name)
if target then
p = target:get_pos()
end
end
+
if teleportee and p then
p = find_free_position_near(p)
teleportee:set_pos(p)
@@ -407,9 +436,9 @@ core.register_chatcommand("teleport", {
return false, "You don't have permission to teleport other players (missing bring privilege)"
end
- local teleportee = nil
- local p = {}
- local teleportee_name = nil
+ teleportee = nil
+ p = {}
+ local teleportee_name
teleportee_name, p.x, p.y, p.z = param:match(
"^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
p.x, p.y, p.z = tonumber(p.x), tonumber(p.y), tonumber(p.z)
@@ -422,10 +451,8 @@ core.register_chatcommand("teleport", {
.. " to " .. core.pos_to_string(p)
end
- local teleportee = nil
- local p = nil
- local teleportee_name = nil
- local target_name = nil
+ teleportee = nil
+ p = nil
teleportee_name, target_name = string.match(param, "^([^ ]+) +([^ ]+)$")
if teleportee_name then
teleportee = core.get_player_by_name(teleportee_name)
@@ -459,7 +486,8 @@ core.register_chatcommand("set", {
core.settings:set(setname, setvalue)
return true, setname .. " = " .. setvalue
end
- local setname, setvalue = string.match(param, "([^ ]+) (.+)")
+
+ setname, setvalue = string.match(param, "([^ ]+) (.+)")
if setname and setvalue then
if not core.settings:get(setname) then
return false, "Failed. Use '/set -n <name> <value>' to create a new setting."
@@ -467,14 +495,16 @@ core.register_chatcommand("set", {
core.settings:set(setname, setvalue)
return true, setname .. " = " .. setvalue
end
- local setname = string.match(param, "([^ ]+)")
+
+ setname = string.match(param, "([^ ]+)")
if setname then
- local setvalue = core.settings:get(setname)
+ setvalue = core.settings:get(setname)
if not setvalue then
setvalue = "<not set>"
end
return true, setname .. " = " .. setvalue
end
+
return false, "Invalid parameters (see /help set)."
end,
})
@@ -692,7 +722,7 @@ core.register_chatcommand("pulverize", {
end
core.log("action", name .. " pulverized \"" ..
wielded_item:get_name() .. " " .. wielded_item:get_count() .. "\"")
- player:set_wielded_item(nil)
+ player:set_wielded_item(nil)
return true, "An item was pulverized."
end,
})
@@ -771,7 +801,7 @@ core.register_chatcommand("rollback", {
end
local target_name, seconds = string.match(param, ":([^ ]+) *(%d*)")
if not target_name then
- local player_name = nil
+ local player_name
player_name, seconds = string.match(param, "([^ ]+) *(%d*)")
if not player_name then
return false, "Invalid parameters. See /help rollback"
@@ -962,7 +992,7 @@ core.register_chatcommand("clearobjects", {
core.register_chatcommand("msg", {
params = "<name> <message>",
- description = "Send a private message",
+ description = "Send a direct message to a player",
privs = {shout=true},
func = function(name, param)
local sendto, message = param:match("^(%S+)%s(.+)$")
@@ -973,9 +1003,9 @@ core.register_chatcommand("msg", {
return false, "The player " .. sendto
.. " is not online."
end
- core.log("action", "PM from " .. name .. " to " .. sendto
+ core.log("action", "DM from " .. name .. " to " .. sendto
.. ": " .. message)
- core.chat_send_player(sendto, "PM from " .. name .. ": "
+ core.chat_send_player(sendto, "DM from " .. name .. ": "
.. message)
return true, "Message sent."
end,
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index 62b6973a7..950d6b56f 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -22,7 +22,18 @@ core.register_entity(":__builtin:falling_node", {
set_node = function(self, node, meta)
self.node = node
- self.meta = meta or {}
+ meta = meta or {}
+ if type(meta.to_table) == "function" then
+ meta = meta:to_table()
+ end
+ for _, list in pairs(meta.inventory or {}) do
+ for i, stack in pairs(list) do
+ if type(stack) == "userdata" then
+ list[i] = stack:to_string()
+ end
+ end
+ end
+ self.meta = meta
self.object:set_properties({
is_visible = true,
textures = {node.name},
@@ -116,7 +127,7 @@ core.register_entity(":__builtin:falling_node", {
local meta = core.get_meta(np)
meta:from_table(self.meta)
end
- if def.sounds and def.sounds.place and def.sounds.place.name then
+ if def.sounds and def.sounds.place then
core.sound_play(def.sounds.place, {pos = np})
end
end
@@ -141,6 +152,11 @@ local function convert_to_falling_node(pos, node)
local meta = core.get_meta(pos)
local metatable = meta and meta:to_table() or {}
+ local def = core.registered_nodes[node.name]
+ if def and def.sounds and def.sounds.fall then
+ core.sound_play(def.sounds.fall, {pos = pos})
+ end
+
obj:get_luaentity():set_node(node, metatable)
core.remove_node(pos)
return true
@@ -170,6 +186,9 @@ local function drop_attached_node(p)
drops = drop_stacks
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
end
+ if def and def.sounds and def.sounds.fall then
+ core.sound_play(def.sounds.fall, {pos = p})
+ end
core.remove_node(p)
for _, item in pairs(drops) do
local pos = {
diff --git a/builtin/game/features.lua b/builtin/game/features.lua
index 8e5104867..0af0dc1da 100644
--- a/builtin/game/features.lua
+++ b/builtin/game/features.lua
@@ -12,6 +12,9 @@ core.features = {
no_chat_message_prediction = true,
object_use_texture_alpha = true,
object_independent_selectionbox = true,
+ httpfetch_binary_data = true,
+ formspec_version_element = true,
+ area_store_persistent_ids = true,
}
function core.has_feature(arg)
diff --git a/builtin/game/forceloading.lua b/builtin/game/forceloading.lua
index 7c5537e85..e1e00920c 100644
--- a/builtin/game/forceloading.lua
+++ b/builtin/game/forceloading.lua
@@ -8,6 +8,9 @@ local blocks_forceloaded
local blocks_temploaded = {}
local total_forceloaded = 0
+-- true, if the forceloaded blocks got changed (flag for persistence on-disk)
+local forceload_blocks_changed = false
+
local BLOCKSIZE = core.MAP_BLOCKSIZE
local function get_blockpos(pos)
return {
@@ -31,6 +34,9 @@ local function get_relevant_tables(transient)
end
function core.forceload_block(pos, transient)
+ -- set changed flag
+ forceload_blocks_changed = true
+
local blockpos = get_blockpos(pos)
local hash = core.hash_node_position(blockpos)
local relevant_table, other_table = get_relevant_tables(transient)
@@ -51,6 +57,9 @@ function core.forceload_block(pos, transient)
end
function core.forceload_free_block(pos, transient)
+ -- set changed flag
+ forceload_blocks_changed = true
+
local blockpos = get_blockpos(pos)
local hash = core.hash_node_position(blockpos)
local relevant_table, other_table = get_relevant_tables(transient)
@@ -95,6 +104,28 @@ core.after(5, function()
end
end)
-core.register_on_shutdown(function()
+-- persists the currently forceloaded blocks to disk
+local function persist_forceloaded_blocks()
write_file(wpath.."/force_loaded.txt", blocks_forceloaded)
-end)
+end
+
+-- periodical forceload persistence
+local function periodically_persist_forceloaded_blocks()
+
+ -- only persist if the blocks actually changed
+ if forceload_blocks_changed then
+ persist_forceloaded_blocks()
+
+ -- reset changed flag
+ forceload_blocks_changed = false
+ end
+
+ -- recheck after some time
+ core.after(10, periodically_persist_forceloaded_blocks)
+end
+
+-- persist periodically
+core.after(5, periodically_persist_forceloaded_blocks)
+
+-- persist on shutdown
+core.register_on_shutdown(persist_forceloaded_blocks)
diff --git a/builtin/game/init.lua b/builtin/game/init.lua
index ab1503dee..1d62be019 100644
--- a/builtin/game/init.lua
+++ b/builtin/game/init.lua
@@ -1,36 +1,38 @@
local scriptpath = core.get_builtin_path()
-local commonpath = scriptpath.."common"..DIR_DELIM
-local gamepath = scriptpath.."game"..DIR_DELIM
+local commonpath = scriptpath .. "common" .. DIR_DELIM
+local gamepath = scriptpath .. "game".. DIR_DELIM
-- Shared between builtin files, but
-- not exposed to outer context
local builtin_shared = {}
-dofile(commonpath.."vector.lua")
+dofile(commonpath .. "vector.lua")
-dofile(gamepath.."constants.lua")
-assert(loadfile(gamepath.."item.lua"))(builtin_shared)
-dofile(gamepath.."register.lua")
+dofile(gamepath .. "constants.lua")
+assert(loadfile(gamepath .. "item.lua"))(builtin_shared)
+dofile(gamepath .. "register.lua")
if core.settings:get_bool("profiler.load") then
- profiler = dofile(scriptpath.."profiler"..DIR_DELIM.."init.lua")
+ profiler = dofile(scriptpath .. "profiler" .. DIR_DELIM .. "init.lua")
end
dofile(commonpath .. "after.lua")
-dofile(gamepath.."item_entity.lua")
-dofile(gamepath.."deprecated.lua")
-dofile(gamepath.."misc.lua")
-dofile(gamepath.."privileges.lua")
-dofile(gamepath.."auth.lua")
+dofile(gamepath .. "item_entity.lua")
+dofile(gamepath .. "deprecated.lua")
+dofile(gamepath .. "misc.lua")
+dofile(gamepath .. "privileges.lua")
+dofile(gamepath .. "auth.lua")
dofile(commonpath .. "chatcommands.lua")
-dofile(gamepath.."chatcommands.lua")
-dofile(gamepath.."static_spawn.lua")
-dofile(gamepath.."detached_inventory.lua")
-assert(loadfile(gamepath.."falling.lua"))(builtin_shared)
-dofile(gamepath.."features.lua")
-dofile(gamepath.."voxelarea.lua")
-dofile(gamepath.."forceloading.lua")
-dofile(gamepath.."statbars.lua")
+dofile(gamepath .. "chat.lua")
+dofile(commonpath .. "information_formspecs.lua")
+dofile(gamepath .. "static_spawn.lua")
+dofile(gamepath .. "detached_inventory.lua")
+assert(loadfile(gamepath .. "falling.lua"))(builtin_shared)
+dofile(gamepath .. "features.lua")
+dofile(gamepath .. "voxelarea.lua")
+dofile(gamepath .. "forceloading.lua")
+dofile(gamepath .. "statbars.lua")
+dofile(gamepath .. "knockback.lua")
profiler = nil
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index ced28771e..8041d557e 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -206,7 +206,6 @@ function core.get_node_drops(node, toolname)
-- Extended drop table
local got_items = {}
local got_count = 0
- local _, item, tool
for _, item in ipairs(drop.items) do
local good_rarity = true
local good_tool = true
@@ -251,11 +250,6 @@ local function user_name(user)
return user and user:get_player_name() or ""
end
-local function is_protected(pos, name)
- return core.is_protected(pos, name) and
- not minetest.check_player_privs(name, "protection_bypass")
-end
-
-- Returns a logging function. For empty names, does not log.
local function make_log(name)
return name ~= "" and core.log or function() end
@@ -302,7 +296,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
place_to = {x = under.x, y = under.y, z = under.z}
end
- if is_protected(place_to, playername) then
+ if core.is_protected(place_to, playername) then
log("action", playername
.. " tried to place " .. def.name
.. " at protected position "
@@ -552,7 +546,7 @@ function core.node_dig(pos, node, digger)
return
end
- if is_protected(pos, diggername) then
+ if core.is_protected(pos, diggername) then
log("action", diggername
.. " tried to dig " .. node.name
.. " at protected position "
@@ -619,15 +613,10 @@ function core.node_dig(pos, node, digger)
end
-- Run script hook
- local _, callback
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)
- --print("Running " .. tostring(callback) ..
- -- " (a " .. origin.name .. " callback in " .. origin.mod .. ")")
- else
- --print("No data associated with callback")
end
-- Copy pos and node because callback can modify them
diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua
index a330e8723..87fec93ea 100644
--- a/builtin/game/item_entity.lua
+++ b/builtin/game/item_entity.lua
@@ -35,7 +35,12 @@ core.register_entity(":__builtin:item", {
itemstring = "",
moving_state = true,
slippery_state = false,
+ physical_state = true,
+ -- Item expiry
age = 0,
+ -- Pushing item out of solid nodes
+ force_out = nil,
+ force_out_start = nil,
set_item = function(self, item)
local stack = ItemStack(item or self.itemstring)
@@ -131,6 +136,24 @@ core.register_entity(":__builtin:item", {
return true
end,
+ enable_physics = function(self)
+ if not self.physical_state then
+ self.physical_state = true
+ self.object:set_properties({physical = true})
+ self.object:set_velocity({x=0, y=0, z=0})
+ self.object:set_acceleration({x=0, y=-gravity, z=0})
+ end
+ end,
+
+ disable_physics = function(self)
+ if self.physical_state then
+ self.physical_state = false
+ self.object:set_properties({physical = false})
+ self.object:set_velocity({x=0, y=0, z=0})
+ self.object:set_acceleration({x=0, y=0, z=0})
+ end
+ end,
+
on_step = function(self, dtime)
self.age = self.age + dtime
if time_to_live > 0 and self.age > time_to_live then
@@ -152,6 +175,74 @@ core.register_entity(":__builtin:item", {
return
end
+ local is_stuck = false
+ local snode = core.get_node_or_nil(pos)
+ if snode then
+ local sdef = core.registered_nodes[snode.name] or {}
+ is_stuck = (sdef.walkable == nil or sdef.walkable == true)
+ and (sdef.collision_box == nil or sdef.collision_box.type == "regular")
+ and (sdef.node_box == nil or sdef.node_box.type == "regular")
+ end
+
+ -- Push item out when stuck inside solid node
+ if is_stuck then
+ local shootdir
+ local order = {
+ {x=1, y=0, z=0}, {x=-1, y=0, z= 0},
+ {x=0, y=0, z=1}, {x= 0, y=0, z=-1},
+ }
+
+ -- Check which one of the 4 sides is free
+ for o = 1, #order do
+ local cnode = core.get_node(vector.add(pos, order[o])).name
+ local cdef = core.registered_nodes[cnode] or {}
+ if cnode ~= "ignore" and cdef.walkable == false then
+ shootdir = order[o]
+ break
+ end
+ end
+ -- If none of the 4 sides is free, check upwards
+ if not shootdir then
+ shootdir = {x=0, y=1, z=0}
+ local cnode = core.get_node(vector.add(pos, shootdir)).name
+ if cnode == "ignore" then
+ shootdir = nil -- Do not push into ignore
+ end
+ end
+
+ if shootdir then
+ -- Set new item moving speed accordingly
+ local newv = vector.multiply(shootdir, 3)
+ self:disable_physics()
+ self.object:set_velocity(newv)
+
+ self.force_out = newv
+ self.force_out_start = vector.round(pos)
+ return
+ end
+ elseif self.force_out then
+ -- This code runs after the entity got a push from the above code.
+ -- It makes sure the entity is entirely outside the solid node
+ local c = self.object:get_properties().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
+ (f.y > 0 and pos.y + c[2] > s.y + 0.5) or
+ (f.z > 0 and pos.z + c[3] > s.z + 0.5) or
+ (f.x < 0 and pos.x + c[4] < s.x - 0.5) or
+ (f.z < 0 and pos.z + c[6] < s.z - 0.5)
+ if ok then
+ -- Item was successfully forced out
+ self.force_out = nil
+ self:enable_physics()
+ end
+ end
+
+ if not self.physical_state then
+ return -- Don't do anything
+ end
+
+ -- Slide on slippery nodes
local vel = self.object:get_velocity()
local def = node and core.registered_nodes[node.name]
local is_moving = (def and not def.walkable) or
diff --git a/builtin/game/knockback.lua b/builtin/game/knockback.lua
new file mode 100644
index 000000000..b5c4cbc5a
--- /dev/null
+++ b/builtin/game/knockback.lua
@@ -0,0 +1,46 @@
+-- can be overriden by mods
+function core.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
+ if damage == 0 or player:get_armor_groups().immortal then
+ return 0.0
+ end
+
+ local m = 8
+ -- solve m - m*e^(k*4) = 4 for k
+ local k = -0.17328
+ local res = m - m * math.exp(k * damage)
+
+ if distance < 2.0 then
+ res = res * 1.1 -- more knockback when closer
+ elseif distance > 4.0 then
+ res = res * 0.9 -- less when far away
+ end
+ return res
+end
+
+local function vector_absmax(v)
+ local max, abs = math.max, math.abs
+ return max(max(abs(v.x), abs(v.y)), abs(v.z))
+end
+
+core.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, unused_dir, damage)
+ if player:get_hp() == 0 then
+ return -- RIP
+ end
+
+ -- Server::handleCommand_Interact() adds eye offset to one but not the other
+ -- so the direction is slightly off, calculate it ourselves
+ local dir = vector.subtract(player:get_pos(), hitter:get_pos())
+ local d = vector.length(dir)
+ if d ~= 0.0 then
+ dir = vector.divide(dir, d)
+ end
+
+ local k = core.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, d, damage)
+
+ local kdir = vector.multiply(dir, k)
+ if vector_absmax(kdir) < 1.0 then
+ return -- barely noticeable, so don't even send
+ end
+
+ player:add_player_velocity(kdir)
+end)
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua
index e6d16dde7..02c36ccb1 100644
--- a/builtin/game/misc.lua
+++ b/builtin/game/misc.lua
@@ -62,7 +62,7 @@ end
core.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
player_list[player_name] = player
- if not minetest.is_singleplayer() then
+ if not core.is_singleplayer() then
local status = core.get_server_status(player_name, true)
if status and status ~= "" then
core.chat_send_player(player_name, status)
diff --git a/builtin/game/privileges.lua b/builtin/game/privileges.lua
index d77a481ac..c7417d2f4 100644
--- a/builtin/game/privileges.lua
+++ b/builtin/game/privileges.lua
@@ -18,7 +18,7 @@ function core.register_privilege(name, param)
def.description = "(no description)"
end
end
- local def = {}
+ local def
if type(param) == "table" then
def = param
else
diff --git a/builtin/game/register.lua b/builtin/game/register.lua
index 3edab0471..bfad6845c 100644
--- a/builtin/game/register.lua
+++ b/builtin/game/register.lua
@@ -79,6 +79,7 @@ end
function core.register_abm(spec)
-- Add to core.registered_abms
+ assert(type(spec.action) == "function", "Required field 'action' of type function")
core.registered_abms[#core.registered_abms + 1] = spec
spec.mod_origin = core.get_current_modname() or "??"
end
@@ -86,6 +87,7 @@ end
function core.register_lbm(spec)
-- Add to core.registered_lbms
check_modname_prefix(spec.name)
+ assert(type(spec.action) == "function", "Required field 'action' of type function")
core.registered_lbms[#core.registered_lbms + 1] = spec
spec.mod_origin = core.get_current_modname() or "??"
end
@@ -254,6 +256,18 @@ function core.register_tool(name, tooldef)
end
-- END Legacy stuff
+ -- This isn't just legacy, but more of a convenience feature
+ local toolcaps = tooldef.tool_capabilities
+ if toolcaps and toolcaps.punch_attack_uses == nil then
+ for _, cap in pairs(toolcaps.groupcaps or {}) do
+ local level = (cap.maxlevel or 0) - 1
+ if (cap.uses or 0) ~= 0 and level >= 0 then
+ toolcaps.punch_attack_uses = cap.uses * (3 ^ level)
+ break
+ end
+ end
+ end
+
core.register_item(name, tooldef)
end
@@ -301,7 +315,6 @@ end
-- Alias the forbidden item names to "" so they can't be
-- created via itemstrings (e.g. /give)
-local name
for name in pairs(forbidden_item_names) do
core.registered_aliases[name] = ""
register_alias_raw(name, "")
@@ -361,9 +374,9 @@ core.register_node(":ignore", {
drop = "",
groups = {not_in_creative_inventory=1},
on_place = function(itemstack, placer, pointed_thing)
- minetest.chat_send_player(
+ core.chat_send_player(
placer:get_player_name(),
- minetest.colorize("#FF0000",
+ core.colorize("#FF0000",
"You can't place 'ignore' nodes!"))
return ""
end,
@@ -372,6 +385,7 @@ core.register_node(":ignore", {
-- The hand (bare definition)
core.register_item(":", {
type = "none",
+ wield_image = "wieldhand.png",
groups = {not_in_creative_inventory=1},
})
@@ -411,10 +425,6 @@ function core.run_callbacks(callbacks, mode, ...)
local origin = core.callback_origins[callbacks[i]]
if origin then
core.set_last_run_mod(origin.mod)
- --print("Running " .. tostring(callbacks[i]) ..
- -- " (a " .. origin.name .. " callback in " .. origin.mod .. ")")
- else
- --print("No data associated with callback")
end
local cb_ret = callbacks[i](...)
@@ -514,11 +524,17 @@ local function make_registration_wrap(reg_fn_name, clear_fn_name)
end
local function make_wrap_deregistration(reg_fn, clear_fn, list)
- local unregister = function (unregistered_key)
+ local unregister = function (key)
+ if type(key) ~= "string" then
+ error("key is not a string", 2)
+ end
+ if not list[key] then
+ error("Attempt to unregister non-existent element - '" .. key .. "'", 2)
+ end
local temporary_list = table.copy(list)
clear_fn()
for k,v in pairs(temporary_list) do
- if unregistered_key ~= k then
+ if key ~= k then
reg_fn(v)
end
end
@@ -529,7 +545,7 @@ end
core.registered_on_player_hpchanges = { modifiers = { }, loggers = { } }
function core.registered_on_player_hpchange(player, hp_change, reason)
- local last = false
+ local last
for i = #core.registered_on_player_hpchanges.modifiers, 1, -1 do
local func = core.registered_on_player_hpchanges.modifiers[i]
hp_change, last = func(player, hp_change, reason)
@@ -564,7 +580,8 @@ core.registered_biomes = make_registration_wrap("register_biome", "cle
core.registered_ores = make_registration_wrap("register_ore", "clear_registered_ores")
core.registered_decorations = make_registration_wrap("register_decoration", "clear_registered_decorations")
-core.unregister_biome = make_wrap_deregistration(core.register_biome, core.clear_registered_biomes, core.registered_biomes)
+core.unregister_biome = make_wrap_deregistration(core.register_biome,
+ core.clear_registered_biomes, core.registered_biomes)
core.registered_on_chat_messages, core.register_on_chat_message = make_registration()
core.registered_globalsteps, core.register_globalstep = make_registration()
diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua
index da924d6f8..46c947b60 100644
--- a/builtin/game/statbars.lua
+++ b/builtin/game/statbars.lua
@@ -1,8 +1,7 @@
-- cache setting
local enable_damage = core.settings:get_bool("enable_damage")
-local health_bar_definition =
-{
+local health_bar_definition = {
hud_elem_type = "statbar",
position = { x=0.5, y=1 },
text = "heart.png",
@@ -12,8 +11,7 @@ local health_bar_definition =
offset = { x=(-10*24)-25, y=-(48+24+16)},
}
-local breath_bar_definition =
-{
+local breath_bar_definition = {
hud_elem_type = "statbar",
position = { x=0.5, y=1 },
text = "bubble.png",
@@ -30,8 +28,8 @@ local function scaleToDefault(player, field)
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
+ math.max(player:get_properties()[field .. "_max"], current))
+ return current / max_display * nominal
end
local function update_builtin_statbars(player)
@@ -50,10 +48,11 @@ local function update_builtin_statbars(player)
end
local hud = hud_ids[name]
- if flags.healthbar and enable_damage then
+ local immortal = player:get_armor_groups().immortal == 1
+ if flags.healthbar and enable_damage and not immortal then
local number = scaleToDefault(player, "hp")
- if hud.id_healthbar == nil then
- local hud_def = table.copy(health_bar_definition)
+ if hud.id_healthbar == nil then
+ local hud_def = table.copy(health_bar_definition)
hud_def.number = number
hud.id_healthbar = player:hud_add(hud_def)
else
@@ -65,11 +64,11 @@ local function update_builtin_statbars(player)
end
local breath_max = player:get_properties().breath_max
- if flags.breathbar and enable_damage and
+ if flags.breathbar and enable_damage and not immortal and
player:get_breath() < breath_max then
local number = 2 * scaleToDefault(player, "breath")
if hud.id_breathbar == nil then
- local hud_def = table.copy(breath_bar_definition)
+ local hud_def = table.copy(breath_bar_definition)
hud_def.number = number
hud.id_breathbar = player:hud_add(hud_def)
else
@@ -116,7 +115,7 @@ local function player_event_handler(player,eventname)
end
end
- if eventname == "hud_changed" then
+ if eventname == "hud_changed" or eventname == "properties_changed" then
update_builtin_statbars(player)
return true
end
@@ -124,14 +123,14 @@ local function player_event_handler(player,eventname)
return false
end
-function core.hud_replace_builtin(name, definition)
+function core.hud_replace_builtin(hud_name, definition)
if type(definition) ~= "table" or
definition.hud_elem_type ~= "statbar" then
return false
end
- if name == "health" then
+ if hud_name == "health" then
health_bar_definition = definition
for name, ids in pairs(hud_ids) do
@@ -145,7 +144,7 @@ function core.hud_replace_builtin(name, definition)
return true
end
- if name == "breath" then
+ if hud_name == "breath" then
breath_bar_definition = definition
for name, ids in pairs(hud_ids) do
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index cc61fe0ad..782d6973f 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -93,9 +93,9 @@ function render_serverlist_row(spec, is_favorite)
end
end
- local details = ""
local grey_out = not is_server_protocol_compat(spec.proto_min, spec.proto_max)
+ local details
if is_favorite then
details = "1,"
else
@@ -118,11 +118,11 @@ function render_serverlist_row(spec, is_favorite)
end
if spec.clients and spec.clients_max then
- local clients_color = ''
local clients_percent = 100 * spec.clients / spec.clients_max
-- Choose a color depending on how many clients are connected
-- (relatively to clients_max)
+ local clients_color
if grey_out then clients_color = '#aaaaaa'
elseif spec.clients == 0 then clients_color = '' -- 0 players: default/white
elseif clients_percent <= 60 then clients_color = '#a1e587' -- 0-60%: green
@@ -171,6 +171,7 @@ os.tempfolder = function()
local filetocheck = os.tmpname()
os.remove(filetocheck)
+ -- luacheck: ignore
-- https://blogs.msdn.microsoft.com/vcblog/2014/06/18/c-runtime-crt-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1/
-- The C runtime (CRT) function called by os.tmpname is tmpnam.
-- Microsofts tmpnam implementation in older CRT / MSVC releases is defective.
diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua
index daa8099c4..97218df9c 100644
--- a/builtin/mainmenu/dlg_config_world.lua
+++ b/builtin/mainmenu/dlg_config_world.lua
@@ -31,8 +31,6 @@ local function get_formspec(data)
"label[0.5,0;" .. fgettext("World:") .. "]" ..
"label[1.75,0;" .. data.worldspec.name .. "]"
- local hard_deps, soft_deps = pkgmgr.get_dependencies(mod.path)
-
if mod.is_modpack or mod.type == "game" then
local info = minetest.formspec_escape(
core.get_content_info(mod.path).description)
@@ -46,15 +44,46 @@ local function get_formspec(data)
retval = retval ..
"textarea[0.25,0.7;5.75,7.2;;" .. info .. ";]"
else
+ local hard_deps, soft_deps = pkgmgr.get_dependencies(mod.path)
+ local hard_deps_str = table.concat(hard_deps, ",")
+ local soft_deps_str = table.concat(soft_deps, ",")
+
retval = retval ..
"label[0,0.7;" .. fgettext("Mod:") .. "]" ..
- "label[0.75,0.7;" .. mod.name .. "]" ..
- "label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
- "textlist[0,1.75;5,2.125;world_config_depends;" .. hard_deps ..
- ";0]" ..
- "label[0,3.875;" .. fgettext("Optional dependencies:") .. "]" ..
- "textlist[0,4.375;5,1.8;world_config_optdepends;" ..
- soft_deps .. ";0]"
+ "label[0.75,0.7;" .. mod.name .. "]"
+
+ if hard_deps_str == "" then
+ if soft_deps_str == "" then
+ retval = retval ..
+ "label[0,1.25;" ..
+ fgettext("No (optional) dependencies") .. "]"
+ else
+ retval = retval ..
+ "label[0,1.25;" .. fgettext("No hard dependencies") ..
+ "]" ..
+ "label[0,1.75;" .. fgettext("Optional dependencies:") ..
+ "]" ..
+ "textlist[0,2.25;5,4;world_config_optdepends;" ..
+ soft_deps_str .. ";0]"
+ end
+ else
+ if soft_deps_str == "" then
+ retval = retval ..
+ "label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
+ "textlist[0,1.75;5,4;world_config_depends;" ..
+ hard_deps_str .. ";0]" ..
+ "label[0,6;" .. fgettext("No optional dependencies") .. "]"
+ else
+ retval = retval ..
+ "label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
+ "textlist[0,1.75;5,2.125;world_config_depends;" ..
+ hard_deps_str .. ";0]" ..
+ "label[0,3.9;" .. fgettext("Optional dependencies:") ..
+ "]" ..
+ "textlist[0,4.375;5,1.8;world_config_optdepends;" ..
+ soft_deps_str .. ";0]"
+ end
+ end
end
retval = retval ..
"button[3.25,7;2.5,0.5;btn_config_world_save;" ..
diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua
index 384bee36c..3bc5f60bb 100644
--- a/builtin/mainmenu/dlg_contentstore.lua
+++ b/builtin/mainmenu/dlg_contentstore.lua
@@ -96,19 +96,16 @@ local function start_install(calling_dialog, package)
if conf_path then
local conf = Settings(conf_path)
- local function set_def(key, value)
- if conf:get(key) == nil then
- conf:set(key, value)
- end
- end
if name_is_title then
- set_def("name", result.package.title)
+ conf:set("name", result.package.title)
else
- set_def("title", result.package.title)
- set_def("name", result.package.name)
+ conf:set("title", result.package.title)
+ conf:set("name", result.package.name)
+ end
+ if not conf:get("description") then
+ conf:set("description", result.package.short_description)
end
- set_def("description", result.package.short_description)
- set_def("author", result.package.author)
+ conf:set("author", result.package.author)
conf:set("release", result.package.release)
conf:write()
end
@@ -273,7 +270,6 @@ function store.load()
assert(core.create_dir(tmpdir))
local base_url = core.settings:get("contentdb_url")
- local show_nonfree = core.settings:get_bool("show_nonfree_packages")
local url = base_url ..
"/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
core.get_max_supp_proto()
@@ -299,9 +295,9 @@ function store.load()
local name_len = #package.name
if package.type == "game" and name_len > 5 and package.name:sub(name_len - 4) == "_game" then
- package.id = package.author .. "/" .. package.name:sub(1, name_len - 5)
+ package.id = package.author:lower() .. "/" .. package.name:sub(1, name_len - 5)
else
- package.id = package.author .. "/" .. package.name
+ package.id = package.author:lower() .. "/" .. package.name
end
end
@@ -317,22 +313,22 @@ function store.update_paths()
pkgmgr.refresh_globals()
for _, mod in pairs(pkgmgr.global_mods:get_list()) do
if mod.author then
- mod_hash[mod.author .. "/" .. mod.name] = mod
+ mod_hash[mod.author:lower() .. "/" .. mod.name] = mod
end
end
local game_hash = {}
pkgmgr.update_gamelist()
for _, game in pairs(pkgmgr.games) do
- if game.author then
- game_hash[game.author .. "/" .. game.id] = game
+ if game.author ~= "" then
+ game_hash[game.author:lower() .. "/" .. game.id] = game
end
end
local txp_hash = {}
for _, txp in pairs(pkgmgr.get_texture_packs()) do
if txp.author then
- txp_hash[txp.author .. "/" .. txp.name] = txp
+ txp_hash[txp.author:lower() .. "/" .. txp.name] = txp
end
end
diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua
index c701f094e..31d41d693 100644
--- a/builtin/mainmenu/dlg_create_world.lua
+++ b/builtin/mainmenu/dlg_create_world.lua
@@ -24,10 +24,11 @@ local function create_world_formspec(dialogdata)
local current_mg = core.settings:get("mg_name")
local gameid = core.settings:get("menu_last_game")
- local game, gameidx = nil , 0
+ local gameidx = 0
if gameid ~= nil then
- game, gameidx = pkgmgr.find_by_gameid(gameid)
-
+ local _
+ _, gameidx = pkgmgr.find_by_gameid(gameid)
+
if gameidx == nil then
gameidx = 0
end
@@ -82,7 +83,7 @@ local function create_world_formspec(dialogdata)
"button[3.25,6;2.5,0.5;world_create_confirm;" .. fgettext("Create") .. "]" ..
"button[5.75,6;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
-
+
if #pkgmgr.games == 0 then
retval = retval .. "box[2,4;8,1;#ff8800]label[2.25,4;" ..
fgettext("You have no games installed.") .. "]label[2.25,4.4;" ..
@@ -111,10 +112,10 @@ local function create_world_buttonhandler(this, fields)
local random_world_name = "Unnamed" .. random_number
worldname = random_world_name
end
- local message = nil
core.settings:set("fixed_map_seed", fields["te_seed"])
+ local message
if not menudata.worldlist:uid_exists_raw(worldname) then
core.settings:set("mg_name",fields["dd_mapgen"])
message = core.create_world(worldname,gameindex)
@@ -165,6 +166,6 @@ function create_create_world_dlg(update_worldlistfilter)
create_world_buttonhandler,
nil)
retval.update_worldlist_filter = update_worldlistfilter
-
+
return retval
end
diff --git a/builtin/mainmenu/dlg_delete_content.lua b/builtin/mainmenu/dlg_delete_content.lua
index 9d89316a0..a24171541 100644
--- a/builtin/mainmenu/dlg_delete_content.lua
+++ b/builtin/mainmenu/dlg_delete_content.lua
@@ -22,6 +22,7 @@ local function delete_content_formspec(dialogdata)
"size[11.5,4.5,true]" ..
"label[2,2;" ..
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.content.name) .. "]"..
+ "style[dlg_delete_content_confirm;bgcolor=red]" ..
"button[3.25,3.5;2.5,0.5;dlg_delete_content_confirm;" .. fgettext("Delete") .. "]" ..
"button[5.75,3.5;2.5,0.5;dlg_delete_content_cancel;" .. fgettext("Cancel") .. "]"
diff --git a/builtin/mainmenu/dlg_delete_world.lua b/builtin/mainmenu/dlg_delete_world.lua
index df1091033..33e7bc945 100644
--- a/builtin/mainmenu/dlg_delete_world.lua
+++ b/builtin/mainmenu/dlg_delete_world.lua
@@ -21,6 +21,7 @@ local function delete_world_formspec(dialogdata)
"size[10,2.5,true]" ..
"label[0.5,0.5;" ..
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" ..
+ "style[world_delete_confirm;bgcolor=red]" ..
"button[0.5,1.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
"button[7.0,1.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
return retval
diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua
index bff36d8cb..24b71d957 100644
--- a/builtin/mainmenu/dlg_settings_advanced.lua
+++ b/builtin/mainmenu/dlg_settings_advanced.lua
@@ -148,9 +148,9 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
local values = {}
local ti = 1
local index = 1
- for line in default:gmatch("[+-]?[%d.-e]+") do -- All numeric characters
- index = default:find("[+-]?[%d.-e]+", index) + line:len()
- table.insert(values, line)
+ for match in default:gmatch("[+-]?[%d.-e]+") do -- All numeric characters
+ index = default:find("[+-]?[%d.-e]+", index) + match:len()
+ table.insert(values, match)
ti = ti + 1
if ti > 9 then
break
@@ -322,17 +322,20 @@ end
-- read_all: whether to ignore certain setting types for GUI or not
-- parse_mods: whether to parse settingtypes.txt in mods and games
local function parse_config_file(read_all, parse_mods)
- local builtin_path = core.get_builtin_path() .. FILENAME
- local file = io.open(builtin_path, "r")
local settings = {}
- if not file then
- core.log("error", "Can't load " .. FILENAME)
- return settings
- end
- parse_single_file(file, builtin_path, read_all, settings, 0, true)
+ do
+ local builtin_path = core.get_builtin_path() .. FILENAME
+ local file = io.open(builtin_path, "r")
+ if not file then
+ core.log("error", "Can't load " .. FILENAME)
+ return settings
+ end
+
+ parse_single_file(file, builtin_path, read_all, settings, 0, true)
- file:close()
+ file:close()
+ end
if parse_mods then
-- Parse games
@@ -344,7 +347,7 @@ local function parse_config_file(read_all, parse_mods)
local file = io.open(path, "r")
if file then
if not games_category_initialized then
- local translation = fgettext_ne("Games"), -- not used, but needed for xgettext
+ fgettext_ne("Games") -- not used, but needed for xgettext
table.insert(settings, {
name = "Games",
level = 0,
@@ -377,7 +380,7 @@ local function parse_config_file(read_all, parse_mods)
local file = io.open(path, "r")
if file then
if not mods_category_initialized then
- local translation = fgettext_ne("Mods"), -- not used, but needed for xgettext
+ fgettext_ne("Mods") -- not used, but needed for xgettext
table.insert(settings, {
name = "Mods",
level = 0,
@@ -667,34 +670,42 @@ local function create_change_setting_formspec(dialogdata)
height = height + 1.1
elseif setting.type == "flags" then
- local enabled_flags = flags_to_table(get_current_value(setting))
+ local current_flags = flags_to_table(get_current_value(setting))
local flags = {}
- for _, name in ipairs(enabled_flags) do
+ for _, name in ipairs(current_flags) do
-- Index by name, to avoid iterating over all enabled_flags for every possible flag.
- flags[name] = true
+ if name:sub(1, 2) == "no" then
+ flags[name:sub(3)] = false
+ else
+ flags[name] = true
+ end
end
- local flags_count = #setting.possible
- local max_height = flags_count / 4
+ local flags_count = #setting.possible / 2
+ local max_height = math.ceil(flags_count / 2) / 2
-- More space for flags
description_height = description_height - 1
height = height - 1
local fields = {} -- To build formspec
- for i, name in ipairs(setting.possible) do
- local x = 0.5
- local y = height + i / 2 - 0.75
- if i - 1 >= flags_count / 2 then -- 2nd column
- x = 5
- y = y - max_height
+ local j = 1
+ for _, name in ipairs(setting.possible) do
+ if name:sub(1, 2) ~= "no" then
+ local x = 0.5
+ local y = height + j / 2 - 0.75
+ if j - 1 >= flags_count / 2 then -- 2nd column
+ x = 5
+ y = y - max_height
+ end
+ j = j + 1;
+ local checkbox_name = "cb_" .. name
+ local is_enabled = flags[name] == true -- to get false if nil
+ checkboxes[checkbox_name] = is_enabled
+
+ fields[#fields + 1] = ("checkbox[%f,%f;%s;%s;%s]"):format(
+ x, y, checkbox_name, name, tostring(is_enabled)
+ )
end
- local checkbox_name = "cb_" .. name
- local is_enabled = flags[name] == true -- to get false if nil
- checkboxes[checkbox_name] = is_enabled
-
- fields[#fields + 1] = ("checkbox[%f,%f;%s;%s;%s]"):format(
- x, y, checkbox_name, name, tostring(is_enabled)
- )
end
formspec = table.concat(fields)
height = height + max_height + 0.25
@@ -753,7 +764,7 @@ local function create_change_setting_formspec(dialogdata)
" (" .. setting.name .. ")"
end
- local comment_text = ""
+ local comment_text
if setting.comment == "" then
comment_text = fgettext_ne("(No description of setting given)")
else
@@ -830,8 +841,12 @@ local function handle_change_setting_buttons(this, fields)
elseif setting.type == "flags" then
local values = {}
for _, name in ipairs(setting.possible) do
- if checkboxes["cb_" .. name] then
- table.insert(values, name)
+ if name:sub(1, 2) ~= "no" then
+ if checkboxes["cb_" .. name] then
+ table.insert(values, name)
+ else
+ table.insert(values, "no" .. name)
+ end
end
end
@@ -918,7 +933,7 @@ local function handle_change_setting_buttons(this, fields)
return false
end
-local function create_settings_formspec(tabview, name, tabdata)
+local function create_settings_formspec(tabview, _, tabdata)
local formspec = "size[12,5.4;true]" ..
"tablecolumns[color;tree;text,width=28;text]" ..
"tableoptions[background=#00000000;border=false]" ..
@@ -950,7 +965,7 @@ local function create_settings_formspec(tabview, name, tabdata)
formspec = formspec .. "," .. (current_level + 1) .. "," .. core.formspec_escape(name) .. ","
.. value .. ","
- elseif entry.type == "key" then
+ elseif entry.type == "key" then --luacheck: ignore
-- ignore key settings, since we have a special dialog for them
elseif entry.type == "noise_params_2d" or entry.type == "noise_params_3d" then
@@ -1029,8 +1044,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
if fields["btn_edit"] or list_enter then
local setting = settings[selected_setting]
if setting and setting.type ~= "category" then
- local edit_dialog = dialog_create("change_setting", create_change_setting_formspec,
- handle_change_setting_buttons)
+ local edit_dialog = dialog_create("change_setting",
+ create_change_setting_formspec, handle_change_setting_buttons)
edit_dialog:set_parent(this)
this:hide()
edit_dialog:show()
@@ -1076,4 +1091,5 @@ end
-- For RUN_IN_PLACE the generated files may appear in the 'bin' folder.
-- See comment and alternative line at the end of 'generate_from_settingtypes.lua'.
---assert(loadfile(core.get_builtin_path().."mainmenu"..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
+--assert(loadfile(core.get_builtin_path().."mainmenu"..DIR_DELIM..
+-- "generate_from_settingtypes.lua"))(parse_config_file(true, false))
diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua
index 60a496093..f87367689 100644
--- a/builtin/mainmenu/pkgmgr.lua
+++ b/builtin/mainmenu/pkgmgr.lua
@@ -285,17 +285,14 @@ function pkgmgr.identify_modname(modpath,filename)
end
--------------------------------------------------------------------------------
function pkgmgr.render_packagelist(render_list)
- local retval = ""
-
- if render_list == nil then
- if pkgmgr.global_mods == nil then
+ if not render_list then
+ if not pkgmgr.global_mods then
pkgmgr.refresh_globals()
end
render_list = pkgmgr.global_mods
end
local list = render_list:get_list()
- local last_modpack = nil
local retval = {}
for i, v in ipairs(list) do
local color = ""
@@ -332,11 +329,11 @@ end
--------------------------------------------------------------------------------
function pkgmgr.get_dependencies(path)
if path == nil then
- return "", ""
+ return {}, {}
end
local info = core.get_content_info(path)
- return table.concat(info.depends or {}, ","), table.concat(info.optional_depends or {}, ",")
+ return info.depends or {}, info.optional_depends or {}
end
----------- tests whether all of the mods in the modpack are enabled -----------
@@ -350,35 +347,113 @@ function pkgmgr.is_modpack_entirely_enabled(data, name)
return true
end
----------- toggles or en/disables a mod or modpack -----------------------------
+---------- toggles or en/disables a mod or modpack and its dependencies --------
function pkgmgr.enable_mod(this, toset)
- local mod = this.data.list:get_list()[this.data.selected_mod]
+ local list = this.data.list:get_list()
+ local mod = list[this.data.selected_mod]
- -- game mods can't be enabled or disabled
+ -- Game mods can't be enabled or disabled
if mod.is_game_content then
return
end
- -- toggle or en/disable the mod
+ local toggled_mods = {}
+
+ local enabled_mods = {}
if not mod.is_modpack then
+ -- Toggle or en/disable the mod
if toset == nil then
- mod.enabled = not mod.enabled
- else
+ toset = not mod.enabled
+ end
+ if mod.enabled ~= toset then
mod.enabled = toset
+ toggled_mods[#toggled_mods+1] = mod.name
+ end
+ if toset then
+ -- Mark this mod for recursive dependency traversal
+ enabled_mods[mod.name] = true
+ end
+ else
+ -- Toggle or en/disable every mod in the modpack,
+ -- interleaved unsupported
+ for i = 1, #list do
+ if list[i].modpack == mod.name then
+ if toset == nil then
+ toset = not list[i].enabled
+ end
+ if list[i].enabled ~= toset then
+ list[i].enabled = toset
+ toggled_mods[#toggled_mods+1] = list[i].name
+ end
+ if toset then
+ enabled_mods[list[i].name] = true
+ end
+ end
end
+ end
+ if not toset then
+ -- Mod(s) were disabled, so no dependencies need to be enabled
+ table.sort(toggled_mods)
+ minetest.log("info", "Following mods were disabled: " ..
+ table.concat(toggled_mods, ", "))
return
end
- -- toggle or en/disable every mod in the modpack, interleaved unsupported
- local list = this.data.list:get_raw_list()
- for i = 1, #list do
- if list[i].modpack == mod.name then
- if toset == nil then
- toset = not list[i].enabled
+ -- Enable mods' depends after activation
+
+ -- Make a list of mod ids indexed by their names
+ local mod_ids = {}
+ for id, mod in pairs(list) do
+ if mod.type == "mod" and not mod.is_modpack then
+ mod_ids[mod.name] = id
+ end
+ end
+
+ -- to_enable is used as a DFS stack with sp as stack pointer
+ local to_enable = {}
+ local sp = 0
+ for name in pairs(enabled_mods) do
+ local depends = pkgmgr.get_dependencies(list[mod_ids[name]].path)
+ for i = 1, #depends do
+ local dependency_name = depends[i]
+ if not enabled_mods[dependency_name] then
+ sp = sp+1
+ to_enable[sp] = dependency_name
+ end
+ end
+ end
+ -- If sp is 0, every dependency is already activated
+ while sp > 0 do
+ local name = to_enable[sp]
+ sp = sp-1
+
+ if not enabled_mods[name] then
+ enabled_mods[name] = true
+ local mod = list[mod_ids[name]]
+ if not mod then
+ minetest.log("warning", "Mod dependency \"" .. name ..
+ "\" not found!")
+ else
+ if mod.enabled == false then
+ mod.enabled = true
+ toggled_mods[#toggled_mods+1] = mod.name
+ end
+ -- Push the dependencies of the dependency onto the stack
+ local depends = pkgmgr.get_dependencies(mod.path)
+ for i = 1, #depends do
+ if not enabled_mods[name] then
+ sp = sp+1
+ to_enable[sp] = depends[i]
+ end
+ end
end
- list[i].enabled = toset
end
end
+
+ -- Log the list of enabled mods
+ table.sort(toggled_mods)
+ minetest.log("info", "Following mods were enabled: " ..
+ table.concat(toggled_mods, ", "))
end
--------------------------------------------------------------------------------
@@ -465,7 +540,7 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
else
return nil,
fgettext("Install Mod: Unable to find suitable folder name for modpack $1",
- modfilename)
+ path)
end
end
elseif basefolder.type == "mod" then
@@ -490,7 +565,7 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
if targetfolder ~= nil and pkgmgr.isValidModname(targetfolder) then
targetpath = core.get_modpath() .. DIR_DELIM .. targetfolder
else
- return nil, fgettext("Install Mod: Unable to find real mod name for: $1", modfilename)
+ return nil, fgettext("Install Mod: Unable to find real mod name for: $1", path)
end
end
diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua
index d8e2c9753..336730bf4 100644
--- a/builtin/mainmenu/tab_content.lua
+++ b/builtin/mainmenu/tab_content.lua
@@ -134,9 +134,13 @@ local function get_formspec(tabview, name, tabdata)
end
retval = retval .. "textarea[5.85,2.2;6.35,2.9;;" ..
- fgettext("Information:") .. ";" .. desc .. "]" ..
- "button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;" ..
- fgettext("Uninstall Package") .. "]"
+ fgettext("Information:") .. ";" .. desc .. "]"
+
+ if core.may_modify_path(selected_pkg.path) then
+ retval = retval ..
+ "button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;" ..
+ fgettext("Uninstall Package") .. "]"
+ end
end
return retval
end
@@ -149,11 +153,6 @@ local function handle_buttons(tabview, fields, tabname, tabdata)
return true
end
- if fields["btn_mod_mgr_install_local"] ~= nil then
- core.show_file_open_dialog("mod_mgt_open_dlg", fgettext("Select Package File:"))
- return true
- end
-
if fields["btn_contentdb"] ~= nil then
local dlg = create_store_dlg()
dlg:set_parent(tabview)
@@ -197,12 +196,6 @@ local function handle_buttons(tabview, fields, tabname, tabdata)
return true
end
- if fields["mod_mgt_open_dlg_accepted"] and
- fields["mod_mgt_open_dlg_accepted"] ~= "" then
- pkgmgr.install_mod(fields["mod_mgt_open_dlg_accepted"],nil)
- return true
- end
-
return false
end
diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua
index 15ef96dc8..0969bccfb 100644
--- a/builtin/mainmenu/tab_local.lua
+++ b/builtin/mainmenu/tab_local.lua
@@ -21,7 +21,7 @@ local current_game, singleplayer_refresh_gamebar
if enable_gamebar then
function current_game()
local last_game_id = core.settings:get("menu_last_game")
- local game, index = pkgmgr.find_by_gameid(last_game_id)
+ local game = pkgmgr.find_by_gameid(last_game_id)
return game
end
@@ -222,7 +222,7 @@ local function main_button_handler(this, fields, name, tabdata)
--update last game
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
if world then
- local game, index = pkgmgr.find_by_gameid(world.gameid)
+ local game = pkgmgr.find_by_gameid(world.gameid)
core.settings:set("menu_last_game", game.id)
end
diff --git a/builtin/mainmenu/tab_online.lua b/builtin/mainmenu/tab_online.lua
index c632039fc..8733f7618 100644
--- a/builtin/mainmenu/tab_online.lua
+++ b/builtin/mainmenu/tab_online.lua
@@ -20,7 +20,7 @@ local function get_formspec(tabview, name, tabdata)
-- Update the cached supported proto info,
-- it may have changed after a change by the settings menu.
common_update_cached_supp_proto()
- local fav_selected = nil
+ local fav_selected
if menudata.search_result then
fav_selected = menudata.search_result[tabdata.fav_selected]
else
@@ -273,8 +273,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
for k = 1, #keywords do
local keyword = keywords[k]
if server.name then
- local name = server.name:lower()
- local _, count = name:gsub(keyword, keyword)
+ local sername = server.name:lower()
+ local _, count = sername:gsub(keyword, keyword)
found = found + count * 4
end
diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua
index 71b2d88fa..1e5264904 100644
--- a/builtin/mainmenu/tab_settings.lua
+++ b/builtin/mainmenu/tab_settings.lua
@@ -148,11 +148,9 @@ local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
core.create_world("singleplayerworld", 1)
worldlist = core.get_worlds()
- found_singleplayerworld = false
for i = 1, #worldlist do
if worldlist[i].name == "singleplayerworld" then
- found_singleplayerworld = true
gamedata.worldindex = i
end
end
@@ -254,7 +252,7 @@ local function formspec(tabview, name, tabdata)
.. dump(core.settings:get_bool("generate_normalmaps")) .. "]" ..
"checkbox[8.25,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
.. dump(core.settings:get_bool("enable_parallax_occlusion")) .. "]" ..
- "checkbox[8.25,2.5;cb_waving_water;" .. fgettext("Waving Water") .. ";"
+ "checkbox[8.25,2.5;cb_waving_water;" .. fgettext("Waving Liquids") .. ";"
.. dump(core.settings:get_bool("enable_waving_water")) .. "]" ..
"checkbox[8.25,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
.. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
@@ -271,7 +269,7 @@ local function formspec(tabview, name, tabdata)
"label[8.38,2.2;" .. core.colorize("#888888",
fgettext("Parallax Occlusion")) .. "]" ..
"label[8.38,2.7;" .. core.colorize("#888888",
- fgettext("Waving Water")) .. "]" ..
+ fgettext("Waving Liquids")) .. "]" ..
"label[8.38,3.2;" .. core.colorize("#888888",
fgettext("Waving Leaves")) .. "]" ..
"label[8.38,3.7;" .. core.colorize("#888888",
diff --git a/builtin/mainmenu/tab_simple_main.lua b/builtin/mainmenu/tab_simple_main.lua
index de4ae1751..7ec95158a 100644
--- a/builtin/mainmenu/tab_simple_main.lua
+++ b/builtin/mainmenu/tab_simple_main.lua
@@ -188,10 +188,10 @@ local function main_button_handler(tabview, fields, name, tabdata)
core.settings:set("address", fields.te_address)
core.settings:set("remote_port", fields.te_port)
-
- core.start()
- return true
- end
+
+ core.start()
+ return true
+ end
if fields.btn_config_sp_world then
local configdialog = create_configure_world_dlg(1)
diff --git a/builtin/mainmenu/textures.lua b/builtin/mainmenu/textures.lua
index 68b05dc18..a3acbbdec 100644
--- a/builtin/mainmenu/textures.lua
+++ b/builtin/mainmenu/textures.lua
@@ -23,9 +23,9 @@ function mm_texture.init()
mm_texture.defaulttexturedir = core.get_texturepath() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM
mm_texture.basetexturedir = mm_texture.defaulttexturedir
-
+
mm_texture.texturepack = core.settings:get("texture_path")
-
+
mm_texture.gameid = nil
end
@@ -39,7 +39,7 @@ function mm_texture.update(tab,gamedetails)
if gamedetails == nil then
return
end
-
+
mm_texture.update_game(gamedetails)
end
@@ -48,18 +48,18 @@ function mm_texture.reset()
mm_texture.gameid = nil
local have_bg = false
local have_overlay = mm_texture.set_generic("overlay")
-
+
if not have_overlay then
have_bg = mm_texture.set_generic("background")
end
-
+
mm_texture.clear("header")
mm_texture.clear("footer")
core.set_clouds(false)
-
+
mm_texture.set_generic("footer")
mm_texture.set_generic("header")
-
+
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
@@ -74,30 +74,30 @@ function mm_texture.update_game(gamedetails)
if mm_texture.gameid == gamedetails.id then
return
end
-
+
local have_bg = false
local have_overlay = mm_texture.set_game("overlay",gamedetails)
-
+
if not have_overlay then
have_bg = mm_texture.set_game("background",gamedetails)
end
-
+
mm_texture.clear("header")
mm_texture.clear("footer")
core.set_clouds(false)
-
+
if not have_bg then
-
+
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
mm_texture.set_dirt_bg()
end
end
-
+
mm_texture.set_game("footer",gamedetails)
mm_texture.set_game("header",gamedetails)
-
+
mm_texture.gameid = gamedetails.id
end
@@ -116,7 +116,7 @@ function mm_texture.set_generic(identifier)
return true
end
end
-
+
if mm_texture.defaulttexturedir ~= nil then
local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
identifier .. ".png"
@@ -124,13 +124,13 @@ function mm_texture.set_generic(identifier)
return true
end
end
-
+
return false
end
--------------------------------------------------------------------------------
function mm_texture.set_game(identifier, gamedetails)
-
+
if gamedetails == nil then
return false
end
@@ -142,7 +142,7 @@ function mm_texture.set_game(identifier, gamedetails)
return true
end
end
-
+
-- Find out how many randomized textures the game provides
local n = 0
local filename
@@ -167,7 +167,7 @@ function mm_texture.set_game(identifier, gamedetails)
if core.set_background(identifier, path) then
return true
end
-
+
return false
end
@@ -178,7 +178,7 @@ function mm_texture.set_dirt_bg()
return true
end
end
-
+
-- Use universal fallback texture in textures/base/pack
local minimalpath = defaulttexturedir .. "menu_bg.png"
core.set_background("background", minimalpath, true, 128)
diff --git a/builtin/profiler/instrumentation.lua b/builtin/profiler/instrumentation.lua
index 2ab658bb2..80eed05e8 100644
--- a/builtin/profiler/instrumentation.lua
+++ b/builtin/profiler/instrumentation.lua
@@ -117,7 +117,8 @@ end
local function assert_can_be_called(func, func_name, level)
if not can_be_called(func) then
-- Then throw an *helpful* error, by pointing on our caller instead of us.
- error(format("Invalid argument to %s. Expected function-like type instead of '%s'.", func_name, type(func)), level + 1)
+ error(format("Invalid argument to %s. Expected function-like type instead of '%s'.",
+ func_name, type(func)), level + 1)
end
end
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index 5d68007e3..0ff8066aa 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -112,7 +112,7 @@ always_fly_fast (Always fly and fast) bool true
# The time in seconds it takes between repeated right clicks when holding the right
# mouse button.
-repeat_rightclick_time (Rightclick repetition interval) float 0.25
+repeat_rightclick_time (Rightclick repetition interval) float 0.25 0.001
# Automatically jump up single-node obstacles.
autojump (Automatic jumping) bool false
@@ -150,7 +150,7 @@ joystick_type (Joystick type) enum auto auto,generic,xbox
# 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
+repeat_joystick_button_time (Joystick button repetition interval) float 0.17 0.001
# The sensitivity of the joystick axes for moving the
# ingame view frustum around.
@@ -212,7 +212,7 @@ keymap_freemove (Fly key) key KEY_KEY_K
# Key for toggling pitch move mode.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
-keymap_pitchmove (Pitch move key) key KEY_KEY_L
+keymap_pitchmove (Pitch move key) key KEY_KEY_P
# Key for toggling fast mode.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
@@ -508,10 +508,11 @@ texture_min_size (Minimum texture size) int 64
# when set to higher number than 0.
fsaa (FSAA) enum 0 0,1,2,4,8,16
-# Undersampling is similar to using lower screen resolution, but it applies
+# Undersampling is similar to using a lower screen resolution, but it applies
# to the game world only, keeping the GUI intact.
-# It should give significant performance boost at the cost of less detailed image.
-undersampling (Undersampling) enum 0 0,2,3,4
+# It should give a significant performance boost at the cost of less detailed image.
+# Higher values result in a less detailed image.
+undersampling (Undersampling) int 1 1 8
[**Shaders]
@@ -574,11 +575,11 @@ parallax_occlusion_bias (Parallax occlusion bias) float 0.04
# Requires shaders to be enabled.
enable_waving_water (Waving water) bool false
-water_wave_height (Waving water height) float 1.0
+water_wave_height (Waving water wave height) float 1.0
-water_wave_length (Waving water length) float 20.0
+water_wave_length (Waving water wavelength) float 20.0
-water_wave_speed (Waving water speed) float 5.0
+water_wave_speed (Waving water wave speed) float 5.0
# Set to true enables waving leaves.
# Requires shaders to be enabled.
@@ -596,10 +597,10 @@ arm_inertia (Arm inertia) bool true
# If FPS would go higher than this, limit it by sleeping
# to not waste CPU power for no benefit.
-fps_max (Maximum FPS) int 60
+fps_max (Maximum FPS) int 60 1
# Maximum FPS when game is paused.
-pause_fps_max (FPS in pause menu) int 20
+pause_fps_max (FPS in pause menu) int 20 1
# Open the pause menu when the window's focus is lost. Does not pause if a formspec is
# open.
@@ -608,17 +609,17 @@ pause_on_lost_focus (Pause on lost window focus) bool false
# View distance in nodes.
viewing_range (Viewing range) int 100 20 4000
-# Camera near plane distance in nodes, between 0 and 0.5
+# Camera 'near clipping plane' distance in nodes, between 0 and 0.5.
# Most users will not need to change this.
# Increasing can reduce artifacting on weaker GPUs.
# 0.1 = Default, 0.25 = Good value for weaker tablets.
-near_plane (Near plane) float 0.1 0 0.5
+near_plane (Near clipping plane) float 0.1 0 0.5
# Width component of the initial window size.
-screen_w (Screen width) int 1024
+screen_w (Screen width) int 1024 1
# Height component of the initial window size.
-screen_h (Screen height) int 600
+screen_h (Screen height) int 600 1
# Save window size automatically when modified.
autosave_screensize (Autosave screen size) bool true
@@ -637,7 +638,7 @@ fov (Field of view) int 72 45 160
# Adjust the gamma encoding for the light tables. Higher numbers are brighter.
# This setting is for the client only and is ignored by the server.
-display_gamma (Gamma) float 1.0 0.5 3.0
+display_gamma (Gamma) float 1.0 0.5 10.0
# Gradient of light curve at minimum light level.
lighting_alpha (Darkness sharpness) float 0.0 0.0 4.0
@@ -805,7 +806,7 @@ menu_clouds (Clouds in menu) bool true
# This will smooth over some of the rough edges, and blend
# pixels when scaling down, at the cost of blurring some
# edge pixels when images are scaled by non-integer sizes.
-gui_scaling (GUI scaling) float 1.0
+gui_scaling (GUI scaling) float 1.0 0.001
# When gui_scaling_filter is true, all GUI images need to be
# filtered in software, but some images are generated directly
@@ -830,7 +831,7 @@ freetype (FreeType fonts) bool true
# Path to TrueTypeFont or bitmap.
font_path (Font path) filepath fonts/liberationsans.ttf
-font_size (Font size) int 16
+font_size (Font size) int 16 1
# Font shadow offset, if 0 then shadow will not be drawn.
font_shadow (Font shadow) int 1
@@ -840,11 +841,11 @@ font_shadow_alpha (Font shadow alpha) int 127 0 255
mono_font_path (Monospace font path) filepath fonts/liberationmono.ttf
-mono_font_size (Monospace font size) int 15
+mono_font_size (Monospace font size) int 15 1
# This font will be used for certain languages.
fallback_font_path (Fallback font) filepath fonts/DroidSansFallbackFull.ttf
-fallback_font_size (Fallback font size) int 15
+fallback_font_size (Fallback font size) int 15 1
fallback_font_shadow (Fallback font shadow) int 1
fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255
@@ -862,7 +863,7 @@ screenshot_quality (Screenshot quality) int 0 0 100
[*Advanced]
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.
-screen_dpi (DPI) int 72
+screen_dpi (DPI) int 72 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).
@@ -1058,6 +1059,10 @@ disable_anticheat (Disable anticheat) bool false
# This option is only read when server starts.
enable_rollback_recording (Rollback recording) bool false
+# Format of player chat messages. The following strings are valid placeholders:
+# @name, @message, @timestamp (optional)
+chat_message_format (Chat message format) string <@name> @message
+
# A message to be displayed to all clients when the server shuts down.
kick_msg_shutdown (Shutdown message) string Server shutting down.
@@ -1097,7 +1102,7 @@ time_send_interval (Time send interval) int 5
time_speed (Time speed) int 72
# Time of day when a new world is started, in millihours (0-23999).
-world_start_time (World start time) int 5250 0 23999
+world_start_time (World start time) int 6125 0 23999
# Interval of saving important changes in the world, stated in seconds.
server_map_save_interval (Map save interval) float 5.3
@@ -1113,17 +1118,44 @@ chat_message_limit_trigger_kick (Chat message kick threshold) int 50
[**Physics]
+# Horizontal and vertical acceleration on ground or when climbing,
+# in nodes per second per second.
movement_acceleration_default (Default acceleration) float 3
+
+# Horizontal acceleration in air when jumping or falling,
+# in nodes per second per second.
movement_acceleration_air (Acceleration in air) float 2
+
+# Horizontal and vertical acceleration in fast mode,
+# in nodes per second per second.
movement_acceleration_fast (Fast mode acceleration) float 10
+
+# Walking and flying speed, in nodes per second.
movement_speed_walk (Walking speed) float 4
+
+# Sneaking speed, in nodes per second.
movement_speed_crouch (Sneaking speed) float 1.35
+
+# Walking, flying and climbing speed in fast mode, in nodes per second.
movement_speed_fast (Fast mode speed) float 20
+
+# Vertical climbing speed, in nodes per second.
movement_speed_climb (Climbing speed) float 3
+
+# Initial vertical speed when jumping, in nodes per second.
movement_speed_jump (Jumping speed) float 6.5
+
+# Decrease this to increase liquid resistence to movement.
movement_liquid_fluidity (Liquid fluidity) float 1
+
+# Maximum liquid resistence. Controls deceleration when entering liquid at
+# high speed.
movement_liquid_fluidity_smooth (Liquid fluidity smoothing) float 0.5
-movement_liquid_sink (Liquid sinking speed) float 10
+
+# Controls sinking speed in liquid.
+movement_liquid_sink (Liquid sinking) float 10
+
+# Acceleration of gravity, in nodes per second per second.
movement_gravity (Gravity) float 9.81
[**Advanced]
@@ -1288,6 +1320,12 @@ language (Language) enum ,be,ca,cs,da,de,dv,en,eo,es,et,fr,he,hu,id,it,ja,jbo,
# - verbose
debug_log_level (Debug log level) enum action ,none,error,warning,action,info,verbose
+# 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,
+# deleting an older debug.txt.1 if it exists.
+# debug.txt is only moved if this setting is positive.
+debug_log_size_max (Debug log file size threshold) int 50
+
# IPv6 support.
enable_ipv6 (IPv6) bool true
@@ -1327,11 +1365,9 @@ profiler_print_interval (Engine profiling data print interval) int 0
# Name of map generator to be used when creating a new world.
# Creating a world in the main menu will override this.
-# Current stable mapgens:
-# v5, v6, v7 (except floatlands), singlenode.
-# 'stable' means the terrain shape in an existing world will not be changed
-# in the future. Note that biomes are defined by games and may still change.
-mg_name (Mapgen name) enum v7 v5,v6,v7,valleys,carpathian,fractal,flat,singlenode
+# Current mapgens in a highly unstable state:
+# - The optional floatlands of v7 (disabled by default).
+mg_name (Mapgen name) enum v7 v7,valleys,carpathian,v5,flat,fractal,singlenode,v6
# Water surface level of the world.
water_level (Water level) int 1
@@ -1349,9 +1385,6 @@ mapgen_limit (Map generation limit) int 31000 0 31000
# and junglegrass, in all other mapgens this flag controls all decorations.
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes caves,dungeons,light,decorations,biomes,nocaves,nodungeons,nolight,nodecorations,nobiomes
-# Whether dungeons occasionally project from the terrain.
-projecting_dungeons (Projecting dungeons) bool true
-
[*Biome API temperature and humidity noise parameters]
# Temperature variation for biomes.
@@ -1377,6 +1410,7 @@ mgv5_cave_width (Cave width) float 0.09
# Y of upper limit of large caves.
mgv5_large_cave_depth (Large cave depth) int -256
+# Deprecated, define and locate cave liquids using biome definitions instead.
# Y of upper limit of lava in large caves.
mgv5_lava_depth (Lava depth) int -256
@@ -1419,16 +1453,19 @@ mgv5_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.6
# 3D noise defining terrain.
mgv5_np_ground (Ground noise) noise_params_3d 0, 40, (80, 80, 80), 983240, 4, 0.55, 2.0, eased
+# 3D noise that determines number of dungeons per mapchunk.
+mgv5_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
+
[*Mapgen V6]
# Map generation attributes specific to Mapgen v6.
# The 'snowbiomes' flag enables the new 5 biome system.
-# When the new biome system is enabled jungles are automatically enabled and
+# When the 'snowbiomes' flag is enabled jungles are automatically enabled and
# the 'jungles' flag is ignored.
-mgv6_spflags (Mapgen V6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,trees jungles,biomeblend,mudflow,snowbiomes,flat,trees,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat,notrees
+mgv6_spflags (Mapgen V6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,noflat,trees jungles,biomeblend,mudflow,snowbiomes,flat,trees,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat,notrees
# Deserts occur when np_biome exceeds this value.
-# When the new biome system is enabled, this is ignored.
+# When the 'snowbiomes' flag is enabled, this is ignored.
mgv6_freq_desert (Desert noise threshold) float 0.45
# Sandy beaches occur when np_beach exceeds this value.
@@ -1490,6 +1527,7 @@ mgv7_cave_width (Cave width) float 0.09
# Y of upper limit of large caves.
mgv7_large_cave_depth (Large cave depth) int -33
+# Deprecated, define and locate cave liquids using biome definitions instead.
# Y of upper limit of lava in large caves.
mgv7_lava_depth (Lava depth) int -256
@@ -1571,20 +1609,33 @@ mgv7_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5,
# Second of two 3D noises that together define tunnels.
mgv7_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
+# 3D noise that determines number of dungeons per mapchunk.
+mgv7_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
+
[*Mapgen Carpathian]
# Map generation attributes specific to Mapgen Carpathian.
-mgcarpathian_spflags (Mapgen Carpathian specific flags) flags caverns caverns,nocaverns
+mgcarpathian_spflags (Mapgen Carpathian specific flags) flags caverns,norivers caverns,rivers,nocaverns,norivers
# Defines the base ground level.
mgcarpathian_base_level (Base ground level) float 12.0
+# Defines the width of the river channel.
+mgcarpathian_river_width (River channel width) float 0.05
+
+# Defines the depth of the river channel.
+mgcarpathian_river_depth (River channel depth) float 24.0
+
+# Defines the width of the river valley.
+mgcarpathian_valley_width (River valley width) float 0.25
+
# Controls width of tunnels, a smaller value creates wider tunnels.
mgcarpathian_cave_width (Cave width) float 0.09
# Y of upper limit of large caves.
mgcarpathian_large_cave_depth (Large cave depth) int -33
+# Deprecated, define and locate cave liquids using biome definitions instead.
# Y of upper limit of lava in large caves.
mgcarpathian_lava_depth (Lava depth) int -256
@@ -1638,6 +1689,9 @@ mgcarpathian_np_ridge_mnt (Ridged mountain size noise) noise_params_2d 0, 12, (7
# 2D noise that controls the shape/size of step mountains.
mgcarpathian_np_step_mnt (Step mountain size noise) noise_params_2d 0, 8, (509, 509, 509), 2590, 6, 0.6, 2.0, eased
+# 2D noise that locates the river valleys and channels.
+mgcarpathian_np_rivers (River noise) noise_params_2d 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0, eased
+
# 3D noise for mountain overhangs, cliffs, etc. Usually small variations.
mgcarpathian_np_mnt_var (Mountain variation noise) noise_params_3d 0, 1, (499, 499, 499), 2490, 5, 0.55, 2.0
@@ -1650,6 +1704,9 @@ mgcarpathian_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325,
# 3D noise defining giant caverns.
mgcarpathian_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0
+# 3D noise that determines number of dungeons per mapchunk.
+mgcarpathian_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
+
[*Mapgen Flat]
# Map generation attributes specific to Mapgen flat.
@@ -1662,6 +1719,7 @@ mgflat_ground_level (Ground level) int 8
# Y of upper limit of large caves.
mgflat_large_cave_depth (Large cave depth) int -33
+# Deprecated, define and locate cave liquids using biome definitions instead.
# Y of upper limit of lava in large caves.
mgflat_lava_depth (Lava depth) int -256
@@ -1704,14 +1762,23 @@ mgflat_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5
# Second of two 3D noises that together define tunnels.
mgflat_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
+# 3D noise that determines number of dungeons per mapchunk.
+mgflat_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
+
[*Mapgen Fractal]
+# Map generation attributes specific to Mapgen flat.
+# 'terrain' enables the generation of non-fractal terrain:
+# ocean, islands and underground.
+mgfractal_spflags (Mapgen Fractal specific flags) flags terrain terrain,noterrain
+
# Controls width of tunnels, a smaller value creates wider tunnels.
mgfractal_cave_width (Cave width) float 0.09
# Y of upper limit of large caves.
mgfractal_large_cave_depth (Large cave depth) int -33
+# Deprecated, define and locate cave liquids using biome definitions instead.
# Y of upper limit of lava in large caves.
mgfractal_lava_depth (Lava depth) int -256
@@ -1813,6 +1880,9 @@ mgfractal_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3,
# Second of two 3D noises that together define tunnels.
mgfractal_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
+# 3D noise that determines number of dungeons per mapchunk.
+mgfractal_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
+
[*Mapgen Valleys]
# Map generation attributes specific to Mapgen Valleys.
@@ -1821,7 +1891,7 @@ mgfractal_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3,
# 'vary_river_depth': If enabled, low humidity and high heat causes rivers
# to become shallower and occasionally dry.
# 'altitude_dry': Reduces humidity with altitude.
-mgvalleys_spflags (Mapgen Valleys specific flags) flags altitude_chill,humid_rivers,vary_river_depth,altitude_dry altitude_chill,noaltitude_chill,humid_rivers,nohumid_rivers,vary_river_depth,novary_river_depth,altitude_dry,noaltitude_dry
+mgvalleys_spflags (Mapgen Valleys specific flags) flags altitude_chill,humid_rivers,vary_river_depth,altitude_dry altitude_chill,humid_rivers,vary_river_depth,altitude_dry,noaltitude_chill,nohumid_rivers,novary_river_depth,noaltitude_dry
# The vertical distance over which heat drops by 20 if 'altitude_chill' is
# enabled. Also the vertical distance over which humidity drops by 10 if
@@ -1831,6 +1901,7 @@ mgvalleys_altitude_chill (Altitude chill) int 90
# Depth below which you'll find large caves.
mgvalleys_large_cave_depth (Large cave depth) int -33
+# Deprecated, define and locate cave liquids using biome definitions instead.
# Y of upper limit of lava in large caves.
mgvalleys_lava_depth (Lava depth) int 1
@@ -1890,6 +1961,9 @@ mgvalleys_np_valley_profile (Valley profile) noise_params_2d 0.6, 0.5, (512, 512
# Slope and fill work together to modify the heights.
mgvalleys_np_inter_valley_slope (Valley slope) noise_params_2d 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0, eased
+# 3D noise that determines number of dungeons per mapchunk.
+mgvalleys_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
+
[*Advanced]
# Size of mapchunks generated by mapgen, stated in mapblocks (16 nodes).