diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/common/information_formspecs.lua | 4 | ||||
-rw-r--r-- | builtin/common/misc_helpers.lua | 109 | ||||
-rw-r--r-- | builtin/common/serialize.lua | 34 | ||||
-rw-r--r-- | builtin/common/tests/misc_helpers_spec.lua | 73 | ||||
-rw-r--r-- | builtin/common/tests/serialize_spec.lua | 44 | ||||
-rw-r--r-- | builtin/common/tests/vector_spec.lua | 46 | ||||
-rw-r--r-- | builtin/game/chat.lua | 17 | ||||
-rw-r--r-- | builtin/game/deprecated.lua | 2 | ||||
-rw-r--r-- | builtin/game/falling.lua | 140 | ||||
-rw-r--r-- | builtin/game/features.lua | 1 | ||||
-rw-r--r-- | builtin/game/item.lua | 52 | ||||
-rw-r--r-- | builtin/game/item_entity.lua | 3 | ||||
-rw-r--r-- | builtin/game/misc.lua | 16 | ||||
-rw-r--r-- | builtin/game/register.lua | 8 | ||||
-rw-r--r-- | builtin/mainmenu/dlg_settings_advanced.lua | 11 | ||||
-rw-r--r-- | builtin/mainmenu/pkgmgr.lua | 74 | ||||
-rw-r--r-- | builtin/mainmenu/tab_credits.lua | 81 | ||||
-rw-r--r-- | builtin/mainmenu/tab_online.lua | 1 | ||||
-rw-r--r-- | builtin/profiler/instrumentation.lua | 2 | ||||
-rw-r--r-- | builtin/settingtypes.txt | 314 |
20 files changed, 720 insertions, 312 deletions
diff --git a/builtin/common/information_formspecs.lua b/builtin/common/information_formspecs.lua index b977e2656..8afa5bc87 100644 --- a/builtin/common/information_formspecs.lua +++ b/builtin/common/information_formspecs.lua @@ -136,14 +136,14 @@ help_command.func = function(name, param) core.show_formspec(name, "__builtin:help_privs", build_privs_formspec(name)) if name ~= admin then - return + 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 + return true end end diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index d6673a691..715f89bc4 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -5,7 +5,7 @@ local string_sub, string_find = string.sub, string.find -------------------------------------------------------------------------------- -function basic_dump(o) +local function basic_dump(o) local tp = type(o) if tp == "number" then return tostring(o) @@ -200,28 +200,11 @@ function table.indexof(list, val) return -1 end -assert(table.indexof({"foo", "bar"}, "foo") == 1) -assert(table.indexof({"foo", "bar"}, "baz") == -1) - --------------------------------------------------------------------------------- -if INIT ~= "client" then - function file_exists(filename) - local f = io.open(filename, "r") - if f == nil then - return false - else - f:close() - return true - end - end -end -------------------------------------------------------------------------------- function string:trim() return (self:gsub("^%s*(.-)%s*$", "%1")) end -assert(string.trim("\n \t\tfoo bar\t ") == "foo bar") - -------------------------------------------------------------------------------- function math.hypot(x, y) local t @@ -259,64 +242,6 @@ function math.factorial(x) return v end --------------------------------------------------------------------------------- -function get_last_folder(text,count) - local parts = text:split(DIR_DELIM) - - if count == nil then - return parts[#parts] - end - - local retval = "" - for i=1,count,1 do - retval = retval .. parts[#parts - (count-i)] .. DIR_DELIM - end - - return retval -end - --------------------------------------------------------------------------------- -function cleanup_path(temppath) - - local parts = temppath:split("-") - temppath = "" - for i=1,#parts,1 do - if temppath ~= "" then - temppath = temppath .. "_" - end - temppath = temppath .. parts[i] - end - - parts = temppath:split(".") - temppath = "" - for i=1,#parts,1 do - if temppath ~= "" then - temppath = temppath .. "_" - end - temppath = temppath .. parts[i] - end - - parts = temppath:split("'") - temppath = "" - for i=1,#parts,1 do - if temppath ~= "" then - temppath = temppath .. "" - end - temppath = temppath .. parts[i] - end - - parts = temppath:split(" ") - temppath = "" - for i=1,#parts,1 do - if temppath ~= "" then - temppath = temppath - end - temppath = temppath .. parts[i] - end - - return temppath -end - function core.formspec_escape(text) if text ~= nil then text = string.gsub(text,"\\","\\\\") @@ -428,10 +353,9 @@ if INIT == "game" then core.rotate_node = function(itemstack, placer, pointed_thing) local name = placer and placer:get_player_name() or "" local invert_wall = placer and placer:get_player_control().sneak or false - core.rotate_and_place(itemstack, placer, pointed_thing, + return core.rotate_and_place(itemstack, placer, pointed_thing, is_creative(name), {invert_wall = invert_wall}, true) - return itemstack end end @@ -521,9 +445,6 @@ function core.string_to_pos(value) return nil end -assert(core.string_to_pos("10.0, 5, -2").x == 10) -assert(core.string_to_pos("( 10.0, 5, -2)").z == -2) -assert(core.string_to_pos("asd, 5, -2)") == nil) -------------------------------------------------------------------------------- function core.string_to_area(value) @@ -576,6 +497,29 @@ function table.insert_all(t, other) end +function table.key_value_swap(t) + local ti = {} + for k,v in pairs(t) do + ti[v] = k + end + return ti +end + + +function table.shuffle(t, from, to, random) + from = from or 1 + to = to or #t + random = random or math.random + local n = to - from + 1 + while n > 1 do + local r = from + n-1 + local l = from + random(0, n-1) + t[l], t[r] = t[r], t[l] + n = n-1 + end +end + + -------------------------------------------------------------------------------- -- mainmenu only functions -------------------------------------------------------------------------------- @@ -756,6 +700,3 @@ function core.privs_to_string(privs, delim) end return table.concat(list, delim) end - -assert(core.string_to_privs("a,b").b == true) -assert(core.privs_to_string({a=true,b=true}) == "a,b") diff --git a/builtin/common/serialize.lua b/builtin/common/serialize.lua index c91d2d5ce..163aa67ad 100644 --- a/builtin/common/serialize.lua +++ b/builtin/common/serialize.lua @@ -177,13 +177,16 @@ end -- Deserialization -local env = { - loadstring = loadstring, -} +local function safe_loadstring(...) + local func, err = loadstring(...) + if func then + setfenv(func, {}) + return func + end + return nil, err +end -local safe_env = { - loadstring = function() end, -} +local function dummy_func() end function core.deserialize(str, safe) if type(str) ~= "string" then @@ -195,7 +198,10 @@ function core.deserialize(str, safe) end local f, err = loadstring(str) if not f then return nil, err end - setfenv(f, safe and safe_env or env) + + -- The environment is recreated every time so deseralized code cannot + -- pollute it with permanent references. + setfenv(f, {loadstring = safe and dummy_func or safe_loadstring}) local good, data = pcall(f) if good then @@ -204,17 +210,3 @@ function core.deserialize(str, safe) return nil, data end end - - --- Unit tests -local test_in = {cat={sound="nyan", speed=400}, dog={sound="woof"}} -local test_out = core.deserialize(core.serialize(test_in)) - -assert(test_in.cat.sound == test_out.cat.sound) -assert(test_in.cat.speed == test_out.cat.speed) -assert(test_in.dog.sound == test_out.dog.sound) - -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/tests/misc_helpers_spec.lua b/builtin/common/tests/misc_helpers_spec.lua new file mode 100644 index 000000000..bb9d13e7f --- /dev/null +++ b/builtin/common/tests/misc_helpers_spec.lua @@ -0,0 +1,73 @@ +_G.core = {} +dofile("builtin/common/misc_helpers.lua") + +describe("string", function() + it("trim()", function() + assert.equal("foo bar", string.trim("\n \t\tfoo bar\t ")) + end) + + describe("split()", function() + it("removes empty", function() + assert.same({ "hello" }, string.split("hello")) + assert.same({ "hello", "world" }, string.split("hello,world")) + assert.same({ "hello", "world" }, string.split("hello,world,,,")) + assert.same({ "hello", "world" }, string.split(",,,hello,world")) + assert.same({ "hello", "world", "2" }, string.split("hello,,,world,2")) + assert.same({ "hello ", " world" }, string.split("hello :| world", ":|")) + end) + + it("keeps empty", function() + assert.same({ "hello" }, string.split("hello", ",", true)) + assert.same({ "hello", "world" }, string.split("hello,world", ",", true)) + assert.same({ "hello", "world", "" }, string.split("hello,world,", ",", true)) + assert.same({ "hello", "", "", "world", "2" }, string.split("hello,,,world,2", ",", true)) + assert.same({ "", "", "hello", "world", "2" }, string.split(",,hello,world,2", ",", true)) + assert.same({ "hello ", " world | :" }, string.split("hello :| world | :", ":|")) + end) + + it("max_splits", function() + assert.same({ "one" }, string.split("one", ",", true, 2)) + assert.same({ "one,two,three,four" }, string.split("one,two,three,four", ",", true, 0)) + assert.same({ "one", "two", "three,four" }, string.split("one,two,three,four", ",", true, 2)) + assert.same({ "one", "", "two,three,four" }, string.split("one,,two,three,four", ",", true, 2)) + assert.same({ "one", "two", "three,four" }, string.split("one,,,,,,two,three,four", ",", false, 2)) + end) + + it("pattern", function() + assert.same({ "one", "two" }, string.split("one,two", ",", false, -1, true)) + assert.same({ "one", "two", "three" }, string.split("one2two3three", "%d", false, -1, true)) + end) + end) +end) + +describe("privs", function() + it("from string", function() + assert.same({ a = true, b = true }, core.string_to_privs("a,b")) + end) + + it("to string", function() + assert.equal("one", core.privs_to_string({ one=true })) + + local ret = core.privs_to_string({ a=true, b=true }) + assert(ret == "a,b" or ret == "b,a") + end) +end) + +describe("pos", function() + it("from string", function() + assert.same({ x = 10, y = 5.1, z = -2}, core.string_to_pos("10.0, 5.1, -2")) + assert.same({ x = 10, y = 5.1, z = -2}, core.string_to_pos("( 10.0, 5.1, -2)")) + assert.is_nil(core.string_to_pos("asd, 5, -2)")) + end) + + it("to string", function() + assert.equal("(10.1,5.2,-2.3)", core.pos_to_string({ x = 10.1, y = 5.2, z = -2.3})) + end) +end) + +describe("table", function() + it("indexof()", function() + assert.equal(1, table.indexof({"foo", "bar"}, "foo")) + assert.equal(-1, table.indexof({"foo", "bar"}, "baz")) + end) +end) diff --git a/builtin/common/tests/serialize_spec.lua b/builtin/common/tests/serialize_spec.lua new file mode 100644 index 000000000..c41b0a372 --- /dev/null +++ b/builtin/common/tests/serialize_spec.lua @@ -0,0 +1,44 @@ +_G.core = {} + +_G.setfenv = require 'busted.compatibility'.setfenv + +dofile("builtin/common/serialize.lua") + +describe("serialize", function() + it("works", function() + local test_in = {cat={sound="nyan", speed=400}, dog={sound="woof"}} + local test_out = core.deserialize(core.serialize(test_in)) + + assert.same(test_in, test_out) + end) + + it("handles characters", function() + local test_in = {escape_chars="\n\r\t\v\\\"\'", non_european="θשׁ٩∂"} + local test_out = core.deserialize(core.serialize(test_in)) + assert.same(test_in, test_out) + end) + + it("handles recursive structures", function() + local test_in = { hello = "world" } + test_in.foo = test_in + + local test_out = core.deserialize(core.serialize(test_in)) + assert.same(test_in, test_out) + end) + + it("strips functions in safe mode", function() + local test_in = { + func = function(a, b) + error("test") + end, + foo = "bar" + } + + local str = core.serialize(test_in) + assert.not_nil(str:find("loadstring")) + + local test_out = core.deserialize(str, true) + assert.is_nil(test_out.func) + assert.equals(test_out.foo, "bar") + end) +end) diff --git a/builtin/common/tests/vector_spec.lua b/builtin/common/tests/vector_spec.lua new file mode 100644 index 000000000..79f032f28 --- /dev/null +++ b/builtin/common/tests/vector_spec.lua @@ -0,0 +1,46 @@ +_G.vector = {} +dofile("builtin/common/vector.lua") + +describe("vector", function() + describe("new()", function() + it("constructs", function() + assert.same({ x = 0, y = 0, z = 0 }, vector.new()) + assert.same({ x = 1, y = 2, z = 3 }, vector.new(1, 2, 3)) + assert.same({ x = 3, y = 2, z = 1 }, vector.new({ x = 3, y = 2, z = 1 })) + + local input = vector.new({ x = 3, y = 2, z = 1 }) + local output = vector.new(input) + assert.same(input, output) + assert.are_not.equal(input, output) + end) + + it("throws on invalid input", function() + assert.has.errors(function() + vector.new({ x = 3 }) + end) + + assert.has.errors(function() + vector.new({ d = 3 }) + end) + end) + end) + + it("equal()", function() + local function assertE(a, b) + assert.is_true(vector.equals(a, b)) + end + local function assertNE(a, b) + assert.is_false(vector.equals(a, b)) + end + + assertE({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}) + assertE({x = -1, y = 0, z = 1}, {x = -1, y = 0, z = 1}) + local a = { x = 2, y = 4, z = -10 } + assertE(a, a) + assertNE({x = -1, y = 0, z = 1}, a) + end) + + it("add()", function() + assert.same({ x = 2, y = 4, z = 6 }, vector.add(vector.new(1, 2, 3), { x = 1, y = 2, z = 3 })) + end) +end) diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index d0d456a46..fd1379162 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -115,6 +115,7 @@ core.register_chatcommand("me", { privs = {shout=true}, func = function(name, param) core.chat_send_all("* " .. name .. " " .. param) + return true end, }) @@ -141,7 +142,7 @@ core.register_chatcommand("privs", { end return true, "Privileges of " .. name .. ": " .. core.privs_to_string( - core.get_player_privs(name), ' ') + core.get_player_privs(name), ", ") end, }) @@ -919,12 +920,13 @@ core.register_chatcommand("shutdown", { core.chat_send_all("*** Server shutting down (operator request).") end core.request_shutdown(message:trim(), core.is_yes(reconnect), delay) + return true end, }) core.register_chatcommand("ban", { - params = "[<name> | <IP_address>]", - description = "Ban player or show ban list", + params = "[<name>]", + description = "Ban the IP of a player or show the ban list", privs = {ban=true}, func = function(name, param) if param == "" then @@ -936,7 +938,7 @@ core.register_chatcommand("ban", { end end if not core.get_player_by_name(param) then - return false, "No such player." + return false, "Player is not online." end if not core.ban_player(param) then return false, "Failed to ban player." @@ -949,7 +951,7 @@ core.register_chatcommand("ban", { core.register_chatcommand("unban", { params = "<name> | <IP_address>", - description = "Remove player ban", + description = "Remove IP ban belonging to a player/IP", privs = {ban=true}, func = function(name, param) if not core.unban_player_or_ip(param) then @@ -995,12 +997,13 @@ core.register_chatcommand("clearobjects", { core.log("action", name .. " clears all objects (" .. options.mode .. " mode).") - core.chat_send_all("Clearing all objects. This may take long." - .. " You may experience a timeout. (by " + core.chat_send_all("Clearing all objects. This may take a long time." + .. " You may experience a timeout. (by " .. name .. ")") core.clear_objects(options) core.log("action", "Object clearing done.") core.chat_send_all("*** Cleared all objects.") + return true end, }) diff --git a/builtin/game/deprecated.lua b/builtin/game/deprecated.lua index 1a9a96f2a..73e105eb8 100644 --- a/builtin/game/deprecated.lua +++ b/builtin/game/deprecated.lua @@ -20,7 +20,7 @@ function core.node_metadata_inventory_move_allow_all() end function core.add_to_creative_inventory(itemstring) - core.log("deprecated", "core.add_to_creative_inventory: This function is deprecated and does nothing.") + core.log("deprecated", "core.add_to_creative_inventory is obsolete and does nothing.") end -- diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 950d6b56f..ea02e3694 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -1,6 +1,34 @@ -- Minetest: builtin/item.lua local builtin_shared = ... +local SCALE = 0.667 + +local facedir_to_euler = { + {y = 0, x = 0, z = 0}, + {y = -math.pi/2, x = 0, z = 0}, + {y = math.pi, x = 0, z = 0}, + {y = math.pi/2, x = 0, z = 0}, + {y = math.pi/2, x = -math.pi/2, z = math.pi/2}, + {y = math.pi/2, x = math.pi, z = math.pi/2}, + {y = math.pi/2, x = math.pi/2, z = math.pi/2}, + {y = math.pi/2, x = 0, z = math.pi/2}, + {y = -math.pi/2, x = math.pi/2, z = math.pi/2}, + {y = -math.pi/2, x = 0, z = math.pi/2}, + {y = -math.pi/2, x = -math.pi/2, z = math.pi/2}, + {y = -math.pi/2, x = math.pi, z = math.pi/2}, + {y = 0, x = 0, z = math.pi/2}, + {y = 0, x = -math.pi/2, z = math.pi/2}, + {y = 0, x = math.pi, z = math.pi/2}, + {y = 0, x = math.pi/2, z = math.pi/2}, + {y = math.pi, x = math.pi, z = math.pi/2}, + {y = math.pi, x = math.pi/2, z = math.pi/2}, + {y = math.pi, x = 0, z = math.pi/2}, + {y = math.pi, x = -math.pi/2, z = math.pi/2}, + {y = math.pi, x = math.pi, z = 0}, + {y = -math.pi/2, x = math.pi, z = 0}, + {y = 0, x = math.pi, z = 0}, + {y = math.pi/2, x = math.pi, z = 0} +} -- -- Falling stuff @@ -8,8 +36,8 @@ local builtin_shared = ... core.register_entity(":__builtin:falling_node", { initial_properties = { - visual = "wielditem", - visual_size = {x = 0.667, y = 0.667}, + visual = "item", + visual_size = {x = SCALE, y = SCALE, z = SCALE}, textures = {}, physical = true, is_visible = false, @@ -33,11 +61,105 @@ core.register_entity(":__builtin:falling_node", { end end end + local def = core.registered_nodes[node.name] + if not def then + -- Don't allow unknown nodes to fall + core.log("info", + "Unknown falling node removed at ".. + core.pos_to_string(self.object:get_pos())) + self.object:remove() + return + end self.meta = meta - self.object:set_properties({ - is_visible = true, - textures = {node.name}, - }) + if def.drawtype == "torchlike" or def.drawtype == "signlike" then + local textures + if def.tiles and def.tiles[1] then + local tile = def.tiles[1] + if type(tile) == "table" then + tile = tile.name + end + if def.drawtype == "torchlike" then + textures = { "("..tile..")^[transformFX", tile } + else + textures = { tile, "("..tile..")^[transformFX" } + end + end + local vsize + if def.visual_scale then + local s = def.visual_scale + vsize = {x = s, y = s, z = s} + end + self.object:set_properties({ + is_visible = true, + visual = "upright_sprite", + visual_size = vsize, + textures = textures, + glow = def.light_source, + }) + elseif def.drawtype ~= "airlike" then + local itemstring = node.name + if core.is_colored_paramtype(def.paramtype2) then + itemstring = core.itemstring_with_palette(itemstring, node.param2) + end + local vsize + if def.visual_scale then + local s = def.visual_scale * SCALE + vsize = {x = s, y = s, z = s} + end + self.object:set_properties({ + is_visible = true, + wield_item = itemstring, + visual_size = vsize, + glow = def.light_source, + }) + end + -- Rotate entity + if def.drawtype == "torchlike" then + self.object:set_yaw(math.pi*0.25) + elseif (node.param2 ~= 0 and (def.wield_image == "" + or def.wield_image == nil)) + or def.drawtype == "signlike" + or def.drawtype == "mesh" + or def.drawtype == "normal" + or def.drawtype == "nodebox" then + if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") then + local fdir = node.param2 % 32 + -- Get rotation from a precalculated lookup table + local euler = facedir_to_euler[fdir + 1] + if euler then + self.object:set_rotation(euler) + end + elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then + local rot = node.param2 % 8 + local pitch, yaw, roll = 0, 0, 0 + if rot == 1 then + pitch, yaw = math.pi, math.pi + elseif rot == 2 then + pitch, yaw = math.pi/2, math.pi/2 + elseif rot == 3 then + pitch, yaw = math.pi/2, -math.pi/2 + elseif rot == 4 then + pitch, yaw = math.pi/2, math.pi + elseif rot == 5 then + pitch, yaw = math.pi/2, 0 + end + if def.drawtype == "signlike" then + pitch = pitch - math.pi/2 + if rot == 0 then + yaw = yaw + math.pi/2 + elseif rot == 1 then + yaw = yaw - math.pi/2 + end + elseif def.drawtype == "mesh" or def.drawtype == "normal" then + if rot >= 0 and rot <= 1 then + roll = roll + math.pi + else + yaw = yaw + math.pi + end + end + self.object:set_rotation({x=pitch, y=yaw, z=roll}) + end + end end, get_staticdata = function(self) @@ -128,7 +250,7 @@ core.register_entity(":__builtin:falling_node", { meta:from_table(self.meta) end if def.sounds and def.sounds.place then - core.sound_play(def.sounds.place, {pos = np}) + core.sound_play(def.sounds.place, {pos = np}, true) end end self.object:remove() @@ -154,7 +276,7 @@ local function convert_to_falling_node(pos, node) 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}) + core.sound_play(def.sounds.fall, {pos = pos}, true) end obj:get_luaentity():set_node(node, metatable) @@ -187,7 +309,7 @@ local function drop_attached_node(p) 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}) + core.sound_play(def.sounds.fall, {pos = p}, true) end core.remove_node(p) for _, item in pairs(drops) do diff --git a/builtin/game/features.lua b/builtin/game/features.lua index 0af0dc1da..623f8183b 100644 --- a/builtin/game/features.lua +++ b/builtin/game/features.lua @@ -15,6 +15,7 @@ core.features = { httpfetch_binary_data = true, formspec_version_element = true, area_store_persistent_ids = true, + pathfinder_works = true, } function core.has_feature(arg) diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 4054949f1..513c3a5e1 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -259,7 +259,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, prevent_after_place) local def = itemstack:get_definition() if def.type ~= "node" or pointed_thing.type ~= "node" then - return itemstack, false + return itemstack, nil end local under = pointed_thing.under @@ -272,7 +272,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, if not oldnode_under or not oldnode_above then log("info", playername .. " tried to place" .. " node in unloaded position " .. core.pos_to_string(above)) - return itemstack, false + return itemstack, nil end local olddef_under = core.registered_nodes[oldnode_under.name] @@ -284,7 +284,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, log("info", playername .. " tried to place" .. " node in invalid position " .. core.pos_to_string(above) .. ", replacing " .. oldnode_above.name) - return itemstack, false + return itemstack, nil end -- Place above pointed node @@ -302,12 +302,9 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, .. " at protected position " .. core.pos_to_string(place_to)) core.record_protection_violation(place_to, playername) - return itemstack + return itemstack, nil end - log("action", playername .. " places node " - .. def.name .. " at " .. core.pos_to_string(place_to)) - local oldnode = core.get_node(place_to) local newnode = {name = def.name, param1 = 0, param2 = param2 or 0} @@ -333,7 +330,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, z = above.z - placer_pos.z } newnode.param2 = core.dir_to_facedir(dir) - log("action", "facedir: " .. newnode.param2) + log("info", "facedir: " .. newnode.param2) end end @@ -361,12 +358,23 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, not builtin_shared.check_attached_node(place_to, newnode) then log("action", "attached node " .. def.name .. " can not be placed at " .. core.pos_to_string(place_to)) - return itemstack, false + return itemstack, nil end + log("action", playername .. " places node " + .. def.name .. " at " .. core.pos_to_string(place_to)) + -- Add node and update core.add_node(place_to, newnode) + -- Play sound if it was done by a player + if playername ~= "" and def.sounds and def.sounds.place then + core.sound_play(def.sounds.place, { + pos = place_to, + exclude_player = playername, + }, true) + end + local take_item = true -- Run callback @@ -395,9 +403,10 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, if take_item then itemstack:take_item() end - return itemstack, true + return itemstack, place_to end +-- deprecated, item_place does not call this function core.item_place_object(itemstack, placer, pointed_thing) local pos = core.get_pointed_thing_position(pointed_thing, true) if pos ~= nil then @@ -415,14 +424,15 @@ function core.item_place(itemstack, placer, pointed_thing, param2) local nn = n.name if core.registered_nodes[nn] and core.registered_nodes[nn].on_rightclick then return core.registered_nodes[nn].on_rightclick(pointed_thing.under, n, - placer, itemstack, pointed_thing) or itemstack, false + placer, itemstack, pointed_thing) or itemstack, nil end end + -- Place if node, otherwise do nothing if itemstack:get_definition().type == "node" then return core.item_place_node(itemstack, placer, pointed_thing, param2) end - return itemstack + return itemstack, nil end function core.item_secondary_use(itemstack, placer) @@ -465,7 +475,10 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed user:set_hp(user:get_hp() + hp_change) if def and def.sound and def.sound.eat then - minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 }) + core.sound_play(def.sound.eat, { + pos = user:get_pos(), + max_hear_distance = 16 + }, true) end if replace_with_item then @@ -572,7 +585,10 @@ function core.node_dig(pos, node, digger) if not core.settings:get_bool("creative_mode") then wielded:add_wear(dp.wear) if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then - core.sound_play(wdef.sound.breaks, {pos = pos, gain = 0.5}) + core.sound_play(wdef.sound.breaks, { + pos = pos, + gain = 0.5 + }, true) end end end @@ -604,6 +620,14 @@ function core.node_dig(pos, node, digger) -- Remove node and update core.remove_node(pos) + -- Play sound if it was done by a player + if diggername ~= "" and def and def.sounds and def.sounds.dug then + core.sound_play(def.sounds.dug, { + pos = pos, + exclude_player = diggername, + }, true) + end + -- Run callback if def and def.after_dig_node then -- Copy pos and node because callback can modify them diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index 87fec93ea..968daac97 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -58,6 +58,8 @@ core.register_entity(":__builtin:item", { local count = math.min(stack:get_count(), max_count) local size = 0.2 + 0.1 * (count / max_count) ^ (1 / 3) local coll_height = size * 0.75 + local def = core.registered_nodes[itemname] + local glow = def and math.floor(def.light_source / 2 + 0.5) self.object:set_properties({ is_visible = true, @@ -69,6 +71,7 @@ core.register_entity(":__builtin:item", { selectionbox = {-size, -size, -size, size, size, size}, automatic_rotate = math.pi * 0.5 * 0.2 / size, wield_item = self.itemstring, + glow = glow, }) end, diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index 02c36ccb1..0ed11ada0 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -40,9 +40,6 @@ function core.check_player_privs(name, ...) end -local player_list = {} - - function core.send_join_message(player_name) if not core.is_singleplayer() then core.chat_send_all("*** " .. player_name .. " joined the game.") @@ -61,7 +58,6 @@ end core.register_on_joinplayer(function(player) local player_name = player:get_player_name() - player_list[player_name] = player if not core.is_singleplayer() then local status = core.get_server_status(player_name, true) if status and status ~= "" then @@ -74,22 +70,10 @@ end) core.register_on_leaveplayer(function(player, timed_out) local player_name = player:get_player_name() - player_list[player_name] = nil core.send_leave_message(player_name, timed_out) end) -function core.get_connected_players() - local temp_table = {} - for index, value in pairs(player_list) do - if value:is_player_connected() then - temp_table[#temp_table + 1] = value - end - end - return temp_table -end - - function core.is_player(player) -- a table being a player is also supported because it quacks sufficiently -- like a player if it has the is_player function diff --git a/builtin/game/register.lua b/builtin/game/register.lua index bfad6845c..eb6c2897c 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -321,11 +321,11 @@ for name in pairs(forbidden_item_names) do end --- Deprecated: +-- Obsolete: -- Aliases for core.register_alias (how ironic...) ---core.alias_node = core.register_alias ---core.alias_tool = core.register_alias ---core.alias_craftitem = core.register_alias +-- core.alias_node = core.register_alias +-- core.alias_tool = core.register_alias +-- core.alias_craftitem = core.register_alias -- -- Built-in node definitions. Also defined in C. diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua index 24b71d957..c16e4aad0 100644 --- a/builtin/mainmenu/dlg_settings_advanced.lua +++ b/builtin/mainmenu/dlg_settings_advanced.lua @@ -639,12 +639,23 @@ local function create_change_setting_formspec(dialogdata) -- Flags formspec = table.concat(fields) .. "checkbox[0.5," .. height - 0.6 .. ";cb_defaults;" + --[[~ "defaults" is a noise parameter flag. + It describes the default processing options + for noise settings in main menu -> "All Settings". ]] .. fgettext("defaults") .. ";" -- defaults .. tostring(flags["defaults"] == true) .. "]" -- to get false if nil .. "checkbox[5," .. height - 0.6 .. ";cb_eased;" + --[[~ "eased" is a noise parameter flag. + It is used to make the map smoother and + can be enabled in noise settings in + main menu -> "All Settings". ]] .. fgettext("eased") .. ";" -- eased .. tostring(flags["eased"] == true) .. "]" .. "checkbox[5," .. height - 0.15 .. ";cb_absvalue;" + --[[~ "absvalue" is a noise parameter flag. + It is short for "absolute value". + It can be enabled in noise settings in + main menu -> "All Settings". ]] .. fgettext("absvalue") .. ";" -- absvalue .. tostring(flags["absvalue"] == true) .. "]" height = height + 1 diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua index f87367689..5b8807310 100644 --- a/builtin/mainmenu/pkgmgr.lua +++ b/builtin/mainmenu/pkgmgr.lua @@ -16,6 +16,62 @@ --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------------- +local function get_last_folder(text,count) + local parts = text:split(DIR_DELIM) + + if count == nil then + return parts[#parts] + end + + local retval = "" + for i=1,count,1 do + retval = retval .. parts[#parts - (count-i)] .. DIR_DELIM + end + + return retval +end + +local function cleanup_path(temppath) + + local parts = temppath:split("-") + temppath = "" + for i=1,#parts,1 do + if temppath ~= "" then + temppath = temppath .. "_" + end + temppath = temppath .. parts[i] + end + + parts = temppath:split(".") + temppath = "" + for i=1,#parts,1 do + if temppath ~= "" then + temppath = temppath .. "_" + end + temppath = temppath .. parts[i] + end + + parts = temppath:split("'") + temppath = "" + for i=1,#parts,1 do + if temppath ~= "" then + temppath = temppath .. "" + end + temppath = temppath .. parts[i] + end + + parts = temppath:split(" ") + temppath = "" + for i=1,#parts,1 do + if temppath ~= "" then + temppath = temppath + end + temppath = temppath .. parts[i] + end + + return temppath +end + function get_mods(path,retval,modpack) local mods = core.get_dir_list(path, true) @@ -403,9 +459,9 @@ function pkgmgr.enable_mod(this, toset) -- 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 + for id, mod2 in pairs(list) do + if mod2.type == "mod" and not mod2.is_modpack then + mod_ids[mod2.name] = id end end @@ -429,17 +485,17 @@ function pkgmgr.enable_mod(this, toset) if not enabled_mods[name] then enabled_mods[name] = true - local mod = list[mod_ids[name]] - if not mod then + local mod_to_enable = list[mod_ids[name]] + if not mod_to_enable 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 + if mod_to_enable.enabled == false 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.path) + local depends = pkgmgr.get_dependencies(mod_to_enable.path) for i = 1, #depends do if not enabled_mods[name] then sp = sp+1 diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua index 58db129fb..962d2a3b4 100644 --- a/builtin/mainmenu/tab_credits.lua +++ b/builtin/mainmenu/tab_credits.lua @@ -20,51 +20,31 @@ local core_developers = { "Perttu Ahola (celeron55) <celeron55@gmail.com>", "sfan5 <sfan5@live.de>", - "ShadowNinja <shadowninja@minetest.net>", "Nathanaël Courant (Nore/Ekdohibs) <nore@mesecons.net>", "Loic Blot (nerzhul/nrz) <loic.blot@unix-experience.fr>", "paramat", "Auke Kok (sofar) <sofar@foo-projects.org>", - "rubenwardy <rw@rubenwardy.com>", + "Andrew Ward (rubenwardy) <rw@rubenwardy.com>", "Krock/SmallJoker <mk939@ymail.com>", "Lars Hofhansl <larsh@apache.org>", } local active_contributors = { - "numberZero [Audiovisuals: meshgen]", - "stujones11 [Android UX improvements]", - "red-001 <red-001@outlook.ie> [CSM & Menu fixes]", - "Paul Ouellette (pauloue) [Docs, fixes]", - "Dániel Juhász (juhdanad) <juhdanad@gmail.com> [Audiovisuals: lighting]", - "Hybrid Dog [API]", - "srifqi [Android]", - "Vincent Glize (Dumbeldor) [Cleanups, CSM APIs]", - "Ben Deutsch [Rendering, Fixes, SQLite auth]", - "Wuzzy [Translation, Slippery]", - "ANAND (ClobberXD) [Docs, Fixes]", - "Shara/Ezhh [Docs, Game API]", - "DTA7 [Fixes, mute key]", - "Thomas-S [Disconnected, Formspecs]", - "Raymoo [Tool Capabilities]", - "Elijah Duffy (octacian) [Mainmenu]", - "noob3167 [Fixes]", - "adelcoding1 [Formspecs]", - "adrido [Windows Installer, Formspecs]", - "Rui [Sound Pitch]", - "Jean-Patrick G (kilbith) <jeanpatrick.guerrero@gmail.com> [Audiovisuals]", - "Esteban (EXio4) [Cleanups]", - "Vaughan Lapsley (vlapsley) [Carpathian mapgen]", - "CoderForTheBetter [Add set_rotation]", - "Quentin Bazin (Unarelith) [Cleanups]", + "Hugues Ross [Formspecs]", "Maksim (MoNTE48) [Android]", - "Gaël-de-Sailly [Mapgen, pitch fly]", - "zeuner [Docs, Fixes]", - "ThomasMonroe314 (tre) [Fixes]", - "Rob Blanckaert (basicer) [Fixes]", - "Jozef Behran (osjc) [Fixes]", - "random-geek [Fixes]", - "Pedro Gimeno (pgimeno) [Fixes]", - "lisacvuk [Fixes]", + "DS [Formspecs]", + "pyrollo [Formspecs: Hypertext]", + "v-rob [Formspecs]", + "Jordach [set_sky]", + "random-geek [Formspecs]", + "Wuzzy [Pathfinder, builtin, translations]", + "ANAND (ClobberXD) [Fixes, per-player FOV]", + "Warr1024 [Fixes]", + "Paul Ouellette (pauloue) [Fixes, Script API]", + "Jean-Patrick G (kilbith) <jeanpatrick.guerrero@gmail.com> [Audiovisuals]", + "HybridDog [Script API]", + "dcbrwn [Object shading]", + "srifqi [Fixes]", } local previous_core_developers = { @@ -79,24 +59,31 @@ local previous_core_developers = { "Ryan Kwolek (kwolekr) <kwolekr@minetest.net>", "sapier", "Zeno", + "ShadowNinja <shadowninja@minetest.net>", } local previous_contributors = { - "Gregory Currie (gregorycu) [optimisation]", - "Diego Martínez (kaeza) <kaeza@users.sf.net>", - "T4im [Profiler]", - "TeTpaAka [Hand overriding, nametag colors]", - "Duane Robertson <duane@duanerobertson.com> [MGValleys]", - "neoascetic [OS X Fixes]", - "TriBlade9 <triblade9@mail.com> [Audiovisuals]", - "Jurgen Doser (doserj) <jurgen.doser@gmail.com> [Fixes]", - "MirceaKitsune <mirceakitsune@gmail.com> [Audiovisuals]", - "Guiseppe Bilotta (Oblomov) <guiseppe.bilotta@gmail.com> [Fixes]", - "matttpt <matttpt@gmail.com> [Fixes]", "Nils Dagsson Moskopp (erlehmann) <nils@dieweltistgarnichtso.net> [Minetest Logo]", + "Dániel Juhász (juhdanad) <juhdanad@gmail.com>", + "red-001 <red-001@outlook.ie>", + "numberZero [Audiovisuals: meshgen]", + "Giuseppe Bilotta", + "MirceaKitsune <mirceakitsune@gmail.com>", + "Constantin Wenger (SpeedProg)", + "Ciaran Gultnieks (CiaranG)", + "stujones11 [Android UX improvements]", "Jeija <jeija@mesecons.net> [HTTP, particles]", - "bigfoot547 [CSM]", + "Vincent Glize (Dumbeldor) [Cleanups, CSM APIs]", + "Ben Deutsch [Rendering, Fixes, SQLite auth]", + "TeTpaAka [Hand overriding, nametag colors]", + "Rui [Sound Pitch]", + "Duane Robertson <duane@duanerobertson.com> [MGValleys]", + "Raymoo [Tool Capabilities]", "Rogier <rogier777@gmail.com> [Fixes]", + "Gregory Currie (gregorycu) [optimisation]", + "TriBlade9 <triblade9@mail.com> [Audiovisuals]", + "T4im [Profiler]", + "Jurgen Doser (doserj) <jurgen.doser@gmail.com>", } local function buildCreditList(source) diff --git a/builtin/mainmenu/tab_online.lua b/builtin/mainmenu/tab_online.lua index 8733f7618..7985fd84a 100644 --- a/builtin/mainmenu/tab_online.lua +++ b/builtin/mainmenu/tab_online.lua @@ -78,6 +78,7 @@ local function get_formspec(tabview, name, tabdata) "text,align=right,padding=0.25;" .. -- clients_max image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" .. image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" .. + --~ PvP = Player versus Player image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" .. "color,span=1;" .. "text,padding=1]" .. diff --git a/builtin/profiler/instrumentation.lua b/builtin/profiler/instrumentation.lua index 80eed05e8..237f048fb 100644 --- a/builtin/profiler/instrumentation.lua +++ b/builtin/profiler/instrumentation.lua @@ -162,7 +162,7 @@ local function init() "on_activate", "on_step", "on_punch", - "rightclick", + "on_rightclick", "get_staticdata", } -- Wrap register_entity() to instrument them on registration. diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 0ff8066aa..1f2889b45 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -440,7 +440,8 @@ keymap_decrease_viewing_range_min (View range decrease key) key - [**Basic] -# Enable VBO +# Enable vertex buffer objects. +# This should greatly improve graphics performance. enable_vbo (VBO) bool true # Whether to fog out the end of the visible area. @@ -526,7 +527,10 @@ shader_path (Shader path) path [***Tone Mapping] -# Enables filmic tone mapping +# Enables Hable's 'Uncharted 2' filmic tone mapping. +# Simulates the tone curve of photographic film and how this approximates the +# appearance of high dynamic range images. Mid-range contrast is slightly +# enhanced, highlights and shadows are gradually compressed. tone_mapping (Filmic tone mapping) bool false [***Bumpmapping] @@ -571,21 +575,31 @@ parallax_occlusion_bias (Parallax occlusion bias) float 0.04 [***Waving Nodes] -# Set to true enables waving water. +# Set to true to enable waving liquids (like water). # Requires shaders to be enabled. -enable_waving_water (Waving water) bool false +enable_waving_water (Waving liquids) bool false -water_wave_height (Waving water wave height) float 1.0 +# The maximum height of the surface of waving liquids. +# 4.0 = Wave height is two nodes. +# 0.0 = Wave doesn't move at all. +# Default is 1.0 (1/2 node). +# Requires waving liquids to be enabled. +water_wave_height (Waving liquids wave height) float 1.0 0.0 4.0 -water_wave_length (Waving water wavelength) float 20.0 +# Length of liquid waves. +# Requires waving liquids to be enabled. +water_wave_length (Waving liquids wavelength) float 20.0 0.1 -water_wave_speed (Waving water wave speed) float 5.0 +# How fast liquid waves will move. Higher = faster. +# If negative, liquid waves will move backwards. +# Requires waving liquids to be enabled. +water_wave_speed (Waving liquids wave speed) float 5.0 -# Set to true enables waving leaves. +# Set to true to enable waving leaves. # Requires shaders to be enabled. enable_waving_leaves (Waving leaves) bool false -# Set to true enables waving plants. +# Set to true to enable waving plants. # Requires shaders to be enabled. enable_waving_plants (Waving plants) bool false @@ -609,11 +623,11 @@ 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 clipping plane' distance in nodes, between 0 and 0.5. -# Most users will not need to change this. +# Camera 'near clipping plane' distance in nodes, between 0 and 0.25 +# Only works on GLES platforms. 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 clipping plane) float 0.1 0 0.5 +near_plane (Near plane) float 0.1 0 0.25 # Width component of the initial window size. screen_w (Screen width) int 1024 1 @@ -636,25 +650,34 @@ vsync (VSync) bool false # Field of view in degrees. 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 10.0 +# Alters the light curve by applying 'gamma correction' to it. +# Higher values make middle and lower light levels brighter. +# Value '1.0' leaves the light curve unaltered. +# This only has significant effect on daylight and artificial +# light, it has very little effect on natural night light. +display_gamma (Light curve gamma) float 1.0 0.33 3.0 # Gradient of light curve at minimum light level. -lighting_alpha (Darkness sharpness) float 0.0 0.0 4.0 +# Controls the contrast of the lowest light levels. +lighting_alpha (Light curve low gradient) float 0.0 0.0 3.0 # Gradient of light curve at maximum light level. -lighting_beta (Lightness sharpness) float 1.5 0.0 4.0 +# Controls the contrast of the highest light levels. +lighting_beta (Light curve high gradient) float 1.5 0.0 3.0 -# Strength of light curve mid-boost. -lighting_boost (Light curve mid boost) float 0.2 0.0 1.0 +# Strength of light curve boost. +# The 3 'boost' parameters define a range of the light +# curve that is boosted in brightness. +lighting_boost (Light curve boost) float 0.2 0.0 0.4 -# Center of light curve mid-boost. -lighting_boost_center (Light curve mid boost center) float 0.5 0.0 1.0 +# Center of light curve boost range. +# Where 0.0 is minimum light level, 1.0 is maximum light level. +lighting_boost_center (Light curve boost center) float 0.5 0.0 1.0 -# Spread of light curve mid-boost. -# Standard deviation of the mid-boost gaussian. -lighting_boost_spread (Light curve mid boost spread) float 0.2 0.0 1.0 +# Spread of light curve boost range. +# Controls the width of the range to be boosted. +# Standard deviation of the light curve boost Gaussian. +lighting_boost_spread (Light curve boost spread) float 0.2 0.0 0.4 # Path to texture directory. All textures are first searched from here. texture_path (Texture path) path @@ -756,7 +779,7 @@ minimap_shape_round (Round minimap) bool true # True = 256 # False = 128 -# Useable to make minimap smoother on slower machines. +# Usable to make minimap smoother on slower machines. minimap_double_scan_height (Minimap scan height) bool true # Make fog and sky colors depend on daytime (dawn/sunset) and view direction. @@ -826,29 +849,60 @@ tooltip_show_delay (Tooltip delay) int 400 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 -# Path to TrueTypeFont or bitmap. -font_path (Font path) filepath fonts/liberationsans.ttf +font_bold (Font bold by default) bool false -font_size (Font size) int 16 1 +font_italic (Font italic by default) bool false -# Font shadow offset, if 0 then shadow will not be drawn. +# Shadow offset (in pixels) of the default font. If 0, then shadow will not be drawn. font_shadow (Font shadow) int 1 -# Font shadow alpha (opaqueness, between 0 and 255). +# Opaqueness (alpha) of the shadow behind the default font, between 0 and 255. font_shadow_alpha (Font shadow alpha) int 127 0 255 -mono_font_path (Monospace font path) filepath fonts/liberationmono.ttf +# Font size of the default font in point (pt). +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. +# The fallback font will be used if the font cannot be loaded. +font_path (Regular font path) filepath fonts/Arimo-Regular.ttf +font_path_bold (Bold font path) filepath fonts/Arimo-Bold.ttf +font_path_italic (Italic font path) filepath fonts/Arimo-Italic.ttf +font_path_bolditalic (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 -# This font will be used for certain languages. -fallback_font_path (Fallback font) filepath fonts/DroidSansFallbackFull.ttf +# 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. +# This font is used for e.g. the console and profiler screen. +mono_font_path (Monospace font path) filepath fonts/Cousine-Regular.ttf + +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_bolditalic (Bold and italic monospace font path) filepath fonts/Cousine-BoldItalic.ttf + +# Font size of the fallback font in point (pt). fallback_font_size (Fallback font size) int 15 1 + +# Shadow offset (in pixels) of the fallback font. If 0, then shadow will not be drawn. fallback_font_shadow (Fallback font shadow) int 1 + +# Opaqueness (alpha) of the shadow behind the fallback font, between 0 and 255. fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255 +# 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. +# 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 + # Path to save screenshots at. screenshot_path (Screenshot folder) path @@ -871,10 +925,20 @@ enable_console (Enable console window) bool false [Sound] +# Enables the sound system. +# If disabled, this completely disables all sounds everywhere and the in-game +# sound controls will be non-functional. +# Changing this setting requires a restart. enable_sound (Sound) bool true +# Volume of all sounds. +# Requires the sound system to be enabled. sound_volume (Volume) float 0.7 0.0 1.0 +# Whether to mute sounds. You can unmute sounds at any time, unless the +# sound system is disabled (enable_sound=false). +# In-game, you can toggle the mute state with the mute key or by using the +# pause menu. mute_sound (Mute sound) bool false [Client] @@ -975,6 +1039,7 @@ remote_media (Remote media) string # Enable/disable running an IPv6 server. # Ignored if bind_address is set. +# Needs enable_ipv6 to be enabled. ipv6_server (IPv6 server) bool false [**Advanced] @@ -1145,10 +1210,10 @@ 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. +# Decrease this to increase liquid resistance to movement. movement_liquid_fluidity (Liquid fluidity) float 1 -# Maximum liquid resistence. Controls deceleration when entering liquid at +# Maximum liquid resistance. Controls deceleration when entering liquid at # high speed. movement_liquid_fluidity_smooth (Liquid fluidity smoothing) float 0.5 @@ -1160,7 +1225,7 @@ movement_gravity (Gravity) float 9.81 [**Advanced] -# Handling for deprecated lua api calls: +# Handling for deprecated Lua API calls: # - legacy: (try to) mimic old behaviour (default for release). # - log: mimic and log backtrace of deprecated call (default for debug). # - error: abort on usage of deprecated call (suggested for mod developers). @@ -1307,8 +1372,7 @@ name (Player name) string # Set the language. Leave empty to use the system language. # A restart is required after changing this. -language (Language) enum ,be,ca,cs,da,de,dv,en,eo,es,et,fr,he,hu,id,it,ja,jbo,ko,ky,lt,ms,nb,nl,pl,pt,pt_BR,ro,ru,sl,sr_Cyrl,sv,sw,tr,uk,zh_CN,zh_TW - +language (Language) enum ,ar,ca,cs,da,de,dv,el,eo,es,et,eu,fil,fr,hu,id,it,ja,ja_KS,jbo,kk,kn,lo,lt,ms,my,nb,nl,nn,pl,pt,pt_BR,ro,ru,sl,sr_Cyrl,sv,sw,th,tr,uk,vi # Level of logging to be written to debug.txt: # - <nothing> (no logging) @@ -1326,7 +1390,8 @@ debug_log_level (Debug log level) enum action ,none,error,warning,action,info,ve # 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 support (for both client and server). +# Required for IPv6 connections to work at all. enable_ipv6 (IPv6) bool true [*Advanced] @@ -1405,14 +1470,27 @@ mg_biome_np_humidity_blend (Humidity blend noise) noise_params_2d 0, 1.5, (8, 8, mgv5_spflags (Mapgen V5 specific flags) flags caverns caverns,nocaverns # Controls width of tunnels, a smaller value creates wider tunnels. +# Value >= 10.0 completely disables generation of tunnels and avoids the +# intensive noise calculations. 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 +# Minimum limit of random number of small caves per mapchunk. +mgv5_small_cave_num_min (Small cave minimum number) int 0 0 256 + +# Maximum limit of random number of small caves per mapchunk. +mgv5_small_cave_num_max (Small cave maximum number) int 0 0 256 + +# Minimum limit of random number of large caves per mapchunk. +mgv5_large_cave_num_min (Large cave minimum number) int 0 0 64 + +# Maximum limit of random number of large caves per mapchunk. +mgv5_large_cave_num_max (Large cave maximum number) int 2 0 64 + +# Proportion of large caves that contain liquid. +mgv5_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0 # Y-level of cavern upper limit. mgv5_cavern_limit (Cavern limit) int -256 @@ -1522,30 +1600,27 @@ mgv7_spflags (Mapgen V7 specific flags) flags mountains,ridges,nofloatlands,cave mgv7_mount_zero_level (Mountain zero level) int 0 # Controls width of tunnels, a smaller value creates wider tunnels. +# Value >= 10.0 completely disables generation of tunnels and avoids the +# intensive noise calculations. 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 - -# Controls the density of mountain-type floatlands. -# Is a noise offset added to the 'mgv7_np_mountain' noise value. -mgv7_float_mount_density (Floatland mountain density) float 0.6 +# Minimum limit of random number of small caves per mapchunk. +mgv7_small_cave_num_min (Small cave minimum number) int 0 0 256 -# Typical maximum height, above and below midpoint, of floatland mountains. -mgv7_float_mount_height (Floatland mountain height) float 128.0 +# Maximum limit of random number of small caves per mapchunk. +mgv7_small_cave_num_max (Small cave maximum number) int 0 0 256 -# Alters how mountain-type floatlands taper above and below midpoint. -mgv7_float_mount_exponent (Floatland mountain exponent) float 0.75 +# Minimum limit of random number of large caves per mapchunk. +mgv7_large_cave_num_min (Large cave minimum number) int 0 0 64 -# Y-level of floatland midpoint and lake surface. -mgv7_floatland_level (Floatland level) int 1280 +# Maximum limit of random number of large caves per mapchunk. +mgv7_large_cave_num_max (Large cave maximum number) int 2 0 64 -# Y-level to which floatland shadows extend. -mgv7_shadow_limit (Shadow limit) int 1024 +# Proportion of large caves that contain liquid. +mgv7_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0 # Y-level of cavern upper limit. mgv7_cavern_limit (Cavern limit) int -256 @@ -1586,13 +1661,6 @@ mgv7_np_mount_height (Mountain height noise) noise_params_2d 256, 112, (1000, 10 # Defines large-scale river channel structure. mgv7_np_ridge_uwater (Ridge underwater noise) noise_params_2d 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0, eased -# Defines areas of floatland smooth terrain. -# Smooth floatlands occur when noise > 0. -mgv7_np_floatland_base (Floatland base noise) noise_params_2d -0.6, 1.5, (600, 600, 600), 114, 5, 0.6, 2.0, eased - -# Variation of hill height and lake depth on floatland smooth terrain. -mgv7_np_float_base_height (Floatland base height noise) noise_params_2d 48, 24, (300, 300, 300), 907, 4, 0.7, 2.0, eased - # 3D noise defining mountain structure and height. # Also defines structure of floatland mountain terrain. mgv7_np_mountain (Mountain noise) noise_params_3d -0.6, 1, (250, 350, 250), 5333, 5, 0.63, 2.0 @@ -1630,14 +1698,27 @@ mgcarpathian_river_depth (River channel depth) float 24.0 mgcarpathian_valley_width (River valley width) float 0.25 # Controls width of tunnels, a smaller value creates wider tunnels. +# Value >= 10.0 completely disables generation of tunnels and avoids the +# intensive noise calculations. 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 +# Minimum limit of random number of small caves per mapchunk. +mgcarpathian_small_cave_num_min (Small cave minimum number) int 0 0 256 + +# Maximum limit of random number of small caves per mapchunk. +mgcarpathian_small_cave_num_max (Small cave maximum number) int 0 0 256 + +# Minimum limit of random number of large caves per mapchunk. +mgcarpathian_large_cave_num_min (Large cave minimum number) int 0 0 64 + +# Maximum limit of random number of large caves per mapchunk. +mgcarpathian_large_cave_num_max (Large cave maximum number) int 2 0 64 + +# Proportion of large caves that contain liquid. +mgcarpathian_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0 # Y-level of cavern upper limit. mgcarpathian_cavern_limit (Cavern limit) int -256 @@ -1709,7 +1790,7 @@ mgcarpathian_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 50 [*Mapgen Flat] -# Map generation attributes specific to Mapgen flat. +# Map generation attributes specific to Mapgen Flat. # Occasional lakes and hills can be added to the flat world. mgflat_spflags (Mapgen Flat specific flags) flags nolakes,nohills lakes,hills,nolakes,nohills @@ -1719,11 +1800,24 @@ 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 +# Minimum limit of random number of small caves per mapchunk. +mgflat_small_cave_num_min (Small cave minimum number) int 0 0 256 + +# Maximum limit of random number of small caves per mapchunk. +mgflat_small_cave_num_max (Small cave maximum number) int 0 0 256 + +# Minimum limit of random number of large caves per mapchunk. +mgflat_large_cave_num_min (Large cave minimum number) int 0 0 64 + +# Maximum limit of random number of large caves per mapchunk. +mgflat_large_cave_num_max (Large cave maximum number) int 2 0 64 + +# Proportion of large caves that contain liquid. +mgflat_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0 # Controls width of tunnels, a smaller value creates wider tunnels. +# Value >= 10.0 completely disables generation of tunnels and avoids the +# intensive noise calculations. mgflat_cave_width (Cave width) float 0.09 # Terrain noise threshold for lakes. @@ -1767,20 +1861,33 @@ mgflat_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, [*Mapgen Fractal] -# Map generation attributes specific to Mapgen flat. +# Map generation attributes specific to Mapgen Fractal. # '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. +# Value >= 10.0 completely disables generation of tunnels and avoids the +# intensive noise calculations. 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 +# Minimum limit of random number of small caves per mapchunk. +mgfractal_small_cave_num_min (Small cave minimum number) int 0 0 256 + +# Maximum limit of random number of small caves per mapchunk. +mgfractal_small_cave_num_max (Small cave maximum number) int 0 0 256 + +# Minimum limit of random number of large caves per mapchunk. +mgfractal_large_cave_num_min (Large cave minimum number) int 0 0 64 + +# Maximum limit of random number of large caves per mapchunk. +mgfractal_large_cave_num_max (Large cave maximum number) int 2 0 64 + +# Proportion of large caves that contain liquid. +mgfractal_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0 # Lower Y limit of dungeons. mgfractal_dungeon_ymin (Dungeon minimum Y) int -31000 @@ -1789,24 +1896,24 @@ mgfractal_dungeon_ymin (Dungeon minimum Y) int -31000 mgfractal_dungeon_ymax (Dungeon maximum Y) int 31000 # Selects one of 18 fractal types. -# 1 = 4D "Roundy" mandelbrot set. -# 2 = 4D "Roundy" julia set. -# 3 = 4D "Squarry" mandelbrot set. -# 4 = 4D "Squarry" julia set. -# 5 = 4D "Mandy Cousin" mandelbrot set. -# 6 = 4D "Mandy Cousin" julia set. -# 7 = 4D "Variation" mandelbrot set. -# 8 = 4D "Variation" julia set. -# 9 = 3D "Mandelbrot/Mandelbar" mandelbrot set. -# 10 = 3D "Mandelbrot/Mandelbar" julia set. -# 11 = 3D "Christmas Tree" mandelbrot set. -# 12 = 3D "Christmas Tree" julia set. -# 13 = 3D "Mandelbulb" mandelbrot set. -# 14 = 3D "Mandelbulb" julia set. -# 15 = 3D "Cosine Mandelbulb" mandelbrot set. -# 16 = 3D "Cosine Mandelbulb" julia set. -# 17 = 4D "Mandelbulb" mandelbrot set. -# 18 = 4D "Mandelbulb" julia set. +# 1 = 4D "Roundy" Mandelbrot set. +# 2 = 4D "Roundy" Julia set. +# 3 = 4D "Squarry" Mandelbrot set. +# 4 = 4D "Squarry" Julia set. +# 5 = 4D "Mandy Cousin" Mandelbrot set. +# 6 = 4D "Mandy Cousin" Julia set. +# 7 = 4D "Variation" Mandelbrot set. +# 8 = 4D "Variation" Julia set. +# 9 = 3D "Mandelbrot/Mandelbar" Mandelbrot set. +# 10 = 3D "Mandelbrot/Mandelbar" Julia set. +# 11 = 3D "Christmas Tree" Mandelbrot set. +# 12 = 3D "Christmas Tree" Julia set. +# 13 = 3D "Mandelbulb" Mandelbrot set. +# 14 = 3D "Mandelbulb" Julia set. +# 15 = 3D "Cosine Mandelbulb" Mandelbrot set. +# 16 = 3D "Cosine Mandelbulb" Julia set. +# 17 = 4D "Mandelbulb" Mandelbrot set. +# 18 = 4D "Mandelbulb" Julia set. mgfractal_fractal (Fractal type) int 1 1 18 # Iterations of the recursive function. @@ -1828,7 +1935,7 @@ mgfractal_scale (Scale) v3f (4096.0, 1024.0, 4096.0) # Can be used to move a desired point to (0, 0) to create a # suitable spawn point, or to allow 'zooming in' on a desired # point by increasing 'scale'. -# The default is tuned for a suitable spawn point for mandelbrot +# The default is tuned for a suitable spawn point for Mandelbrot # sets with default parameters, it may need altering in other # situations. # Range roughly -2 to 2. Multiply by 'scale' for offset in nodes. @@ -1901,9 +2008,20 @@ 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 +# Minimum limit of random number of small caves per mapchunk. +mgvalleys_small_cave_num_min (Small cave minimum number) int 0 0 256 + +# Maximum limit of random number of small caves per mapchunk. +mgvalleys_small_cave_num_max (Small cave maximum number) int 0 0 256 + +# Minimum limit of random number of large caves per mapchunk. +mgvalleys_large_cave_num_min (Large cave minimum number) int 0 0 64 + +# Maximum limit of random number of large caves per mapchunk. +mgvalleys_large_cave_num_max (Large cave maximum number) int 2 0 64 + +# Proportion of large caves that contain liquid. +mgvalleys_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0 # Depth below which you'll find giant caverns. mgvalleys_cavern_limit (Cavern upper limit) int -256 @@ -1921,6 +2039,8 @@ mgvalleys_river_depth (River depth) int 4 mgvalleys_river_size (River size) int 5 # Controls width of tunnels, a smaller value creates wider tunnels. +# Value >= 10.0 completely disables generation of tunnels and avoids the +# intensive noise calculations. mgvalleys_cave_width (Cave width) float 0.09 # Lower Y limit of dungeons. |