diff --git a/README.md b/README.md deleted file mode 100644 index 6e12fd9..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# BlockColor - BlockColor is a creative sandbox with only 8 colors. Only a limit : Your Imagination. (Made with Minetest Engine) diff --git a/bin/blockcolor.exe b/bin/blockcolor.exe index 9f49710..c300378 100644 Binary files a/bin/blockcolor.exe and b/bin/blockcolor.exe differ diff --git a/bin/libcurl-4.dll b/bin/libcurl-4.dll index 6feba87..07a4be4 100644 Binary files a/bin/libcurl-4.dll and b/bin/libcurl-4.dll differ diff --git a/bin/libfreetype-6.dll b/bin/libfreetype-6.dll index 84c74d9..95179c8 100644 Binary files a/bin/libfreetype-6.dll and b/bin/libfreetype-6.dll differ diff --git a/bin/libleveldb.dll b/bin/libleveldb.dll index 71a2619..e207110 100644 Binary files a/bin/libleveldb.dll and b/bin/libleveldb.dll differ diff --git a/bin/libsqlite3-0.dll b/bin/libsqlite3-0.dll index d1ac7ab..c6f2512 100644 Binary files a/bin/libsqlite3-0.dll and b/bin/libsqlite3-0.dll differ diff --git a/bin/screenshot_20190712_171610.png b/bin/screenshot_20190712_171610.png new file mode 100644 index 0000000..6c22345 Binary files /dev/null and b/bin/screenshot_20190712_171610.png differ diff --git a/bin/screenshot_20190712_171723.png b/bin/screenshot_20190712_171723.png new file mode 100644 index 0000000..6c2b3cd Binary files /dev/null and b/bin/screenshot_20190712_171723.png differ diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index 2b8cc4a..201ca4a 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -1,7 +1,7 @@ -- Minetest: builtin/client/chatcommands.lua -core.register_on_sending_chat_messages(function(message) +core.register_on_sending_chat_message(function(message) if message:sub(1,2) == ".." then return false end @@ -40,8 +40,13 @@ end) core.register_chatcommand("list_players", { description = core.gettext("List online players"), func = function(param) - local players = table.concat(core.get_player_names(), ", ") - core.display_chat_message(core.gettext("Online players: ") .. players) + local player_names = core.get_player_names() + if not player_names then + return false, core.gettext("This command is disabled by server.") + end + + local players = table.concat(player_names, ", ") + return true, core.gettext("Online players: ") .. players end }) diff --git a/builtin/client/death_formspec.lua b/builtin/client/death_formspec.lua new file mode 100644 index 0000000..e755ac5 --- /dev/null +++ b/builtin/client/death_formspec.lua @@ -0,0 +1,16 @@ +-- CSM death formspec. Only used when clientside modding is enabled, otherwise +-- handled by the engine. + +core.register_on_death(function() + core.display_chat_message("You died.") + local formspec = "size[11,5.5]bgcolor[#320000b4;true]" .. + "label[4.85,1.35;" .. fgettext("You died") .. + "]button_exit[4,3;3,0.5;btn_respawn;".. fgettext("Respawn") .."]" + core.show_formspec("bultin:death", formspec) +end) + +core.register_on_formspec_input(function(formname, fields) + if formname == "bultin:death" then + core.send_respawn() + end +end) diff --git a/builtin/client/init.lua b/builtin/client/init.lua index 3ac34d8..9633a7c 100644 --- a/builtin/client/init.lua +++ b/builtin/client/init.lua @@ -1,5 +1,5 @@ -- Minetest: builtin/client/init.lua -local scriptpath = core.get_builtin_path()..DIR_DELIM +local scriptpath = core.get_builtin_path() local clientpath = scriptpath.."client"..DIR_DELIM local commonpath = scriptpath.."common"..DIR_DELIM @@ -8,16 +8,4 @@ dofile(commonpath .. "after.lua") dofile(commonpath .. "chatcommands.lua") dofile(clientpath .. "chatcommands.lua") dofile(commonpath .. "vector.lua") - -core.register_on_death(function() - core.display_chat_message("You died.") - local formspec = "size[11,5.5]bgcolor[#320000b4;true]" .. - "label[4.85,1.35;" .. fgettext("You died.") .. "]button_exit[4,3;3,0.5;btn_respawn;".. fgettext("Respawn") .."]" - core.show_formspec("bultin:death", formspec) -end) - -core.register_on_formspec_input(function(formname, fields) - if formname == "bultin:death" then - core.send_respawn() - end -end) +dofile(clientpath .. "death_formspec.lua") diff --git a/builtin/client/register.lua b/builtin/client/register.lua index 6b12dde..c1b4965 100644 --- a/builtin/client/register.lua +++ b/builtin/client/register.lua @@ -59,10 +59,10 @@ local function make_registration() end core.registered_globalsteps, core.register_globalstep = make_registration() +core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration() core.registered_on_shutdown, core.register_on_shutdown = make_registration() -core.registered_on_connect, core.register_on_connect = make_registration() -core.registered_on_receiving_chat_messages, core.register_on_receiving_chat_messages = make_registration() -core.registered_on_sending_chat_messages, core.register_on_sending_chat_messages = make_registration() +core.registered_on_receiving_chat_message, core.register_on_receiving_chat_message = make_registration() +core.registered_on_sending_chat_message, core.register_on_sending_chat_message = make_registration() core.registered_on_death, core.register_on_death = make_registration() core.registered_on_hp_modification, core.register_on_hp_modification = make_registration() core.registered_on_damage_taken, core.register_on_damage_taken = make_registration() @@ -71,3 +71,6 @@ core.registered_on_dignode, core.register_on_dignode = make_registration() core.registered_on_punchnode, core.register_on_punchnode = make_registration() core.registered_on_placenode, core.register_on_placenode = make_registration() core.registered_on_item_use, core.register_on_item_use = make_registration() +core.registered_on_modchannel_message, core.register_on_modchannel_message = make_registration() +core.registered_on_modchannel_signal, core.register_on_modchannel_signal = make_registration() +core.registered_on_inventory_open, core.register_on_inventory_open = make_registration() diff --git a/builtin/common/chatcommands.lua b/builtin/common/chatcommands.lua index e8955c6..52edda6 100644 --- a/builtin/common/chatcommands.lua +++ b/builtin/common/chatcommands.lua @@ -97,7 +97,7 @@ end if INIT == "client" then core.register_chatcommand("help", { - params = gettext("[all/]"), + params = gettext("[all | ]"), description = gettext("Get help for commands"), func = function(param) return do_help_cmd(nil, param) @@ -105,7 +105,7 @@ if INIT == "client" then }) else core.register_chatcommand("help", { - params = "[all/privs/]", + params = "[all | privs | ]", description = "Get help for commands or list privileges", func = do_help_cmd, }) diff --git a/builtin/common/filterlist.lua b/builtin/common/filterlist.lua index 5622311..1ba1d87 100644 --- a/builtin/common/filterlist.lua +++ b/builtin/common/filterlist.lua @@ -47,17 +47,17 @@ function filterlist.create(raw_fct,compare_fct,uid_match_fct,filter_fct,fetch_pa assert((raw_fct ~= nil) and (type(raw_fct) == "function")) assert((compare_fct ~= nil) and (type(compare_fct) == "function")) - + local self = {} - + self.m_raw_list_fct = raw_fct self.m_compare_fct = compare_fct self.m_filter_fct = filter_fct self.m_uid_match_fct = uid_match_fct - + self.m_filtercriteria = nil self.m_fetch_param = fetch_param - + self.m_sortmode = "none" self.m_sort_list = {} @@ -79,7 +79,7 @@ function filterlist.create(raw_fct,compare_fct,uid_match_fct,filter_fct,fetch_pa self.refresh = filterlist.refresh filterlist.process(self) - + return self end @@ -128,49 +128,49 @@ function filterlist.get_raw_element(self,idx) if type(idx) ~= "number" then idx = tonumber(idx) end - + if idx ~= nil and idx > 0 and idx <= #self.m_raw_list then return self.m_raw_list[idx] end - + return nil end -------------------------------------------------------------------------------- function filterlist.get_raw_index(self,listindex) assert(self.m_processed_list ~= nil) - + if listindex ~= nil and listindex > 0 and listindex <= #self.m_processed_list then local entry = self.m_processed_list[listindex] - + for i,v in ipairs(self.m_raw_list) do - + if self.m_compare_fct(v,entry) then return i end end end - + return 0 end -------------------------------------------------------------------------------- function filterlist.get_current_index(self,listindex) assert(self.m_processed_list ~= nil) - + if listindex ~= nil and listindex > 0 and listindex <= #self.m_raw_list then local entry = self.m_raw_list[listindex] - + for i,v in ipairs(self.m_processed_list) do - + if self.m_compare_fct(v,entry) then return i end end end - + return 0 end @@ -183,23 +183,23 @@ function filterlist.process(self) self.m_processed_list = self.m_raw_list return end - + self.m_processed_list = {} - + for k,v in pairs(self.m_raw_list) do if self.m_filtercriteria == nil or self.m_filter_fct(v,self.m_filtercriteria) then self.m_processed_list[#self.m_processed_list + 1] = v end end - + if self.m_sortmode == "none" then return end - + if self.m_sort_list[self.m_sortmode] ~= nil and type(self.m_sort_list[self.m_sortmode]) == "function" then - + self.m_sort_list[self.m_sortmode](self) end end @@ -209,7 +209,7 @@ function filterlist.size(self) if self.m_processed_list == nil then return 0 end - + return #self.m_processed_list end @@ -233,8 +233,8 @@ function filterlist.raw_index_by_uid(self, uid) elementidx = i end end - - + + -- If there are more elements than one with same name uid can't decide which -- one is meant. self shouldn't be possible but just for sure. if elementcount > 1 then @@ -254,11 +254,11 @@ function compare_worlds(world1,world2) if world1.path ~= world2.path then return false end - + if world1.name ~= world2.name then return false end - + if world1.gameid ~= world2.gameid then return false end @@ -288,11 +288,11 @@ function sort_mod_list(self) table.sort(self.m_processed_list, function(a, b) -- Show game mods at bottom - if a.typ ~= b.typ then - if b.typ == "game" then - return a.typ ~= "game_mod" + if a.type ~= b.type or a.loc ~= b.loc then + if b.type == "game" then + return a.loc ~= "game" end - return b.typ == "game_mod" + return b.loc == "game" end -- If in same or no modpack, sort by name if a.modpack == b.modpack then @@ -308,7 +308,7 @@ function sort_mod_list(self) elseif b.name == a.modpack then return false end - + local name_a = a.modpack or a.name local name_b = b.modpack or b.name if name_a:lower() == name_b:lower() then diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index aad5f2d..e250b0e 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -166,9 +166,9 @@ end -------------------------------------------------------------------------------- function string.split(str, delim, include_empty, max_splits, sep_is_pattern) delim = delim or "," - max_splits = max_splits or -1 + max_splits = max_splits or -2 local items = {} - local pos, len, seplen = 1, #str, #delim + local pos, len = 1, #str local plain = not sep_is_pattern max_splits = max_splits + 1 repeat @@ -382,7 +382,7 @@ if INIT == "game" then param2 = dirs1[fdir + 1] elseif isceiling then if orient_flags.force_facedir then - cparam2 = 20 + param2 = 20 else param2 = dirs2[fdir + 1] end @@ -462,6 +462,12 @@ function core.explode_scrollbar_event(evt) return retval end +-------------------------------------------------------------------------------- +function core.rgba(r, g, b, a) + return a and string.format("#%02X%02X%02X%02X", r, g, b, a) or + string.format("#%02X%02X%02X", r, g, b) +end + -------------------------------------------------------------------------------- function core.pos_to_string(pos, decimal_places) local x = pos.x @@ -489,7 +495,7 @@ function core.string_to_pos(value) p.z = tonumber(p.z) return p end - local p = {} + p = {} p.x, p.y, p.z = string.match(value, "^%( *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) *%)$") if p.x and p.y and p.z then p.x = tonumber(p.x) @@ -545,12 +551,22 @@ function table.copy(t, seen) end return n end + + +function table.insert_all(t, other) + for i=1, #other do + t[#t + 1] = other[i] + end + return t +end + + -------------------------------------------------------------------------------- -- mainmenu only functions -------------------------------------------------------------------------------- if INIT == "mainmenu" then function core.get_game(index) - local games = game.get_games() + local games = core.get_games() if index > 0 and index <= #games then return games[index] @@ -625,10 +641,57 @@ function core.strip_colors(str) return (str:gsub(ESCAPE_CHAR .. "%([bc]@[^)]+%)", "")) end +function core.translate(textdomain, str, ...) + local start_seq + if textdomain == "" then + start_seq = ESCAPE_CHAR .. "T" + else + start_seq = ESCAPE_CHAR .. "(T@" .. textdomain .. ")" + end + local arg = {n=select('#', ...), ...} + local end_seq = ESCAPE_CHAR .. "E" + local arg_index = 1 + local translated = str:gsub("@(.)", function(matched) + local c = string.byte(matched) + if string.byte("1") <= c and c <= string.byte("9") then + local a = c - string.byte("0") + if a ~= arg_index then + error("Escape sequences in string given to core.translate " .. + "are not in the correct order: got @" .. matched .. + "but expected @" .. tostring(arg_index)) + end + if a > arg.n then + error("Not enough arguments provided to core.translate") + end + arg_index = arg_index + 1 + return ESCAPE_CHAR .. "F" .. arg[a] .. ESCAPE_CHAR .. "E" + elseif matched == "n" then + return "\n" + else + return matched + end + end) + if arg_index < arg.n + 1 then + error("Too many arguments provided to core.translate") + end + return start_seq .. translated .. end_seq +end + +function core.get_translator(textdomain) + return function(str, ...) return core.translate(textdomain or "", str, ...) end +end + -------------------------------------------------------------------------------- -- Returns the exact coordinate of a pointed surface -------------------------------------------------------------------------------- function core.pointed_thing_to_face_pos(placer, pointed_thing) + -- Avoid crash in some situations when player is inside a node, causing + -- 'above' to equal 'under'. + if vector.equals(pointed_thing.above, pointed_thing.under) then + return pointed_thing.under + end + + local eye_height = placer:get_properties().eye_height local eye_offset_first = placer:get_eye_offset() local node_pos = pointed_thing.under local camera_pos = placer:get_pos() @@ -648,7 +711,7 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing) end local fine_pos = {[nc] = node_pos[nc] + offset} - camera_pos.y = camera_pos.y + 1.625 + eye_offset_first.y / 10 + camera_pos.y = camera_pos.y + eye_height + eye_offset_first.y / 10 local f = (node_pos[nc] + offset - camera_pos[nc]) / look_dir[nc] for i = 1, #oc do @@ -656,3 +719,28 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing) end return fine_pos end + +function core.string_to_privs(str, delim) + assert(type(str) == "string") + delim = delim or ',' + local privs = {} + for _, priv in pairs(string.split(str, delim)) do + privs[priv:trim()] = true + end + return privs +end + +function core.privs_to_string(privs, delim) + assert(type(privs) == "table") + delim = delim or ',' + local list = {} + for priv, bool in pairs(privs) do + if bool then + list[#list + 1] = priv + end + 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/vector.lua b/builtin/common/vector.lua index 0549f9a..c3d380e 100644 --- a/builtin/common/vector.lua +++ b/builtin/common/vector.lua @@ -63,34 +63,13 @@ function vector.distance(a, b) end function vector.direction(pos1, pos2) - local x_raw = pos2.x - pos1.x - local y_raw = pos2.y - pos1.y - local z_raw = pos2.z - pos1.z - local x_abs = math.abs(x_raw) - local y_abs = math.abs(y_raw) - local z_abs = math.abs(z_raw) - if x_abs >= y_abs and - x_abs >= z_abs then - y_raw = y_raw * (1 / x_abs) - z_raw = z_raw * (1 / x_abs) - x_raw = x_raw / x_abs - end - if y_abs >= x_abs and - y_abs >= z_abs then - x_raw = x_raw * (1 / y_abs) - z_raw = z_raw * (1 / y_abs) - y_raw = y_raw / y_abs - end - if z_abs >= y_abs and - z_abs >= x_abs then - x_raw = x_raw * (1 / z_abs) - y_raw = y_raw * (1 / z_abs) - z_raw = z_raw / z_abs - end - return {x=x_raw, y=y_raw, z=z_raw} + return vector.normalize({ + x = pos2.x - pos1.x, + y = pos2.y - pos1.y, + z = pos2.z - pos1.z + }) end - function vector.add(a, b) if type(b) == "table" then return {x = a.x + b.x, diff --git a/builtin/game/auth.lua b/builtin/game/auth.lua index 19af8db..7aedfc8 100644 --- a/builtin/game/auth.lua +++ b/builtin/game/auth.lua @@ -1,100 +1,25 @@ -- Minetest: builtin/auth.lua -- --- Authentication handler +-- Builtin authentication handler -- -function core.string_to_privs(str, delim) - assert(type(str) == "string") - delim = delim or ',' - local privs = {} - for _, priv in pairs(string.split(str, delim)) do - privs[priv:trim()] = true - end - return privs -end - -function core.privs_to_string(privs, delim) - assert(type(privs) == "table") - delim = delim or ',' - local list = {} - for priv, bool in pairs(privs) do - if bool then - list[#list + 1] = priv - end - 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") - -core.auth_file_path = core.get_worldpath().."/auth.txt" -core.auth_table = {} - -local function read_auth_file() - local newtable = {} - local file, errmsg = io.open(core.auth_file_path, 'rb') - if not file then - core.log("info", core.auth_file_path.." could not be opened for reading ("..errmsg.."); assuming new world") - return - end - for line in file:lines() do - if line ~= "" then - local fields = line:split(":", true) - local name, password, privilege_string, last_login = unpack(fields) - last_login = tonumber(last_login) - if not (name and password and privilege_string) then - error("Invalid line in auth.txt: "..dump(line)) - end - local privileges = core.string_to_privs(privilege_string) - newtable[name] = {password=password, privileges=privileges, last_login=last_login} - end - end - io.close(file) - core.auth_table = newtable - core.notify_authentication_modified() -end - -local function save_auth_file() - local newtable = {} - -- Check table for validness before attempting to save - for name, stuff in pairs(core.auth_table) do - assert(type(name) == "string") - assert(name ~= "") - assert(type(stuff) == "table") - assert(type(stuff.password) == "string") - assert(type(stuff.privileges) == "table") - assert(stuff.last_login == nil or type(stuff.last_login) == "number") - end - local content = {} - for name, stuff in pairs(core.auth_table) do - local priv_string = core.privs_to_string(stuff.privileges) - local parts = {name, stuff.password, priv_string, stuff.last_login or ""} - content[#content + 1] = table.concat(parts, ":") - end - if not core.safe_file_write(core.auth_file_path, table.concat(content, "\n")) then - error(core.auth_file_path.." could not be written to") - end -end - -read_auth_file() +-- Make the auth object private, deny access to mods +local core_auth = core.auth +core.auth = nil core.builtin_auth_handler = { get_auth = function(name) assert(type(name) == "string") - -- Figure out what password to use for a new player (singleplayer - -- always has an empty password, otherwise use default, which is - -- usually empty too) - local new_password_hash = "" - -- If not in authentication table, return nil - if not core.auth_table[name] then + local auth_entry = core_auth.read(name) + -- If no such auth found, return nil + if not auth_entry then return nil end -- Figure out what privileges the player should have. -- Take a copy of the privilege table local privileges = {} - for priv, _ in pairs(core.auth_table[name].privileges) do + for priv, _ in pairs(auth_entry.privileges) do privileges[priv] = true end -- If singleplayer, give all privileges except those marked as give_to_singleplayer = false @@ -107,63 +32,125 @@ core.builtin_auth_handler = { -- For the admin, give everything elseif name == core.settings:get("name") then for priv, def in pairs(core.registered_privileges) do - privileges[priv] = true + if def.give_to_admin then + privileges[priv] = true + end end end -- All done return { - password = core.auth_table[name].password, + password = auth_entry.password, privileges = privileges, -- Is set to nil if unknown - last_login = core.auth_table[name].last_login, + last_login = auth_entry.last_login, } end, create_auth = function(name, password) assert(type(name) == "string") assert(type(password) == "string") core.log('info', "Built-in authentication handler adding player '"..name.."'") - core.auth_table[name] = { + return core_auth.create({ + name = name, password = password, privileges = core.string_to_privs(core.settings:get("default_privs")), last_login = os.time(), - } - save_auth_file() + }) + end, + delete_auth = function(name) + assert(type(name) == "string") + local auth_entry = core_auth.read(name) + if not auth_entry then + return false + end + core.log('info', "Built-in authentication handler deleting player '"..name.."'") + return core_auth.delete(name) end, set_password = function(name, password) assert(type(name) == "string") assert(type(password) == "string") - if not core.auth_table[name] then + local auth_entry = core_auth.read(name) + if not auth_entry then core.builtin_auth_handler.create_auth(name, password) else core.log('info', "Built-in authentication handler setting password of player '"..name.."'") - core.auth_table[name].password = password - save_auth_file() + auth_entry.password = password + core_auth.save(auth_entry) end return true end, set_privileges = function(name, privileges) assert(type(name) == "string") assert(type(privileges) == "table") - if not core.auth_table[name] then - core.builtin_auth_handler.create_auth(name, + local auth_entry = core_auth.read(name) + if not auth_entry then + auth_entry = core.builtin_auth_handler.create_auth(name, core.get_password_hash(name, core.settings:get("default_password"))) end - core.auth_table[name].privileges = privileges + + -- Run grant callbacks + for priv, _ in pairs(privileges) do + if not auth_entry.privileges[priv] then + core.run_priv_callbacks(name, priv, nil, "grant") + end + end + + -- Run revoke callbacks + for priv, _ in pairs(auth_entry.privileges) do + if not privileges[priv] then + core.run_priv_callbacks(name, priv, nil, "revoke") + end + end + + auth_entry.privileges = privileges + core_auth.save(auth_entry) core.notify_authentication_modified(name) - save_auth_file() end, reload = function() - read_auth_file() + core_auth.reload() return true end, record_login = function(name) assert(type(name) == "string") - assert(core.auth_table[name]).last_login = os.time() - save_auth_file() + local auth_entry = core_auth.read(name) + assert(auth_entry) + auth_entry.last_login = os.time() + core_auth.save(auth_entry) + end, + iterate = function() + local names = {} + local nameslist = core_auth.list_names() + for k,v in pairs(nameslist) do + names[v] = true + end + return pairs(names) end, } +core.register_on_prejoinplayer(function(name, ip) + if core.registered_auth_handler ~= nil then + return -- Don't do anything if custom auth handler registered + end + local auth_entry = core_auth.read(name) + if auth_entry ~= nil then + return + end + + local name_lower = name:lower() + for k in core.builtin_auth_handler.iterate() do + if k:lower() == name_lower then + return string.format("\nCannot create new player called '%s'. ".. + "Another account called '%s' is already registered. ".. + "Please check the spelling if it's your account ".. + "or use a different nickname.", name, k) + end + end +end) + +-- +-- Authentication API +-- + function core.register_authentication_handler(handler) if core.registered_auth_handler then error("Add-on authentication handler already registered by "..core.registered_auth_handler_modname) @@ -189,28 +176,10 @@ end core.set_player_password = auth_pass("set_password") core.set_player_privs = auth_pass("set_privileges") +core.remove_player_auth = auth_pass("delete_auth") core.auth_reload = auth_pass("reload") - local record_login = auth_pass("record_login") - core.register_on_joinplayer(function(player) record_login(player:get_player_name()) end) - -core.register_on_prejoinplayer(function(name, ip) - local auth = core.auth_table - if auth[name] ~= nil then - return - end - - local name_lower = name:lower() - for k in pairs(auth) do - if k:lower() == name_lower then - return string.format("\nCannot create new player called '%s'. ".. - "Another account called '%s' is already registered. ".. - "Please check the spelling if it's your account ".. - "or use a different nickname.", name, k) - end - end -end) diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 3bd8f2f..60d5d47 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -41,7 +41,7 @@ end) if core.settings:get_bool("profiler.load") then -- Run after register_chatcommand and its register_on_chat_message - -- Before any chattcommands that should be profiled + -- Before any chatcommands that should be profiled profiler.init_chatcommand() end @@ -71,7 +71,7 @@ end -- core.register_chatcommand("me", { params = "", - description = "Display chat action (e.g., '/me orders a pizza' displays" + description = "Show chat action (e.g., '/me orders a pizza' displays" .. " ' orders a pizza')", privs = {shout=true}, func = function(name, param) @@ -82,9 +82,9 @@ core.register_chatcommand("me", { core.register_chatcommand("admin", { description = "Show the name of the server owner", func = function(name) - local admin = minetest.settings:get("name") + local admin = core.settings:get("name") if admin then - return true, "The administrator of this server is "..admin.."." + return true, "The administrator of this server is " .. admin .. "." else return false, "There's no administrator named in the config file." end @@ -92,19 +92,47 @@ core.register_chatcommand("admin", { }) core.register_chatcommand("privs", { - params = "", - description = "Print privileges of player", + params = "[]", + description = "Show privileges of yourself or another player", func = function(caller, param) param = param:trim() local name = (param ~= "" and param or caller) + if not core.player_exists(name) then + return false, "Player " .. name .. " does not exist." + end return true, "Privileges of " .. name .. ": " .. core.privs_to_string( core.get_player_privs(name), ' ') end, }) +core.register_chatcommand("haspriv", { + params = "", + description = "Return list of all online players with privilege.", + privs = {basic_privs = true}, + func = function(caller, param) + param = param:trim() + if param == "" then + return false, "Invalid parameters (see /help haspriv)" + end + if not core.registered_privileges[param] then + return false, "Unknown privilege!" + end + local privs = core.string_to_privs(param) + local players_with_priv = {} + for _, player in pairs(core.get_connected_players()) do + local player_name = player:get_player_name() + if core.check_player_privs(player_name, privs) then + table.insert(players_with_priv, player_name) + end + end + return true, "Players online with the \"" .. param .. "\" privilege: " .. + table.concat(players_with_priv, ", ") + end +}) + local function handle_grant_command(caller, grantname, grantprivstr) - local caller_privs = minetest.get_player_privs(caller) + local caller_privs = core.get_player_privs(caller) if not (caller_privs.privs or caller_privs.basic_privs) then return false, "Your privileges are insufficient." end @@ -132,6 +160,9 @@ local function handle_grant_command(caller, grantname, grantprivstr) if privs_unknown ~= "" then return false, privs_unknown end + for priv, _ in pairs(grantprivs) do + core.run_priv_callbacks(grantname, priv, caller, "grant") + end core.set_player_privs(grantname, privs) core.log("action", caller..' granted ('..core.privs_to_string(grantprivs, ', ')..') privileges to '..grantname) if grantname ~= caller then @@ -145,8 +176,8 @@ local function handle_grant_command(caller, grantname, grantprivstr) end core.register_chatcommand("grant", { - params = " |all", - description = "Give privilege to player", + params = " ( | all)", + description = "Give privileges to player", func = function(name, param) local grantname, grantprivstr = string.match(param, "([^ ]+) (.+)") if not grantname or not grantprivstr then @@ -157,7 +188,7 @@ core.register_chatcommand("grant", { }) core.register_chatcommand("grantme", { - params = "|all", + params = " | all", description = "Grant privileges to yourself", func = function(name, param) if param == "" then @@ -168,8 +199,8 @@ core.register_chatcommand("grantme", { }) core.register_chatcommand("revoke", { - params = " |all", - description = "Remove privilege from player", + params = " ( | all)", + description = "Remove privileges from player", privs = {}, func = function(name, param) if not core.check_player_privs(name, {privs=true}) and @@ -193,12 +224,18 @@ core.register_chatcommand("revoke", { end end if revoke_priv_str == "all" then + revoke_privs = privs privs = {} else for priv, _ in pairs(revoke_privs) do privs[priv] = nil end end + + for priv, _ in pairs(revoke_privs) do + core.run_priv_callbacks(revoke_name, priv, name, "revoke") + end + core.set_player_privs(revoke_name, privs) core.log("action", name..' revoked (' ..core.privs_to_string(revoke_privs, ', ') @@ -254,7 +291,7 @@ core.register_chatcommand("setpassword", { core.register_chatcommand("clearpassword", { params = "", - description = "Set empty password", + description = "Set empty password for a player", privs = {password=true}, func = function(name, param) local toname = param @@ -281,7 +318,7 @@ core.register_chatcommand("auth_reload", { core.register_chatcommand("remove_player", { params = "", - description = "Remove player data", + description = "Remove a player's data", privs = {server=true}, func = function(name, param) local toname = param @@ -305,8 +342,8 @@ core.register_chatcommand("remove_player", { }) core.register_chatcommand("teleport", { - params = ",, | | ,, | ", - description = "Teleport to player or position", + params = ",, | | ( ,,) | ( )", + description = "Teleport to position or player", privs = {teleport=true}, func = function(name, param) -- Returns (pos, true) if found, otherwise (pos, false) @@ -343,7 +380,7 @@ core.register_chatcommand("teleport", { end teleportee = core.get_player_by_name(name) if teleportee then - teleportee:setpos(p) + teleportee:set_pos(p) return true, "Teleporting to "..core.pos_to_string(p) end end @@ -356,12 +393,12 @@ core.register_chatcommand("teleport", { if target_name then local target = core.get_player_by_name(target_name) if target then - p = target:getpos() + p = target:get_pos() end end if teleportee and p then p = find_free_position_near(p) - teleportee:setpos(p) + teleportee:set_pos(p) return true, "Teleporting to " .. target_name .. " at "..core.pos_to_string(p) end @@ -380,7 +417,7 @@ core.register_chatcommand("teleport", { teleportee = core.get_player_by_name(teleportee_name) end if teleportee and p.x and p.y and p.z then - teleportee:setpos(p) + teleportee:set_pos(p) return true, "Teleporting " .. teleportee_name .. " to " .. core.pos_to_string(p) end @@ -396,12 +433,12 @@ core.register_chatcommand("teleport", { if target_name then local target = core.get_player_by_name(target_name) if target then - p = target:getpos() + p = target:get_pos() end end if teleportee and p then p = find_free_position_near(p) - teleportee:setpos(p) + teleportee:set_pos(p) return true, "Teleporting " .. teleportee_name .. " to " .. target_name .. " at " .. core.pos_to_string(p) @@ -413,7 +450,7 @@ core.register_chatcommand("teleport", { }) core.register_chatcommand("set", { - params = "[-n] | ", + params = "([-n] ) | ", description = "Set or read server configuration setting", privs = {server=true}, func = function(name, param) @@ -468,9 +505,9 @@ local function emergeblocks_progress_update(ctx) end core.register_chatcommand("emergeblocks", { - params = "(here [radius]) | ( )", + params = "(here []) | ( )", description = "Load (or, if nonexistent, generate) map blocks " - .. "contained in area pos1 to pos2", + .. "contained in area pos1 to pos2 ( and must be in parentheses)", privs = {server=true}, func = function(name, param) local p1, p2 = parse_range_str(name, param) @@ -494,8 +531,9 @@ core.register_chatcommand("emergeblocks", { }) core.register_chatcommand("deleteblocks", { - params = "(here [radius]) | ( )", - description = "Delete map blocks contained in area pos1 to pos2", + params = "(here []) | ( )", + description = "Delete map blocks contained in area pos1 to pos2 " + .. "( and must be in parentheses)", privs = {server=true}, func = function(name, param) local p1, p2 = parse_range_str(name, param) @@ -513,8 +551,9 @@ core.register_chatcommand("deleteblocks", { }) core.register_chatcommand("fixlight", { - params = "(here [radius]) | ( )", - description = "Resets lighting in the area between pos1 and pos2", + params = "(here []) | ( )", + description = "Resets lighting in the area between pos1 and pos2 " + .. "( and must be in parentheses)", privs = {server = true}, func = function(name, param) local p1, p2 = parse_range_str(name, param) @@ -546,8 +585,11 @@ local function handle_give_command(cmd, giver, receiver, stackstring) local itemstack = ItemStack(stackstring) if itemstack:is_empty() then return false, "Cannot give an empty item" - elseif not itemstack:is_known() then + elseif (not itemstack:is_known()) or (itemstack:get_name() == "unknown") then return false, "Cannot give an unknown item" + -- Forbid giving 'ignore' due to unwanted side effects + elseif itemstack:get_name() == "ignore" then + return false, "Giving 'ignore' is not allowed" end local receiverref = core.get_player_by_name(receiver) if receiverref == nil then @@ -566,18 +608,18 @@ local function handle_give_command(cmd, giver, receiver, stackstring) -- entered (e.g. big numbers are always interpreted as 2^16-1). stackstring = itemstack:to_string() if giver == receiver then - return true, ("%q %sadded to inventory.") - :format(stackstring, partiality) + local msg = "%q %sadded to inventory." + return true, msg:format(stackstring, partiality) else core.chat_send_player(receiver, ("%q %sadded to inventory.") :format(stackstring, partiality)) - return true, ("%q %sadded to %s's inventory.") - :format(stackstring, partiality, receiver) + local msg = "%q %sadded to %s's inventory." + return true, msg:format(stackstring, partiality, receiver) end end core.register_chatcommand("give", { - params = " ", + params = " [ []]", description = "Give item to player", privs = {give=true}, func = function(name, param) @@ -590,7 +632,7 @@ core.register_chatcommand("give", { }) core.register_chatcommand("giveme", { - params = "", + params = " [ []]", description = "Give item to yourself", privs = {give=true}, func = function(name, param) @@ -618,8 +660,11 @@ core.register_chatcommand("spawnentity", { core.log("error", "Unable to spawn entity, player is nil") return false, "Unable to spawn entity, player is nil" end + if not core.registered_entities[entityname] then + return false, "Cannot spawn an unknown entity" + end if p == "" then - p = player:getpos() + p = player:get_pos() else p = core.string_to_pos(p) if p == nil then @@ -641,10 +686,13 @@ core.register_chatcommand("pulverize", { core.log("error", "Unable to pulverize, no player.") return false, "Unable to pulverize, no player." end - if player:get_wielded_item():is_empty() then + local wielded_item = player:get_wielded_item() + if wielded_item:is_empty() then return false, "Unable to pulverize, no item in hand." end - player:set_wielded_item(nil) + core.log("action", name .. " pulverized \"" .. + wielded_item:get_name() .. " " .. wielded_item:get_count() .. "\"") + player:set_wielded_item(nil) return true, "An item was pulverized." end, }) @@ -661,7 +709,7 @@ core.register_on_punchnode(function(pos, node, puncher) end) core.register_chatcommand("rollback_check", { - params = "[] [] [limit]", + params = "[] [] []", description = "Check who last touched a node or a node near it" .. " within the time specified by . Default: range = 0," .. " seconds = 86400 = 24h, limit = 5", @@ -714,7 +762,7 @@ core.register_chatcommand("rollback_check", { }) core.register_chatcommand("rollback", { - params = " [] | : []", + params = "( []) | (: [])", description = "Revert actions of a player. Default for is 60", privs = {rollback=true}, func = function(name, param) @@ -752,15 +800,19 @@ core.register_chatcommand("rollback", { }) core.register_chatcommand("status", { - description = "Print server status", + description = "Show server status", func = function(name, param) - return true, core.get_server_status() + local status = core.get_server_status(name, false) + if status and status ~= "" then + return true, status + end + return false, "This command was disabled by a mod or game" end, }) core.register_chatcommand("time", { - params = "<0..23>:<0..59> | <0..24000>", - description = "Set time of day", + params = "[<0..23>:<0..59> | <0..24000>]", + description = "Show or set time of day", privs = {}, func = function(name, param) if param == "" then @@ -799,24 +851,26 @@ core.register_chatcommand("time", { }) core.register_chatcommand("days", { - description = "Display day count", + description = "Show day count since world creation", func = function(name, param) return true, "Current day is " .. core.get_day_count() end }) core.register_chatcommand("shutdown", { - description = "Shutdown server", - params = "[delay_in_seconds (non-negative number, or -1 to cancel)] [reconnect] [message]", + params = "[ | -1] [reconnect] []", + description = "Shutdown server (-1 cancels a delayed shutdown)", privs = {server=true}, func = function(name, param) - local delay, reconnect, message = param:match("([^ ][-]?[0-9]+)([^ ]+)(.*)") - message = message or "" + local delay, reconnect, message + delay, param = param:match("^%s*(%S+)(.*)") + if param then + reconnect, param = param:match("^%s*(%S+)(.*)") + end + message = param and param:match("^%s*(.+)") or "" + delay = tonumber(delay) or 0 - if delay ~= "" then - delay = tonumber(delay) or 0 - else - delay = 0 + if delay == 0 then core.log("action", name .. " shuts down server") core.chat_send_all("*** Server shutting down (operator request).") end @@ -825,12 +879,17 @@ core.register_chatcommand("shutdown", { }) core.register_chatcommand("ban", { - params = "", - description = "Ban IP of player", + params = "[ | ]", + description = "Ban player or show ban list", privs = {ban=true}, func = function(name, param) if param == "" then - return true, "Ban list: " .. core.get_ban_list() + local ban_list = core.get_ban_list() + if ban_list == "" then + return true, "The ban list is empty." + else + return true, "Ban list: " .. ban_list + end end if not core.get_player_by_name(param) then return false, "No such player." @@ -845,8 +904,8 @@ core.register_chatcommand("ban", { }) core.register_chatcommand("unban", { - params = "", - description = "Remove IP ban", + params = " | ", + description = "Remove player ban", privs = {ban=true}, func = function(name, param) if not core.unban_player_or_ip(param) then @@ -858,7 +917,7 @@ core.register_chatcommand("unban", { }) core.register_chatcommand("kick", { - params = " [reason]", + params = " []", description = "Kick a player", privs = {kick=true}, func = function(name, param) @@ -877,15 +936,15 @@ core.register_chatcommand("kick", { }) core.register_chatcommand("clearobjects", { - params = "[full|quick]", + params = "[full | quick]", description = "Clear all objects in world", privs = {server=true}, func = function(name, param) local options = {} - if param == "" or param == "full" then - options.mode = "full" - elseif param == "quick" then + if param == "" or param == "quick" then options.mode = "quick" + elseif param == "full" then + options.mode = "full" else return false, "Invalid usage, see /help clearobjects." end @@ -923,8 +982,8 @@ core.register_chatcommand("msg", { }) core.register_chatcommand("last-login", { - params = "[name]", - description = "Get the last login time of a player", + params = "[]", + description = "Get the last login time of a player or yourself", func = function(name, param) if param == "" then param = name @@ -940,14 +999,14 @@ core.register_chatcommand("last-login", { }) core.register_chatcommand("clearinv", { - params = "[name]", + params = "[]", description = "Clear the inventory of yourself or another player", func = function(name, param) local player if param and param ~= "" and param ~= name then if not core.check_player_privs(name, {server=true}) then return false, "You don't have permission" - .. " to run this command (missing privilege: server)" + .. " to clear another player's inventory (missing privilege: server)" end player = core.get_player_by_name(param) core.chat_send_player(param, name.." cleared your inventory.") @@ -966,3 +1025,34 @@ core.register_chatcommand("clearinv", { end end, }) + +local function handle_kill_command(killer, victim) + if core.settings:get_bool("enable_damage") == false then + return false, "Players can't be killed, damage has been disabled." + end + local victimref = core.get_player_by_name(victim) + if victimref == nil then + return false, string.format("Player %s is not online.", victim) + elseif victimref:get_hp() <= 0 then + if killer == victim then + return false, "You are already dead." + else + return false, string.format("%s is already dead.", victim) + end + end + if not killer == victim then + core.log("action", string.format("%s killed %s", killer, victim)) + end + -- Kill victim + victimref:set_hp(0) + return true, string.format("%s has been killed.", victim) +end + +core.register_chatcommand("kill", { + params = "[]", + description = "Kill player or yourself", + privs = {server=true}, + func = function(name, param) + return handle_kill_command(name, param == "" and name or param) + end, +}) diff --git a/builtin/game/constants.lua b/builtin/game/constants.lua index 50c515b..0ee2a72 100644 --- a/builtin/game/constants.lua +++ b/builtin/game/constants.lua @@ -21,6 +21,10 @@ core.EMERGE_GENERATED = 4 -- constants.h -- Size of mapblocks in nodes core.MAP_BLOCKSIZE = 16 +-- Default maximal HP of a player +core.PLAYER_MAX_HP_DEFAULT = 20 +-- Default maximal breath of a player +core.PLAYER_MAX_BREATH_DEFAULT = 11 -- light.h -- Maximum value for node 'light_source' parameter diff --git a/builtin/game/detached_inventory.lua b/builtin/game/detached_inventory.lua index 420e89f..2e27168 100644 --- a/builtin/game/detached_inventory.lua +++ b/builtin/game/detached_inventory.lua @@ -18,3 +18,7 @@ function core.create_detached_inventory(name, callbacks, player_name) return core.create_detached_inventory_raw(name, player_name) end +function core.remove_detached_inventory(name) + core.detached_inventories[name] = nil + return core.remove_detached_inventory_raw(name) +end diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 991962c..62b6973 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -39,7 +39,7 @@ core.register_entity(":__builtin:falling_node", { on_activate = function(self, staticdata) self.object:set_armor_groups({immortal = 1}) - + local ds = core.deserialize(staticdata) if ds and ds.node then self:set_node(ds.node, ds.meta) @@ -52,12 +52,12 @@ core.register_entity(":__builtin:falling_node", { on_step = function(self, dtime) -- Set gravity - local acceleration = self.object:getacceleration() + local acceleration = self.object:get_acceleration() if not vector.equals(acceleration, {x = 0, y = -10, z = 0}) then - self.object:setacceleration({x = 0, y = -10, z = 0}) + self.object:set_acceleration({x = 0, y = -10, z = 0}) end -- Turn to actual node when colliding with ground, or continue to move - local pos = self.object:getpos() + local pos = self.object:get_pos() -- Position of bottom center point local bcp = {x = pos.x, y = pos.y - 0.7, z = pos.z} -- 'bcn' is nil for unloaded nodes @@ -109,30 +109,41 @@ core.register_entity(":__builtin:falling_node", { end end -- Create node and remove entity - if core.registered_nodes[self.node.name] then + local def = core.registered_nodes[self.node.name] + if def then core.add_node(np, self.node) if self.meta then 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 + core.sound_play(def.sounds.place, {pos = np}) + end end self.object:remove() core.check_for_falling(np) return end - local vel = self.object:getvelocity() + local vel = self.object:get_velocity() if vector.equals(vel, {x = 0, y = 0, z = 0}) then - local npos = self.object:getpos() - self.object:setpos(vector.round(npos)) + local npos = self.object:get_pos() + self.object:set_pos(vector.round(npos)) end end }) -local function spawn_falling_node(p, node, meta) - local obj = core.add_entity(p, "__builtin:falling_node") - if obj then - obj:get_luaentity():set_node(node, meta) +local function convert_to_falling_node(pos, node) + local obj = core.add_entity(pos, "__builtin:falling_node") + if not obj then + return false end + node.level = core.get_node_level(pos) + local meta = core.get_meta(pos) + local metatable = meta and meta:to_table() or {} + + obj:get_luaentity():set_node(node, metatable) + core.remove_node(pos) + return true end function core.spawn_falling_node(pos) @@ -140,19 +151,27 @@ function core.spawn_falling_node(pos) if node.name == "air" or node.name == "ignore" then return false end - local obj = core.add_entity(pos, "__builtin:falling_node") - if obj then - obj:get_luaentity():set_node(node) - core.remove_node(pos) - return true - end - return false + return convert_to_falling_node(pos, node) end local function drop_attached_node(p) local n = core.get_node(p) + local drops = core.get_node_drops(n, "") + local def = core.registered_items[n.name] + if def and def.preserve_metadata then + local oldmeta = core.get_meta(p):to_table().fields + -- Copy pos and node because the callback can modify them. + local pos_copy = {x=p.x, y=p.y, z=p.z} + local node_copy = {name=n.name, param1=n.param1, param2=n.param2} + local drop_stacks = {} + for k, v in pairs(drops) do + drop_stacks[k] = ItemStack(v) + end + drops = drop_stacks + def.preserve_metadata(pos_copy, node_copy, oldmeta, drops) + end core.remove_node(p) - for _, item in pairs(core.get_node_drops(n, "")) do + for _, item in pairs(drops) do local pos = { x = p.x + math.random()/2 - 0.25, y = p.y + math.random()/2 - 0.25, @@ -205,14 +224,7 @@ function core.check_single_for_falling(p) core.get_node_max_level(p_bottom))) and (not d_bottom.walkable or d_bottom.buildable_to) then - n.level = core.get_node_level(p) - local meta = core.get_meta(p) - local metatable = {} - if meta ~= nil then - metatable = meta:to_table() - end - core.remove_node(p) - spawn_falling_node(p, n, metatable) + convert_to_falling_node(p, n) return true end end @@ -313,19 +325,3 @@ local function on_punchnode(p, node) core.check_for_falling(p) end core.register_on_punchnode(on_punchnode) - --- --- Globally exported functions --- - --- TODO remove this function after the 0.4.15 release -function nodeupdate(p) - core.log("deprecated", "nodeupdate: deprecated, please use core.check_for_falling instead") - core.check_for_falling(p) -end - --- TODO remove this function after the 0.4.15 release -function nodeupdate_single(p) - core.log("deprecated", "nodeupdate_single: deprecated, please use core.check_single_for_falling instead") - core.check_single_for_falling(p) -end diff --git a/builtin/game/features.lua b/builtin/game/features.lua index ef85fbb..8e51048 100644 --- a/builtin/game/features.lua +++ b/builtin/game/features.lua @@ -3,7 +3,6 @@ core.features = { glasslike_framed = true, nodebox_as_selectionbox = true, - chat_send_player_param3 = true, get_all_craft_recipes_works = true, use_texture_alpha = true, no_legacy_abms = true, @@ -11,6 +10,8 @@ core.features = { area_store_custom_ids = true, add_entity_with_staticdata = true, no_chat_message_prediction = true, + object_use_texture_alpha = true, + object_independent_selectionbox = true, } function core.has_feature(arg) diff --git a/builtin/game/init.lua b/builtin/game/init.lua index e2635f0..ab1503d 100644 --- a/builtin/game/init.lua +++ b/builtin/game/init.lua @@ -1,5 +1,5 @@ -local scriptpath = core.get_builtin_path()..DIR_DELIM +local scriptpath = core.get_builtin_path() local commonpath = scriptpath.."common"..DIR_DELIM local gamepath = scriptpath.."game"..DIR_DELIM diff --git a/builtin/game/item.lua b/builtin/game/item.lua index ea9681a..ced2877 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -33,7 +33,7 @@ function core.get_pointed_thing_position(pointed_thing, above) -- The position where a node would be dug return pointed_thing.under elseif pointed_thing.type == "object" then - return pointed_thing.ref and pointed_thing.ref:getpos() + return pointed_thing.ref and pointed_thing.ref:get_pos() end end @@ -197,7 +197,7 @@ function core.get_node_drops(node, toolname) return {nodename} elseif type(drop) == "string" then -- itemstring drop - return {drop} + return drop ~= "" and {drop} or {} elseif drop.items == nil then -- drop = {} to disable default drop return {} @@ -331,7 +331,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2, -- Calculate the direction for furnaces and chests and stuff elseif (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") and not param2 then - local placer_pos = placer and placer:getpos() + local placer_pos = placer and placer:get_pos() if placer_pos then local dir = { x = above.x - placer_pos.x, @@ -441,9 +441,6 @@ function core.item_drop(itemstack, dropper, pos) local cnt = itemstack:get_count() if dropper_is_player then p.y = p.y + 1.2 - if dropper:get_player_control().sneak then - cnt = 1 - end end local item = itemstack:take_item(cnt) local obj = core.add_item(p, item) @@ -472,6 +469,11 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed if itemstack:take_item() ~= nil then user:set_hp(user:get_hp() + hp_change) + local def = itemstack:get_definition() + if def and def.sound and def.sound.eat then + minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 }) + end + if replace_with_item then if itemstack:is_empty() then itemstack:add_item(replace_with_item) @@ -481,7 +483,7 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed if inv and inv:room_for_item("main", {name=replace_with_item}) then inv:add_item("main", replace_with_item) else - local pos = user:getpos() + local pos = user:get_pos() pos.y = math.floor(pos.y + 0.5) core.add_item(pos, replace_with_item) end @@ -583,6 +585,20 @@ function core.node_dig(pos, node, digger) digger:set_wielded_item(wielded) end + -- Check to see if metadata should be preserved. + if def and def.preserve_metadata then + local oldmeta = core.get_meta(pos):to_table().fields + -- Copy pos and node because the callback can modify them. + local pos_copy = {x=pos.x, y=pos.y, z=pos.z} + local node_copy = {name=node.name, param1=node.param1, param2=node.param2} + local drop_stacks = {} + for k, v in pairs(drops) do + drop_stacks[k] = ItemStack(v) + end + drops = drop_stacks + def.preserve_metadata(pos_copy, node_copy, oldmeta, drops) + end + -- Handle drops core.handle_node_drops(pos, drops, digger) @@ -621,6 +637,18 @@ function core.node_dig(pos, node, digger) end end +function core.itemstring_with_palette(item, palette_index) + local stack = ItemStack(item) -- convert to ItemStack + stack:get_meta():set_int("palette_index", palette_index) + return stack:to_string() +end + +function core.itemstring_with_color(item, colorstring) + local stack = ItemStack(item) -- convert to ItemStack + stack:get_meta():set_string("color", colorstring) + return stack:to_string() +end + -- This is used to allow mods to redefine core.item_place and so on -- NOTE: This is not the preferred way. Preferred way is to provide enough -- callbacks to not require redefining global functions. -celeron55 diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index caa7598..a330e87 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -14,10 +14,9 @@ end -- If item_entity_ttl is not set, enity will have default life time -- Setting it to -1 disables the feature -local time_to_live = tonumber(core.settings:get("item_entity_ttl")) -if not time_to_live then - time_to_live = 900 -end +local time_to_live = tonumber(core.settings:get("item_entity_ttl")) or 900 +local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81 + core.register_entity(":__builtin:item", { initial_properties = { @@ -33,50 +32,45 @@ core.register_entity(":__builtin:item", { is_visible = false, }, - itemstring = '', - physical_state = true, + itemstring = "", + moving_state = true, + slippery_state = false, age = 0, - set_item = function(self, itemstring) - self.itemstring = itemstring - local stack = ItemStack(itemstring) - local count = stack:get_count() - local max_count = stack:get_stack_max() - if count > max_count then - count = max_count - self.itemstring = stack:get_name().." "..max_count - end - local s = 0.2 + 0.1 * (count / max_count) - local c = s - local itemtable = stack:to_table() - local itemname = nil - if itemtable then - itemname = stack:to_table().name + set_item = function(self, item) + local stack = ItemStack(item or self.itemstring) + self.itemstring = stack:to_string() + if self.itemstring == "" then + -- item not yet known + return end + -- Backwards compatibility: old clients use the texture -- to get the type of the item - local item_texture = nil - local item_type = "" - if core.registered_items[itemname] then - item_texture = core.registered_items[itemname].inventory_image - item_type = core.registered_items[itemname].type - end - local prop = { + local itemname = stack:is_known() and stack:get_name() or "unknown" + + local max_count = stack:get_stack_max() + 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 + + self.object:set_properties({ is_visible = true, visual = "wielditem", textures = {itemname}, - visual_size = {x = s, y = s}, - collisionbox = {-c, -c, -c, c, c, c}, - automatic_rotate = math.pi * 0.5, - wield_item = itemstring, - } - self.object:set_properties(prop) + visual_size = {x = size, y = size}, + collisionbox = {-size, -coll_height, -size, + size, coll_height, size}, + selectionbox = {-size, -size, -size, size, size, size}, + automatic_rotate = math.pi * 0.5 * 0.2 / size, + wield_item = self.itemstring, + }) + end, get_staticdata = function(self) return core.serialize({ itemstring = self.itemstring, - always_collect = self.always_collect, age = self.age, dropped_by = self.dropped_by }) @@ -87,93 +81,70 @@ core.register_entity(":__builtin:item", { local data = core.deserialize(staticdata) if data and type(data) == "table" then self.itemstring = data.itemstring - self.always_collect = data.always_collect - if data.age then - self.age = data.age + dtime_s - else - self.age = dtime_s - end + self.age = (data.age or 0) + dtime_s self.dropped_by = data.dropped_by end else self.itemstring = staticdata end self.object:set_armor_groups({immortal = 1}) - self.object:setvelocity({x = 0, y = 2, z = 0}) - self.object:setacceleration({x = 0, y = -10, z = 0}) - self:set_item(self.itemstring) + self.object:set_velocity({x = 0, y = 2, z = 0}) + self.object:set_acceleration({x = 0, y = -gravity, z = 0}) + self:set_item() end, - -- moves items from this stack to an other stack - try_merge_with = function(self, own_stack, object, obj) - -- other item's stack - local stack = ItemStack(obj.itemstring) - -- only merge if items are the same - if own_stack:get_name() == stack:get_name() and - own_stack:get_meta() == stack:get_meta() and - own_stack:get_wear() == stack:get_wear() and - stack:get_free_space() > 0 then - local overflow = false - local count = stack:get_count() + own_stack:get_count() - local max_count = stack:get_stack_max() - if count > max_count then - overflow = true - stack:set_count(max_count) - count = count - max_count - own_stack:set_count(count) - else - self.itemstring = '' - stack:set_count(count) - end - local pos = object:getpos() - pos.y = pos.y + (count - stack:get_count()) / max_count * 0.15 - object:moveto(pos, false) - local s, c - if not overflow then - obj.itemstring = stack:to_string() - s = 0.2 + 0.1 * (count / max_count) - c = s - object:set_properties({ - visual_size = {x = s, y = s}, - collisionbox = {-c, -c, -c, c, c, c}, - wield_item = obj.itemstring - }) - self.object:remove() - -- merging succeeded - return true - else - s = 0.4 - c = 0.3 - obj.itemstring = stack:to_string() - object:set_properties({ - visual_size = {x = s, y = s}, - collisionbox = {-c, -c, -c, c, c, c}, - wield_item = obj.itemstring - }) - s = 0.2 + 0.1 * (count / max_count) - c = s - self.itemstring = own_stack:to_string() - self.object:set_properties({ - visual_size = {x = s, y = s}, - collisionbox = {-c, -c, -c, c, c, c}, - wield_item = self.itemstring - }) - end + try_merge_with = function(self, own_stack, object, entity) + if self.age == entity.age then + -- Can not merge with itself + return false end - -- merging didn't succeed - return false + + local stack = ItemStack(entity.itemstring) + local name = stack:get_name() + if own_stack:get_name() ~= name or + own_stack:get_meta() ~= stack:get_meta() or + own_stack:get_wear() ~= stack:get_wear() or + own_stack:get_free_space() == 0 then + -- Can not merge different or full stack + return false + end + + local count = own_stack:get_count() + local total_count = stack:get_count() + count + local max_count = stack:get_stack_max() + + if total_count > max_count then + return false + end + -- Merge the remote stack into this one + + local pos = object:get_pos() + pos.y = pos.y + ((total_count - count) / max_count) * 0.15 + self.object:move_to(pos) + + self.age = 0 -- Handle as new entity + own_stack:set_count(total_count) + self:set_item(own_stack) + + entity.itemstring = "" + object:remove() + return true end, on_step = function(self, dtime) self.age = self.age + dtime if time_to_live > 0 and self.age > time_to_live then - self.itemstring = '' + self.itemstring = "" self.object:remove() return end - local p = self.object:getpos() - p.y = p.y - 0.5 - local node = core.get_node_or_nil(p) + + local pos = self.object:get_pos() + local node = core.get_node_or_nil({ + x = pos.x, + y = pos.y + self.object:get_properties().collisionbox[2] - 0.05, + z = pos.z + }) -- Delete in 'ignore' nodes if node and node.name == "ignore" then self.itemstring = "" @@ -181,48 +152,77 @@ core.register_entity(":__builtin:item", { return end - -- If node is nil (unloaded area), or node is not registered, or node is - -- walkably solid and item is resting on nodebox - local v = self.object:getvelocity() - if not node or not core.registered_nodes[node.name] or - core.registered_nodes[node.name].walkable and v.y == 0 then - if self.physical_state then - local own_stack = ItemStack(self.object:get_luaentity().itemstring) - -- Merge with close entities of the same item - for _, object in ipairs(core.get_objects_inside_radius(p, 0.8)) do - local obj = object:get_luaentity() - if obj and obj.name == "__builtin:item" - and obj.physical_state == false then - if self:try_merge_with(own_stack, object, obj) then - return - end + local vel = self.object:get_velocity() + local def = node and core.registered_nodes[node.name] + local is_moving = (def and not def.walkable) or + vel.x ~= 0 or vel.y ~= 0 or vel.z ~= 0 + local is_slippery = false + + if def and def.walkable then + local slippery = core.get_item_group(node.name, "slippery") + is_slippery = slippery ~= 0 + if is_slippery and (math.abs(vel.x) > 0.2 or math.abs(vel.z) > 0.2) then + -- Horizontal deceleration + local slip_factor = 4.0 / (slippery + 4) + self.object:set_acceleration({ + x = -vel.x * slip_factor, + y = 0, + z = -vel.z * slip_factor + }) + elseif vel.y == 0 then + is_moving = false + end + end + + if self.moving_state == is_moving and + self.slippery_state == is_slippery then + -- Do not update anything until the moving state changes + return + end + + self.moving_state = is_moving + self.slippery_state = is_slippery + + if is_moving then + self.object:set_acceleration({x = 0, y = -gravity, z = 0}) + else + self.object:set_acceleration({x = 0, y = 0, z = 0}) + self.object:set_velocity({x = 0, y = 0, z = 0}) + end + + --Only collect items if not moving + if is_moving then + return + end + -- Collect the items around to merge with + local own_stack = ItemStack(self.itemstring) + if own_stack:get_free_space() == 0 then + return + end + local objects = core.get_objects_inside_radius(pos, 1.0) + for k, obj in pairs(objects) do + local entity = obj:get_luaentity() + if entity and entity.name == "__builtin:item" then + if self:try_merge_with(own_stack, obj, entity) then + own_stack = ItemStack(self.itemstring) + if own_stack:get_free_space() == 0 then + return end end - self.object:setvelocity({x = 0, y = 0, z = 0}) - self.object:setacceleration({x = 0, y = 0, z = 0}) - self.physical_state = false - self.object:set_properties({physical = false}) - end - else - if not self.physical_state then - self.object:setvelocity({x = 0, y = 0, z = 0}) - self.object:setacceleration({x = 0, y = -10, z = 0}) - self.physical_state = true - self.object:set_properties({physical = true}) end end end, on_punch = function(self, hitter) local inv = hitter:get_inventory() - if inv and self.itemstring ~= '' then + if inv and self.itemstring ~= "" then local left = inv:add_item("main", self.itemstring) if left and not left:is_empty() then - self.itemstring = left:to_string() + self:set_item(left) return end end - self.itemstring = '' + self.itemstring = "" self.object:remove() end, }) diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index d8f7a63..e6d16dd 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -39,26 +39,46 @@ function core.check_player_privs(name, ...) return true, "" end + local player_list = {} -core.register_on_joinplayer(function(player) - local player_name = player:get_player_name() - player_list[player_name] = player - if not minetest.is_singleplayer() then + +function core.send_join_message(player_name) + if not core.is_singleplayer() then core.chat_send_all("*** " .. player_name .. " joined the game.") end -end) +end -core.register_on_leaveplayer(function(player, timed_out) - local player_name = player:get_player_name() - player_list[player_name] = nil + +function core.send_leave_message(player_name, timed_out) local announcement = "*** " .. player_name .. " left the game." if timed_out then announcement = announcement .. " (timed out)" end core.chat_send_all(announcement) +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 + local status = core.get_server_status(player_name, true) + if status and status ~= "" then + core.chat_send_player(player_name, status) + end + end + core.send_join_message(player_name) 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 @@ -79,19 +99,21 @@ function core.is_player(player) end -function minetest.player_exists(name) - return minetest.get_auth_handler().get_auth(name) ~= nil +function core.player_exists(name) + return core.get_auth_handler().get_auth(name) ~= nil end + -- Returns two position vectors representing a box of `radius` in each -- direction centered around the player corresponding to `player_name` + function core.get_player_radius_area(player_name, radius) local player = core.get_player_by_name(player_name) if player == nil then return nil end - local p1 = player:getpos() + local p1 = player:get_pos() local p2 = p1 if radius then @@ -102,20 +124,25 @@ function core.get_player_radius_area(player_name, radius) return p1, p2 end + function core.hash_node_position(pos) - return (pos.z+32768)*65536*65536 + (pos.y+32768)*65536 + pos.x+32768 + return (pos.z + 32768) * 65536 * 65536 + + (pos.y + 32768) * 65536 + + pos.x + 32768 end + function core.get_position_from_hash(hash) local pos = {} - pos.x = (hash%65536) - 32768 - hash = math.floor(hash/65536) - pos.y = (hash%65536) - 32768 - hash = math.floor(hash/65536) - pos.z = (hash%65536) - 32768 + pos.x = (hash % 65536) - 32768 + hash = math.floor(hash / 65536) + pos.y = (hash % 65536) - 32768 + hash = math.floor(hash / 65536) + pos.z = (hash % 65536) - 32768 return pos end + function core.get_item_group(name, group) if not core.registered_items[name] or not core.registered_items[name].groups[group] then @@ -124,11 +151,13 @@ function core.get_item_group(name, group) return core.registered_items[name].groups[group] end + function core.get_node_group(name, group) core.log("deprecated", "Deprecated usage of get_node_group, use get_item_group instead") return core.get_item_group(name, group) end + function core.setting_get_pos(name) local value = core.settings:get(name) if not value then @@ -137,17 +166,68 @@ function core.setting_get_pos(name) return core.string_to_pos(value) end + -- To be overriden by protection mods + function core.is_protected(pos, name) return false end + function core.record_protection_violation(pos, name) for _, func in pairs(core.registered_on_protection_violation) do func(pos, name) end end + +-- Checks if specified volume intersects a protected volume + +function core.is_area_protected(minp, maxp, player_name, interval) + -- 'interval' is the largest allowed interval for the 3D lattice of checks. + + -- Compute the optimal float step 'd' for each axis so that all corners and + -- borders are checked. 'd' will be smaller or equal to 'interval'. + -- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the + -- for loop (which might otherwise not be the case due to rounding errors). + + -- Default to 4 + interval = interval or 4 + local d = {} + + for _, c in pairs({"x", "y", "z"}) do + if minp[c] > maxp[c] then + -- Repair positions: 'minp' > 'maxp' + local tmp = maxp[c] + maxp[c] = minp[c] + minp[c] = tmp + end + + if maxp[c] > minp[c] then + d[c] = (maxp[c] - minp[c]) / + math.ceil((maxp[c] - minp[c]) / interval) - 1e-4 + else + d[c] = 1 -- Any value larger than 0 to avoid division by zero + end + end + + for zf = minp.z, maxp.z, d.z do + local z = math.floor(zf + 0.5) + for yf = minp.y, maxp.y, d.y do + local y = math.floor(yf + 0.5) + for xf = minp.x, maxp.x, d.x do + local x = math.floor(xf + 0.5) + local pos = {x = x, y = y, z = z} + if core.is_protected(pos, player_name) then + return pos + end + end + end + end + return false +end + + local raillike_ids = {} local raillike_cur_id = 0 function core.raillike_group(name) @@ -160,7 +240,9 @@ function core.raillike_group(name) return id end + -- HTTP callback interface + function core.http_add_fetch(httpenv) httpenv.fetch = function(req, callback) local handle = httpenv.fetch_async(req) @@ -179,11 +261,12 @@ function core.http_add_fetch(httpenv) return httpenv end + function core.close_formspec(player_name, formname) - return minetest.show_formspec(player_name, formname, "") + return core.show_formspec(player_name, formname, "") end + function core.cancel_shutdown_requests() core.request_shutdown("", false, -1) end - diff --git a/builtin/game/privileges.lua b/builtin/game/privileges.lua index 56e090f..d77a481 100644 --- a/builtin/game/privileges.lua +++ b/builtin/game/privileges.lua @@ -11,6 +11,9 @@ function core.register_privilege(name, param) if def.give_to_singleplayer == nil then def.give_to_singleplayer = true end + if def.give_to_admin == nil then + def.give_to_admin = def.give_to_singleplayer + end if def.description == nil then def.description = "(no description)" end @@ -31,7 +34,7 @@ core.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privil core.register_privilege("privs", "Can modify privileges") core.register_privilege("teleport", { - description = "Can use /teleport command", + description = "Can teleport self", give_to_singleplayer = false, }) core.register_privilege("bring", { @@ -39,12 +42,13 @@ core.register_privilege("bring", { give_to_singleplayer = false, }) core.register_privilege("settime", { - description = "Can use /time", + description = "Can set the time of day using /time", give_to_singleplayer = false, }) core.register_privilege("server", { description = "Can do server maintenance stuff", give_to_singleplayer = false, + give_to_admin = true, }) core.register_privilege("protection_bypass", { description = "Can bypass node protection in the world", @@ -53,10 +57,12 @@ core.register_privilege("protection_bypass", { core.register_privilege("ban", { description = "Can ban and unban players", give_to_singleplayer = false, + give_to_admin = true, }) core.register_privilege("kick", { description = "Can kick players", give_to_singleplayer = false, + give_to_admin = true, }) core.register_privilege("give", { description = "Can use /give and /giveme", @@ -65,28 +71,31 @@ core.register_privilege("give", { core.register_privilege("password", { description = "Can use /setpassword and /clearpassword", give_to_singleplayer = false, + give_to_admin = true, }) core.register_privilege("fly", { - description = "Can fly using the free_move mode", + description = "Can use fly mode", give_to_singleplayer = false, }) core.register_privilege("fast", { - description = "Can walk fast using the fast_move mode", + description = "Can use fast mode", give_to_singleplayer = false, }) core.register_privilege("noclip", { - description = "Can fly through walls", + description = "Can fly through solid nodes using noclip mode", give_to_singleplayer = false, }) core.register_privilege("rollback", { description = "Can use the rollback functionality", give_to_singleplayer = false, }) -core.register_privilege("zoom", { - description = "Can zoom the camera", - give_to_singleplayer = false, -}) core.register_privilege("debug", { description = "Allows enabling various debug options that may affect gameplay", give_to_singleplayer = false, + give_to_admin = true, }) + +core.register_can_bypass_userlimit(function(name, ip) + local privs = core.get_player_privs(name) + return privs["server"] or privs["ban"] or privs["privs"] or privs["password"] +end) diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 25af24e..3edab04 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -65,14 +65,14 @@ local function check_modname_prefix(name) error("Name " .. name .. " does not follow naming conventions: " .. "\"" .. expected_prefix .. "\" or \":\" prefix required") end - + -- Enforce that the name only contains letters, numbers and underscores. local subname = name:sub(#expected_prefix+1) if subname:find("[^%w_]") then error("Name " .. name .. " does not follow naming conventions: " .. "contains unallowed characters") end - + return name end end @@ -116,8 +116,6 @@ function core.register_item(name, itemdef) end itemdef.name = name - local is_overriding = core.registered_items[name] - -- Apply defaults and add to registered_* table if itemdef.type == "node" then -- Use the nodebox as selection box if it's not set manually @@ -179,13 +177,7 @@ function core.register_item(name, itemdef) --core.log("Registering item: " .. itemdef.name) core.registered_items[itemdef.name] = itemdef core.registered_aliases[itemdef.name] = nil - - -- Used to allow builtin to register ignore to registered_items - if name ~= "ignore" then - register_item_raw(itemdef) - elseif is_overriding then - core.log("warning", "Attempted redefinition of \"ignore\"") - end + register_item_raw(itemdef) end function core.unregister_item(name) @@ -338,7 +330,7 @@ core.register_item(":unknown", { }) core.register_node(":air", { - description = "Air (you hacker you!)", + description = "Air", inventory_image = "air.png", wield_image = "air.png", drawtype = "airlike", @@ -355,7 +347,7 @@ core.register_node(":air", { }) core.register_node(":ignore", { - description = "Ignore (you hacker you!)", + description = "Ignore", inventory_image = "ignore.png", wield_image = "ignore.png", drawtype = "airlike", @@ -368,6 +360,13 @@ core.register_node(":ignore", { air_equivalent = true, drop = "", groups = {not_in_creative_inventory=1}, + on_place = function(itemstack, placer, pointed_thing) + minetest.chat_send_player( + placer:get_player_name(), + minetest.colorize("#FF0000", + "You can't place 'ignore' nodes!")) + return "" + end, }) -- The hand (bare definition) @@ -443,6 +442,18 @@ function core.run_callbacks(callbacks, mode, ...) return ret end +function core.run_priv_callbacks(name, priv, caller, method) + local def = core.registered_privileges[priv] + if not def or not def["on_" .. method] or + not def["on_" .. method](name, caller) then + for _, func in ipairs(core["registered_on_priv_" .. method]) do + if not func(name, caller, priv) then + break + end + end + end +end + -- -- Callback registration -- @@ -502,13 +513,26 @@ local function make_registration_wrap(reg_fn_name, clear_fn_name) return list end +local function make_wrap_deregistration(reg_fn, clear_fn, list) + local unregister = function (unregistered_key) + local temporary_list = table.copy(list) + clear_fn() + for k,v in pairs(temporary_list) do + if unregistered_key ~= k then + reg_fn(v) + end + end + end + return unregister +end + core.registered_on_player_hpchanges = { modifiers = { }, loggers = { } } -function core.registered_on_player_hpchange(player, hp_change) +function core.registered_on_player_hpchange(player, hp_change, reason) local last = false 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) + hp_change, last = func(player, hp_change, reason) if type(hp_change) ~= "number" then local debuginfo = debug.getinfo(func) error("The register_on_hp_changes function has to return a number at " .. @@ -519,7 +543,7 @@ function core.registered_on_player_hpchange(player, hp_change) end end for i, func in ipairs(core.registered_on_player_hpchanges.loggers) do - func(player, hp_change) + func(player, hp_change, reason) end return hp_change end @@ -540,9 +564,12 @@ 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.registered_on_chat_messages, core.register_on_chat_message = make_registration() core.registered_globalsteps, core.register_globalstep = make_registration() core.registered_playerevents, core.register_playerevent = make_registration() +core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration() core.registered_on_shutdown, core.register_on_shutdown = make_registration() core.registered_on_punchnodes, core.register_on_punchnode = make_registration() core.registered_on_placenodes, core.register_on_placenode = make_registration() @@ -561,10 +588,16 @@ core.registered_craft_predicts, core.register_craft_predict = make_registration( core.registered_on_protection_violation, core.register_on_protection_violation = make_registration() core.registered_on_item_eats, core.register_on_item_eat = make_registration() core.registered_on_punchplayers, core.register_on_punchplayer = make_registration() +core.registered_on_priv_grant, core.register_on_priv_grant = make_registration() +core.registered_on_priv_revoke, core.register_on_priv_revoke = make_registration() +core.registered_can_bypass_userlimit, core.register_can_bypass_userlimit = make_registration() +core.registered_on_modchannel_message, core.register_on_modchannel_message = make_registration() +core.registered_on_auth_fail, core.register_on_auth_fail = make_registration() +core.registered_on_player_inventory_actions, core.register_on_player_inventory_action = make_registration() +core.registered_allow_player_inventory_actions, core.register_allow_player_inventory_action = make_registration() -- -- Compatibility for on_mapgen_init() -- core.register_on_mapgen_init = function(func) func(core.get_mapgen_params()) end - diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua index 6aa1061..da924d6 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -6,7 +6,7 @@ local health_bar_definition = hud_elem_type = "statbar", position = { x=0.5, y=1 }, text = "heart.png", - number = 20, + number = core.PLAYER_MAX_HP_DEFAULT, direction = 0, size = { x=24, y=24 }, offset = { x=(-10*24)-25, y=-(48+24+16)}, @@ -17,7 +17,7 @@ local breath_bar_definition = hud_elem_type = "statbar", position = { x=0.5, y=1 }, text = "bubble.png", - number = 20, + number = core.PLAYER_MAX_BREATH_DEFAULT, direction = 0, size = { x=24, y=24 }, offset = {x=25,y=-(48+24+16)}, @@ -25,60 +25,63 @@ local breath_bar_definition = local hud_ids = {} -local function initialize_builtin_statbars(player) - - if not player:is_player() then - return - end +local function scaleToDefault(player, field) + -- Scale "hp" or "breath" to the default dimensions + local current = player["get_" .. field](player) + local nominal = core["PLAYER_MAX_".. field:upper() .. "_DEFAULT"] + local max_display = math.max(nominal, + math.max(player:get_properties()[field .. "_max"], current)) + return current / max_display * nominal +end +local function update_builtin_statbars(player) local name = player:get_player_name() if name == "" then return end - if (hud_ids[name] == nil) then + local flags = player:hud_get_flags() + if not hud_ids[name] then hud_ids[name] = {} -- flags are not transmitted to client on connect, we need to make sure -- our current flags are transmitted by sending them actively - player:hud_set_flags(player:hud_get_flags()) + player:hud_set_flags(flags) end + local hud = hud_ids[name] - if player:hud_get_flags().healthbar and enable_damage then - if hud_ids[name].id_healthbar == nil then - health_bar_definition.number = player:get_hp() - hud_ids[name].id_healthbar = player:hud_add(health_bar_definition) - end - else - if hud_ids[name].id_healthbar ~= nil then - player:hud_remove(hud_ids[name].id_healthbar) - hud_ids[name].id_healthbar = nil - end - end - - if (player:get_breath() < 11) then - if player:hud_get_flags().breathbar and enable_damage then - if hud_ids[name].id_breathbar == nil then - hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition) - end + if flags.healthbar and enable_damage then + local number = scaleToDefault(player, "hp") + 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 - if hud_ids[name].id_breathbar ~= nil then - player:hud_remove(hud_ids[name].id_breathbar) - hud_ids[name].id_breathbar = nil - end + player:hud_change(hud.id_healthbar, "number", number) end - elseif hud_ids[name].id_breathbar ~= nil then - player:hud_remove(hud_ids[name].id_breathbar) - hud_ids[name].id_breathbar = nil + elseif hud.id_healthbar then + player:hud_remove(hud.id_healthbar) + hud.id_healthbar = nil + end + + local breath_max = player:get_properties().breath_max + if flags.breathbar and enable_damage 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) + hud_def.number = number + hud.id_breathbar = player:hud_add(hud_def) + else + player:hud_change(hud.id_breathbar, "number", number) + end + elseif hud.id_breathbar then + player:hud_remove(hud.id_breathbar) + hud.id_breathbar = nil end end local function cleanup_builtin_statbars(player) - - if not player:is_player() then - return - end - local name = player:get_player_name() if name == "" then @@ -93,30 +96,28 @@ local function player_event_handler(player,eventname) local name = player:get_player_name() - if name == "" then + if name == "" or not hud_ids[name] then return end if eventname == "health_changed" then - initialize_builtin_statbars(player) + update_builtin_statbars(player) - if hud_ids[name].id_healthbar ~= nil then - player:hud_change(hud_ids[name].id_healthbar,"number",player:get_hp()) + if hud_ids[name].id_healthbar then return true end end if eventname == "breath_changed" then - initialize_builtin_statbars(player) + update_builtin_statbars(player) - if hud_ids[name].id_breathbar ~= nil then - player:hud_change(hud_ids[name].id_breathbar,"number",player:get_breath()*2) + if hud_ids[name].id_breathbar then return true end end if eventname == "hud_changed" then - initialize_builtin_statbars(player) + update_builtin_statbars(player) return true end @@ -125,20 +126,20 @@ end function core.hud_replace_builtin(name, definition) - if definition == nil or - type(definition) ~= "table" or - definition.hud_elem_type ~= "statbar" then + if type(definition) ~= "table" or + definition.hud_elem_type ~= "statbar" then return false end if name == "health" then health_bar_definition = definition - for name,ids in pairs(hud_ids) do + for name, ids in pairs(hud_ids) do local player = core.get_player_by_name(name) - if player and hud_ids[name].id_healthbar then - player:hud_remove(hud_ids[name].id_healthbar) - initialize_builtin_statbars(player) + if player and ids.id_healthbar then + player:hud_remove(ids.id_healthbar) + ids.id_healthbar = nil + update_builtin_statbars(player) end end return true @@ -147,11 +148,12 @@ function core.hud_replace_builtin(name, definition) if name == "breath" then breath_bar_definition = definition - for name,ids in pairs(hud_ids) do + for name, ids in pairs(hud_ids) do local player = core.get_player_by_name(name) - if player and hud_ids[name].id_breathbar then - player:hud_remove(hud_ids[name].id_breathbar) - initialize_builtin_statbars(player) + if player and ids.id_breathbar then + player:hud_remove(ids.id_breathbar) + ids.id_breathbar = nil + update_builtin_statbars(player) end end return true @@ -160,6 +162,10 @@ function core.hud_replace_builtin(name, definition) return false end -core.register_on_joinplayer(initialize_builtin_statbars) +-- Append "update_builtin_statbars" as late as possible +-- This ensures that the HUD is hidden when the flags are updated in this callback +core.register_on_mods_loaded(function() + core.register_on_joinplayer(update_builtin_statbars) +end) core.register_on_leaveplayer(cleanup_builtin_statbars) core.register_playerevent(player_event_handler) diff --git a/builtin/game/static_spawn.lua b/builtin/game/static_spawn.lua index b1157b4..fae23ea 100644 --- a/builtin/game/static_spawn.lua +++ b/builtin/game/static_spawn.lua @@ -1,15 +1,13 @@ -- Minetest: builtin/static_spawn.lua -local function warn_invalid_static_spawnpoint() - if core.settings:get("static_spawnpoint") and - not core.setting_get_pos("static_spawnpoint") then - core.log("error", "The static_spawnpoint setting is invalid: \"".. - core.settings:get("static_spawnpoint").."\"") - end +local static_spawnpoint_string = core.settings:get("static_spawnpoint") +if static_spawnpoint_string and + static_spawnpoint_string ~= "" and + not core.setting_get_pos("static_spawnpoint") then + error('The static_spawnpoint setting is invalid: "' .. + static_spawnpoint_string .. '"') end -warn_invalid_static_spawnpoint() - local function put_player_in_spawn(player_obj) local static_spawnpoint = core.setting_get_pos("static_spawnpoint") if not static_spawnpoint then @@ -17,7 +15,7 @@ local function put_player_in_spawn(player_obj) end core.log("action", "Moving " .. player_obj:get_player_name() .. " to static spawnpoint at " .. core.pos_to_string(static_spawnpoint)) - player_obj:setpos(static_spawnpoint) + player_obj:set_pos(static_spawnpoint) return true end diff --git a/builtin/init.lua b/builtin/init.lua index 73ab5cf..f76174b 100644 --- a/builtin/init.lua +++ b/builtin/init.lua @@ -24,7 +24,7 @@ math.randomseed(os.time()) minetest = core -- Load other files -local scriptdir = core.get_builtin_path() .. DIR_DELIM +local scriptdir = core.get_builtin_path() local gamepath = scriptdir .. "game" .. DIR_DELIM local clientpath = scriptdir .. "client" .. DIR_DELIM local commonpath = scriptdir .. "common" .. DIR_DELIM diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua index 114dbc1..de2a622 100644 --- a/builtin/mainmenu/tab_credits.lua +++ b/builtin/mainmenu/tab_credits.lua @@ -18,7 +18,7 @@ -------------------------------------------------------------------------------- local engine = { - "Minetest 0.4.17.1 : celeron55, Core Devs and Community Minetest", + "Minetest 5.0.1 : celeron55, Core Devs and Community Minetest", } local developers = { diff --git a/builtin/mainmenu/tab_online.lua b/builtin/mainmenu/tab_online.lua index ab23a4b..5436387 100644 --- a/builtin/mainmenu/tab_online.lua +++ b/builtin/mainmenu/tab_online.lua @@ -33,27 +33,27 @@ local function get_formspec(tabview, name, tabdata) local retval = -- Search - "field[0.15,0.35;6.05,0.27;te_search;;"..core.formspec_escape(tabdata.search_for).."]".. - "button[5.8,0.1;2,0.1;btn_mp_search;" .. fgettext("Search") .. "]" .. + --"field[0.15,0.35;6.05,0.27;te_search;;"..core.formspec_escape(tabdata.search_for).."]".. + --"button[5.8,0.1;2,0.1;btn_mp_search;" .. fgettext("Search") .. "]" .. -- Address / Port - "label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" .. - "field[8,0.65;3.25,0.5;te_address;;" .. + "label[0.75,0.25;" .. fgettext("Address / Port") .. "]" .. + "field[1,1.15;3.25,0.5;te_address;;" .. core.formspec_escape(core.settings:get("address")) .. "]" .. - "field[11.1,0.65;1.4,0.5;te_port;;" .. + "field[4.1,1.15;1.4,0.5;te_port;;" .. core.formspec_escape(core.settings:get("remote_port")) .. "]" .. -- Name / Password - "label[7.75,0.95;" .. fgettext("Name / Password") .. "]" .. - "field[8,1.85;2.9,0.5;te_name;;" .. + "label[0.75,1.65;" .. fgettext("Name / Password") .. " : ]" .. + "field[1,2.55;2.9,0.5;te_name;;" .. core.formspec_escape(core.settings:get("name")) .. "]" .. - "pwdfield[10.73,1.85;1.77,0.5;te_pwd;]" .. + "pwdfield[3.73,2.55;1.77,0.5;te_pwd;]" .. -- Description Background - "box[7.73,2.25;4.25,2.6;#999999]".. + "box[0,0;11.5,5.5;#999999]".. -- Connect - "button[10.1,5.15;2,0.5;btn_mp_connect;" .. fgettext("Connect") .. "]" + "button[9,4;2,0.5;btn_mp_connect;" .. fgettext("Connect") .. "]" if tabdata.fav_selected and fav_selected then if gamedata.fav then @@ -66,20 +66,7 @@ local function get_formspec(tabview, name, tabdata) end end - --favourites - retval = retval .. "tablecolumns[" .. - image_column(fgettext("Favorite"), "favorite") .. ";" .. - image_column(fgettext("Ping")) .. ",padding=0.25;" .. - "color,span=3;" .. - "text,align=right;" .. -- clients - "text,align=center,padding=0.25;" .. -- "/" - "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;" .. - image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" .. - "color,span=1;" .. - "text,padding=1]" .. - "table[-0.15,0.6;7.75,5.15;favourites;" + if menudata.search_result then for i = 1, #menudata.search_result do @@ -235,7 +222,7 @@ local function main_button_handler(tabview, fields, name, tabdata) asyncOnlineFavourites() tabdata.fav_selected = nil - core.settings:set("address", "") + core.settings:set("address", "Blockcolor.net") core.settings:set("remote_port", "30000") return true end diff --git a/builtin/profiler/init.lua b/builtin/profiler/init.lua index 8749503..a0033d7 100644 --- a/builtin/profiler/init.lua +++ b/builtin/profiler/init.lua @@ -23,7 +23,7 @@ local function get_bool_default(name, default) return val end -local profiler_path = core.get_builtin_path()..DIR_DELIM.."profiler"..DIR_DELIM +local profiler_path = core.get_builtin_path().."profiler"..DIR_DELIM local profiler = {} local sampler = assert(loadfile(profiler_path .. "sampling.lua"))(profiler) local instrumentation = assert(loadfile(profiler_path .. "instrumentation.lua"))(profiler, sampler, get_bool_default) diff --git a/builtin/profiler/instrumentation.lua b/builtin/profiler/instrumentation.lua index 7c21859..2ab658b 100644 --- a/builtin/profiler/instrumentation.lua +++ b/builtin/profiler/instrumentation.lua @@ -88,7 +88,7 @@ local function instrument(def) if not def or not def.func then return end - def.mod = def.mod or get_current_modname() + def.mod = def.mod or get_current_modname() or "??" local modname = def.mod local instrument_name = generate_name(def) local func = def.func diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 5e8e93d..5d68007 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -12,9 +12,12 @@ # - float # - enum # - path +# - filepath # - key (will be ignored in GUI, since a special key change dialog exists) # - flags -# - noise_params +# - noise_params_2d +# - noise_params_3d +# - v3f # # `type_args` can be: # * int: @@ -31,13 +34,22 @@ # - default value1,value2,... # * path: # - default (if default is not specified then "" is set) +# * filepath: +# - default (if default is not specified then "" is set) # * key: # - default # * flags: # Flags are always separated by comma without spaces. # - default possible_flags -# * noise_params: -# TODO: these are currently treated like strings +# * noise_params_2d: +# Format is , , (, , ), , , , [, ] +# - default +# * noise_params_3d: +# Format is , , (, , ), , , , [, ] +# - default +# * v3f: +# Format is (, , ) +# - default # # Comments directly above a setting are bound to this setting. # All other comments are ignored. @@ -51,9 +63,7 @@ # There shouldn't be too much settings per category; settings that shouldn't be # modified by the "average user" should be in (sub-)categories called "Advanced". -[Client] - -[*Controls] +[Controls] # If enabled, you can place blocks at the position (feet + eye level) where you stand. # This is helpful when working with nodeboxes in small areas. enable_build_where_you_stand (Build inside player) bool false @@ -62,7 +72,10 @@ enable_build_where_you_stand (Build inside player) bool false # This requires the "fly" privilege on the server. free_move (Flying) bool false -# Fast movement (via use key). +# If enabled, makes move directions relative to the player's pitch when flying or swimming. +pitch_move (Pitch move mode) bool false + +# Fast movement (via the "special" key). # This requires the "fast" privilege on the server. fast_move (Fast movement) bool false @@ -86,32 +99,54 @@ invert_mouse (Invert mouse) bool false # Mouse sensitivity multiplier. mouse_sensitivity (Mouse sensitivity) float 0.2 -# If enabled, "use" key instead of "sneak" key is used for climbing down and descending. -aux1_descends (Key use for climbing/descending) bool false +# If enabled, "special" key instead of "sneak" key is used for climbing down and +# descending. +aux1_descends (Special key for climbing/descending) bool false # Double-tapping the jump key toggles fly mode. doubletap_jump (Double tap jump for fly) bool false -# If disabled "use" key is used to fly fast if both fly and fast mode are enabled. +# If disabled, "special" key is used to fly fast if both fly and fast mode are +# enabled. 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. +# 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 +# Automatically jump up single-node obstacles. +autojump (Automatic jumping) bool false + +# Prevent digging and placing from repeating when holding the mouse buttons. +# Enable this when you dig or place too often by accident. +safe_dig_and_place (Safe digging and placing) bool false + # Enable random user input (only used for testing). random_input (Random input) bool false -# Continuous forward movement (only used for testing). +# Continuous forward movement, toggled by autoforward key. +# Press the autoforward key again or the backwards movement to disable. continuous_forward (Continuous forward) bool false -# Enable Joysticks -enable_joysticks (Enable Joysticks) bool false +# The length in pixels it takes for touch screen interaction to start. +touchscreen_threshold (Touch screen threshold) int 20 0 100 + +# (Android) Fixes the position of virtual joystick. +# If disabled, virtual joystick will center to first-touch's position. +fixed_virtual_joystick (Fixed virtual joystick) bool false + +# (Android) Use virtual joystick to trigger "aux" button. +# If enabled, virtual joystick will also tap "aux" button when out of main circle. +virtual_joystick_triggers_aux (Virtual joystick triggers aux button) bool false + +# Enable joysticks +enable_joysticks (Enable joysticks) bool false # The identifier of the joystick to use joystick_id (Joystick ID) int 0 # The type of joystick -joystick_type (Joystick Type) enum auto auto,generic,xbox +joystick_type (Joystick type) enum auto auto,generic,xbox # The time in seconds it takes between repeated events # when holding down a joystick button combination. @@ -126,6 +161,7 @@ joystick_frustum_sensitivity (Joystick frustum sensitivity) float 170 keymap_forward (Forward key) key KEY_KEY_W # Key for moving the player backward. +# Will also disable autoforward, when active. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_backward (Backward key) key KEY_KEY_S @@ -152,7 +188,7 @@ keymap_inventory (Inventory key) key KEY_KEY_I # Key for moving fast in fast mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_special1 (Use key) key KEY_KEY_E +keymap_special1 (Special key) key KEY_KEY_E # Key for opening the chat window. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 @@ -174,6 +210,10 @@ keymap_rangeselect (Range select key) key KEY_KEY_R # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 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 + # Key for toggling fast mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_fastmove (Fast key) key KEY_KEY_J @@ -202,9 +242,9 @@ keymap_increase_volume (Inc. volume key) key # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_decrease_volume (Dec. volume key) key -# Key for toggling autorun. +# Key for toggling autoforward. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_autorun (Autorun key) key +keymap_autoforward (Automatic forward key) key # Key for toggling cinematic mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 @@ -226,11 +266,139 @@ keymap_drop (Drop item key) key KEY_KEY_Q # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_zoom (View zoom key) key KEY_KEY_Z +# Key for selecting the first hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot1 (Hotbar slot 1 key) key KEY_KEY_1 + +# Key for selecting the second hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot2 (Hotbar slot 2 key) key KEY_KEY_2 + +# Key for selecting the third hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot3 (Hotbar slot 3 key) key KEY_KEY_3 + +# Key for selecting the fourth hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot4 (Hotbar slot 4 key) key KEY_KEY_4 + +# Key for selecting the fifth hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot5 (Hotbar slot 5 key) key KEY_KEY_5 + +# Key for selecting the sixth hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot6 (Hotbar slot 6 key) key KEY_KEY_6 + +# Key for selecting the seventh hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot7 (Hotbar slot 7 key) key KEY_KEY_7 + +# Key for selecting the eighth hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot8 (Hotbar slot 8 key) key KEY_KEY_8 + +# Key for selecting the ninth hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot9 (Hotbar slot 9 key) key KEY_KEY_9 + +# Key for selecting the tenth hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot10 (Hotbar slot 10 key) key KEY_KEY_0 + +# Key for selecting the 11th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot11 (Hotbar slot 11 key) key + +# Key for selecting the 12th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot12 (Hotbar slot 12 key) key + +# Key for selecting the 13th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot13 (Hotbar slot 13 key) key + +# Key for selecting the 14th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot14 (Hotbar slot 14 key) key + +# Key for selecting the 15th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot15 (Hotbar slot 15 key) key + +# Key for selecting the 16th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot16 (Hotbar slot 16 key) key + +# Key for selecting the 17th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot17 (Hotbar slot 17 key) key + +# Key for selecting the 18th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot18 (Hotbar slot 18 key) key + +# Key for selecting the 19th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot19 (Hotbar slot 19 key) key + +# Key for selecting the 20th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot20 (Hotbar slot 20 key) key + +# Key for selecting the 21st hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot21 (Hotbar slot 21 key) key + +# Key for selecting the 22nd hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot22 (Hotbar slot 22 key) key + +# Key for selecting the 23rd hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot23 (Hotbar slot 23 key) key + +# Key for selecting the 24th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot24 (Hotbar slot 24 key) key + +# Key for selecting the 25th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot25 (Hotbar slot 25 key) key + +# Key for selecting the 26th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot26 (Hotbar slot 26 key) key + +# Key for selecting the 27th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot27 (Hotbar slot 27 key) key + +# Key for selecting the 28th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot28 (Hotbar slot 28 key) key + +# Key for selecting the 29th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot29 (Hotbar slot 29 key) key + +# Key for selecting the 30th hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot30 (Hotbar slot 30 key) key + +# Key for selecting the 31st hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot31 (Hotbar slot 31 key) key + +# Key for selecting the 32nd hotbar slot. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_slot32 (Hotbar slot 32 key) key + # Key for toggling the display of the HUD. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_hud (HUD toggle key) key KEY_F1 -# Key for toggling the display of the chat. +# Key for toggling the display of chat. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_chat (Chat toggle key) key KEY_F2 @@ -238,7 +406,7 @@ keymap_toggle_chat (Chat toggle key) key KEY_F2 # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_console (Large chat console key) key KEY_F10 -# Key for toggling the display of the fog. +# Key for toggling the display of fog. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_force_fog_off (Fog toggle key) key KEY_F3 @@ -266,56 +434,11 @@ keymap_increase_viewing_range_min (View range increase key) key + # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_decrease_viewing_range_min (View range decrease key) key - -# Key for printing debug stacks. Used for development. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_print_debug_stacks (Print stacks) key KEY_KEY_P +[Graphics] -[*Network] +[*In-Game] -# Address to connect to. -# Leave this blank to start a local server. -# Note that the address field in the main menu overrides this setting. -address (Server address) string - -# Port to connect to (UDP). -# Note that the port field in the main menu overrides this setting. -remote_port (Remote port) int 30000 1 65535 - -# Whether to support older servers before protocol version 25. -# Enable if you want to connect to 0.4.12 servers and before. -# Servers starting with 0.4.13 will work, 0.4.12-dev servers may work. -# Disabling this option will protect your password better. -send_pre_v25_init (Support older servers) bool false - -# Save the map received by the client on disk. -enable_local_map_saving (Saving map received from server) bool false - -# Show entity selection boxes -show_entity_selectionbox (Show entity selection boxes) bool true - -# Enable usage of remote media server (if provided by server). -# Remote servers offer a significantly faster way to download media (e.g. textures) -# when connecting to the server. -enable_remote_media_server (Connect to external media server) bool true - -# Enable Lua modding support on client. -# This support is experimental and API can change. -enable_client_modding (Client modding) bool false - -# URL to the server list displayed in the Multiplayer Tab. -serverlist_url (Serverlist URL) string - -# File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab. -serverlist_file (Serverlist file) string favoriteservers.txt - -# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited -max_out_chat_queue_size (Maximum size of the out chat queue) int 20 - -[*Graphics] - -[**In-Game] - -[***Basic] +[**Basic] # Enable VBO enable_vbo (VBO) bool true @@ -348,9 +471,11 @@ node_highlighting (Node highlighting) enum box box,halo,none # Adds particles when digging a node. enable_particles (Digging particles) bool true -[***Filtering] +[**Filtering] -# Use mip mapping to scale textures. May slightly increase performance. +# Use mip mapping to scale textures. May slightly increase performance, +# especially when using a high resolution texture pack. +# Gamma correct downscaling is not supported. mip_map (Mipmapping) bool false # Use anisotropic filtering when viewing at textures from an angle. @@ -364,18 +489,20 @@ trilinear_filter (Trilinear filtering) bool false # Filtered textures can blend RGB values with fully-transparent neighbors, # which PNG optimizers usually discard, sometimes resulting in a dark or -# light edge to transparent textures. Apply this filter to clean that up +# light edge to transparent textures. Apply this filter to clean that up # at texture load time. texture_clean_transparent (Clean transparent textures) bool false # When using bilinear/trilinear/anisotropic filters, low-resolution textures # can be blurred, so automatically upscale them with nearest-neighbor -# interpolation to preserve crisp pixels. This sets the minimum texture size +# interpolation to preserve crisp pixels. This sets the minimum texture size # for the upscaled textures; higher values look sharper, but require more -# memory. Powers of 2 are recommended. Setting this higher than 1 may not +# memory. Powers of 2 are recommended. Setting this higher than 1 may not # have a visible effect unless bilinear/trilinear/anisotropic filtering is # enabled. -texture_min_size (Minimum texture size for filters) int 64 +# This is also used as the base node texture size for world-aligned +# texture autoscaling. +texture_min_size (Minimum texture size) int 64 # Experimental option, might cause visible spaces between blocks # when set to higher number than 0. @@ -386,21 +513,22 @@ fsaa (FSAA) enum 0 0,1,2,4,8,16 # It should give significant performance boost at the cost of less detailed image. undersampling (Undersampling) enum 0 0,2,3,4 -[***Shaders] +[**Shaders] -# Shaders allow advanced visual effects and may increase performance on some video cards. +# Shaders allow advanced visual effects and may increase performance on some video +# cards. # This only works with the OpenGL video backend. enable_shaders (Shaders) bool true # Path to shader directory. If no path is defined, default location will be used. shader_path (Shader path) path -[****Tone Mapping] +[***Tone Mapping] # Enables filmic tone mapping tone_mapping (Filmic tone mapping) bool false -[****Bumpmapping] +[***Bumpmapping] # Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack # or need to be auto-generated. @@ -418,7 +546,7 @@ normalmaps_strength (Normalmaps strength) float 0.6 # A higher value results in smoother normal maps. normalmaps_smooth (Normalmaps sampling) int 0 0 2 -[****Parallax Occlusion] +[***Parallax Occlusion] # Enables parallax occlusion mapping. # Requires shaders to be enabled. @@ -435,12 +563,12 @@ parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1 parallax_occlusion_iterations (Parallax occlusion iterations) int 4 # Overall scale of parallax occlusion effect. -parallax_occlusion_scale (Parallax occlusion Scale) float 0.08 +parallax_occlusion_scale (Parallax occlusion scale) float 0.08 # Overall bias of parallax occlusion effect, usually scale/2. parallax_occlusion_bias (Parallax occlusion bias) float 0.04 -[****Waving Nodes] +[***Waving Nodes] # Set to true enables waving water. # Requires shaders to be enabled. @@ -460,7 +588,11 @@ enable_waving_leaves (Waving leaves) bool false # Requires shaders to be enabled. enable_waving_plants (Waving plants) bool false -[***Advanced] +[**Advanced] + +# Arm inertia, gives a more realistic movement of +# the arm when the camera moves. +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. @@ -469,6 +601,10 @@ fps_max (Maximum FPS) int 60 # Maximum FPS when game is paused. pause_fps_max (FPS in pause menu) int 20 +# Open the pause menu when the window's focus is lost. Does not pause if a formspec is +# open. +pause_on_lost_focus (Pause on lost window focus) bool false + # View distance in nodes. viewing_range (Viewing range) int 100 20 4000 @@ -479,13 +615,13 @@ viewing_range (Viewing range) int 100 20 4000 near_plane (Near plane) float 0.1 0 0.5 # Width component of the initial window size. -screenW (Screen width) int 800 +screen_w (Screen width) int 1024 # Height component of the initial window size. -screenH (Screen height) int 600 +screen_h (Screen height) int 600 # Save window size automatically when modified. -autosave_screensize (Autosave Screen Size) bool true +autosave_screensize (Autosave screen size) bool true # Fullscreen mode. fullscreen (Full screen) bool false @@ -494,27 +630,40 @@ fullscreen (Full screen) bool false fullscreen_bpp (Full screen BPP) int 24 # Vertical screen synchronization. -vsync (V-Sync) bool false +vsync (VSync) bool false # Field of view in degrees. -fov (Field of view) int 72 30 160 - -# Field of view while zooming in degrees. -# This requires the "zoom" privilege on the server. -zoom_fov (Field of view for zoom) int 15 7 160 +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 2.2 1.0 3.0 +display_gamma (Gamma) float 1.0 0.5 3.0 + +# Gradient of light curve at minimum light level. +lighting_alpha (Darkness sharpness) float 0.0 0.0 4.0 + +# Gradient of light curve at maximum light level. +lighting_beta (Lightness sharpness) float 1.5 0.0 4.0 + +# Strength of light curve mid-boost. +lighting_boost (Light curve mid boost) float 0.2 0.0 1.0 + +# Center of light curve mid-boost. +lighting_boost_center (Light curve mid 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 # Path to texture directory. All textures are first searched from here. texture_path (Texture path) path # The rendering back-end for Irrlicht. -video_driver (Video driver) enum opengl null,software,burningsvideo,direct3d8,direct3d9,opengl - -# Height on which clouds are appearing. -cloud_height (Cloud height) int 120 +# A restart is required after changing this. +# Note: On Android, stick with OGLES1 if unsure! App may fail to start otherwise. +# On other platforms, OpenGL is recommended, and it’s the only driver with +# shader support currently. +video_driver (Video driver) enum opengl null,software,burningsvideo,direct3d8,direct3d9,opengl,ogles1,ogles2 # Radius of cloud area stated in number of 64 node cloud squares. # Values larger than 26 will start to produce sharp cutoffs at cloud area corners. @@ -526,7 +675,7 @@ view_bobbing_amount (View bobbing factor) float 1.0 # Multiplier for fall bobbing. # For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double. -fall_bobbing_amount (Fall bobbing factor) float 0.0 +fall_bobbing_amount (Fall bobbing factor) float 0.03 # 3D support. # Currently supported: @@ -535,11 +684,13 @@ fall_bobbing_amount (Fall bobbing factor) float 0.0 # - interlaced: odd/even line based polarisation screen support. # - topbottom: split screen top/bottom. # - sidebyside: split screen side by side. +# - crossview: Cross-eyed 3d # - pageflip: quadbuffer based 3d. -3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,pageflip +# Note that the interlaced mode requires shaders to be enabled. +3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,crossview,pageflip # In-game chat console height, between 0.1 (10%) and 1.0 (100%). -console_height (Console height) float 1.0 0.1 1.0 +console_height (Console height) float 0.6 0.1 1.0 # In-game chat console background color (R,G,B). console_color (Console color) string (0,0,0) @@ -547,10 +698,22 @@ console_color (Console color) string (0,0,0) # In-game chat console background alpha (opaqueness, between 0 and 255). console_alpha (Console alpha) int 200 0 255 +# Formspec full-screen background opacity (between 0 and 255). +formspec_fullscreen_bg_opacity (Formspec Full-Screen Background Opacity) int 140 0 255 + +# Formspec full-screen background color (R,G,B). +formspec_fullscreen_bg_color (Formspec Full-Screen Background Color) string (0,0,0) + +# Formspec default background opacity (between 0 and 255). +formspec_default_bg_opacity (Formspec Default Background Opacity) int 140 0 255 + +# Formspec default background color (R,G,B). +formspec_default_bg_color (Formspec Default Background Color) string (0,0,0) + # Selection box border color (R,G,B). selectionbox_color (Selection box color) string (0,0,0) -# Width of the selectionbox's lines around nodes. +# Width of the selection box lines around nodes. selectionbox_width (Selection box width) int 2 1 5 # Crosshair color (R,G,B). @@ -559,6 +722,9 @@ crosshair_color (Crosshair color) string (255,255,255) # Crosshair alpha (opaqueness, between 0 and 255). crosshair_alpha (Crosshair alpha) int 255 0 255 +# Maximum number of recent chat messages to show +recent_chat_messages (Recent Chat Messages) int 6 2 20 + # Whether node texture animations should be desynchronized per mapblock. desynchronize_mapblock_texture_animation (Desynchronize block animation) bool true @@ -579,7 +745,7 @@ mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50 # Size of the MapBlock cache of the mesh generator. Increasing this will # increase the cache hit %, reducing the data being copied from the main # thread, thus reducing jitter. -meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size MB) int 20 0 1000 +meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size in MB) int 20 0 1000 # Enables minimap. enable_minimap (Minimap) bool true @@ -604,22 +770,37 @@ ambient_occlusion_gamma (Ambient occlusion gamma) float 2.2 0.25 4.0 # Enables animation of inventory items. inventory_items_animations (Inventory items animations) bool false -# Android systems only: Tries to create inventory textures from meshes -# when no supported render was found. -inventory_image_hack (Inventory image hack) bool false - # Fraction of the visible distance at which fog starts to be rendered -fog_start (Fog Start) float 0.4 0.0 0.99 +fog_start (Fog start) float 0.4 0.0 0.99 # Makes all liquids opaque opaque_water (Opaque liquids) bool false -[**Menus] +# Textures on a node may be aligned either to the node or to the world. +# The former mode suits better things like machines, furniture, etc., while +# the latter makes stairs and microblocks fit surroundings better. +# However, as this possibility is new, thus may not be used by older servers, +# this option allows enforcing it for certain node types. Note though that +# that is considered EXPERIMENTAL and may not work properly. +world_aligned_mode (World-aligned textures mode) enum enable disable,enable,force_solid,force_nodebox + +# World-aligned textures may be scaled to span several nodes. However, +# the server may not send the scale you want, especially if you use +# a specially-designed texture pack; with this option, the client tries +# to determine the scale automatically basing on the texture size. +# See also texture_min_size. +# Warning: This option is EXPERIMENTAL! +autoscale_mode (Autoscaling mode) enum disable disable,enable,force + +# Show entity selection boxes +show_entity_selectionbox (Show entity selection boxes) bool true + +[*Menus] # Use a cloud animation for the main menu background. menu_clouds (Clouds in menu) bool true -# Scale gui by a user specified value. +# Scale GUI by a user specified value. # Use a nearest-neighbor-anti-alias filter to scale the GUI. # This will smooth over some of the rough edges, and blend # pixels when scaling down, at the cost of blurring some @@ -640,11 +821,14 @@ gui_scaling_filter_txr2img (GUI scaling filter txr2img) bool true # Delay showing tooltips, stated in milliseconds. tooltip_show_delay (Tooltip delay) int 400 -# Whether freetype fonts are used, requires freetype support to be compiled in. -freetype (Freetype fonts) bool true +# Append item name to tooltip. +tooltip_append_itemname (Append item name) bool false + +# Whether FreeType fonts are used, requires FreeType support to be compiled in. +freetype (FreeType fonts) bool true # Path to TrueTypeFont or bitmap. -font_path (Font path) path fonts/liberationsans.ttf +font_path (Font path) filepath fonts/liberationsans.ttf font_size (Font size) int 16 @@ -654,12 +838,12 @@ font_shadow (Font shadow) int 1 # Font shadow alpha (opaqueness, between 0 and 255). font_shadow_alpha (Font shadow alpha) int 127 0 255 -mono_font_path (Monospace font path) path fonts/liberationmono.ttf +mono_font_path (Monospace font path) filepath fonts/liberationmono.ttf mono_font_size (Monospace font size) int 15 # This font will be used for certain languages. -fallback_font_path (Fallback font) path fonts/DroidSansFallbackFull.ttf +fallback_font_path (Fallback font) filepath fonts/DroidSansFallbackFull.ttf fallback_font_size (Fallback font size) int 15 fallback_font_shadow (Fallback font shadow) int 1 fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255 @@ -675,7 +859,7 @@ screenshot_format (Screenshot format) enum png png,jpg,bmp,pcx,ppm,tga # Use 0 for default quality. screenshot_quality (Screenshot quality) int 0 0 100 -[**Advanced] +[*Advanced] # Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens. screen_dpi (DPI) int 72 @@ -684,12 +868,54 @@ screen_dpi (DPI) int 72 # Contains the same information as the file debug.txt (default name). enable_console (Enable console window) bool false -[*Sound] +[Sound] enable_sound (Sound) bool true sound_volume (Volume) float 0.7 0.0 1.0 +mute_sound (Mute sound) bool false + +[Client] + +[*Network] + +# Address to connect to. +# Leave this blank to start a local server. +# Note that the address field in the main menu overrides this setting. +address (Server address) string + +# Port to connect to (UDP). +# Note that the port field in the main menu overrides this setting. +remote_port (Remote port) int 30000 1 65535 + +# Save the map received by the client on disk. +enable_local_map_saving (Saving map received from server) bool false + +# Enable usage of remote media server (if provided by server). +# Remote servers offer a significantly faster way to download media (e.g. textures) +# when connecting to the server. +enable_remote_media_server (Connect to external media server) bool true + +# Enable Lua modding support on client. +# This support is experimental and API can change. +enable_client_modding (Client modding) bool false + +# URL to the server list displayed in the Multiplayer Tab. +serverlist_url (Serverlist URL) string servers.minetest.net + +# File in client/serverlist/ that contains your favorite servers displayed in the +# Multiplayer Tab. +serverlist_file (Serverlist file) string favoriteservers.txt + +# Maximum size of the out chat queue. +# 0 to disable queueing and -1 to make the queue size unlimited. +max_out_chat_queue_size (Maximum size of the out chat queue) int 20 + +# Enable register confirmation when connecting to server. +# If disabled, new account will be registered automatically. +enable_register_confirmation (Enable register confirmation) bool true + [*Advanced] # Timeout for client to remove unused map data from memory. @@ -714,18 +940,16 @@ server_description (Server description) string mine here server_address (Server address) string game.minetest.net # Homepage of server, to be displayed in the serverlist. -server_url (Server URL) string http://minetest.net +server_url (Server URL) string https://minetest.net -# Automaticaly report to the serverlist. +# Automatically report to the serverlist. server_announce (Announce server) bool false # Announce to this serverlist. -# If you want to announce your ipv6 address, use serverlist_url = v6.servers.minetest.net. +serverlist_url (Serverlist URL) string servers.minetest.net -# serverlist_url (Serverlist URL) string servers.minetest.net - -# Remove color codes from incoming chat messages -# Use this to stop players from being able to use color in their messages +# Remove color codes from incoming chat messages +# Use this to stop players from being able to use color in their messages strip_color_codes (Strip color codes) bool false [*Network] @@ -748,18 +972,16 @@ strict_protocol_version_checking (Strict protocol checking) bool false # Files that are not present will be fetched the usual way. remote_media (Remote media) string -# Enable/disable running an IPv6 server. An IPv6 server may be restricted -# to IPv6 clients, depending on system configuration. +# Enable/disable running an IPv6 server. # Ignored if bind_address is set. ipv6_server (IPv6 server) bool false [**Advanced] # Maximum number of blocks that are simultaneously sent per client. -max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) int 10 - -# Maximum number of blocks that are simultaneously sent in total. -max_simultaneous_block_sends_server_total (Maximum simultaneous block sends total) int 40 +# The maximum total count is calculated dynamically: +# max_total = ceil((#clients + max_users) * per_client / 4) +max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) int 40 # To reduce lag, block transfers are slowed down when a player is building something. # This determines how long they are slowed down after placing or removing a node. @@ -774,12 +996,12 @@ max_packets_per_iteration (Max. packets per iteration) int 1024 # Default game when creating a new world. # This will be overridden when creating a world from the main menu. -default_game (Default game) string blockcolor +default_game (Default game) string minetest # Message of the day displayed to players connecting. motd (Message of the day) string -# Maximum number of players that can connect simultaneously. +# Maximum number of players that can be connected simultaneously. max_users (Maximum users) int 15 # World directory (everything in the world is stored here). @@ -790,14 +1012,11 @@ map-dir (Map directory) path # Setting it to -1 disables the feature. item_entity_ttl (Item entity TTL) int 900 -# If enabled, show the server status message on player connection. -show_statusline_on_connect (Status message on connection) bool true - # Enable players getting damage and dying. -enable_damage (Damage) bool true +enable_damage (Damage) bool false # Enable creative mode for new created maps. -creative_mode (Creative) bool true +creative_mode (Creative) bool false # A chosen map seed for a new map, leave empty for random. # Will be overridden when creating a new world in the main menu. @@ -811,7 +1030,7 @@ default_password (Default password) string default_privs (Default privileges) string interact, shout # Privileges that players with basic_privs can grant -basic_privs (Basic Privileges) string interact, shout +basic_privs (Basic privileges) string interact, shout # Whether players are shown to clients without any range limit. # Deprecated, use the setting player_transfer_distance instead. @@ -821,7 +1040,10 @@ unlimited_player_transfer_distance (Unlimited player transfer distance) bool tru player_transfer_distance (Player transfer distance) int 0 # Whether to allow players to damage and kill each other. -enable_pvp (Player versus Player) bool true +enable_pvp (Player versus player) bool true + +# Enable mod channels support. +enable_mod_channels (Mod channels) bool false # If this is set, players will always (re)spawn at the given position. static_spawnpoint (Static spawnpoint) string @@ -847,10 +1069,17 @@ kick_msg_crash (Crash message) string This server has experienced an internal er ask_reconnect_on_crash (Ask to reconnect after crash) bool false # From how far clients know about objects, stated in mapblocks (16 nodes). -active_object_send_range_blocks (Active object send range) int 3 +# +# Setting this larger than active_block_range will also cause the server +# to maintain active objects up to this distance in the direction the +# player is looking. (This can avoid mobs suddenly disappearing from view) +active_object_send_range_blocks (Active object send range) int 4 -# How large area of blocks are subject to the active block stuff, stated in mapblocks (16 nodes). +# The radius of the volume of blocks around every player that is subject to the +# active block stuff, stated in mapblocks (16 nodes). # In active blocks objects are loaded and ABMs run. +# This is also the minimum range in which active objects (mobs) are maintained. +# This should be configured together with active_object_range. active_block_range (Active block range) int 3 # From how far blocks are sent to clients, stated in mapblocks (16 nodes). @@ -863,20 +1092,24 @@ max_forceloaded_blocks (Maximum forceloaded blocks) int 16 time_send_interval (Time send interval) int 5 # Controls length of day/night cycle. -# Examples: 72 = 20min, 360 = 4min, 1 = 24hour, 0 = day/night/whatever stays unchanged. +# Examples: +# 72 = 20min, 360 = 4min, 1 = 24hour, 0 = day/night/whatever stays unchanged. 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 + # Interval of saving important changes in the world, stated in seconds. server_map_save_interval (Map save interval) float 5.3 # Set the maximum character length of a chat message sent by clients. -# chat_message_max_size int 500 +chat_message_max_size (Chat message max length) int 500 -# Limit a single player to send X messages per 10 seconds. -# chat_message_limit_per_10sec float 10.0 +# Amount of messages a player may send per 10 seconds. +chat_message_limit_per_10sec (Chat message count limit) float 10.0 -# Kick player if send more than X messages per 10 seconds. -# chat_message_limit_trigger_kick int 50 +# Kick players who sent more than X messages per 10 seconds. +chat_message_limit_trigger_kick (Chat message kick threshold) int 50 [**Physics] @@ -884,13 +1117,13 @@ movement_acceleration_default (Default acceleration) float 3 movement_acceleration_air (Acceleration in air) float 2 movement_acceleration_fast (Fast mode acceleration) float 10 movement_speed_walk (Walking speed) float 4 -movement_speed_crouch (Crouch speed) float 1.35 +movement_speed_crouch (Sneaking speed) float 1.35 movement_speed_fast (Fast mode speed) float 20 movement_speed_climb (Climbing speed) float 3 movement_speed_jump (Jumping speed) float 6.5 movement_liquid_fluidity (Liquid fluidity) float 1 movement_liquid_fluidity_smooth (Liquid fluidity smoothing) float 0.5 -movement_liquid_sink (Liquid sink) float 10 +movement_liquid_sink (Liquid sinking speed) float 10 movement_gravity (Gravity) float 9.81 [**Advanced] @@ -913,17 +1146,18 @@ server_unload_unused_data_timeout (Unload unused server data) int 29 # Maximum number of statically stored objects in a block. max_objects_per_block (Maximum objects per block) int 64 -# See http://www.sqlite.org/pragma.html#pragma_synchronous +# See https://www.sqlite.org/pragma.html#pragma_synchronous sqlite_synchronous (Synchronous SQLite) enum 2 0,1,2 -# Length of a server tick and the interval at which objects are generally updated over network. -dedicated_server_step (Dedicated server step) float 0.1 +# Length of a server tick and the interval at which objects are generally updated over +# network. +dedicated_server_step (Dedicated server step) float 0.09 -# Time in between active block management cycles -active_block_mgmt_interval (Active Block Management interval) float 2.0 +# Length of time between active block management cycles +active_block_mgmt_interval (Active block management interval) float 2.0 -# Length of time between ABM execution cycles -abm_interval (Active Block Modifier interval) float 1.0 +# Length of time between Active Block Modifier (ABM) execution cycles +abm_interval (ABM interval) float 1.0 # Length of time between NodeTimer execution cycles nodetimer_interval (NodeTimer interval) float 0.2 @@ -943,12 +1177,15 @@ liquid_queue_purge_time (Liquid queue purge time) int 0 # Liquid update interval in seconds. liquid_update (Liquid update tick) float 1.0 -# At this distance the server will aggressively optimize which blocks are sent to clients. -# Small values potentially improve performance a lot, at the expense of visible rendering glitches. -# (some blocks will not be rendered under water and in caves, as well as sometimes on land) -# Setting this to a value greater than max_block_send_distance disables this optimization. -# Stated in mapblocks (16 nodes) -block_send_optimize_distance (block send optimize distance) int 4 2 +# At this distance the server will aggressively optimize which blocks are sent to +# clients. +# Small values potentially improve performance a lot, at the expense of visible +# rendering glitches (some blocks will not be rendered under water and in caves, +# as well as sometimes on land). +# Setting this to a value greater than max_block_send_distance disables this +# optimization. +# Stated in mapblocks (16 nodes). +block_send_optimize_distance (Block send optimize distance) int 4 2 # If enabled the server will perform map block occlusion culling based on # on the eye position of the player. This can reduce the number of blocks @@ -956,442 +1193,21 @@ block_send_optimize_distance (block send optimize distance) int 4 2 # so that the utility of noclip mode is reduced. server_side_occlusion_culling (Server side occlusion culling) bool true -[*Mapgen] - -# Name of map generator to be used when creating a new world. -# Creating a world in the main menu will override this. -mg_name (Mapgen name) enum v7 v5,v6,v7,flat,valleys,fractal,singlenode - -# Water surface level of the world. -water_level (Water level) int 1 - -# From how far blocks are generated for clients, stated in mapblocks (16 nodes). -max_block_generate_distance (Max block generate distance) int 6 - -# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0). -# Only mapchunks completely within the mapgen limit are generated. -# Value is stored per-world. -mapgen_limit (Map generation limit) int 31000 0 31000 - -# Global map generation attributes. -# In Mapgen v6 the 'decorations' flag controls all decorations except trees -# and junglegrass, in all other mapgens this flag controls all decorations. -# Flags that are not specified in the flag string are not modified from the default. -# Flags starting with 'no' are used to explicitly disable them. -mg_flags (Mapgen flags) flags caves,dungeons,light,decorations caves,dungeons,light,decorations,nocaves,nodungeons,nolight,nodecorations - -[**Advanced] - -# Size of chunks to be generated at once by mapgen, stated in mapblocks (16 nodes). -chunksize (Chunk size) int 5 - -# Dump the mapgen debug infos. -enable_mapgen_debug_info (Mapgen debug) bool false - -# Maximum number of blocks that can be queued for loading. -emergequeue_limit_total (Absolute limit of emerge queues) int 256 - -# Maximum number of blocks to be queued that are to be loaded from file. -# Set to blank for an appropriate amount to be chosen automatically. -emergequeue_limit_diskonly (Limit of emerge queues on disk) int 32 - -# Maximum number of blocks to be queued that are to be generated. -# Set to blank for an appropriate amount to be chosen automatically. -emergequeue_limit_generate (Limit of emerge queues to generate) int 32 - -# Number of emerge threads to use. Make this field blank, or increase this number -# to use multiple threads. On multiprocessor systems, this will improve mapgen speed greatly -# at the cost of slightly buggy caves. -num_emerge_threads (Number of emerge threads) int 1 - -[***Biome API temperature and humidity noise parameters] - -# Temperature variation for biomes. -mg_biome_np_heat (Heat noise) noise_params 50, 50, (1000, 1000, 1000), 5349, 3, 0.5, 2.0 - -# Small-scale temperature variation for blending biomes on borders. -mg_biome_np_heat_blend (Heat blend noise) noise_params 0, 1.5, (8, 8, 8), 13, 2, 1.0, 2.0 - -# Humidity variation for biomes. -mg_biome_np_humidity (Humidity noise) noise_params 50, 50, (1000, 1000, 1000), 842, 3, 0.5, 2.0 - -# Small-scale humidity variation for blending biomes on borders. -mg_biome_np_humidity_blend (Humidity blend noise) noise_params 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0 - -[***Mapgen v5] - -# Map generation attributes specific to Mapgen v5. -# Flags that are not specified in the flag string are not modified from the default. -# Flags starting with 'no' are used to explicitly disable them. -mgv5_spflags (Mapgen v5 specific flags) flags caverns caverns,nocaverns - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgv5_cave_width (Cave width) float 0.125 - -# Y-level of cavern upper limit. -mgv5_cavern_limit (Cavern limit) int -256 - -# Y-distance over which caverns expand to full size. -mgv5_cavern_taper (Cavern taper) int 256 - -# Defines full size of caverns, smaller values create larger caverns. -mgv5_cavern_threshold (Cavern threshold) float 0.7 - -# Variation of biome filler depth. -mgv5_np_filler_depth (Filler depth noise) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0 - -# Variation of terrain vertical scale. -# When noise is < -0.55 terrain is near-flat. -mgv5_np_factor (Factor noise) noise_params 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0 - -# Y-level of average terrain surface. -mgv5_np_height (Height noise) noise_params 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0 - -# First of 2 3D noises that together define tunnels. -mgv5_np_cave1 (Cave1 noise) noise_params 0, 12, (50, 50, 50), 52534, 4, 0.5, 2.0 - -# Second of 2 3D noises that together define tunnels. -mgv5_np_cave2 (Cave2 noise) noise_params 0, 12, (50, 50, 50), 10325, 4, 0.5, 2.0 - -# 3D noise defining giant caverns. -mgv5_np_cavern (Cavern noise) noise_params 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 - -# TODO -# Noise parameters in group format, unsupported by advanced settings -# menu but settable in minetest.conf. -# See documentation of noise parameter formats in minetest.conf.example. -# 3D noise defining terrain. -#mgv5_np_ground = { -# offset = 0 -# scale = 40 -# spread = (80, 80, 80) -# seed = 983240 -# octaves = 4 -# persistence = 0.55 -# lacunarity = 2.0 -# flags = "eased" -#} - -[***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 -# the 'jungles' flag is ignored. -# Flags that are not specified in the flag string are not modified from the default. -# Flags starting with 'no' are used to explicitly disable them. -mgv6_spflags (Mapgen v6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,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. -mgv6_freq_desert (Desert noise threshold) float 0.45 - -# Sandy beaches occur when np_beach exceeds this value. -mgv6_freq_beach (Beach noise threshold) float 0.15 - -# Y-level of lower terrain and lakebeds. -mgv6_np_terrain_base (Terrain base noise) noise_params -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0 - -# Y-level of higher (cliff-top) terrain. -mgv6_np_terrain_higher (Terrain higher noise) noise_params 20, 16, (500, 500, 500), 85039, 5, 0.6, 2.0 - -# Varies steepness of cliffs. -mgv6_np_steepness (Steepness noise) noise_params 0.85, 0.5, (125, 125, 125), -932, 5, 0.7, 2.0 - -# Defines areas of 'terrain_higher' (cliff-top terrain). -mgv6_np_height_select (Height select noise) noise_params 0.5, 1, (250, 250, 250), 4213, 5, 0.69, 2.0 - -# Varies depth of biome surface nodes. -mgv6_np_mud (Mud noise) noise_params 4, 2, (200, 200, 200), 91013, 3, 0.55, 2.0 - -# Defines areas with sandy beaches. -mgv6_np_beach (Beach noise) noise_params 0, 1, (250, 250, 250), 59420, 3, 0.50, 2.0 - -# Temperature variation for biomes. -mgv6_np_biome (Biome noise) noise_params 0, 1, (500, 500, 500), 9130, 3, 0.50, 2.0 - -# Variation of number of caves. -mgv6_np_cave (Cave noise) noise_params 6, 6, (250, 250, 250), 34329, 3, 0.50, 2.0 - -# Humidity variation for biomes. -mgv6_np_humidity (Humidity noise) noise_params 0.5, 0.5, (500, 500, 500), 72384, 3, 0.50, 2.0 - -# Defines tree areas and tree density. -mgv6_np_trees (Trees noise) noise_params 0, 1, (125, 125, 125), 2, 4, 0.66, 2.0 - -# Defines areas where trees have apples. -mgv6_np_apple_trees (Apple trees noise) noise_params 0, 1, (100, 100, 100), 342902, 3, 0.45, 2.0 - -[***Mapgen v7] - -# Map generation attributes specific to Mapgen v7. -# The 'ridges' flag enables the rivers. -# Floatlands are currently experimental and subject to change. -# Flags that are not specified in the flag string are not modified from the default. -# Flags starting with 'no' are used to explicitly disable them. -mgv7_spflags (Mapgen v7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgv7_cave_width (Cave width) float 0.09 - -# Controls the density of floatland mountain terrain. -# Is an offset added to the 'np_mountain' noise value. -mgv7_float_mount_density (Floatland mountain density) float 0.6 - -# Typical maximum height, above and below midpoint, of floatland mountain terrain. -mgv7_float_mount_height (Floatland mountain height) float 128.0 - -# Y-level of floatland midpoint and lake surface. -mgv7_floatland_level (Floatland level) int 1280 - -# Y-level to which floatland shadows extend. -mgv7_shadow_limit (Shadow limit) int 1024 - -# Y-level of cavern upper limit. -mgv7_cavern_limit (Cavern limit) int -256 - -# Y-distance over which caverns expand to full size. -mgv7_cavern_taper (Cavern taper) int 256 - -# Defines full size of caverns, smaller values create larger caverns. -mgv7_cavern_threshold (Cavern threshold) float 0.7 - -# Y-level of higher (cliff-top) terrain. -mgv7_np_terrain_base (Terrain base noise) noise_params 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0 - -# Y-level of lower terrain and lakebeds. -mgv7_np_terrain_alt (Terrain alt noise) noise_params 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0 - -# Varies roughness of terrain. -# Defines the 'persistence' value for terrain_base and terrain_alt noises. -mgv7_np_terrain_persist (Terrain persistence noise) noise_params 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0 - -# Defines areas of higher (cliff-top) terrain and affects steepness of cliffs. -mgv7_np_height_select (Height select noise) noise_params -8, 16, (500, 500, 500), 4213, 6, 0.7, 2.0 - -# Variation of biome filler depth. -mgv7_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0 - -# Variation of maximum mountain height (in nodes). -mgv7_np_mount_height (Mountain height noise) noise_params 256, 112, (1000, 1000, 1000), 72449, 3, 0.6, 2.0 - -# Defines large-scale river channel structure. -mgv7_np_ridge_uwater (Ridge underwater noise) noise_params 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0 - -# Defines areas of floatland smooth terrain. -# Smooth floatlands occur when noise > 0. -mgv7_np_floatland_base (Floatland base noise) noise_params -0.6, 1.5, (600, 600, 600), 114, 5, 0.6, 2.0 - -# Variation of hill height and lake depth on floatland smooth terrain. -mgv7_np_float_base_height (Floatland base height noise) noise_params 48, 24, (300, 300, 300), 907, 4, 0.7, 2.0 - -# 3D noise defining mountain structure and height. -# Also defines structure of floatland mountain terrain. -mgv7_np_mountain (Mountain noise) noise_params -0.6, 1, (250, 350, 250), 5333, 5, 0.63, 2.0 - -# 3D noise defining structure of river canyon walls. -mgv7_np_ridge (Ridge noise) noise_params 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0 - -# 3D noise defining giant caverns. -mgv7_np_cavern (Cavern noise) noise_params 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 - -# First of 2 3D noises that together define tunnels. -mgv7_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of 2 3D noises that together define tunnels. -mgv7_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -[***Mapgen flat] - -# Map generation attributes specific to Mapgen flat. -# Occasional lakes and hills can be added to the flat world. -# Flags that are not specified in the flag string are not modified from the default. -# Flags starting with 'no' are used to explicitly disable them. -mgflat_spflags (Mapgen flat specific flags) flags nolakes,nohills lakes,hills,nolakes,nohills - -# Y of flat ground. -mgflat_ground_level (Ground level) int 8 - -# Y of upper limit of large pseudorandom caves. -mgflat_large_cave_depth (Large cave depth) int -33 - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgflat_cave_width (Cave width) float 0.09 - -# Terrain noise threshold for lakes. -# Controls proportion of world area covered by lakes. -# Adjust towards 0.0 for a larger proportion. -mgflat_lake_threshold (Lake threshold) float -0.45 - -# Controls steepness/depth of lake depressions. -mgflat_lake_steepness (Lake steepness) float 48.0 - -# Terrain noise threshold for hills. -# Controls proportion of world area covered by hills. -# Adjust towards 0.0 for a larger proportion. -mgflat_hill_threshold (Hill threshold) float 0.45 - -# Controls steepness/height of hills. -mgflat_hill_steepness (Hill steepness) float 64.0 - -# Defines location and terrain of optional hills and lakes. -mgflat_np_terrain (Terrain noise) noise_params 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0 - -# Variation of biome filler depth. -mgflat_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0 - -# First of 2 3D noises that together define tunnels. -mgflat_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of 2 3D noises that together define tunnels. -mgflat_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -[***Mapgen fractal] - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgfractal_cave_width (Cave width) float 0.09 - -# Choice of 18 fractals from 9 formulas. -# 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. -# Controls the amount of fine detail. -mgfractal_iterations (Iterations) int 11 - -# Approximate (X,Y,Z) scale of fractal in nodes. -mgfractal_scale (Scale) v3f (4096.0, 1024.0, 4096.0) - -# (X,Y,Z) offset of fractal from world centre in units of 'scale'. -# Used to move a suitable spawn area of low land close to (0, 0). -# The default is suitable for mandelbrot sets, it needs to be edited for julia sets. -# Range roughly -2 to 2. Multiply by 'scale' for offset in nodes. -mgfractal_offset (Offset) v3f (1.79, 0.0, 0.0) - -# W co-ordinate of the generated 3D slice of a 4D fractal. -# Determines which 3D slice of the 4D shape is generated. -# Has no effect on 3D fractals. -# Range roughly -2 to 2. -mgfractal_slice_w (Slice w) float 0.0 - -# Julia set only: X component of hypercomplex constant determining julia shape. -# Range roughly -2 to 2. -mgfractal_julia_x (Julia x) float 0.33 - -# Julia set only: Y component of hypercomplex constant determining julia shape. -# Range roughly -2 to 2. -mgfractal_julia_y (Julia y) float 0.33 - -# Julia set only: Z component of hypercomplex constant determining julia shape. -# Range roughly -2 to 2. -mgfractal_julia_z (Julia z) float 0.33 - -# Julia set only: W component of hypercomplex constant determining julia shape. -# Has no effect on 3D fractals. -# Range roughly -2 to 2. -mgfractal_julia_w (Julia w) float 0.33 - -# Y-level of seabed. -mgfractal_np_seabed (Seabed noise) noise_params -14, 9, (600, 600, 600), 41900, 5, 0.6, 2.0 - -# Variation of biome filler depth. -mgfractal_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0 - -# First of 2 3D noises that together define tunnels. -mgfractal_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of 2 3D noises that together define tunnels. -mgfractal_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -# Mapgen Valleys parameters -[***Mapgen Valleys] - -# General parameters -[****General] - -# Map generation attributes specific to Mapgen Valleys. -# 'altitude_chill' makes higher elevations colder, which may cause biome issues. -# 'humid_rivers' modifies the humidity around rivers and in areas where water would tend to pool, -# it may interfere with delicately adjusted biomes. -# Flags that are not specified in the flag string are not modified from the default. -# Flags starting with 'no' are used to explicitly disable them. -mg_valleys_spflags (Valleys C Flags) flags altitude_chill,humid_rivers altitude_chill,noaltitude_chill,humid_rivers,nohumid_rivers - -# The altitude at which temperature drops by 20C -mgvalleys_altitude_chill (Altitude Chill) int 90 - -# Depth below which you'll find large caves. -mgvalleys_large_cave_depth (Large cave depth) int -33 - -# Creates unpredictable lava features in caves. -# These can make mining difficult. Zero disables them. (0-10) -mgvalleys_lava_features (Lava Features) int 0 - -# Depth below which you'll find massive caves. -mgvalleys_massive_cave_depth (Massive cave depth) int -256 - -# How deep to make rivers -mgvalleys_river_depth (River Depth) int 4 - -# How wide to make rivers -mgvalleys_river_size (River Size) int 5 - -# Creates unpredictable water features in caves. -# These can make mining difficult. Zero disables them. (0-10) -mgvalleys_water_features (Water Features) int 0 - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgvalleys_cave_width (Cave width) float 0.09 - -# Noise parameters -[****Noises] - -# Caves and tunnels form at the intersection of the two noises -mgvalleys_np_cave1 (Cave noise #1) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Caves and tunnels form at the intersection of the two noises -mgvalleys_np_cave2 (Cave noise #2) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -# The depth of dirt or other filler -mgvalleys_np_filler_depth (Filler Depth) noise_params 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0 - -# Massive caves form here. -mgvalleys_np_massive_caves (Massive cave noise) noise_params 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0 - -# River noise -- rivers occur close to zero -mgvalleys_np_rivers (River Noise) noise_params 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0 - -# Base terrain height -mgvalleys_np_terrain_height (Terrain Height) noise_params -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0 - -# Raises terrain to make valleys around the rivers -mgvalleys_np_valley_depth (Valley Depth) noise_params 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0 - -# Slope and fill work together to modify the heights -mgvalleys_np_inter_valley_fill (Valley Fill) noise_params 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0 - -# Amplifies the valleys -mgvalleys_np_valley_profile (Valley Profile) noise_params 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0 - -# Slope and fill work together to modify the heights -mgvalleys_np_inter_valley_slope (Valley Slope) noise_params 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0 +# Restricts the access of certain client-side functions on servers. +# Combine the byteflags below to restrict client-side features, or set to 0 +# for no restrictions: +# LOAD_CLIENT_MODS: 1 (disable loading client-provided mods) +# CHAT_MESSAGES: 2 (disable send_chat_message call client-side) +# READ_ITEMDEFS: 4 (disable get_item_def call client-side) +# READ_NODEDEFS: 8 (disable get_node_def call client-side) +# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to +# csm_restriction_noderange) +# READ_PLAYERINFO: 32 (disable get_player_names call client-side) +csm_restriction_flags (Client side modding restrictions) int 62 + +# If the CSM restriction for node range is enabled, get_node calls are limited +# to this distance from the player to the node. +csm_restriction_noderange (Client side node lookup range restriction) int 0 [*Security] @@ -1402,9 +1218,9 @@ secure.enable_security (Enable mod security) bool true # functions even when mod security is on (via request_insecure_environment()). secure.trusted_mods (Trusted mods) string -# Comma-separated list of mods that are allowed to access HTTP APIs, which -# allow them to upload and download data to/from the internet. -secure.http_mods (HTTP Mods) string +# Comma-separated list of mods that are allowed to access HTTP APIs, which +# allow them to upload and download data to/from the internet. +secure.http_mods (HTTP mods) string [*Advanced] @@ -1459,7 +1275,8 @@ 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,en,eo,es,et,fr,he,hu,id,it,ja,jbo,ko,ky,lt,nb,nl,pl,pt,pt_BR,ro,ru,sr_Cyrl,tr,uk,zh_CN,zh_TW +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 + # Level of logging to be written to debug.txt: # - (no logging) @@ -1493,18 +1310,634 @@ curl_file_download_timeout (cURL file download timeout) int 300000 # Makes DirectX work with LuaJIT. Disable if it causes troubles. high_precision_fpu (High-precision FPU) bool true +# Changes the main menu UI: +# - Full: Multiple singleplayer worlds, game choice, texture pack chooser, etc. +# - Simple: One singleplayer world, no game or texture pack choosers. May be +# necessary for smaller screens. +main_menu_style (Main menu style) enum full full,simple + # Replaces the default main menu with a custom one. main_menu_script (Main menu script) string -main_menu_game_mgr (Main menu game manager) int 0 - -main_menu_mod_mgr (Main menu mod manager) int 1 - -modstore_download_url (Modstore download URL) string https://forum.minetest.net/media/ - -modstore_listmods_url (Modstore mods list URL) string https://forum.minetest.net/mmdb/mods/ - -modstore_details_url (Modstore details URL) string https://forum.minetest.net/mmdb/mod/*/ - -# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers. +# Print the engine's profiling data in regular intervals (in seconds). +# 0 = disable. Useful for developers. profiler_print_interval (Engine profiling data print interval) int 0 + +[Mapgen] + +# 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 + +# Water surface level of the world. +water_level (Water level) int 1 + +# From how far blocks are generated for clients, stated in mapblocks (16 nodes). +max_block_generate_distance (Max block generate distance) int 8 + +# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0). +# Only mapchunks completely within the mapgen limit are generated. +# Value is stored per-world. +mapgen_limit (Map generation limit) int 31000 0 31000 + +# Global map generation attributes. +# In Mapgen v6 the 'decorations' flag controls all decorations except trees +# and junglegrass, in all other mapgens this flag controls all decorations. +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. +mg_biome_np_heat (Heat noise) noise_params_2d 50, 50, (1000, 1000, 1000), 5349, 3, 0.5, 2.0, eased + +# Small-scale temperature variation for blending biomes on borders. +mg_biome_np_heat_blend (Heat blend noise) noise_params_2d 0, 1.5, (8, 8, 8), 13, 2, 1.0, 2.0, eased + +# Humidity variation for biomes. +mg_biome_np_humidity (Humidity noise) noise_params_2d 50, 50, (1000, 1000, 1000), 842, 3, 0.5, 2.0, eased + +# Small-scale humidity variation for blending biomes on borders. +mg_biome_np_humidity_blend (Humidity blend noise) noise_params_2d 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0, eased + +[*Mapgen V5] + +# Map generation attributes specific to Mapgen v5. +mgv5_spflags (Mapgen V5 specific flags) flags caverns caverns,nocaverns + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgv5_cave_width (Cave width) float 0.09 + +# Y of upper limit of large caves. +mgv5_large_cave_depth (Large cave depth) int -256 + +# Y of upper limit of lava in large caves. +mgv5_lava_depth (Lava depth) int -256 + +# Y-level of cavern upper limit. +mgv5_cavern_limit (Cavern limit) int -256 + +# Y-distance over which caverns expand to full size. +mgv5_cavern_taper (Cavern taper) int 256 + +# Defines full size of caverns, smaller values create larger caverns. +mgv5_cavern_threshold (Cavern threshold) float 0.7 + +# Lower Y limit of dungeons. +mgv5_dungeon_ymin (Dungeon minimum Y) int -31000 + +# Upper Y limit of dungeons. +mgv5_dungeon_ymax (Dungeon maximum Y) int 31000 + +[**Noises] + +# Variation of biome filler depth. +mgv5_np_filler_depth (Filler depth noise) noise_params_2d 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0, eased + +# Variation of terrain vertical scale. +# When noise is < -0.55 terrain is near-flat. +mgv5_np_factor (Factor noise) noise_params_2d 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0, eased + +# Y-level of average terrain surface. +mgv5_np_height (Height noise) noise_params_2d 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0, eased + +# First of two 3D noises that together define tunnels. +mgv5_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# Second of two 3D noises that together define tunnels. +mgv5_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 + +# 3D noise defining giant caverns. +mgv5_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 + +# 3D noise defining terrain. +mgv5_np_ground (Ground noise) noise_params_3d 0, 40, (80, 80, 80), 983240, 4, 0.55, 2.0, eased + +[*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 +# 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 + +# Deserts occur when np_biome exceeds this value. +# When the new biome system is enabled, this is ignored. +mgv6_freq_desert (Desert noise threshold) float 0.45 + +# Sandy beaches occur when np_beach exceeds this value. +mgv6_freq_beach (Beach noise threshold) float 0.15 + +# Lower Y limit of dungeons. +mgv6_dungeon_ymin (Dungeon minimum Y) int -31000 + +# Upper Y limit of dungeons. +mgv6_dungeon_ymax (Dungeon maximum Y) int 31000 + +[**Noises] + +# Y-level of lower terrain and seabed. +mgv6_np_terrain_base (Terrain base noise) noise_params_2d -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0, eased + +# Y-level of higher terrain that creates cliffs. +mgv6_np_terrain_higher (Terrain higher noise) noise_params_2d 20, 16, (500, 500, 500), 85039, 5, 0.6, 2.0, eased + +# Varies steepness of cliffs. +mgv6_np_steepness (Steepness noise) noise_params_2d 0.85, 0.5, (125, 125, 125), -932, 5, 0.7, 2.0, eased + +# Defines distribution of higher terrain. +mgv6_np_height_select (Height select noise) noise_params_2d 0.5, 1, (250, 250, 250), 4213, 5, 0.69, 2.0, eased + +# Varies depth of biome surface nodes. +mgv6_np_mud (Mud noise) noise_params_2d 4, 2, (200, 200, 200), 91013, 3, 0.55, 2.0, eased + +# Defines areas with sandy beaches. +mgv6_np_beach (Beach noise) noise_params_2d 0, 1, (250, 250, 250), 59420, 3, 0.50, 2.0, eased + +# Temperature variation for biomes. +mgv6_np_biome (Biome noise) noise_params_2d 0, 1, (500, 500, 500), 9130, 3, 0.50, 2.0, eased + +# Variation of number of caves. +mgv6_np_cave (Cave noise) noise_params_2d 6, 6, (250, 250, 250), 34329, 3, 0.50, 2.0, eased + +# Humidity variation for biomes. +mgv6_np_humidity (Humidity noise) noise_params_2d 0.5, 0.5, (500, 500, 500), 72384, 3, 0.50, 2.0, eased + +# Defines tree areas and tree density. +mgv6_np_trees (Trees noise) noise_params_2d 0, 1, (125, 125, 125), 2, 4, 0.66, 2.0, eased + +# Defines areas where trees have apples. +mgv6_np_apple_trees (Apple trees noise) noise_params_2d 0, 1, (100, 100, 100), 342902, 3, 0.45, 2.0, eased + +[*Mapgen V7] + +# Map generation attributes specific to Mapgen v7. +# 'ridges' enables the rivers. +mgv7_spflags (Mapgen V7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns + +# Y of mountain density gradient zero level. Used to shift mountains vertically. +mgv7_mount_zero_level (Mountain zero level) int 0 + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgv7_cave_width (Cave width) float 0.09 + +# Y of upper limit of large caves. +mgv7_large_cave_depth (Large cave depth) int -33 + +# 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 + +# Typical maximum height, above and below midpoint, of floatland mountains. +mgv7_float_mount_height (Floatland mountain height) float 128.0 + +# Alters how mountain-type floatlands taper above and below midpoint. +mgv7_float_mount_exponent (Floatland mountain exponent) float 0.75 + +# Y-level of floatland midpoint and lake surface. +mgv7_floatland_level (Floatland level) int 1280 + +# Y-level to which floatland shadows extend. +mgv7_shadow_limit (Shadow limit) int 1024 + +# Y-level of cavern upper limit. +mgv7_cavern_limit (Cavern limit) int -256 + +# Y-distance over which caverns expand to full size. +mgv7_cavern_taper (Cavern taper) int 256 + +# Defines full size of caverns, smaller values create larger caverns. +mgv7_cavern_threshold (Cavern threshold) float 0.7 + +# Lower Y limit of dungeons. +mgv7_dungeon_ymin (Dungeon minimum Y) int -31000 + +# Upper Y limit of dungeons. +mgv7_dungeon_ymax (Dungeon maximum Y) int 31000 + +[**Noises] + +# Y-level of higher terrain that creates cliffs. +mgv7_np_terrain_base (Terrain base noise) noise_params_2d 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0, eased + +# Y-level of lower terrain and seabed. +mgv7_np_terrain_alt (Terrain alternative noise) noise_params_2d 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0, eased + +# Varies roughness of terrain. +# Defines the 'persistence' value for terrain_base and terrain_alt noises. +mgv7_np_terrain_persist (Terrain persistence noise) noise_params_2d 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0, eased + +# Defines distribution of higher terrain and steepness of cliffs. +mgv7_np_height_select (Height select noise) noise_params_2d -8, 16, (500, 500, 500), 4213, 6, 0.7, 2.0, eased + +# Variation of biome filler depth. +mgv7_np_filler_depth (Filler depth noise) noise_params_2d 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0, eased + +# Variation of maximum mountain height (in nodes). +mgv7_np_mount_height (Mountain height noise) noise_params_2d 256, 112, (1000, 1000, 1000), 72449, 3, 0.6, 2.0, eased + +# 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 + +# 3D noise defining structure of river canyon walls. +mgv7_np_ridge (Ridge noise) noise_params_3d 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0 + +# 3D noise defining giant caverns. +mgv7_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 + +# First of two 3D noises that together define tunnels. +mgv7_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# 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 + +[*Mapgen Carpathian] + +# Map generation attributes specific to Mapgen Carpathian. +mgcarpathian_spflags (Mapgen Carpathian specific flags) flags caverns caverns,nocaverns + +# Defines the base ground level. +mgcarpathian_base_level (Base ground level) float 12.0 + +# 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 + +# Y of upper limit of lava in large caves. +mgcarpathian_lava_depth (Lava depth) int -256 + +# Y-level of cavern upper limit. +mgcarpathian_cavern_limit (Cavern limit) int -256 + +# Y-distance over which caverns expand to full size. +mgcarpathian_cavern_taper (Cavern taper) int 256 + +# Defines full size of caverns, smaller values create larger caverns. +mgcarpathian_cavern_threshold (Cavern threshold) float 0.7 + +# Lower Y limit of dungeons. +mgcarpathian_dungeon_ymin (Dungeon minimum Y) int -31000 + +# Upper Y limit of dungeons. +mgcarpathian_dungeon_ymax (Dungeon maximum Y) int 31000 + +[**Noises] + +# Variation of biome filler depth. +mgcarpathian_np_filler_depth (Filler depth noise) noise_params_2d 0, 1, (128, 128, 128), 261, 3, 0.7, 2.0, eased + +# First of 4 2D noises that together define hill/mountain range height. +mgcarpathian_np_height1 (Hilliness1 noise) noise_params_2d 0, 5, (251, 251, 251), 9613, 5, 0.5, 2.0, eased + +# Second of 4 2D noises that together define hill/mountain range height. +mgcarpathian_np_height2 (Hilliness2 noise) noise_params_2d 0, 5, (383, 383, 383), 1949, 5, 0.5, 2.0, eased + +# Third of 4 2D noises that together define hill/mountain range height. +mgcarpathian_np_height3 (Hilliness3 noise) noise_params_2d 0, 5, (509, 509, 509), 3211, 5, 0.5, 2.0, eased + +# Fourth of 4 2D noises that together define hill/mountain range height. +mgcarpathian_np_height4 (Hilliness4 noise) noise_params_2d 0, 5, (631, 631, 631), 1583, 5, 0.5, 2.0, eased + +# 2D noise that controls the size/occurrence of rolling hills. +mgcarpathian_np_hills_terrain (Rolling hills spread noise) noise_params_2d 1, 1, (1301, 1301, 1301), 1692, 3, 0.5, 2.0, eased + +# 2D noise that controls the size/occurrence of ridged mountain ranges. +mgcarpathian_np_ridge_terrain (Ridge mountain spread noise) noise_params_2d 1, 1, (1889, 1889, 1889), 3568, 3, 0.5, 2.0, eased + +# 2D noise that controls the size/occurrence of step mountain ranges. +mgcarpathian_np_step_terrain (Step mountain spread noise) noise_params_2d 1, 1, (1889, 1889, 1889), 4157, 3, 0.5, 2.0, eased + +# 2D noise that controls the shape/size of rolling hills. +mgcarpathian_np_hills (Rolling hill size noise) noise_params_2d 0, 3, (257, 257, 257), 6604, 6, 0.5, 2.0, eased + +# 2D noise that controls the shape/size of ridged mountains. +mgcarpathian_np_ridge_mnt (Ridged mountain size noise) noise_params_2d 0, 12, (743, 743, 743), 5520, 6, 0.7, 2.0, eased + +# 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 + +# 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 + +# First of two 3D noises that together define tunnels. +mgcarpathian_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# Second of two 3D noises that together define tunnels. +mgcarpathian_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 + +# 3D noise defining giant caverns. +mgcarpathian_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 + +[*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 + +# Y of flat ground. +mgflat_ground_level (Ground level) int 8 + +# Y of upper limit of large caves. +mgflat_large_cave_depth (Large cave depth) int -33 + +# Y of upper limit of lava in large caves. +mgflat_lava_depth (Lava depth) int -256 + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgflat_cave_width (Cave width) float 0.09 + +# Terrain noise threshold for lakes. +# Controls proportion of world area covered by lakes. +# Adjust towards 0.0 for a larger proportion. +mgflat_lake_threshold (Lake threshold) float -0.45 + +# Controls steepness/depth of lake depressions. +mgflat_lake_steepness (Lake steepness) float 48.0 + +# Terrain noise threshold for hills. +# Controls proportion of world area covered by hills. +# Adjust towards 0.0 for a larger proportion. +mgflat_hill_threshold (Hill threshold) float 0.45 + +# Controls steepness/height of hills. +mgflat_hill_steepness (Hill steepness) float 64.0 + +# Lower Y limit of dungeons. +mgflat_dungeon_ymin (Dungeon minimum Y) int -31000 + +# Upper Y limit of dungeons. +mgflat_dungeon_ymax (Dungeon maximum Y) int 31000 + +[**Noises] + +# Defines location and terrain of optional hills and lakes. +mgflat_np_terrain (Terrain noise) noise_params_2d 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0, eased + +# Variation of biome filler depth. +mgflat_np_filler_depth (Filler depth noise) noise_params_2d 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0, eased + +# First of two 3D noises that together define tunnels. +mgflat_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# 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 + +[*Mapgen Fractal] + +# 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 + +# Y of upper limit of lava in large caves. +mgfractal_lava_depth (Lava depth) int -256 + +# Lower Y limit of dungeons. +mgfractal_dungeon_ymin (Dungeon minimum Y) int -31000 + +# Upper Y limit of dungeons. +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. +mgfractal_fractal (Fractal type) int 1 1 18 + +# Iterations of the recursive function. +# Increasing this increases the amount of fine detail, but also +# increases processing load. +# At iterations = 20 this mapgen has a similar load to mapgen V7. +mgfractal_iterations (Iterations) int 11 + +# (X,Y,Z) scale of fractal in nodes. +# Actual fractal size will be 2 to 3 times larger. +# These numbers can be made very large, the fractal does +# not have to fit inside the world. +# Increase these to 'zoom' into the detail of the fractal. +# Default is for a vertically-squashed shape suitable for +# an island, set all 3 numbers equal for the raw shape. +mgfractal_scale (Scale) v3f (4096.0, 1024.0, 4096.0) + +# (X,Y,Z) offset of fractal from world center in units of 'scale'. +# 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 +# sets with default parameters, it may need altering in other +# situations. +# Range roughly -2 to 2. Multiply by 'scale' for offset in nodes. +mgfractal_offset (Offset) v3f (1.79, 0.0, 0.0) + +# W coordinate of the generated 3D slice of a 4D fractal. +# Determines which 3D slice of the 4D shape is generated. +# Alters the shape of the fractal. +# Has no effect on 3D fractals. +# Range roughly -2 to 2. +mgfractal_slice_w (Slice w) float 0.0 + +# Julia set only. +# X component of hypercomplex constant. +# Alters the shape of the fractal. +# Range roughly -2 to 2. +mgfractal_julia_x (Julia x) float 0.33 + +# Julia set only. +# Y component of hypercomplex constant. +# Alters the shape of the fractal. +# Range roughly -2 to 2. +mgfractal_julia_y (Julia y) float 0.33 + +# Julia set only. +# Z component of hypercomplex constant. +# Alters the shape of the fractal. +# Range roughly -2 to 2. +mgfractal_julia_z (Julia z) float 0.33 + +# Julia set only. +# W component of hypercomplex constant. +# Alters the shape of the fractal. +# Has no effect on 3D fractals. +# Range roughly -2 to 2. +mgfractal_julia_w (Julia w) float 0.33 + +[**Noises] + +# Y-level of seabed. +mgfractal_np_seabed (Seabed noise) noise_params_2d -14, 9, (600, 600, 600), 41900, 5, 0.6, 2.0, eased + +# Variation of biome filler depth. +mgfractal_np_filler_depth (Filler depth noise) noise_params_2d 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0, eased + +# First of two 3D noises that together define tunnels. +mgfractal_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# 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 + +[*Mapgen Valleys] + +# Map generation attributes specific to Mapgen Valleys. +# 'altitude_chill': Reduces heat with altitude. +# 'humid_rivers': Increases humidity around rivers. +# '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 + +# 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 +# 'altitude_dry' is enabled. +mgvalleys_altitude_chill (Altitude chill) int 90 + +# Depth below which you'll find large caves. +mgvalleys_large_cave_depth (Large cave depth) int -33 + +# Y of upper limit of lava in large caves. +mgvalleys_lava_depth (Lava depth) int 1 + +# Depth below which you'll find giant caverns. +mgvalleys_cavern_limit (Cavern upper limit) int -256 + +# Y-distance over which caverns expand to full size. +mgvalleys_cavern_taper (Cavern taper) int 192 + +# Defines full size of caverns, smaller values create larger caverns. +mgvalleys_cavern_threshold (Cavern threshold) float 0.6 + +# How deep to make rivers. +mgvalleys_river_depth (River depth) int 4 + +# How wide to make rivers. +mgvalleys_river_size (River size) int 5 + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgvalleys_cave_width (Cave width) float 0.09 + +# Lower Y limit of dungeons. +mgvalleys_dungeon_ymin (Dungeon minimum Y) int -31000 + +# Upper Y limit of dungeons. +mgvalleys_dungeon_ymax (Dungeon maximum Y) int 63 + +[**Noises] + +# First of two 3D noises that together define tunnels. +mgvalleys_np_cave1 (Cave noise #1) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# Second of two 3D noises that together define tunnels. +mgvalleys_np_cave2 (Cave noise #2) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 + +# The depth of dirt or other biome filler node. +mgvalleys_np_filler_depth (Filler depth) noise_params_2d 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0, eased + +# 3D noise defining giant caverns. +mgvalleys_np_cavern (Cavern noise) noise_params_3d 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0 + +# Defines large-scale river channel structure. +mgvalleys_np_rivers (River noise) noise_params_2d 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0, eased + +# Base terrain height. +mgvalleys_np_terrain_height (Terrain height) noise_params_2d -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0, eased + +# Raises terrain to make valleys around the rivers. +mgvalleys_np_valley_depth (Valley depth) noise_params_2d 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0, eased + +# Slope and fill work together to modify the heights. +mgvalleys_np_inter_valley_fill (Valley fill) noise_params_3d 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0 + +# Amplifies the valleys. +mgvalleys_np_valley_profile (Valley profile) noise_params_2d 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0, eased + +# 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 + +[*Advanced] + +# Size of mapchunks generated by mapgen, stated in mapblocks (16 nodes). +# WARNING!: There is no benefit, and there are several dangers, in +# increasing this value above 5. +# Reducing this value increases cave and dungeon density. +# Altering this value is for special usage, leaving it unchanged is +# recommended. +chunksize (Chunk size) int 5 + +# Dump the mapgen debug information. +enable_mapgen_debug_info (Mapgen debug) bool false + +# Maximum number of blocks that can be queued for loading. +emergequeue_limit_total (Absolute limit of emerge queues) int 512 + +# Maximum number of blocks to be queued that are to be loaded from file. +# Set to blank for an appropriate amount to be chosen automatically. +emergequeue_limit_diskonly (Limit of emerge queues on disk) int 64 + +# Maximum number of blocks to be queued that are to be generated. +# Set to blank for an appropriate amount to be chosen automatically. +emergequeue_limit_generate (Limit of emerge queues to generate) int 64 + +# Number of emerge threads to use. +# WARNING: Currently there are multiple bugs that may cause crashes when +# 'num_emerge_threads' is larger than 1. Until this warning is removed it is +# strongly recommended this value is set to the default '1'. +# Value 0: +# - Automatic selection. The number of emerge threads will be +# - 'number of processors - 2', with a lower limit of 1. +# Any other value: +# - Specifies the number of emerge threads, with a lower limit of 1. +# WARNING: Increasing the number of emerge threads increases engine mapgen +# speed, but this may harm game performance by interfering with other +# processes, especially in singleplayer and/or when running Lua code in +# 'on_generated'. For many users the optimum setting may be '1'. +num_emerge_threads (Number of emerge threads) int 1 + +[Online Content Repository] + +# The URL for the content repository +contentdb_url (ContentDB URL) string https://content.minetest.net + +# Comma-separated list of flags to hide in the content repository. +# "nonfree" can be used to hide packages which do not qualify as 'free software', +# as defined by the Free Software Foundation. +# You can also specify content ratings. +# These flags are independent from Minetest versions, +# so see a full list at https://content.minetest.net/help/content_flags/ +contentdb_flag_blacklist (ContentDB Flag Blacklist) string nonfree, desktop_default diff --git a/client/serverlist/favoriteservers.txt b/client/serverlist/favoriteservers.txt index a77b145..b2945a4 100644 --- a/client/serverlist/favoriteservers.txt +++ b/client/serverlist/favoriteservers.txt @@ -1,6 +1,6 @@ [server] -BlockColor +BlockColor Server blockcolor.net 30000 -BlockColor is a creative sandbox with only 8 colors. Only a limit : Your Imagination. +BlockColor is a creative sandbox with only 8 colors. Only a limit : Your Imagination - http://blockcolor.net/ diff --git a/client/shaders/3d_interlaced_merge/opengl_fragment.glsl b/client/shaders/3d_interlaced_merge/opengl_fragment.glsl new file mode 100644 index 0000000..25945ad --- /dev/null +++ b/client/shaders/3d_interlaced_merge/opengl_fragment.glsl @@ -0,0 +1,21 @@ +uniform sampler2D baseTexture; +uniform sampler2D normalTexture; +uniform sampler2D textureFlags; + +#define leftImage baseTexture +#define rightImage normalTexture +#define maskImage textureFlags + +void main(void) +{ + vec2 uv = gl_TexCoord[0].st; + vec4 left = texture2D(leftImage, uv).rgba; + vec4 right = texture2D(rightImage, uv).rgba; + vec4 mask = texture2D(maskImage, uv).rgba; + vec4 color; + if (mask.r > 0.5) + color = right; + else + color = left; + gl_FragColor = color; +} diff --git a/client/shaders/3d_interlaced_merge/opengl_vertex.glsl b/client/shaders/3d_interlaced_merge/opengl_vertex.glsl new file mode 100644 index 0000000..4e0b2b1 --- /dev/null +++ b/client/shaders/3d_interlaced_merge/opengl_vertex.glsl @@ -0,0 +1,6 @@ +void main(void) +{ + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_Vertex; + gl_FrontColor = gl_BackColor = gl_Color; +} diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl index 3ac79c2..54b569c 100644 --- a/client/shaders/nodes_shader/opengl_vertex.glsl +++ b/client/shaders/nodes_shader/opengl_vertex.glsl @@ -135,7 +135,7 @@ float disp_z; color.a = 1; // Emphase blue a bit in darker places - // See C++ implementation in mapblock_mesh.cpp finalColorBlend() + // See C++ implementation in mapblock_mesh.cpp final_color_blend() float brightness = (color.r + color.g + color.b) / 3; color.b += max(0.0, 0.021 - abs(0.2 * brightness - 0.021) + 0.07 * brightness); diff --git a/clientmods/mods.conf b/clientmods/mods.conf deleted file mode 100644 index dc3f0f2..0000000 --- a/clientmods/mods.conf +++ /dev/null @@ -1 +0,0 @@ -load_mod_preview = false diff --git a/clientmods/preview/example.lua b/clientmods/preview/example.lua new file mode 100644 index 0000000..2f661c0 --- /dev/null +++ b/clientmods/preview/example.lua @@ -0,0 +1,2 @@ +print("Loaded example file!, loading more examples") +dofile("preview:examples/first.lua") diff --git a/clientmods/preview/examples/first.lua b/clientmods/preview/examples/first.lua new file mode 100644 index 0000000..c24f461 --- /dev/null +++ b/clientmods/preview/examples/first.lua @@ -0,0 +1 @@ +print("loaded first.lua example file") diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua index f399261..bb8d1d6 100644 --- a/clientmods/preview/init.lua +++ b/clientmods/preview/init.lua @@ -1,18 +1,57 @@ local modname = core.get_current_modname() or "??" local modstorage = core.get_mod_storage() +local mod_channel +dofile("preview:example.lua") -- This is an example function to ensure it's working properly, should be removed before merge core.register_on_shutdown(function() print("[PREVIEW] shutdown client") end) +local id = nil -core.register_on_connect(function() - print("[PREVIEW] Player connection completed") - local server_info = core.get_server_info() - print("Server version: " .. server_info.protocol_version) - print("Server ip: " .. server_info.ip) - print("Server address: " .. server_info.address) - print("Server port: " .. server_info.port) +local server_info = core.get_server_info() +print("Server version: " .. server_info.protocol_version) +print("Server ip: " .. server_info.ip) +print("Server address: " .. server_info.address) +print("Server port: " .. server_info.port) +mod_channel = core.mod_channel_join("experimental_preview") + +core.after(4, function() + if mod_channel:is_writeable() then + mod_channel:send_all("preview talk to experimental") + end +end) + +core.after(1, function() + id = core.localplayer:hud_add({ + hud_elem_type = "text", + name = "example", + number = 0xff0000, + position = {x=0, y=1}, + offset = {x=8, y=-8}, + text = "You are using the preview mod", + scale = {x=200, y=60}, + alignment = {x=1, y=-1}, + }) +end) + +core.register_on_modchannel_message(function(channel, sender, message) + print("[PREVIEW][modchannels] Received message `" .. message .. "` on channel `" + .. channel .. "` from sender `" .. sender .. "`") + core.after(1, function() + mod_channel:send_all("CSM preview received " .. message) + end) +end) + +core.register_on_modchannel_signal(function(channel, signal) + print("[PREVIEW][modchannels] Received signal id `" .. signal .. "` on channel `" + .. channel) +end) + +core.register_on_inventory_open(function(inventory) + print("INVENTORY OPEN") + print(dump(inventory)) + return false end) core.register_on_placenode(function(pointed_thing, node) @@ -30,13 +69,13 @@ core.register_on_item_use(function(itemstack, pointed_thing) end) -- This is an example function to ensure it's working properly, should be removed before merge -core.register_on_receiving_chat_messages(function(message) +core.register_on_receiving_chat_message(function(message) print("[PREVIEW] Received message " .. message) return false end) -- This is an example function to ensure it's working properly, should be removed before merge -core.register_on_sending_chat_messages(function(message) +core.register_on_sending_chat_message(function(message) print("[PREVIEW] Sending message " .. message) return false end) @@ -150,3 +189,19 @@ core.register_on_punchnode(function(pos, node) return false end) +core.register_chatcommand("privs", { + func = function(param) + return true, core.privs_to_string(minetest.get_privilege_list()) + end, +}) + +core.register_chatcommand("text", { + func = function(param) + return core.localplayer:hud_change(id, "text", param) + end, +}) + + +core.register_on_mods_loaded(function() + core.log("Yeah preview mod is loaded with other CSM mods.") +end) diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000..8be6ecc --- /dev/null +++ b/doc/README.md @@ -0,0 +1,500 @@ +Minetest +======== + +[![Build Status](https://travis-ci.org/minetest/minetest.svg?branch=master)](https://travis-ci.org/minetest/minetest) +[![Translation status](https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg)](https://hosted.weblate.org/engage/minetest/?utm_source=widget) +[![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html) + +Minetest is a free open-source voxel game engine with easy modding and game creation. + +Copyright (C) 2010-2018 Perttu Ahola +and contributors (see source file comments and the version control log) + +In case you downloaded the source code: +--------------------------------------- +If you downloaded the Minetest Engine source code in which this file is +contained, you probably want to download the [Minetest Game](https://github.com/minetest/minetest_game/) +project too. See its README.txt for more information. + +Table of Contents +------------------ + +1. [Further Documentation](#further-documentation) +2. [Default Controls](#default-controls) +3. [Paths](#paths) +4. [Configuration File](#configuration-file) +5. [Command-line Options](#command-line-options) +6. [Compiling](#compiling) +7. [Docker](#docker) +8. [Version Scheme](#version-scheme) + + +Further documentation +---------------------- +- Website: http://minetest.net/ +- Wiki: http://wiki.minetest.net/ +- Developer wiki: http://dev.minetest.net/ +- Forum: http://forum.minetest.net/ +- GitHub: https://github.com/minetest/minetest/ +- [doc/](doc/) directory of source distribution + +Default controls +---------------- +All controls are re-bindable using settings. +Some can be changed in the key config dialog in the settings tab. + +| Button | Action | +|-------------------------------|----------------------------------------------------------------| +| Move mouse | Look around | +| W, A, S, D | Move | +| Space | Jump/move up | +| Shift | Sneak/move down | +| Q | Drop itemstack | +| Shift + Q | Drop single item | +| Left mouse button | Dig/punch/take item | +| Right mouse button | Place/use | +| Shift + right mouse button | Build (without using) | +| I | Inventory menu | +| Mouse wheel | Select item | +| 0-9 | Select item | +| Z | Zoom (needs zoom privilege) | +| T | Chat | +| / | Command | +| Esc | Pause menu/abort/exit (pauses only singleplayer game) | +| R | Enable/disable full range view | +| + | Increase view range | +| - | Decrease view range | +| K | Enable/disable fly mode (needs fly privilege) | +| L | Enable/disable pitch move mode | +| J | Enable/disable fast mode (needs fast privilege) | +| H | Enable/disable noclip mode (needs noclip privilege) | +| E | Move fast in fast mode | +| F1 | Hide/show HUD | +| F2 | Hide/show chat | +| F3 | Disable/enable fog | +| F4 | Disable/enable camera update (Mapblocks are not updated anymore when disabled, disabled in release builds) | +| F5 | Cycle through debug information screens | +| F6 | Cycle through profiler info screens | +| F7 | Cycle through camera modes | +| F9 | Cycle through minimap modes | +| Shift + F9 | Change minimap orientation | +| F10 | Show/hide console | +| F12 | Take screenshot | + +Paths +----- +Locations: + +* `bin` - Compiled binaries +* `share` - Distributed read-only data +* `user` - User-created modifiable data + +Where each location is on each platform: + +* Windows .zip / RUN_IN_PLACE source: + * bin = `bin` + * share = `.` + * user = `.` +* Windows installed: + * $bin = `C:\Program Files\Minetest\bin (Depends on the install location)` + * $share = `C:\Program Files\Minetest (Depends on the install location)` + * $user = `%Appdata%\Minetest` +* Linux installed: + * `bin` = `/usr/bin` + * `share` = `/usr/share/minetest` + * `user` = `~/.minetest` +* macOS: + * `bin` = `Contents/MacOS` + * `share` = `Contents/Resources` + * `user` = `Contents/User OR ~/Library/Application Support/minetest` + +Worlds can be found as separate folders in: `user/worlds/` + +Configuration file: +------------------- +- Default location: + `user/minetest.conf` +- It is created by Minetest when it is ran the first time. +- A specific file can be specified on the command line: + `--config ` +- A run-in-place build will look for the configuration file in + `location_of_exe/../minetest.conf` and also `location_of_exe/../../minetest.conf` + +Command-line options: +--------------------- +- Use `--help` + +Compiling +--------- +### Compiling on GNU/Linux + +#### Dependencies + +| Dependency | Version | Commentary | +|------------|---------|------------| +| GCC | 4.9+ | Can be replaced with Clang 3.4+ | +| CMake | 2.6+ | | +| Irrlicht | 1.7.3+ | | +| SQLite3 | 3.0+ | | +| LuaJIT | 2.0+ | Bundled Lua 5.1 is used if not present | +| GMP | 5.0.0+ | Bundled mini-GMP is used if not present | +| JsonCPP | 1.0.0+ | Bundled JsonCPP is used if not present | + +For Debian/Ubuntu: + + sudo apt install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev + +For Fedora users: + + sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel + +#### Download + +You can install Git for easily keeping your copy up to date. +If you don’t want Git, read below on how to get the source without Git. +This is an example for installing Git on Debian/Ubuntu: + + sudo apt install git + +For Fedora users: + + sudo dnf install git + +Download source (this is the URL to the latest of source repository, which might not work at all times) using Git: + + git clone --depth 1 https://github.com/minetest/minetest.git + cd minetest + +Download minetest_game (otherwise only the "Minimal development test" game is available) using Git: + + git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game + +Download source, without using Git: + + wget https://github.com/minetest/minetest/archive/master.tar.gz + tar xf master.tar.gz + cd minetest-master + +Download minetest_game, without using Git: + + cd games/ + wget https://github.com/minetest/minetest_game/archive/master.tar.gz + tar xf master.tar.gz + mv minetest_game-master minetest_game + cd .. + +#### Build + +Build a version that runs directly from the source directory: + + cmake . -DRUN_IN_PLACE=TRUE + make -j + +Run it: + + ./bin/minetest + +- Use `cmake . -LH` to see all CMake options and their current state +- If you want to install it system-wide (or are making a distribution package), + you will want to use `-DRUN_IN_PLACE=FALSE` +- You can build a bare server by specifying `-DBUILD_SERVER=TRUE` +- You can disable the client build by specifying `-DBUILD_CLIENT=FALSE` +- You can select between Release and Debug build by `-DCMAKE_BUILD_TYPE=` + - Debug build is slower, but gives much more useful output in a debugger +- If you build a bare server, you don't need to have Irrlicht installed. + - In that case use `-DIRRLICHT_SOURCE_DIR=/the/irrlicht/source` + +### CMake options + +General options and their default values: + + BUILD_CLIENT=TRUE - Build Minetest client + BUILD_SERVER=FALSE - Build Minetest server + CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug) + Release - Release build + Debug - Debug build + SemiDebug - Partially optimized debug build + RelWithDebInfo - Release build with debug information + MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible + ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http + ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal) + ENABLE_FREETYPE=ON - Build with FreeType2; Allows using TTF fonts + ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations + ENABLE_GLES=OFF - Search for Open GLES headers & libraries and use them + ENABLE_LEVELDB=ON - Build with LevelDB; Enables use of LevelDB map backend + ENABLE_POSTGRESQL=ON - Build with libpq; Enables use of PostgreSQL map backend (PostgreSQL 9.5 or greater recommended) + ENABLE_REDIS=ON - Build with libhiredis; Enables use of Redis map backend + ENABLE_SPATIAL=ON - Build with LibSpatial; Speeds up AreaStores + ENABLE_SOUND=ON - Build with OpenAL, libogg & libvorbis; in-game sounds + ENABLE_LUAJIT=ON - Build with LuaJIT (much faster than non-JIT Lua) + ENABLE_SYSTEM_GMP=ON - Use GMP from system (much faster than bundled mini-gmp) + ENABLE_SYSTEM_JSONCPP=OFF - Use JsonCPP from system + OPENGL_GL_PREFERENCE=LEGACY - Linux client build only; See CMake Policy CMP0072 for reference + RUN_IN_PLACE=FALSE - Create a portable install (worlds, settings etc. in current directory) + USE_GPROF=FALSE - Enable profiling using GProf + VERSION_EXTRA= - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar) + +Library specific options: + + BZIP2_INCLUDE_DIR - Linux only; directory where bzlib.h is located + BZIP2_LIBRARY - Linux only; path to libbz2.a/libbz2.so + CURL_DLL - Only if building with cURL on Windows; path to libcurl.dll + CURL_INCLUDE_DIR - Only if building with cURL; directory where curl.h is located + CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib + EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h + EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so + FREETYPE_INCLUDE_DIR_freetype2 - Only if building with FreeType 2; directory that contains an freetype directory with files such as ftimage.h in it + FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h + FREETYPE_LIBRARY - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib + FREETYPE_DLL - Only if building with FreeType 2 on Windows; path to libfreetype.dll + GETTEXT_DLL - Only when building with gettext on Windows; path to libintl3.dll + GETTEXT_ICONV_DLL - Only when building with gettext on Windows; path to libiconv2.dll + GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h + GETTEXT_LIBRARY - Only when building with gettext on Windows; path to libintl.dll.a + GETTEXT_MSGFMT - Only when building with gettext; path to msgfmt/msgfmt.exe + IRRLICHT_DLL - Only on Windows; path to Irrlicht.dll + IRRLICHT_INCLUDE_DIR - Directory that contains IrrCompileConfig.h + IRRLICHT_LIBRARY - Path to libIrrlicht.a/libIrrlicht.so/libIrrlicht.dll.a/Irrlicht.lib + LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h + LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a + LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll + PostgreSQL_INCLUDE_DIR - Only when building with PostgreSQL; directory that contains libpq-fe.h + POSTGRESQL_LIBRARY - Only when building with PostgreSQL; path to libpq.a/libpq.so + REDIS_INCLUDE_DIR - Only when building with Redis; directory that contains hiredis.h + REDIS_LIBRARY - Only when building with Redis; path to libhiredis.a/libhiredis.so + SPATIAL_INCLUDE_DIR - Only when building with LibSpatial; directory that contains spatialindex/SpatialIndex.h + SPATIAL_LIBRARY - Only when building with LibSpatial; path to libspatialindex_c.so/spatialindex-32.lib + LUA_INCLUDE_DIR - Only if you want to use LuaJIT; directory where luajit.h is located + LUA_LIBRARY - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so + MINGWM10_DLL - Only if compiling with MinGW; path to mingwm10.dll + OGG_DLL - Only if building with sound on Windows; path to libogg.dll + OGG_INCLUDE_DIR - Only if building with sound; directory that contains an ogg directory which contains ogg.h + OGG_LIBRARY - Only if building with sound; path to libogg.a/libogg.so/libogg.dll.a + OPENAL_DLL - Only if building with sound on Windows; path to OpenAL32.dll + OPENAL_INCLUDE_DIR - Only if building with sound; directory where al.h is located + OPENAL_LIBRARY - Only if building with sound; path to libopenal.a/libopenal.so/OpenAL32.lib + OPENGLES2_INCLUDE_DIR - Only if building with GLES; directory that contains gl2.h + OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so + SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h + SQLITE3_LIBRARY - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib + VORBISFILE_DLL - Only if building with sound on Windows; path to libvorbisfile-3.dll + VORBISFILE_LIBRARY - Only if building with sound; path to libvorbisfile.a/libvorbisfile.so/libvorbisfile.dll.a + VORBIS_DLL - Only if building with sound on Windows; path to libvorbis-0.dll + VORBIS_INCLUDE_DIR - Only if building with sound; directory that contains a directory vorbis with vorbisenc.h inside + VORBIS_LIBRARY - Only if building with sound; path to libvorbis.a/libvorbis.so/libvorbis.dll.a + XXF86VM_LIBRARY - Only on Linux; path to libXXf86vm.a/libXXf86vm.so + ZLIB_DLL - Only on Windows; path to zlib1.dll + ZLIBWAPI_DLL - Only on Windows; path to zlibwapi.dll + ZLIB_INCLUDE_DIR - Directory that contains zlib.h + ZLIB_LIBRARY - Path to libz.a/libz.so/zlibwapi.lib + +### Compiling on Windows + +* This section is outdated. In addition to what is described here: + * In addition to minetest, you need to download [minetest_game](https://github.com/minetest/minetest_game). + * If you wish to have sound support, you need libogg, libvorbis and libopenal + +* You need: + * CMake: + http://www.cmake.org/cmake/resources/software.html + * A compiler + * MinGW: http://www.mingw.org/ + * or Visual Studio: http://msdn.microsoft.com/en-us/vstudio/default + * Irrlicht SDK 1.7: + http://irrlicht.sourceforge.net/downloads.html + * Zlib headers (zlib125.zip) + http://www.winimage.com/zLibDll/index.html + * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip): + http://www.winimage.com/zLibDll/index.html + * SQLite3 headers and library + https://www.sqlite.org/download.html + * Optional: gettext library and tools: + http://gnuwin32.sourceforge.net/downlinks/gettext.php + * This is used for other UI languages. Feel free to leave it out. + * And, of course, Minetest: + http://minetest.net/download +* Steps: + * Select a directory called DIR hereafter in which you will operate. + * Make sure you have CMake and a compiler installed. + * Download all the other stuff to DIR and extract them into there. + ("extract here", not "extract to packagename/") + * NOTE: zlib125dll.zip needs to be extracted into zlib125dll + * NOTE: You need to extract sqlite3.h & sqlite3ext.h from the SQLite 3 + source and sqlite3.dll & sqlite3.def from the SQLite 3 precompiled + binaries into "sqlite3" directory, and generate sqlite3.lib using + command "LIB /DEF:sqlite3.def /OUT:sqlite3.lib" + * All those packages contain a nice base directory in them, which + should end up being the direct subdirectories of DIR. + * You will end up with a directory structure like this (+=dir, -=file): + ----------------- + + DIR + * zlib-1.2.5.tar.gz + * zlib125dll.zip + * irrlicht-1.8.3.zip + * sqlite-amalgamation-3130000.zip (SQLite3 headers) + * sqlite-dll-win32-x86-3130000.zip (SQLite3 library for 32bit system) + * 110214175330.zip (or whatever, this is the minetest source) + + zlib-1.2.5 + * zlib.h + + win32 + ... + + zlib125dll + * readme.txt + + dll32 + ... + + irrlicht-1.8.3 + + lib + + include + ... + + sqlite3 + sqlite3.h + sqlite3ext.h + sqlite3.lib + sqlite3.dll + + gettext (optional) + +bin + +include + +lib + + minetest + + src + + doc + * CMakeLists.txt + ... + ----------------- + * Start up the CMake GUI + * Select "Browse Source..." and select DIR/minetest + * Now, if using MSVC: + * Select "Browse Build..." and select DIR/minetest-build + * Else if using MinGW: + * Select "Browse Build..." and select DIR/minetest + * Select "Configure" + * Select your compiler + * It will warn about missing stuff, ignore that at this point. (later don't) + * Make sure the configuration is as follows + (note that the versions may differ for you): + + BUILD_CLIENT [X] + BUILD_SERVER [ ] + CMAKE_BUILD_TYPE Release + CMAKE_INSTALL_PREFIX DIR/minetest-install + IRRLICHT_SOURCE_DIR DIR/irrlicht-1.8.3 + RUN_IN_PLACE [X] + WARN_ALL [ ] + ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll + ZLIB_INCLUDE_DIR DIR/zlib-1.2.5 + ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib + GETTEXT_BIN_DIR DIR/gettext/bin + GETTEXT_INCLUDE_DIR DIR/gettext/include + GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib + GETTEXT_MSGFMT DIR/gettext/bin/msgfmt + + * If CMake complains it couldn't find SQLITE3, choose "Advanced" box on the + right top corner, then specify the location of SQLITE3_INCLUDE_DIR and + SQLITE3_LIBRARY manually. + * If you want to build 64-bit minetest, you will need to build 64-bit version + of irrlicht engine manually, as only 32-bit pre-built library is provided. + * Hit "Configure" + * Hit "Configure" once again 8) + * If something is still coloured red, you have a problem. + * Hit "Generate" + If using MSVC: + * Open the generated minetest.sln + * The project defaults to the "Debug" configuration. Make very sure to + select "Release", unless you want to debug some stuff (it's slower + and might not even work at all) + * Build the ALL_BUILD project + * Build the INSTALL project + * You should now have a working game with the executable in + DIR/minetest-install/bin/minetest.exe + * Additionally you may create a zip package by building the PACKAGE + project. + If using MinGW: + * Using the command line, browse to the build directory and run 'make' + (or mingw32-make or whatever it happens to be) + * You may need to copy some of the downloaded DLLs into bin/, see what + running the produced executable tells you it doesn't have. + * You should now have a working game with the executable in + DIR/minetest/bin/minetest.exe + +### Bat script to build Windows releases of Minetest + +This is how we build Windows releases. + + set sourcedir=%CD% + set installpath="C:\tmp\minetest_install" + set irrlichtpath="C:\tmp\irrlicht-1.7.2" + + set builddir=%sourcedir%\bvc10 + mkdir %builddir% + pushd %builddir% + cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=TRUE -DCMAKE_INSTALL_PREFIX=%installpath% + if %errorlevel% neq 0 goto fail + "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release + if %errorlevel% neq 0 goto fail + "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" INSTALL.vcxproj /p:Configuration=Release + if %errorlevel% neq 0 goto fail + "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" PACKAGE.vcxproj /p:Configuration=Release + if %errorlevel% neq 0 goto fail + popd + echo Finished. + exit /b 0 + + :fail + popd + echo Failed. + exit /b 1 + +### Windows Installer using WIX Toolset + +Requirements: +* Visual Studio 2017 +* Wix Toolset + +In Visual Studio 2017 Installer select "Optional Features" -> "Wix Toolset" + +Build the binaries like described above, but make sure you unselect "RUN_IN_PLACE". + +Open the generated Project file with VS. Right click "PACKAGE" and choose "Generate". +It may take some minutes to generate the installer. + + +Docker +------ +We provide Minetest server docker images using the Gitlab mirror registry. + +Images are built on each commit and available using the following tag scheme: + +* `registry.gitlab.com/minetest/minetest/server:latest` (latest build) +* `registry.gitlab.com/minetest/minetest/server:` (current branch or current tag) +* `registry.gitlab.com/minetest/minetest/server:` (current commit id) + +If you want to test it on a docker server, you can easily run: + + sudo docker run registry.gitlab.com/minetest/minetest/server: + +If you want to use it in a production environment you should use volumes bound to the docker host +to persist data and modify the configuration: + + sudo docker create -v /home/minetest/data/:/var/lib/minetest/ -v /home/minetest/conf/:/etc/minetest/ registry.gitlab.com/minetest/minetest/server:master + +Data will be written to `/home/minetest/data` on the host, and configuration will be read from `/home/minetest/conf/minetest.conf`. + +Note: If you don't understand the previous commands, please read the official Docker documentation before use. + +You can also host your minetest server inside a Kubernetes cluster. See our example implementation in `misc/kubernetes.yml`. + + +Version scheme +-------------- +We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`. + +- Major is incremented when the release contains breaking changes, all other +numbers are set to 0. +- Minor is incremented when the release contains new non-breaking features, +patch is set to 0. +- Patch is incremented when the release only contains bugfixes and very +minor/trivial features considered necessary. + +Since 5.0.0-dev and 0.4.17-dev, the dev notation refers to the next release, +i.e.: 5.0.0-dev is the development version leading to 5.0.0. +Prior to that we used `previous_version-dev`. diff --git a/doc/README.txt b/doc/README.txt deleted file mode 100644 index a627bde..0000000 --- a/doc/README.txt +++ /dev/null @@ -1,557 +0,0 @@ -Minetest -======== - -An InfiniMiner/Minecraft inspired game. - -Copyright (c) 2010-2017 Perttu Ahola -and contributors (see source file comments and the version control log) - -In case you downloaded the source code: ---------------------------------------- -If you downloaded the Minetest Engine source code in which this file is -contained, you probably want to download the minetest_game project too: - https://github.com/minetest/minetest_game/ -See the README.txt in it. - -Further documentation ----------------------- -- Website: http://minetest.net/ -- Wiki: http://wiki.minetest.net/ -- Developer wiki: http://dev.minetest.net/ -- Forum: http://forum.minetest.net/ -- Github: https://github.com/minetest/minetest/ -- doc/ directory of source distribution - -This game is not finished --------------------------- -- Don't expect it to work as well as a finished game will. -- Please report any bugs. When doing that, debug.txt is useful. - -Default controls ------------------ -- Move mouse: Look around -- W, A, S, D: Move -- Space: Jump/move up -- Shift: Sneak/move down -- Q: Drop itemstack -- Shift + Q: Drop single item -- Left mouse button: Dig/punch/take item -- Right mouse button: Place/use -- Shift + right mouse button: Build (without using) -- I: Inventory menu -- Mouse wheel: Select item -- 0-9: Select item -- Z: Zoom (needs zoom privilege) -- T: Chat -- /: Command - -- Esc: Pause menu/abort/exit (pauses only singleplayer game) -- R: Enable/disable full range view -- +: Increase view range -- -: Decrease view range -- K: Enable/disable fly mode (needs fly privilege) -- J: Enable/disable fast mode (needs fast privilege) -- H: Enable/disable noclip mode (needs noclip privilege) - -- F1: Hide/show HUD -- F2: Hide/show chat -- F3: Disable/enable fog -- F4: Disable/enable camera update (Mapblocks are not updated anymore when disabled, disabled in release builds) -- F5: Cycle through debug info screens -- F6: Cycle through profiler info screens -- F7: Cycle through camera modes -- F8: Toggle cinematic mode -- F9: Cycle through minimap modes -- Shift + F9: Change minimap orientation -- F10: Show/hide console -- F12: Take screenshot -- P: Write stack traces into debug.txt - -Most controls are settable in the configuration file, see the section below. - -Paths ------- -$bin - Compiled binaries -$share - Distributed read-only data -$user - User-created modifiable data - -Windows .zip / RUN_IN_PLACE source: -$bin = bin -$share = . -$user = . - -Linux installed: -$bin = /usr/bin -$share = /usr/share/minetest -$user = ~/.minetest - -macOS: -$bin = Contents/MacOS -$share = Contents/Resources -$user = Contents/User OR ~/Library/Application Support/minetest - -World directory ----------------- -- Worlds can be found as separate folders in: - $user/worlds/ - -Configuration file: -------------------- -- Default location: - $user/minetest.conf -- It is created by Minetest when it is ran the first time. -- A specific file can be specified on the command line: - --config -- A run-in-place build will look for the configuration file in - $location_of_exe/../minetest.conf and also $location_of_exe/../../minetest.conf - -Command-line options: ---------------------- -- Use --help - -Compiling on GNU/Linux: ------------------------ - -Install dependencies. Here's an example for Debian/Ubuntu: -$ sudo apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev - -For Fedora users: -$ sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl* openal* libvorbis* libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel - -You can install git for easily keeping your copy up to date. -If you don’t want git, read below on how to get the source without git. -This is an example for installing git on Debian/Ubuntu: -$ sudo apt-get install git - -For Fedora users: -$ sudo dnf install git - -Download source (this is the URL to the latest of source repository, which might not work at all times) using git: -$ git clone --depth 1 https://github.com/minetest/minetest.git -$ cd minetest - -Download minetest_game (otherwise only the "Minimal development test" game is available) using git: -$ git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game - -Download source, without using git: -$ wget https://github.com/minetest/minetest/archive/master.tar.gz -$ tar xf master.tar.gz -$ cd minetest-master - -Download minetest_game, without using git: -$ cd games/ -$ wget https://github.com/minetest/minetest_game/archive/master.tar.gz -$ tar xf master.tar.gz -$ mv minetest_game-master minetest_game -$ cd .. - -Build a version that runs directly from the source directory: -$ cmake . -DRUN_IN_PLACE=TRUE -$ make -j - -Run it: -$ ./bin/minetest - -- Use cmake . -LH to see all CMake options and their current state -- If you want to install it system-wide (or are making a distribution package), - you will want to use -DRUN_IN_PLACE=FALSE -- You can build a bare server by specifying -DBUILD_SERVER=TRUE -- You can disable the client build by specifying -DBUILD_CLIENT=FALSE -- You can select between Release and Debug build by -DCMAKE_BUILD_TYPE= - - Debug build is slower, but gives much more useful output in a debugger -- If you build a bare server, you don't need to have Irrlicht installed. - In that case use -DIRRLICHT_SOURCE_DIR=/the/irrlicht/source - -CMake options -------------- -General options: - -BUILD_CLIENT - Build Minetest client -BUILD_SERVER - Build Minetest server -CMAKE_BUILD_TYPE - Type of build (Release vs. Debug) - Release - Release build - Debug - Debug build - SemiDebug - Partially optimized debug build - RelWithDebInfo - Release build with Debug information - MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible -ENABLE_CURL - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http -ENABLE_CURSES - Build with (n)curses; Enables a server side terminal (command line option: --terminal) -ENABLE_FREETYPE - Build with FreeType2; Allows using TTF fonts -ENABLE_GETTEXT - Build with Gettext; Allows using translations -ENABLE_GLES - Search for Open GLES headers & libraries and use them -ENABLE_LEVELDB - Build with LevelDB; Enables use of LevelDB map backend -ENABLE_POSTGRESQL - Build with libpq; Enables use of PostgreSQL map backend (PostgreSQL 9.5 or greater recommended) -ENABLE_REDIS - Build with libhiredis; Enables use of Redis map backend -ENABLE_SPATIAL - Build with LibSpatial; Speeds up AreaStores -ENABLE_SOUND - Build with OpenAL, libogg & libvorbis; in-game Sounds -ENABLE_LUAJIT - Build with LuaJIT (much faster than non-JIT Lua) -ENABLE_SYSTEM_GMP - Use GMP from system (much faster than bundled mini-gmp) -RUN_IN_PLACE - Create a portable install (worlds, settings etc. in current directory) -USE_GPROF - Enable profiling using GProf -VERSION_EXTRA - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar) - -Library specific options: - -BZIP2_INCLUDE_DIR - Linux only; directory where bzlib.h is located -BZIP2_LIBRARY - Linux only; path to libbz2.a/libbz2.so -CURL_DLL - Only if building with cURL on Windows; path to libcurl.dll -CURL_INCLUDE_DIR - Only if building with cURL; directory where curl.h is located -CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib -EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h -EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so -FREETYPE_INCLUDE_DIR_freetype2 - Only if building with Freetype2; directory that contains an freetype directory with files such as ftimage.h in it -FREETYPE_INCLUDE_DIR_ft2build - Only if building with Freetype2; directory that contains ft2build.h -FREETYPE_LIBRARY - Only if building with Freetype2; path to libfreetype.a/libfreetype.so/freetype.lib -FREETYPE_DLL - Only if building with Freetype2 on Windows; path to libfreetype.dll -GETTEXT_DLL - Only when building with Gettext on Windows; path to libintl3.dll -GETTEXT_ICONV_DLL - Only when building with Gettext on Windows; path to libiconv2.dll -GETTEXT_INCLUDE_DIR - Only when building with Gettext; directory that contains iconv.h -GETTEXT_LIBRARY - Only when building with Gettext on Windows; path to libintl.dll.a -GETTEXT_MSGFMT - Only when building with Gettext; path to msgfmt/msgfmt.exe -IRRLICHT_DLL - Only on Windows; path to Irrlicht.dll -IRRLICHT_INCLUDE_DIR - Directory that contains IrrCompileConfig.h -IRRLICHT_LIBRARY - Path to libIrrlicht.a/libIrrlicht.so/libIrrlicht.dll.a/Irrlicht.lib -LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h -LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a -LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll -PostgreSQL_INCLUDE_DIR - Only when building with PostgreSQL; directory that contains libpq-fe.h -POSTGRESQL_LIBRARY - Only when building with PostgreSQL; path to libpq.a/libpq.so -REDIS_INCLUDE_DIR - Only when building with Redis; directory that contains hiredis.h -REDIS_LIBRARY - Only when building with Redis; path to libhiredis.a/libhiredis.so -SPATIAL_INCLUDE_DIR - Only when building with LibSpatial; directory that contains spatialindex/SpatialIndex.h -SPATIAL_LIBRARY - Only when building with LibSpatial; path to libspatialindex_c.so/spatialindex-32.lib -LUA_INCLUDE_DIR - Only if you want to use LuaJIT; directory where luajit.h is located -LUA_LIBRARY - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so -MINGWM10_DLL - Only if compiling with MinGW; path to mingwm10.dll -OGG_DLL - Only if building with sound on Windows; path to libogg.dll -OGG_INCLUDE_DIR - Only if building with sound; directory that contains an ogg directory which contains ogg.h -OGG_LIBRARY - Only if building with sound; path to libogg.a/libogg.so/libogg.dll.a -OPENAL_DLL - Only if building with sound on Windows; path to OpenAL32.dll -OPENAL_INCLUDE_DIR - Only if building with sound; directory where al.h is located -OPENAL_LIBRARY - Only if building with sound; path to libopenal.a/libopenal.so/OpenAL32.lib -OPENGLES2_INCLUDE_DIR - Only if building with GLES; directory that contains gl2.h -OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so -SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h -SQLITE3_LIBRARY - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib -VORBISFILE_DLL - Only if building with sound on Windows; path to libvorbisfile-3.dll -VORBISFILE_LIBRARY - Only if building with sound; path to libvorbisfile.a/libvorbisfile.so/libvorbisfile.dll.a -VORBIS_DLL - Only if building with sound on Windows; path to libvorbis-0.dll -VORBIS_INCLUDE_DIR - Only if building with sound; directory that contains a directory vorbis with vorbisenc.h inside -VORBIS_LIBRARY - Only if building with sound; path to libvorbis.a/libvorbis.so/libvorbis.dll.a -XXF86VM_LIBRARY - Only on Linux; path to libXXf86vm.a/libXXf86vm.so -ZLIB_DLL - Only on Windows; path to zlib1.dll -ZLIBWAPI_DLL - Only on Windows; path to zlibwapi.dll -ZLIB_INCLUDE_DIR - Directory that contains zlib.h -ZLIB_LIBRARY - Path to libz.a/libz.so/zlibwapi.lib - -Compiling on Windows: ---------------------- -- This section is outdated. In addition to what is described here: - - In addition to minetest, you need to download minetest_game. - - If you wish to have sound support, you need libogg, libvorbis and libopenal - -- You need: - * CMake: - http://www.cmake.org/cmake/resources/software.html - * MinGW or Visual Studio - http://www.mingw.org/ - http://msdn.microsoft.com/en-us/vstudio/default - * Irrlicht SDK 1.7: - http://irrlicht.sourceforge.net/downloads.html - * Zlib headers (zlib125.zip) - http://www.winimage.com/zLibDll/index.html - * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip): - http://www.winimage.com/zLibDll/index.html - * SQLite3 headers and library - https://www.sqlite.org/download.html - * Optional: gettext library and tools: - http://gnuwin32.sourceforge.net/downlinks/gettext.php - - This is used for other UI languages. Feel free to leave it out. - * And, of course, Minetest: - http://minetest.net/download -- Steps: - - Select a directory called DIR hereafter in which you will operate. - - Make sure you have CMake and a compiler installed. - - Download all the other stuff to DIR and extract them into there. - ("extract here", not "extract to packagename/") - NOTE: zlib125dll.zip needs to be extracted into zlib125dll - NOTE: You need to extract sqlite3.h & sqlite3ext.h from sqlite3 source - and sqlite3.dll & sqlite3.def from sqlite3 precompiled binaries - into "sqlite3" directory, and generate sqlite3.lib using command - "LIB /DEF:sqlite3.def /OUT:sqlite3.lib" - - All those packages contain a nice base directory in them, which - should end up being the direct subdirectories of DIR. - - You will end up with a directory structure like this (+=dir, -=file): - ----------------- - + DIR - - zlib-1.2.5.tar.gz - - zlib125dll.zip - - irrlicht-1.8.3.zip - - sqlite-amalgamation-3130000.zip (SQLite3 headers) - - sqlite-dll-win32-x86-3130000.zip (SQLite3 library for 32bit system) - - 110214175330.zip (or whatever, this is the minetest source) - + zlib-1.2.5 - - zlib.h - + win32 - ... - + zlib125dll - - readme.txt - + dll32 - ... - + irrlicht-1.8.3 - + lib - + include - ... - + sqlite3 - sqlite3.h - sqlite3ext.h - sqlite3.lib - sqlite3.dll - + gettext (optional) - +bin - +include - +lib - + minetest - + src - + doc - - CMakeLists.txt - ... - ----------------- - - Start up the CMake GUI - - Select "Browse Source..." and select DIR/minetest - - Now, if using MSVC: - - Select "Browse Build..." and select DIR/minetest-build - - Else if using MinGW: - - Select "Browse Build..." and select DIR/minetest - - Select "Configure" - - Select your compiler - - It will warn about missing stuff, ignore that at this point. (later don't) - - Make sure the configuration is as follows - (note that the versions may differ for you): - ----------------- - BUILD_CLIENT [X] - BUILD_SERVER [ ] - CMAKE_BUILD_TYPE Release - CMAKE_INSTALL_PREFIX DIR/minetest-install - IRRLICHT_SOURCE_DIR DIR/irrlicht-1.8.3 - RUN_IN_PLACE [X] - WARN_ALL [ ] - ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll - ZLIB_INCLUDE_DIR DIR/zlib-1.2.5 - ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib - GETTEXT_BIN_DIR DIR/gettext/bin - GETTEXT_INCLUDE_DIR DIR/gettext/include - GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib - GETTEXT_MSGFMT DIR/gettext/bin/msgfmt - ----------------- - - If CMake complains it couldn't find SQLITE3, choose "Advanced" box on the - right top corner, then specify the location of SQLITE3_INCLUDE_DIR and - SQLITE3_LIBRARY manually. - - If you want to build 64-bit minetest, you will need to build 64-bit version - of irrlicht engine manually, as only 32-bit pre-built library is provided. - - Hit "Configure" - - Hit "Configure" once again 8) - - If something is still coloured red, you have a problem. - - Hit "Generate" - If using MSVC: - - Open the generated minetest.sln - - The project defaults to the "Debug" configuration. Make very sure to - select "Release", unless you want to debug some stuff (it's slower - and might not even work at all) - - Build the ALL_BUILD project - - Build the INSTALL project - - You should now have a working game with the executable in - DIR/minetest-install/bin/minetest.exe - - Additionally you may create a zip package by building the PACKAGE - project. - If using MinGW: - - Using the command line, browse to the build directory and run 'make' - (or mingw32-make or whatever it happens to be) - - You may need to copy some of the downloaded DLLs into bin/, see what - running the produced executable tells you it doesn't have. - - You should now have a working game with the executable in - DIR/minetest/bin/minetest.exe - -Windows releases of minetest are built using a bat script like this: --------------------------------------------------------------------- - -set sourcedir=%CD% -set installpath="C:\tmp\minetest_install" -set irrlichtpath="C:\tmp\irrlicht-1.7.2" - -set builddir=%sourcedir%\bvc10 -mkdir %builddir% -pushd %builddir% -cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=TRUE -DCMAKE_INSTALL_PREFIX=%installpath% -if %errorlevel% neq 0 goto fail -"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release -if %errorlevel% neq 0 goto fail -"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" INSTALL.vcxproj /p:Configuration=Release -if %errorlevel% neq 0 goto fail -"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" PACKAGE.vcxproj /p:Configuration=Release -if %errorlevel% neq 0 goto fail -popd -echo Finished. -exit /b 0 - -:fail -popd -echo Failed. -exit /b 1 - -License of Minetest textures and sounds ---------------------------------------- - -This applies to textures and sounds contained in the main Minetest -distribution. - -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ -Everything not listed in here: -Copyright (C) 2010-2012 celeron55, Perttu Ahola - -ShadowNinja: - textures/base/pack/smoke_puff.png - -Paramat: - textures/base/pack/menu_header.png - -erlehmann: - misc/minetest-icon-24x24.png - misc/minetest-icon.ico - misc/minetest.svg - textures/base/pack/logo.png - -License of Minetest source code -------------------------------- - -Minetest -Copyright (C) 2010-2017 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Irrlicht ---------------- - -This program uses the Irrlicht Engine. http://irrlicht.sourceforge.net/ - - The Irrlicht Engine License - -Copyright © 2002-2005 Nikolaus Gebhardt - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute -it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - - -JThread ---------------- - -This program uses the JThread library. License for JThread follows: - -Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com) - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. - -Lua ---------------- - -Lua is licensed under the terms of the MIT license reproduced below. -This means that Lua is free software and can be used for both academic -and commercial purposes at absolutely no cost. - -For details and rationale, see https://www.lua.org/license.html . - -Copyright (C) 1994-2008 Lua.org, PUC-Rio. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -Fonts ---------------- - -Bitstream Vera Fonts Copyright: - - Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is - a trademark of Bitstream, Inc. - -Arimo - Apache License, version 2.0 - Digitized data copyright (c) 2010-2012 Google Corporation. - -Cousine - Apache License, version 2.0 - Digitized data copyright (c) 2010-2012 Google Corporation. - -DroidSansFallBackFull: - - Copyright (C) 2008 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 728fd0a..2edd0d9 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,192 +1,232 @@ -Minetest Lua Modding API Reference 0.4.17 -========================================= +Minetest Lua Modding API Reference +================================== + * More information at * Developer Wiki: + Introduction ------------- -Content and functionality can be added to Minetest 0.4 by using Lua -scripting in run-time loaded mods. +============ + +Content and functionality can be added to Minetest using Lua scripting +in run-time loaded mods. A mod is a self-contained bunch of scripts, textures and other related -things that is loaded by and interfaces with Minetest. +things, which is loaded by and interfaces with Minetest. Mods are contained and ran solely on the server side. Definitions and media files are automatically transferred to the client. If you see a deficiency in the API, feel free to attempt to add the -functionality in the engine and API. You can send such improvements as -source code patches to . +functionality in the engine and API, and to document it here. Programming in Lua ------------------ + If you have any difficulty in understanding this, please read [Programming in Lua](http://www.lua.org/pil/). Startup ------- + Mods are loaded during server startup from the mod load paths by running the `init.lua` scripts in a shared environment. Paths ----- + * `RUN_IN_PLACE=1` (Windows release, local build) - * `$path_user`: - * Linux: `` - * Windows: `` - * `$path_share` - * Linux: `` - * Windows: `` + * `$path_user`: `` + * `$path_share`: `` * `RUN_IN_PLACE=0`: (Linux release) - * `$path_share` + * `$path_share`: * Linux: `/usr/share/minetest` * Windows: `/minetest-0.4.x` * `$path_user`: * Linux: `$HOME/.minetest` * Windows: `C:/users//AppData/minetest` (maybe) + + + Games ------ +===== + Games are looked up from: -* `$path_share/games/gameid/` -* `$path_user/games/gameid/` +* `$path_share/games//` +* `$path_user/games//` -where `gameid` is unique to each game. +Where `` is unique to each game. -The game directory contains the file `game.conf`, which contains these fields: +The game directory can contain the following files: - name = +* `game.conf`, with the following keys: + * `name`: Required, human readable name e.g. `name = Minetest` + * `description`: Short description to be shown in the content tab + * `disallowed_mapgens = ` + e.g. `disallowed_mapgens = v5,v6,flat` + These mapgens are removed from the list of mapgens for the game. +* `minetest.conf`: + Used to set default settings when running this game. +* `settingtypes.txt`: + In the same format as the one in builtin. + This settingtypes.txt will be parsed by the menu and the settings will be + displayed in the "Games" category in the advanced settings tab. +* If the game contains a folder called `textures` the server will load it as a + texturepack, overriding mod textures. + Any server texturepack will override mod textures and the game texturepack. -e.g. +Menu images +----------- - name = Minetest +Games can provide custom main menu images. They are put inside a `menu` +directory inside the game directory. -The game directory can contain the file minetest.conf, which will be used -to set default settings when running the particular game. -It can also contain a settingtypes.txt in the same format as the one in builtin. -This settingtypes.txt will be parsed by the menu and the settings will be displayed -in the "Games" category in the settings tab. +The images are named `$identifier.png`, where `$identifier` is one of +`overlay`, `background`, `footer`, `header`. +If you want to specify multiple images for one identifier, add additional +images named like `$identifier.$n.png`, with an ascending number $n starting +with 1, and a random image will be chosen from the provided ones. -### Menu images -Games can provide custom main menu images. They are put inside a `menu` directory -inside the game directory. -The images are named `$identifier.png`, where `$identifier` is -one of `overlay,background,footer,header`. -If you want to specify multiple images for one identifier, add additional images named -like `$identifier.$n.png`, with an ascending number $n starting with 1, and a random -image will be chosen from the provided ones. +Mods +==== Mod load path ------------- -Generic: -* `$path_share/games/gameid/mods/` -* `$path_share/mods/` -* `$path_user/games/gameid/mods/` -* `$path_user/mods/` (User-installed mods) -* `$worldpath/worldmods/` +Paths are relative to the directories listed in the [Paths] section above. -In a run-in-place version (e.g. the distributed windows version): +* `games//mods/` +* `mods/` +* `worlds//worldmods/` -* `minetest-0.4.x/games/gameid/mods/` -* `minetest-0.4.x/mods/` (User-installed mods) -* `minetest-0.4.x/worlds/worldname/worldmods/` +World-specific games +-------------------- -On an installed version on Linux: - -* `/usr/share/minetest/games/gameid/mods/` -* `$HOME/.minetest/mods/` (User-installed mods) -* `$HOME/.minetest/worlds/worldname/worldmods` - -Mod load path for world-specific games --------------------------------------- It is possible to include a game in a world; in this case, no mods or games are loaded or checked from anywhere else. -This is useful for e.g. adventure worlds. +This is useful for e.g. adventure worlds and happens if the `/game/` +directory exists. -This happens if the following directory exists: +Mods should then be placed in `/game/mods/`. - $world/game/ +Modpacks +-------- -Mods should be then be placed in: - - $world/game/mods/ - -Modpack support ----------------- Mods can be put in a subdirectory, if the parent directory, which otherwise -should be a mod, contains a file named `modpack.txt`. This file shall be -empty, except for lines starting with `#`, which are comments. +should be a mod, contains a file named `modpack.conf`. +The file is a key-value store of modpack details. + +* `name`: The modpack name. +* `description`: Description of mod to be shown in the Mods tab of the main + menu. + +Note: to support 0.4.x, please also create an empty modpack.txt file. Mod directory structure ------------------------- +----------------------- mods - |-- modname - | |-- depends.txt - | |-- screenshot.png - | |-- description.txt - | |-- settingtypes.txt - | |-- init.lua - | |-- models - | |-- textures - | | |-- modname_stuff.png - | | `-- modname_something_else.png - | |-- sounds - | |-- media - | `-- - `-- another - + ├── modname + │   ├── mod.conf + │   ├── screenshot.png + │   ├── settingtypes.txt + │   ├── init.lua + │   ├── models + │   ├── textures + │   │   ├── modname_stuff.png + │   │   └── modname_something_else.png + │   ├── sounds + │   ├── media + │   ├── locale + │   └── + └── another ### modname + The location of this directory can be fetched by using `minetest.get_modpath(modname)`. +### mod.conf + +A key-value store of mod details. + +* `name`: The mod name. Allows Minetest to determine the mod name even if the + folder is wrongly named. +* `description`: Description of mod to be shown in the Mods tab of the main + menu. +* `depends`: A comma separated list of dependencies. These are mods that must be + loaded before this mod. +* `optional_depends`: A comma separated list of optional dependencies. + Like a dependency, but no error if the mod doesn't exist. + +Note: to support 0.4.x, please also provide depends.txt. + +### `screenshot.png` + +A screenshot shown in the mod manager within the main menu. It should +have an aspect ratio of 3:2 and a minimum size of 300×200 pixels. + ### `depends.txt` + +**Deprecated:** you should use mod.conf instead. + +This file is used if there are no dependencies in mod.conf. + List of mods that have to be loaded before loading this mod. A single line contains a single modname. Optional dependencies can be defined by appending a question mark -to a single modname. Their meaning is that if the specified mod -is missing, that does not prevent this mod from being loaded. - -### `screenshot.png` -A screenshot shown in the mod manager within the main menu. It should -have an aspect ratio of 3:2 and a minimum size of 300×200 pixels. +to a single modname. This means that if the specified mod +is missing, it does not prevent this mod from being loaded. ### `description.txt` -A File containing description to be shown within mainmenu. + +**Deprecated:** you should use mod.conf instead. + +This file is used if there is no description in mod.conf. + +A file containing a description to be shown in the Mods tab of the main menu. ### `settingtypes.txt` + A file in the same format as the one in builtin. It will be parsed by the settings menu and the settings will be displayed in the "Mods" category. ### `init.lua` + The main Lua script. Running this script should register everything it wants to register. Subsequent execution depends on minetest calling the registered callbacks. `minetest.settings` can be used to read custom or existing settings at load -time, if necessary. (See `Settings`) +time, if necessary. (See [`Settings`]) ### `models` + Models for entities or meshnodes. ### `textures`, `sounds`, `media` + Media files (textures, sounds, whatever) that will be transferred to the client and will be available for use by the mod. -Naming convention for registered textual names ----------------------------------------------- +### `locale` + +Translation files for the clients. (See [Translations]) + +Naming conventions +------------------ + Registered names should generally be in this format: - `modname:` + modname: `` can have these characters: @@ -195,38 +235,44 @@ Registered names should generally be in this format: This is to prevent conflicting names from corrupting maps and is enforced by the mod loader. -### Example -In the mod `experimental`, there is the ideal item/node/entity name `tnt`. -So the name should be `experimental:tnt`. - -Enforcement can be overridden by prefixing the name with `:`. This can +Registered names can be overridden by prefixing the name with `:`. This can be used for overriding the registrations of some other mod. -Example: Any mod can redefine `experimental:tnt` by using the name - - :experimental:tnt - -when registering it. -(also that mod is required to have `experimental` as a dependency) - The `:` prefix can also be used for maintaining backwards compatibility. -Aliases -------- -Aliases can be added by using `minetest.register_alias(name, convert_to)` or -`minetest.register_alias_force(name, convert_to)`. +### Example -This will make Minetest to convert things called name to things called -`convert_to`. +In the mod `experimental`, there is the ideal item/node/entity name `tnt`. +So the name should be `experimental:tnt`. + +Any mod can redefine `experimental:tnt` by using the name + + :experimental:tnt + +when registering it. That mod is required to have `experimental` as a +dependency. + + + + +Aliases +======= + +Aliases of itemnames can be added by using +`minetest.register_alias(alias, original_name)` or +`minetest.register_alias_force(alias, original_name)`. + +This adds an alias `alias` for the item called `original_name`. +From now on, you can use `alias` to refer to the item `original_name`. The only difference between `minetest.register_alias` and -`minetest.register_alias_force` is that if an item called `name` exists, +`minetest.register_alias_force` is that if an item named `alias` already exists, `minetest.register_alias` will do nothing while `minetest.register_alias_force` will unregister it. This can be used for maintaining backwards compatibility. -This can be also used for setting quick access names for things, e.g. if +This can also set quick access names for things, e.g. if you have an item called `epiclylongmodname:stuff`, you could do minetest.register_alias("stuff", "epiclylongmodname:stuff") @@ -235,75 +281,88 @@ and be able to use `/giveme stuff`. Mapgen aliases -------------- + In a game, a certain number of these must be set to tell core mapgens which of the game's nodes are to be used by the core mapgens. For example: minetest.register_alias("mapgen_stone", "default:stone") -### Aliases needed for all mapgens except Mapgen v6 +### Aliases needed for all mapgens except Mapgen V6 -Base terrain: +#### Base terrain -"mapgen_stone" -"mapgen_water_source" -"mapgen_river_water_source" +* mapgen_stone +* mapgen_water_source +* mapgen_river_water_source -Caves: +#### Caves -"mapgen_lava_source" +Not required if cave liquid nodes are set in biome definitions. -Dungeons: +* mapgen_lava_source -Only needed for registered biomes where 'node_stone' is stone: -"mapgen_cobble" -"mapgen_stair_cobble" -"mapgen_mossycobble" -Only needed for registered biomes where 'node_stone' is desert stone: -"mapgen_desert_stone" -"mapgen_stair_desert_stone" -Only needed for registered biomes where 'node_stone' is sandstone: -"mapgen_sandstone" -"mapgen_sandstonebrick" -"mapgen_stair_sandstone_block" +#### Dungeons -### Aliases needed for Mapgen v6 +Not required if dungeon nodes are set in biome definitions. -Terrain and biomes: +* mapgen_cobble +* mapgen_stair_cobble +* mapgen_mossycobble +* mapgen_desert_stone +* mapgen_stair_desert_stone +* mapgen_sandstone +* mapgen_sandstonebrick +* mapgen_stair_sandstone_block -"mapgen_stone" -"mapgen_water_source" -"mapgen_lava_source" -"mapgen_dirt" -"mapgen_dirt_with_grass" -"mapgen_sand" -"mapgen_gravel" -"mapgen_desert_stone" -"mapgen_desert_sand" -"mapgen_dirt_with_snow" -"mapgen_snowblock" -"mapgen_snow" -"mapgen_ice" +### Aliases needed for Mapgen V6 -Flora: +#### Terrain and biomes + +* mapgen_stone +* mapgen_water_source +* mapgen_lava_source +* mapgen_dirt +* mapgen_dirt_with_grass +* mapgen_sand +* mapgen_gravel +* mapgen_desert_stone +* mapgen_desert_sand +* mapgen_dirt_with_snow +* mapgen_snowblock +* mapgen_snow +* mapgen_ice + +#### Flora + +* mapgen_tree +* mapgen_leaves +* mapgen_apple +* mapgen_jungletree +* mapgen_jungleleaves +* mapgen_junglegrass +* mapgen_pine_tree +* mapgen_pine_needles + +#### Dungeons + +* mapgen_cobble +* mapgen_stair_cobble +* mapgen_mossycobble +* mapgen_stair_desert_stone + +### Setting the node used in Mapgen Singlenode + +By default the world is filled with air nodes. To set a different node use, for +example: + + minetest.register_alias("mapgen_singlenode", "default:stone") -"mapgen_tree" -"mapgen_leaves" -"mapgen_apple" -"mapgen_jungletree" -"mapgen_jungleleaves" -"mapgen_junglegrass" -"mapgen_pine_tree" -"mapgen_pine_needles" -Dungeons: -"mapgen_cobble" -"mapgen_stair_cobble" -"mapgen_mossycobble" -"mapgen_stair_desert_stone" Textures --------- +======== + Mods should generally prefix their textures with `modname_`, e.g. given the mod name `foomod`, a texture could be called: @@ -317,21 +376,24 @@ stripping out the file extension: Texture modifiers ----------------- + There are various texture modifiers that can be used to generate textures on-the-fly. ### Texture overlaying + Textures can be overlaid by putting a `^` between them. Example: default_dirt.png^default_grass_side.png -`default_grass_side.png` is overlayed over `default_dirt.png`. +`default_grass_side.png` is overlaid over `default_dirt.png`. The texture with the lower resolution will be automatically upscaled to the higher resolution texture. ### Texture grouping + Textures can be grouped together by enclosing them in `(` and `)`. Example: `cobble.png^(thing1.png^thing2.png)` @@ -340,6 +402,7 @@ A texture for `thing1.png^thing2.png` is created and the resulting texture is overlaid on top of `cobble.png`. ### Escaping + Modifiers that accept texture names (e.g. `[combine`) accept escaping to allow passing complex texture names as arguments. Escaping is done with backslash and is required for `^` and `:`. @@ -351,22 +414,34 @@ on top of `cobble.png`. ### Advanced texture modifiers -#### `[crack::

` -* `` = animation frame count -* `

` = current animation frame +#### Crack + +* `[crack::

` +* `[cracko::

` +* `[crack:::

` +* `[cracko:::

` + +Parameters: + +* ``: tile count (in each direction) +* ``: animation frame count +* `

`: current animation frame Draw a step of the crack animation on the texture. +`crack` draws it normally, while `cracko` lays it over, keeping transparent +pixels intact. Example: default_cobble.png^[crack:10:1 #### `[combine:x:,=:,=:...` -* `` = width -* `` = height -* `` = x position -* `` = y position -* `` = texture to combine + +* ``: width +* ``: height +* ``: x position +* ``: y position +* ``: texture to combine Creates a texture of size `` times `` and blits the listed files to their specified coordinates. @@ -376,6 +451,7 @@ Example: [combine:16x32:0,0=default_cobble.png:0,16=default_wood.png #### `[resize:x` + Resizes the texture to the given dimensions. Example: @@ -383,25 +459,27 @@ Example: default_sandstone.png^[resize:16x16 #### `[opacity:` + Makes the base image transparent according to the given ratio. -`r` must be between 0 and 255. -0 means totally transparent. 255 means totally opaque. +`r` must be between 0 (transparent) and 255 (opaque). Example: default_sandstone.png^[opacity:127 #### `[invert:` + Inverts the given channels of the base image. Mode may contain the characters "r", "g", "b", "a". Only the channels that are mentioned in the mode string will be inverted. Example: - default_apple.png^[invert:rgb + default_apple.png^[invert:rgb #### `[brighten` + Brightens the texture. Example: @@ -409,6 +487,7 @@ Example: tnt_tnt_side.png^[brighten #### `[noalpha` + Makes the texture completely opaque. Example: @@ -416,6 +495,7 @@ Example: default_leaves.png^[noalpha #### `[makealpha:,,` + Convert one color to transparency. Example: @@ -423,7 +503,8 @@ Example: default_cobble.png^[makealpha:128,128,128 #### `[transform` -* `` = transformation(s) to apply + +* ``: transformation(s) to apply Rotates and/or flips the image. @@ -444,7 +525,9 @@ Example: default_stone.png^[transformFXR90 #### `[inventorycube{{{` -Escaping does not apply here and `^` is replaced by `&` in texture names instead. + +Escaping does not apply here and `^` is replaced by `&` in texture names +instead. Create an inventory cube texture using the side textures. @@ -456,6 +539,7 @@ Creates an inventorycube with `grass.png`, `dirt.png^grass_side.png` and `dirt.png^grass_side.png` textures #### `[lowpart::` + Blit the lower ``% part of `` on the texture. Example: @@ -463,8 +547,9 @@ Example: base.png^[lowpart:25:overlay.png #### `[verticalframe::` -* `` = animation frame count -* `` = current animation frame + +* ``: animation frame count +* ``: current animation frame Crops the texture to a frame of a vertical animation. @@ -473,16 +558,18 @@ Example: default_torch_animated.png^[verticalframe:16:8 #### `[mask:` + Apply a mask to the base image. The mask is applied using binary AND. #### `[sheet:x:,` + Retrieves a tile at position x,y from the base image which it assumes to be a tilesheet with dimensions w,h. - #### `[colorize::` + Colorize the textures with the given color. `` is specified as a `ColorString`. `` is an int ranging from 0 to 255 or the word "`alpha`". If @@ -494,14 +581,16 @@ the word "`alpha`", then each texture pixel will contain the RGB of texture pixel. #### `[multiply:` + Multiplies texture colors with the given color. `` is specified as a `ColorString`. Result is more like what you'd expect if you put a color on top of another -color. Meaning white surfaces get a lot of your new color while black parts don't -change very much. +color, meaning white surfaces get a lot of your new color while black parts +don't change very much. Hardware coloring ----------------- + The goal of hardware coloring is to simplify the creation of colorful nodes. If your textures use the same pattern, and they only differ in their color (like colored wool blocks), you can use hardware @@ -510,30 +599,35 @@ All of these methods use color multiplication (so a white-black texture with red coloring will result in red-black color). ### Static coloring + This method is useful if you wish to create nodes/items with the same texture, in different colors, each in a new node/item definition. #### Global color + When you register an item or node, set its `color` field (which accepts a `ColorSpec`) to the desired color. -An `ItemStack`s static color can be overwritten by the `color` metadata +An `ItemStack`'s static color can be overwritten by the `color` metadata field. If you set that field to a `ColorString`, that color will be used. #### Tile color + Each tile may have an individual static color, which overwrites every -other coloring methods. To disable the coloring of a face, +other coloring method. To disable the coloring of a face, set its color to white (because multiplying with white does nothing). You can set the `color` property of the tiles in the node's definition if the tile is in table format. ### Palettes + For nodes and items which can have many colors, a palette is more suitable. A palette is a texture, which can contain up to 256 pixels. Each pixel is one possible color for the node/item. You can register one node/item, which can have up to 256 colors. #### Palette indexing + When using palettes, you always provide a pixel index for the given node or `ItemStack`. The palette is read from left to right and from top to bottom. If the palette has less than 256 pixels, then it is @@ -541,18 +635,20 @@ stretched to contain exactly 256 pixels (after arranging the pixels to one line). The indexing starts from 0. Examples: + * 16x16 palette, index = 0: the top left corner * 16x16 palette, index = 4: the fifth pixel in the first row * 16x16 palette, index = 16: the pixel below the top left corner * 16x16 palette, index = 255: the bottom right corner -* 2 (width)x4 (height) palette, index=31: the top left corner. +* 2 (width) x 4 (height) palette, index = 31: the top left corner. The palette has 8 pixels, so each pixel is stretched to 32 pixels, to ensure the total 256 pixels. -* 2x4 palette, index=32: the top right corner -* 2x4 palette, index=63: the top right corner -* 2x4 palette, index=64: the pixel below the top left corner +* 2x4 palette, index = 32: the top right corner +* 2x4 palette, index = 63: the top right corner +* 2x4 palette, index = 64: the pixel below the top left corner #### Using palettes with items + When registering an item, set the item definition's `palette` field to a texture. You can also use texture modifiers. @@ -561,40 +657,43 @@ stack's metadata. `palette_index` is an integer, which specifies the index of the pixel to use. #### Linking palettes with nodes + When registering a node, set the item definition's `palette` field to a texture. You can also use texture modifiers. The node's color depends on its `param2`, so you also must set an -appropriate `drawtype`: -* `drawtype = "color"` for nodes which use their full `param2` for +appropriate `paramtype2`: + +* `paramtype2 = "color"` for nodes which use their full `param2` for palette indexing. These nodes can have 256 different colors. The palette should contain 256 pixels. -* `drawtype = "colorwallmounted"` for nodes which use the first +* `paramtype2 = "colorwallmounted"` for nodes which use the first five bits (most significant) of `param2` for palette indexing. The remaining three bits are describing rotation, as in `wallmounted` - draw type. Division by 8 yields the palette index (without stretching the + paramtype2. Division by 8 yields the palette index (without stretching the palette). These nodes can have 32 different colors, and the palette should contain 32 pixels. Examples: - * `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1) - pixel will be picked from the palette. - * `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1) - pixel will be picked from the palette. -* `drawtype = "colorfacedir"` for nodes which use the first + * `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1) + pixel will be picked from the palette. + * `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1) + pixel will be picked from the palette. +* `paramtype2 = "colorfacedir"` for nodes which use the first three bits of `param2` for palette indexing. The remaining - five bits are describing rotation, as in `facedir` draw type. + five bits are describing rotation, as in `facedir` paramtype2. Division by 32 yields the palette index (without stretching the palette). These nodes can have 8 different colors, and the palette should contain 8 pixels. Examples: - * `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the - first (= 0 + 1) pixel will be picked from the palette. - * `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the - second (= 1 + 1) pixel will be picked from the palette. + * `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the + first (= 0 + 1) pixel will be picked from the palette. + * `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the + second (= 1 + 1) pixel will be picked from the palette. To colorize a node on the map, set its `param2` value (according -to the node's draw type). +to the node's paramtype2). + +### Conversion between nodes in the inventory and on the map -### Conversion between nodes in the inventory and the on the map Static coloring is the same for both cases, there is no need for conversion. @@ -607,6 +706,7 @@ when a player digs or places a colored node. You can disable this feature by setting the `drop` field of the node to itself (without metadata). To transfer the color to a special drop, you need a drop table. + Example: minetest.register_node("mod:stone", { @@ -623,13 +723,12 @@ Example: }) ### Colored items in craft recipes + Craft recipes only support item strings, but fortunately item strings can also contain metadata. Example craft recipe registration: - local stack = ItemStack("wool:block") - dyed:get_meta():set_int("palette_index", 3) -- add index minetest.register_craft({ - output = dyed:to_string(), -- convert to string + output = minetest.itemstring_with_palette("wool:block", 3), type = "shapeless", recipe = { "wool:block", @@ -637,11 +736,14 @@ can also contain metadata. Example craft recipe registration: }, }) +To set the `color` field, you can use `minetest.itemstring_with_color`. + Metadata field filtering in the `recipe` field are not supported yet, so the craft output is independent of the color of the ingredients. Soft texture overlay -------------------- + Sometimes hardware coloring is not enough, because it affects the whole tile. Soft texture overlays were added to Minetest to allow the dynamic coloring of only specific parts of the node's texture. @@ -654,7 +756,11 @@ other. This allows different hardware coloring, but also means that tiles with overlays are drawn slower. Using too much overlays might cause FPS loss. -To define an overlay, simply set the `overlay_tiles` field of the node +For inventory and wield images you can specify overlays which +hardware coloring does not modify. You have to set `inventory_overlay` +and `wield_overlay` fields to an image name. + +To define a node overlay, simply set the `overlay_tiles` field of the node definition. These tiles are defined in the same way as plain tiles: they can have a texture name, color etc. To skip one face, set that overlay tile to an empty string. @@ -665,7 +771,7 @@ Example (colored grass block): description = "Dirt with Grass", -- Regular tiles, as usual -- The dirt tile disables palette coloring - tiles = {{name = "default_grass.png"}, + tiles = {{name = "default_grass.png"}, {name = "default_dirt.png", color = "white"}}, -- Overlay tiles: define them in the same style -- The top and bottom tile does not have overlay @@ -678,8 +784,12 @@ Example (colored grass block): palette = "default_foilage.png", }) + + + Sounds ------- +====== + Only Ogg Vorbis files are supported. For positional playing of sounds, only single-channel (mono) files are @@ -707,108 +817,72 @@ Examples of sound parameter tables: -- Play locationless on all clients { - gain = 1.0, -- default - fade = 0.0, -- default, change to a value > 0 to fade the sound in + gain = 1.0, -- default + fade = 0.0, -- default, change to a value > 0 to fade the sound in + pitch = 1.0, -- default } -- Play locationless to one player { to_player = name, - gain = 1.0, -- default - fade = 0.0, -- default, change to a value > 0 to fade the sound in + gain = 1.0, -- default + fade = 0.0, -- default, change to a value > 0 to fade the sound in + pitch = 1.0, -- default } -- Play locationless to one player, looped { to_player = name, - gain = 1.0, -- default + gain = 1.0, -- default loop = true, } -- Play in a location { pos = {x = 1, y = 2, z = 3}, - gain = 1.0, -- default - max_hear_distance = 32, -- default, uses an euclidean metric + gain = 1.0, -- default + max_hear_distance = 32, -- default, uses an euclidean metric } -- Play connected to an object, looped { object = , - gain = 1.0, -- default - max_hear_distance = 32, -- default, uses an euclidean metric + gain = 1.0, -- default + max_hear_distance = 32, -- default, uses an euclidean metric loop = true, } Looped sounds must either be connected to an object or played locationless to -one player using `to_player = name,` +one player using `to_player = name,`. + +A positional sound will only be heard by players that are within +`max_hear_distance` of the sound position, at the start of the sound. + +`SimpleSoundSpec` +----------------- -### `SimpleSoundSpec` * e.g. `""` * e.g. `"default_place_node"` * e.g. `{}` * e.g. `{name = "default_place_node"}` * e.g. `{name = "default_place_node", gain = 1.0}` +* e.g. `{name = "default_place_node", gain = 1.0, pitch = 1.0}` -Registered definitions of stuff -------------------------------- -Anything added using certain `minetest.register_*` functions get added to -the global `minetest.registered_*` tables. -* `minetest.register_entity(name, prototype table)` - * added to `minetest.registered_entities[name]` -* `minetest.register_node(name, node definition)` - * added to `minetest.registered_items[name]` - * added to `minetest.registered_nodes[name]` -* `minetest.register_tool(name, item definition)` - * added to `minetest.registered_items[name]` +Registered definitions +====================== -* `minetest.register_craftitem(name, item definition)` - * added to `minetest.registered_items[name]` - -* `minetest.unregister_item(name)` - * Unregisters the item name from engine, and deletes the entry with key - * `name` from `minetest.registered_items` and from the associated item - * table according to its nature: `minetest.registered_nodes[]` etc - -* `minetest.register_biome(biome definition)` - * returns an integer uniquely identifying the registered biome - * added to `minetest.registered_biome` with the key of `biome.name` - * if `biome.name` is nil, the key is the returned ID - -* `minetest.register_ore(ore definition)` - * returns an integer uniquely identifying the registered ore - * added to `minetest.registered_ores` with the key of `ore.name` - * if `ore.name` is nil, the key is the returned ID - -* `minetest.register_decoration(decoration definition)` - * returns an integer uniquely identifying the registered decoration - * added to `minetest.registered_decorations` with the key of `decoration.name` - * if `decoration.name` is nil, the key is the returned ID - -* `minetest.register_schematic(schematic definition)` - * returns an integer uniquely identifying the registered schematic - * added to `minetest.registered_schematic` with the key of `schematic.name` - * if `schematic.name` is nil, the key is the returned ID - * if the schematic is loaded from a file, schematic.name is set to the filename - * if the function is called when loading the mod, and schematic.name is a relative - path, then the current mod path will be prepended to the schematic filename - -* `minetest.clear_registered_biomes()` - * clears all biomes currently registered - -* `minetest.clear_registered_ores()` - * clears all ores currently registered - -* `minetest.clear_registered_decorations()` - * clears all decorations currently registered - -* `minetest.clear_registered_schematics()` - * clears all schematics currently registered +Anything added using certain [Registration functions] gets added to one or more +of the global [Registered definition tables]. Note that in some cases you will stumble upon things that are not contained in these tables (e.g. when a mod has been removed). Always check for existence before trying to access the fields. -Example: If you want to check the drawtype of a node, you could do: +Example: + +All nodes register with `minetest.register_node` get added to the table +`minetest.registered_nodes`. + +If you want to check the drawtype of a node, you could do: local function get_nodedef_field(nodename, fieldname) if not minetest.registered_nodes[nodename] then @@ -818,27 +892,21 @@ Example: If you want to check the drawtype of a node, you could do: end local drawtype = get_nodedef_field(nodename, "drawtype") -Example: `minetest.get_item_group(name, group)` has been implemented as: - function minetest.get_item_group(name, group) - if not minetest.registered_items[name] or not - minetest.registered_items[name].groups[group] then - return 0 - end - return minetest.registered_items[name].groups[group] - end + Nodes ------ +===== + Nodes are the bulk data of the world: cubes and other things that take the space of a cube. Huge amounts of them are handled efficiently, but they are quite static. -The definition of a node is stored and can be accessed by name in +The definition of a node is stored and can be accessed by using minetest.registered_nodes[node.name] -See "Registered definitions of stuff". +See [Registered definitions]. Nodes are passed by value between Lua and the engine. They are represented by a table: @@ -849,117 +917,196 @@ They are represented by a table: them for certain automated functions. If you don't use these functions, you can use them to store arbitrary values. +Node paramtypes +--------------- + The functions of `param1` and `param2` are determined by certain fields in the -node definition: +node definition. `param1` is reserved for the engine when `paramtype != "none"`: - paramtype = "light" - ^ The value stores light with and without sun in its upper and lower 4 bits - respectively. Allows light to propagate from or through the node with - light value falling by 1 per node. This is essential for a light source - node to spread its light. +* `paramtype = "light"` + * The value stores light with and without sun in its upper and lower 4 bits + respectively. + * Required by a light source node to enable spreading its light. + * Required by the following drawtypes as they determine their visual + brightness from their internal light value: + * torchlike + * signlike + * firelike + * fencelike + * raillike + * nodebox + * mesh + * plantlike + * plantlike_rooted `param2` is reserved for the engine when any of these are used: - liquidtype == "flowing" - ^ The level and some flags of the liquid is stored in param2 - drawtype == "flowingliquid" - ^ The drawn liquid level is read from param2 - drawtype == "torchlike" - drawtype == "signlike" - paramtype2 == "wallmounted" - ^ The rotation of the node is stored in param2. You can make this value - by using minetest.dir_to_wallmounted(). - paramtype2 == "facedir" - ^ The rotation of the node is stored in param2. Furnaces and chests are - rotated this way. Can be made by using minetest.dir_to_facedir(). - Values range 0 - 23 - facedir / 4 = axis direction: - 0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y- - facedir modulo 4 = rotation around that axis - paramtype2 == "leveled" - ^ Only valid for "nodebox" with type = "leveled". - The level of the top face of the nodebox is stored in param2. - The other faces are defined by 'fixed = {}' like 'type = "fixed"' nodeboxes. - The nodebox height is param2 / 64 nodes. - The maximum accepted value of param2 is 127. - paramtype2 == "degrotate" - ^ The rotation of this node is stored in param2. Plants are rotated this way. - Values range 0 - 179. The value stored in param2 is multiplied by two to - get the actual rotation of the node. - paramtype2 == "meshoptions" - ^ Only valid for "plantlike". The value of param2 becomes a bitfield which can - be used to change how the client draws plantlike nodes. Bits 0, 1 and 2 form - a mesh selector. Currently the following meshes are choosable: - 0 = a "x" shaped plant (ordinary plant) - 1 = a "+" shaped plant (just rotated 45 degrees) - 2 = a "*" shaped plant with 3 faces instead of 2 - 3 = a "#" shaped plant with 4 faces instead of 2 - 4 = a "#" shaped plant with 4 faces that lean outwards - 5-7 are unused and reserved for future meshes. - Bits 3 through 7 are optional flags that can be combined and give these +* `liquidtype = "flowing"` + * The level and some flags of the liquid is stored in `param2` +* `drawtype = "flowingliquid"` + * The drawn liquid level is read from `param2` +* `drawtype = "torchlike"` +* `drawtype = "signlike"` +* `paramtype2 = "wallmounted"` + * The rotation of the node is stored in `param2`. You can make this value + by using `minetest.dir_to_wallmounted()`. +* `paramtype2 = "facedir"` + * The rotation of the node is stored in `param2`. Furnaces and chests are + rotated this way. Can be made by using `minetest.dir_to_facedir()`. + * Values range 0 - 23 + * facedir / 4 = axis direction: + 0 = y+, 1 = z+, 2 = z-, 3 = x+, 4 = x-, 5 = y- + * facedir modulo 4 = rotation around that axis +* `paramtype2 = "leveled"` + * Only valid for "nodebox" with 'type = "leveled"', and "plantlike_rooted". + * Leveled nodebox: + * The level of the top face of the nodebox is stored in `param2`. + * The other faces are defined by 'fixed = {}' like 'type = "fixed"' + nodeboxes. + * The nodebox height is (`param2` / 64) nodes. + * The maximum accepted value of `param2` is 127. + * Rooted plantlike: + * The height of the 'plantlike' section is stored in `param2`. + * The height is (`param2` / 16) nodes. +* `paramtype2 = "degrotate"` + * Only valid for "plantlike". The rotation of the node is stored in + `param2`. + * Values range 0 - 179. The value stored in `param2` is multiplied by two to + get the actual rotation in degrees of the node. +* `paramtype2 = "meshoptions"` + * Only valid for "plantlike". The value of `param2` becomes a bitfield which + can be used to change how the client draws plantlike nodes. + * Bits 0, 1 and 2 form a mesh selector. + Currently the following meshes are choosable: + * 0 = a "x" shaped plant (ordinary plant) + * 1 = a "+" shaped plant (just rotated 45 degrees) + * 2 = a "*" shaped plant with 3 faces instead of 2 + * 3 = a "#" shaped plant with 4 faces instead of 2 + * 4 = a "#" shaped plant with 4 faces that lean outwards + * 5-7 are unused and reserved for future meshes. + * Bits 3 through 7 are optional flags that can be combined and give these effects: - bit 3 (0x08) - Makes the plant slightly vary placement horizontally - bit 4 (0x10) - Makes the plant mesh 1.4x larger - bit 5 (0x20) - Moves each face randomly a small bit down (1/8 max) - bits 6-7 are reserved for future use. - paramtype2 == "color" - ^ `param2` tells which color is picked from the palette. + * bit 3 (0x08) - Makes the plant slightly vary placement horizontally + * bit 4 (0x10) - Makes the plant mesh 1.4x larger + * bit 5 (0x20) - Moves each face randomly a small bit down (1/8 max) + * bits 6-7 are reserved for future use. +* `paramtype2 = "color"` + * `param2` tells which color is picked from the palette. The palette should have 256 pixels. - paramtype2 == "colorfacedir" - ^ Same as `facedir`, but with colors. - The first three bits of `param2` tells which color - is picked from the palette. - The palette should have 8 pixels. - paramtype2 == "colorwallmounted" - ^ Same as `wallmounted`, but with colors. - The first five bits of `param2` tells which color - is picked from the palette. - The palette should have 32 pixels. - paramtype2 == "glasslikeliquidlevel" - ^ Only valid for "glasslike_framed" or "glasslike_framed_optional" drawtypes. - param2 defines 64 levels of internal liquid. - Liquid texture is defined using `special_tiles = {"modname_tilename.png"},` +* `paramtype2 = "colorfacedir"` + * Same as `facedir`, but with colors. + * The first three bits of `param2` tells which color is picked from the + palette. The palette should have 8 pixels. +* `paramtype2 = "colorwallmounted"` + * Same as `wallmounted`, but with colors. + * The first five bits of `param2` tells which color is picked from the + palette. The palette should have 32 pixels. +* `paramtype2 = "glasslikeliquidlevel"` + * Only valid for "glasslike_framed" or "glasslike_framed_optional" + drawtypes. + * `param2` values 0-63 define 64 levels of internal liquid, 0 being empty + and 63 being full. + * Liquid texture is defined using `special_tiles = {"modname_tilename.png"}` -Nodes can also contain extra data. See "Node Metadata". +Nodes can also contain extra data. See [Node Metadata]. Node drawtypes ---------------- +-------------- + There are a bunch of different looking node types. Look for examples in `games/minimal` or `games/minetest_game`. * `normal` + * A node-sized cube. * `airlike` + * Invisible, uses no texture. * `liquid` + * The cubic source node for a liquid. * `flowingliquid` + * The flowing version of a liquid, appears with various heights and slopes. * `glasslike` + * Often used for partially-transparent nodes. + * Only external sides of textures are visible. * `glasslike_framed` + * All face-connected nodes are drawn as one volume within a surrounding + frame. + * The frame appearance is generated from the edges of the first texture + specified in `tiles`. The width of the edges used are 1/16th of texture + size: 1 pixel for 16x16, 2 pixels for 32x32 etc. + * The glass 'shine' (or other desired detail) on each node face is supplied + by the second texture specified in `tiles`. * `glasslike_framed_optional` + * This switches between the above 2 drawtypes according to the menu setting + 'Connected Glass'. * `allfaces` + * Often used for partially-transparent nodes. + * External and internal sides of textures are visible. * `allfaces_optional` + * Often used for leaves nodes. + * This switches between `normal`, `glasslike` and `allfaces` according to + the menu setting: Opaque Leaves / Simple Leaves / Fancy Leaves. + * With 'Simple Leaves' selected, the texture specified in `special_tiles` + is used instead, if present. This allows a visually thicker texture to be + used to compensate for how `glasslike` reduces visual thickness. * `torchlike` + * A single vertical texture. + * If placed on top of a node, uses the first texture specified in `tiles`. + * If placed against the underside of a node, uses the second texture + specified in `tiles`. + * If placed on the side of a node, uses the third texture specified in + `tiles` and is perpendicular to that node. * `signlike` + * A single texture parallel to, and mounted against, the top, underside or + side of a node. * `plantlike` + * Two vertical and diagonal textures at right-angles to each other. + * See `paramtype2 = "meshoptions"` above for other options. * `firelike` + * When above a flat surface, appears as 6 textures, the central 2 as + `plantlike` plus 4 more surrounding those. + * If not above a surface the central 2 do not appear, but the texture + appears against the faces of surrounding nodes if they are present. * `fencelike` + * A 3D model suitable for a wooden fence. + * One placed node appears as a single vertical post. + * Adjacently-placed nodes cause horizontal bars to appear between them. * `raillike` -* `nodebox` -- See below. (**Experimental!**) -* `mesh` -- use models for nodes + * Often used for tracks for mining carts. + * Requires 4 textures to be specified in `tiles`, in order: Straight, + curved, t-junction, crossing. + * Each placed node automatically switches to a suitable rotated texture + determined by the adjacent `raillike` nodes, in order to create a + continuous track network. + * Becomes a sloping node if placed against stepped nodes. +* `nodebox` + * Often used for stairs and slabs. + * Allows defining nodes consisting of an arbitrary number of boxes. + * See [Node boxes] below for more information. +* `mesh` + * Uses models for nodes. + * Tiles should hold model materials textures. + * Only static meshes are implemented. + * For supported model formats see Irrlicht engine documentation. +* `plantlike_rooted` + * Enables underwater `plantlike` without air bubbles around the nodes. + * Consists of a base cube at the co-ordinates of the node plus a + `plantlike` extension above with a height of `param2 / 16` nodes. + * The `plantlike` extension visually passes through any nodes above the + base cube without affecting them. + * The base cube texture tiles are defined as normal, the `plantlike` + extension uses the defined special tile, for example: + `special_tiles = {{name = "default_papyrus.png", tileable_vertical = true}},` -`*_optional` drawtypes need less rendering time if deactivated (always client side). +`*_optional` drawtypes need less rendering time if deactivated +(always client-side). Node boxes ------------ -Node selection boxes are defined using "node boxes" +---------- -The `nodebox` node drawtype allows defining visual of nodes consisting of -arbitrary number of boxes. It allows defining stuff like stairs. Only the -`fixed` and `leveled` box type is supported for these. - -Please note that this is still experimental, and may be incompatibly -changed in the future. +Node selection boxes are defined using "node boxes". A nodebox is defined as any of: @@ -968,10 +1115,18 @@ A nodebox is defined as any of: type = "regular" } { - -- A fixed box (facedir param2 is used, if applicable) + -- A fixed box (or boxes) (facedir param2 is used, if applicable) type = "fixed", fixed = box OR {box1, box2, ...} } + { + -- A variable height box (or boxes) with the top face position defined + -- by the node parameter 'leveled = ', or if 'paramtype2 == "leveled"' + -- by param2. + -- Other faces are defined by 'fixed = {}' as with 'type = "fixed"'. + type = "leveled", + fixed = box OR {box1, box2, ...} + } { -- A box like the selection box for torches -- (wallmounted param2 is used, if applicable) @@ -991,6 +1146,18 @@ A nodebox is defined as any of: connect_left = box OR {box1, box2, ...} connect_back = box OR {box1, box2, ...} connect_right = box OR {box1, box2, ...} + -- The following `disconnected_*` boxes are the opposites of the + -- `connect_*` ones above, i.e. when a node has no suitable neighbour + -- on the respective side, the corresponding disconnected box is drawn. + disconnected_top = box OR {box1, box2, ...} + disconnected_bottom = box OR {box1, box2, ...} + disconnected_front = box OR {box1, box2, ...} + disconnected_left = box OR {box1, box2, ...} + disconnected_back = box OR {box1, box2, ...} + disconnected_right = box OR {box1, box2, ...} + disconnected = box OR {box1, box2, ...} -- when there is *no* neighbour + disconnected_sides = box OR {box1, box2, ...} -- when there are *no* + -- neighbours to the sides } A `box` is defined as: @@ -1001,251 +1168,19 @@ A box of a regular node would look like: {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -`type = "leveled"` is same as `type = "fixed"`, but `y2` will be automatically -set to level from `param2`. -Meshes ------- -If drawtype `mesh` is used, tiles should hold model materials textures. -Only static meshes are implemented. -For supported model formats see Irrlicht engine documentation. - - -Noise Parameters ----------------- -Noise Parameters, or commonly called "`NoiseParams`", define the properties of -perlin noise. - -### `offset` -Offset that the noise is translated by (i.e. added) after calculation. - -### `scale` -Factor that the noise is scaled by (i.e. multiplied) after calculation. - -### `spread` -Vector containing values by which each coordinate is divided by before calculation. -Higher spread values result in larger noise features. - -A value of `{x=250, y=250, z=250}` is common. - -### `seed` -Random seed for the noise. Add the world seed to a seed offset for world-unique noise. -In the case of `minetest.get_perlin()`, this value has the world seed automatically added. - -### `octaves` -Number of times the noise gradient is accumulated into the noise. - -Increase this number to increase the amount of detail in the resulting noise. - -A value of `6` is common. - -### `persistence` -Factor by which the effect of the noise gradient function changes with each successive octave. - -Values less than `1` make the details of successive octaves' noise diminish, while values -greater than `1` make successive octaves stronger. - -A value of `0.6` is common. - -### `lacunarity` -Factor by which the noise feature sizes change with each successive octave. - -A value of `2.0` is common. - -### `flags` -Leave this field unset for no special handling. - -Currently supported are `defaults`, `eased` and `absvalue`. - -#### `defaults` -Specify this if you would like to keep auto-selection of eased/not-eased while specifying -some other flags. - -#### `eased` -Maps noise gradient values onto a quintic S-curve before performing interpolation. -This results in smooth, rolling noise. Disable this (`noeased`) for sharp-looking noise. -If no flags are specified (or defaults is), 2D noise is eased and 3D noise is not eased. - -#### `absvalue` -Accumulates the absolute value of each noise gradient result. - -Noise parameters format example for 2D or 3D perlin noise or perlin noise maps: - - np_terrain = { - offset = 0, - scale = 1, - spread = {x=500, y=500, z=500}, - seed = 571347, - octaves = 5, - persist = 0.63, - lacunarity = 2.0, - flags = "defaults, absvalue" - } - ^ A single noise parameter table can be used to get 2D or 3D noise, - when getting 2D noise spread.z is ignored. - - -Ore types ---------- -These tell in what manner the ore is generated. - -All default ores are of the uniformly-distributed scatter type. - -### `scatter` -Randomly chooses a location and generates a cluster of ore. - -If `noise_params` is specified, the ore will be placed if the 3D perlin noise at -that point is greater than the `noise_threshold`, giving the ability to create -a non-equal distribution of ore. - -### `sheet` -Creates a sheet of ore in a blob shape according to the 2D perlin noise -described by `noise_params` and `noise_threshold`. This is essentially an -improved version of the so-called "stratus" ore seen in some unofficial mods. - -This sheet consists of vertical columns of uniform randomly distributed height, -varying between the inclusive range `column_height_min` and `column_height_max`. -If `column_height_min` is not specified, this parameter defaults to 1. -If `column_height_max` is not specified, this parameter defaults to `clust_size` -for reverse compatibility. New code should prefer `column_height_max`. - -The `column_midpoint_factor` parameter controls the position of the column at which -ore eminates from. If 1, columns grow upward. If 0, columns grow downward. If 0.5, -columns grow equally starting from each direction. `column_midpoint_factor` is a -decimal number ranging in value from 0 to 1. If this parameter is not specified, -the default is 0.5. - -The ore parameters `clust_scarcity` and `clust_num_ores` are ignored for this ore type. - -### `puff` -Creates a sheet of ore in a cloud-like puff shape. - -As with the `sheet` ore type, the size and shape of puffs are described by -`noise_params` and `noise_threshold` and are placed at random vertical positions -within the currently generated chunk. - -The vertical top and bottom displacement of each puff are determined by the noise -parameters `np_puff_top` and `np_puff_bottom`, respectively. - - -### `blob` -Creates a deformed sphere of ore according to 3d perlin noise described by -`noise_params`. The maximum size of the blob is `clust_size`, and -`clust_scarcity` has the same meaning as with the `scatter` type. - -### `vein` -Creates veins of ore varying in density by according to the intersection of two -instances of 3d perlin noise with diffferent seeds, both described by -`noise_params`. `random_factor` varies the influence random chance has on -placement of an ore inside the vein, which is `1` by default. Note that -modifying this parameter may require adjusting `noise_threshold`. -The parameters `clust_scarcity`, `clust_num_ores`, and `clust_size` are ignored -by this ore type. This ore type is difficult to control since it is sensitive -to small changes. The following is a decent set of parameters to work from: - - noise_params = { - offset = 0, - scale = 3, - spread = {x=200, y=200, z=200}, - seed = 5390, - octaves = 4, - persist = 0.5, - flags = "eased", - }, - noise_threshold = 1.6 - -**WARNING**: Use this ore type *very* sparingly since it is ~200x more -computationally expensive than any other ore. - -Ore attributes --------------- -See section "Flag Specifier Format". - -Currently supported flags: -`absheight`, `puff_cliffs`, `puff_additive_composition`. - -### `absheight` -Also produce this same ore between the height range of `-y_max` and `-y_min`. - -Useful for having ore in sky realms without having to duplicate ore entries. - -### `puff_cliffs` -If set, puff ore generation will not taper down large differences in displacement -when approaching the edge of a puff. This flag has no effect for ore types other -than `puff`. - -### `puff_additive_composition` -By default, when noise described by `np_puff_top` or `np_puff_bottom` results in a -negative displacement, the sub-column at that point is not generated. With this -attribute set, puff ore generation will instead generate the absolute difference in -noise displacement values. This flag has no effect for ore types other than `puff`. - -Decoration types ----------------- -The varying types of decorations that can be placed. - -### `simple` -Creates a 1 times `H` times 1 column of a specified node (or a random node from -a list, if a decoration list is specified). Can specify a certain node it must -spawn next to, such as water or lava, for example. Can also generate a -decoration of random height between a specified lower and upper bound. -This type of decoration is intended for placement of grass, flowers, cacti, -papyri, waterlilies and so on. - -### `schematic` -Copies a box of `MapNodes` from a specified schematic file (or raw description). -Can specify a probability of a node randomly appearing when placed. -This decoration type is intended to be used for multi-node sized discrete -structures, such as trees, cave spikes, rocks, and so on. - - -Schematic specifier --------------------- -A schematic specifier identifies a schematic by either a filename to a -Minetest Schematic file (`.mts`) or through raw data supplied through Lua, -in the form of a table. This table specifies the following fields: - -* The `size` field is a 3D vector containing the dimensions of the provided schematic. (required) -* The `yslice_prob` field is a table of {ypos, prob} which sets the `ypos`th vertical slice - of the schematic to have a `prob / 256 * 100` chance of occuring. (default: 255) -* The `data` field is a flat table of MapNode tables making up the schematic, - in the order of `[z [y [x]]]`. (required) - Each MapNode table contains: - * `name`: the name of the map node to place (required) - * `prob` (alias `param1`): the probability of this node being placed (default: 255) - * `param2`: the raw param2 value of the node being placed onto the map (default: 0) - * `force_place`: boolean representing if the node should forcibly overwrite any - previous contents (default: false) - -About probability values: - -* A probability value of `0` or `1` means that node will never appear (0% chance). -* A probability value of `254` or `255` means the node will always appear (100% chance). -* If the probability value `p` is greater than `1`, then there is a - `(p / 256 * 100)` percent chance that node will appear when the schematic is - placed on the map. - - -Schematic attributes --------------------- -See section "Flag Specifier Format". - -Currently supported flags: `place_center_x`, `place_center_y`, `place_center_z`, - `force_placement`. - -* `place_center_x`: Placement of this decoration is centered along the X axis. -* `place_center_y`: Placement of this decoration is centered along the Y axis. -* `place_center_z`: Placement of this decoration is centered along the Z axis. -* `force_placement`: Schematic nodes other than "ignore" will replace existing nodes. +HUD +=== HUD element types ----------------- + The position field is used for all element types. -To account for differing resolutions, the position coordinates are the percentage -of the screen, ranging in value from `0` to `1`. +To account for differing resolutions, the position coordinates are the +percentage of the screen, ranging in value from `0` to `1`. The name field is not yet used, but should contain a description of what the HUD element represents. The direction field is the direction in which something @@ -1254,22 +1189,23 @@ is drawn. `0` draws from left to right, `1` draws from right to left, `2` draws from top to bottom, and `3` draws from bottom to top. -The `alignment` field specifies how the item will be aligned. It ranges from `-1` to `1`, -with `0` being the center, `-1` is moved to the left/up, and `1` is to the right/down. -Fractional values can be used. +The `alignment` field specifies how the item will be aligned. It is a table +where `x` and `y` range from `-1` to `1`, with `0` being central. `-1` is +moved to the left/up, and `1` is to the right/down. Fractional values can be +used. -The `offset` field specifies a pixel offset from the position. Contrary to position, -the offset is not scaled to screen size. This allows for some precisely-positioned -items in the HUD. +The `offset` field specifies a pixel offset from the position. Contrary to +position, the offset is not scaled to screen size. This allows for some +precisely positioned items in the HUD. -**Note**: `offset` _will_ adapt to screen DPI as well as user defined scaling factor! +**Note**: `offset` _will_ adapt to screen DPI as well as user defined scaling +factor! -Below are the specific uses for fields in each type; fields not listed for that type are ignored. - -**Note**: Future revisions to the HUD API may be incompatible; the HUD API is still -in the experimental stages. +Below are the specific uses for fields in each type; fields not listed for that +type are ignored. ### `image` + Displays an image on the HUD. * `scale`: The scale of the image, with 1 being the original texture size. @@ -1281,17 +1217,19 @@ Displays an image on the HUD. * `offset`: offset in pixels from position. ### `text` + Displays text on the HUD. * `scale`: Defines the bounding rectangle of the text. A value such as `{x=100, y=100}` should work. * `text`: The text to be displayed in the HUD element. -* `number`: An integer containing the RGB value of the color used to draw the text. - Specify `0xFFFFFF` for white text, `0xFF0000` for red, and so on. +* `number`: An integer containing the RGB value of the color used to draw the + text. Specify `0xFFFFFF` for white text, `0xFF0000` for red, and so on. * `alignment`: The alignment of the text. * `offset`: offset in pixels from position. ### `statbar` + Displays a horizontal bar made up of half-images. * `text`: The name of the texture that is used. @@ -1299,9 +1237,11 @@ Displays a horizontal bar made up of half-images. If odd, will end with a vertically center-split texture. * `direction` * `offset`: offset in pixels from position. -* `size`: If used, will force full-image size to this value (override texture pack image size) +* `size`: If used, will force full-image size to this value (override texture + pack image size) ### `inventory` + * `text`: The name of the inventory list to be displayed. * `number`: Number of items in the inventory to be displayed. * `item`: Position of item that is selected. @@ -1309,31 +1249,55 @@ Displays a horizontal bar made up of half-images. * `offset`: offset in pixels from position. ### `waypoint` + Displays distance to selected world position. * `name`: The name of the waypoint. * `text`: Distance suffix. Can be blank. -* `number:` An integer containing the RGB value of the color used to draw the text. +* `number:` An integer containing the RGB value of the color used to draw the + text. * `world_pos`: World position of the waypoint. -Representations of simple things --------------------------------- -### Position/vector + + +Representations of simple things +================================ + +Position/vector +--------------- {x=num, y=num, z=num} -For helper functions see "Vector helpers". +For helper functions see [Spatial Vectors]. + +`pointed_thing` +--------------- -### `pointed_thing` * `{type="nothing"}` * `{type="node", under=pos, above=pos}` * `{type="object", ref=ObjectRef}` +Exact pointing location (currently only `Raycast` supports these fields): + +* `pointed_thing.intersection_point`: The absolute world coordinates of the + point on the selection box which is pointed at. May be in the selection box + if the pointer is in the box too. +* `pointed_thing.box_id`: The ID of the pointed selection box (counting starts + from 1). +* `pointed_thing.intersection_normal`: Unit vector, points outwards of the + selected selection box. This specifies which face is pointed at. + Is a null vector `{x = 0, y = 0, z = 0}` when the pointer is inside the + selection box. + + + + Flag Specifier Format ---------------------- -Flags using the standardized flag specifier format can be specified in either of -two ways, by string or table. +===================== + +Flags using the standardized flag specifier format can be specified in either +of two ways, by string or table. The string format is a comma-delimited set of flag names; whitespace and unrecognized flag fields are ignored. Specifying a flag in the string sets the @@ -1363,31 +1327,44 @@ or even since, by default, no schematic attributes are set. -Items ------ -### Item types + + +Items +===== + +Item types +---------- + There are three kinds of items: nodes, tools and craftitems. -* Node (`register_node`): A node from the world. -* Tool (`register_tool`): A tool/weapon that can dig and damage - things according to `tool_capabilities`. -* Craftitem (`register_craftitem`): A miscellaneous item. +* Node: Can be placed in the world's voxel grid +* Tool: Has a wear property but cannot be stacked. The default use action is to + dig nodes or hit objects according to its tool capabilities. +* Craftitem: Cannot dig nodes or be placed -### Amount and wear -All item stacks have an amount between 0 to 65535. It is 1 by +Amount and wear +--------------- + +All item stacks have an amount between 0 and 65535. It is 1 by default. Tool item stacks can not have an amount greater than 1. -Tools use a wear (=damage) value ranging from 0 to 65535. The -value 0 is the default and used is for unworn tools. The values +Tools use a wear (damage) value ranging from 0 to 65535. The +value 0 is the default and is used for unworn tools. The values 1 to 65535 are used for worn tools, where a higher value stands for a higher wear. Non-tools always have a wear value of 0. -### Item formats +Item formats +------------ + Items and item stacks can exist in three formats: Serializes, table format and `ItemStack`. -#### Serialized +When an item must be passed to a function, it can usually be in any of +these formats. + +### Serialized + This is called "stackstring" or "itemstring". It is a simple string with 1-3 components: the full item identifier, an optional amount and an optional wear value. Syntax: @@ -1401,7 +1378,8 @@ Examples: * `'default:pick_stone'`: a new stone pickaxe * `'default:pick_wood 1 21323'`: a wooden pickaxe, ca. 1/3 worn out -#### Table format +### Table format + Examples: 5 dirt nodes: @@ -1416,30 +1394,33 @@ An apple: {name="default:apple", count=1, wear=0, metadata=""} -#### `ItemStack` -A native C++ format with many helper methods. Useful for converting -between formats. See the Class reference section for details. +### `ItemStack` + +A native C++ format with many helper methods. Useful for converting +between formats. See the [Class reference] section for details. + -When an item must be passed to a function, it can usually be in any of -these formats. Groups ------- +====== + In a number of places, there is a group table. Groups define the properties of a thing (item, node, armor of entity, capabilities of tool) in such a way that the engine and other mods can can interact with the thing without actually knowing what the thing is. -### Usage +Usage +----- + Groups are stored in a table, having the group names with keys and the group ratings as values. For example: + -- Default dirt groups = {crumbly=3, soil=1} - -- ^ Default dirt + -- A more special dirt-kind of thing groups = {crumbly=2, soil=1, level=2, outerspace=1} - -- ^ A more special dirt-kind of thing Groups always have a rating associated with them. If there is no useful meaning for a rating for an enabled group, it shall be `1`. @@ -1451,26 +1432,36 @@ You can read the rating of a group for an item or a node by using minetest.get_item_group(itemname, groupname) -### Groups of items +Groups of items +--------------- + Groups of items can define what kind of an item it is (e.g. wool). -### Groups of nodes +Groups of nodes +--------------- + In addition to the general item things, groups are used to define whether a node is destroyable and how long it takes to destroy by a tool. -### Groups of entities +Groups of entities +------------------ + For entities, groups are, as of now, used only for calculating damage. The rating is the percentage of damage caused by tools with this damage group. -See "Entity damage mechanism". +See [Entity damage mechanism]. object.get_armor_groups() --> a group-rating table (e.g. {fleshy=100}) object.set_armor_groups({fleshy=30, cracky=80}) -### Groups of tools +Groups of tools +--------------- + Groups in tools define which groups of nodes and entities they are effective towards. -### Groups in crafting recipes +Groups in crafting recipes +-------------------------- + An example: Make meat soup from any meat, any water and any bowl: { @@ -1491,7 +1482,9 @@ Another example: Make red wool from white wool and red dye: recipe = {'wool:white', 'group:dye,basecolor_red'}, } -### Special groups +Special groups +-------------- + * `immortal`: Disables the group damage system for an entity * `punch_operable`: For entities; disables the regular damage mechanism for players punching it by hand or a non-tool item, so that it can do something @@ -1502,7 +1495,7 @@ Another example: Make red wool from white wool and red dye: from destroyed nodes. * `0` is something that is directly accessible at the start of gameplay * There is no upper limit -* `dig_immediate`: (player can always pick up node without reducing tool wear) +* `dig_immediate`: Player can always pick up node without reducing tool wear * `2`: the node always gets the digging time 0.5 seconds (rail, sign) * `3`: the node always gets the digging time 0 seconds (torch) * `disable_jump`: Player (and possibly other things) cannot jump from node @@ -1512,11 +1505,16 @@ Another example: Make red wool from white wool and red dye: * `attached_node`: if the node under it is not a walkable block the node will be dropped as an item. If the node is wallmounted the wallmounted direction is checked. -* `soil`: saplings will grow on nodes in this group * `connect_to_raillike`: makes nodes of raillike drawtype with same group value connect to each other +* `slippery`: Players and items will slide on the node. + Slipperiness rises steadily with `slippery` value, starting at 1. +* `disable_repair`: If set to 1 for a tool, it cannot be repaired using the + `"toolrepair"` crafting recipe + +Known damage and digging time defining groups +--------------------------------------------- -### Known damage and digging time defining groups * `crumbly`: dirt, sand * `cracky`: tough but crackable stuff like stone. * `snappy`: something that can be cut using fine tools; e.g. leaves, small @@ -1532,7 +1530,9 @@ Another example: Make red wool from white wool and red dye: speed of a tool if the tool can dig at a faster speed than this suggests for the hand. -### Examples of custom groups +Examples of custom groups +------------------------- + Item groups are often used for defining, well, _groups of items_. * `meat`: any meat-kind of a thing (rating might define the size or healing @@ -1546,7 +1546,9 @@ Item groups are often used for defining, well, _groups of items_. * `weapon`: any weapon * `heavy`: anything considerably heavy -### Digging time calculation specifics +Digging time calculation specifics +---------------------------------- + Groups such as `crumbly`, `cracky` and `snappy` are used for this purpose. Rating is `1`, `2` or `3`. A higher rating for such a group implies faster digging time. @@ -1561,7 +1563,15 @@ Tools define their properties by a list of parameters for groups. They cannot dig other groups; thus it is important to use a standard bunch of groups to enable interaction with tools. -#### Tools definition + + + +Tools +===== + +Tools definition +---------------- + Tools define: * Full punch interval @@ -1572,19 +1582,22 @@ Tools define: * Digging times * Damage groups -#### Full punch interval +### Full punch interval + When used as a weapon, the tool will do full damage if this time is spent between punches. If e.g. half the time is spent, the tool will do half damage. -#### Maximum drop level +### Maximum drop level + Suggests the maximum level of node, when dug with the tool, that will drop it's useful item. (e.g. iron ore to drop a lump of iron). This is not automated; it is the responsibility of the node definition to implement this. -#### Uses +### Uses + Determines how many uses the tool has when it is used for digging a node, of this group, of the maximum level. For lower leveled nodes, the use count is multiplied by `3^leveldiff`. @@ -1593,11 +1606,13 @@ is multiplied by `3^leveldiff`. * `uses=10, leveldiff=1`: actual uses: 30 * `uses=10, leveldiff=2`: actual uses: 90 -#### Maximum level +### Maximum level + Tells what is the maximum level of a node of this group that the tool will be able to dig. -#### Digging times +### Digging times + List of digging times for different ratings of the group, for nodes of the maximum level. @@ -1610,10 +1625,12 @@ If the result digging time is 0, a delay of 0.15 seconds is added between digging nodes; If the player releases LMB after digging, this delay is set to 0, i.e. players can more quickly click the nodes away instead of holding LMB. -#### Damage groups -List of damage for groups of entities. See "Entity damage mechanism". +### Damage groups -#### Example definition of the capabilities of a tool +List of damage for groups of entities. See [Entity damage mechanism]. + +Example definition of the capabilities of a tool +------------------------------------------------ tool_capabilities = { full_punch_interval=1.5, @@ -1653,14 +1670,18 @@ Table of resulting tool uses: easy nodes to be quickly breakable. * At `level > 2`, the node is not diggable, because it's `level > maxlevel` + + + Entity damage mechanism ------------------------ +======================= + Damage calculation: damage = 0 foreach group in cap.damage_groups: - damage += cap.damage_groups[group] * limit(actual_interval / - cap.full_punch_interval, 0.0, 1.0) + damage += cap.damage_groups[group] + * limit(actual_interval / cap.full_punch_interval, 0.0, 1.0) * (object.armor_groups[group] / 100.0) -- Where object.armor_groups[group] is 0 for inexistent values return damage @@ -1679,7 +1700,8 @@ a non-tool item, so that it can do something else than take damage. On the Lua side, every punch calls: - entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, damage) + entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, + damage) This should never be called directly, because damage is usually not handled by the entity itself. @@ -1691,23 +1713,30 @@ the entity itself. * `direction` is a unit vector, pointing from the source of the punch to the punched object. * `damage` damage that will be done to entity -Return value of this function will determin if damage is done by this function +Return value of this function will determine if damage is done by this function (retval true) or shall be done by engine (retval false) To punch an entity/object in Lua, call: - object:punch(puncher, time_from_last_punch, tool_capabilities, direction) + object:punch(puncher, time_from_last_punch, tool_capabilities, direction) * Return value is tool wear. * Parameters are equal to the above callback. -* If `direction` equals `nil` and `puncher` does not equal `nil`, - `direction` will be automatically filled in based on the location of `puncher`. +* If `direction` equals `nil` and `puncher` does not equal `nil`, `direction` + will be automatically filled in based on the location of `puncher`. + + + + +Metadata +======== Node Metadata ------------- + The instance of a node in the world normally only contains the three values -mentioned in "Nodes". However, it is possible to insert extra data into a -node. It is called "node metadata"; See `NodeMetaRef`. +mentioned in [Nodes]. However, it is possible to insert extra data into a node. +It is called "node metadata"; See `NodeMetaRef`. Node metadata contains two things: @@ -1716,10 +1745,10 @@ Node metadata contains two things: Some of the values in the key-value store are handled specially: -* `formspec`: Defines a right-click inventory menu. See "Formspec". +* `formspec`: Defines a right-click inventory menu. See [Formspec]. * `infotext`: Text shown on the screen when the node is pointed at -Example stuff: +Example: local meta = minetest.get_meta(pos) meta:set_string("formspec", @@ -1749,40 +1778,69 @@ Example stuff: Item Metadata ------------- -Item stacks can store metadata too. See `ItemStackMetaRef`. + +Item stacks can store metadata too. See [`ItemStackMetaRef`]. Item metadata only contains a key-value store. Some of the values in the key-value store are handled specially: -* `description`: Set the item stack's description. Defaults to `idef.description` +* `description`: Set the item stack's description. Defaults to + `idef.description`. * `color`: A `ColorString`, which sets the stack's color. * `palette_index`: If the item has a palette, this is used to get the - current color from the palette. + current color from the palette. -Example stuff: +Example: local meta = stack:get_meta() meta:set_string("key", "value") print(dump(meta:to_table())) + + + Formspec --------- -Formspec defines a menu. Currently not much else than inventories are -supported. It is a string, with a somewhat strange format. +======== + +Formspec defines a menu. This supports inventories and some of the +typical widgets like buttons, checkboxes, text input fields, etc. +It is a string, with a somewhat strange format. + +A formspec is made out of formspec elements, which includes widgets +like buttons but also can be used to set stuff like background color. + +Many formspec elements have a `name`, which is a unique identifier which +is used when the server receives user input. You must not use the name +"quit" for formspec elements. Spaces and newlines can be inserted between the blocks, as is used in the examples. -### Examples +Position and size units are inventory slots, `X` and `Y` position the formspec +element relative to the top left of the menu or container. `W` and `H` are its +width and height values. +Inventories with a `player:` inventory location are only sent to the +player named ``. -#### Chest +When displaying text which can contain formspec code, e.g. text set by a player, +use `minetest.formspec_escape`. +For coloured text you can use `minetest.colorize`. + +WARNING: Minetest allows you to add elements to every single formspec instance +using `player:set_formspec_prepend()`, which may be the reason backgrounds are +appearing when you don't expect them to. See [`no_prepend[]`]. + +Examples +-------- + +### Chest size[8,9] list[context;main;0,0;8,4;] list[current_player;main;0,5;8,4;] -#### Furnace +### Furnace size[8,9] list[context;fuel;2,3;1,1;] @@ -1790,7 +1848,7 @@ examples. list[context;dst;5,1;2,2;] list[current_player;main;0,5;8,4;] -#### Minecraft-like player inventory +### Minecraft-like player inventory size[8,7.5] image[1,0.6;1,2;player.png] @@ -1798,283 +1856,337 @@ examples. list[current_player;craft;3,0;3,3;] list[current_player;craftpreview;7,1;1,1;] -### Elements +Elements +-------- + +### `size[,,]` -#### `size[,,]` * Define the size of the menu in inventory slots * `fixed_size`: `true`/`false` (optional) * deprecated: `invsize[,;]` -#### `position[,]` -* Define the position of the formspec -* A value between 0.0 and 1.0 represents a position inside the screen -* The default value is the center of the screen (0.5, 0.5) +### `position[,]` -#### `anchor[,]` -* Define the anchor of the formspec -* A value between 0.0 and 1.0 represents an anchor inside the formspec -* The default value is the center of the formspec (0.5, 0.5) +* Must be used after `size` element. +* Defines the position on the game window of the formspec's `anchor` point. +* For X and Y, 0.0 and 1.0 represent opposite edges of the game window, + for example: + * [0.0, 0.0] sets the position to the top left corner of the game window. + * [1.0, 1.0] sets the position to the bottom right of the game window. +* Defaults to the center of the game window [0.5, 0.5]. -#### `container[,]` -* Start of a container block, moves all physical elements in the container by (X, Y) +### `anchor[,]` + +* Must be used after both `size` and `position` (if present) elements. +* Defines the location of the anchor point within the formspec. +* For X and Y, 0.0 and 1.0 represent opposite edges of the formspec, + for example: + * [0.0, 1.0] sets the anchor to the bottom left corner of the formspec. + * [1.0, 0.0] sets the anchor to the top right of the formspec. +* Defaults to the center of the formspec [0.5, 0.5]. + +* `position` and `anchor` elements need suitable values to avoid a formspec + extending off the game window due to particular game window sizes. + +### `no_prepend[]` + +* Must be used after the `size`, `position`, and `anchor` elements (if present). +* Disables player:set_formspec_prepend() from applying to this formspec. + +### `container[,]` + +* Start of a container block, moves all physical elements in the container by + (X, Y). * Must have matching `container_end` * Containers can be nested, in which case the offsets are added (child containers are relative to parent containers) -#### `container_end[]` -* End of a container, following elements are no longer relative to this container +### `container_end[]` -#### `list[;;,;,;]` -* Show an inventory list +* End of a container, following elements are no longer relative to this + container. -#### `list[;;,;,;]` -* Show an inventory list +### `list[;;,;,;]` + +* Show an inventory list if it has been sent to the client. Nothing will + be shown if the inventory list is of size 0. + +### `list[;;,;,;]` + +* Show an inventory list if it has been sent to the client. Nothing will + be shown if the inventory list is of size 0. + +### `listring[;]` -#### `listring[;]` * Allows to create a ring of inventory lists * Shift-clicking on items in one element of the ring will send them to the next inventory list inside the ring * The first occurrence of an element inside the ring will determine the inventory where items will be sent to -#### `listring[]` +### `listring[]` + * Shorthand for doing `listring[;]` for the last two inventory lists added by list[...] -#### `listcolors[;]` +### `listcolors[;]` + * Sets background color of slots as `ColorString` * Sets background color of slots on mouse hovering -#### `listcolors[;;]` +### `listcolors[;;]` + * Sets background color of slots as `ColorString` * Sets background color of slots on mouse hovering * Sets color of slots border -#### `listcolors[;;;;]` +### `listcolors[;;;;]` + * Sets background color of slots as `ColorString` * Sets background color of slots on mouse hovering * Sets color of slots border * Sets default background color of tooltips * Sets default font color of tooltips -#### `tooltip[;;;]` +### `tooltip[;;;]` + * Adds tooltip for an element * `` tooltip background color as `ColorString` (optional) * `` tooltip font color as `ColorString` (optional) -#### `image[,;,;]` +### `tooltip[,;,;;;]` + +* Adds tooltip for an area. Other tooltips will take priority when present. +* `` tooltip background color as `ColorString` (optional) +* `` tooltip font color as `ColorString` (optional) + +### `image[,;,;]` + * Show an image -* Position and size units are inventory slots -#### `item_image[,;,;]` +### `item_image[,;,;]` + * Show an inventory image of registered item/node -* Position and size units are inventory slots -#### `bgcolor[;]` +### `bgcolor[;]` + * Sets background color of formspec as `ColorString` -* If `true`, the background color is drawn fullscreen (does not effect the size of the formspec) +* If `true`, the background color is drawn fullscreen (does not affect the size + of the formspec). + +### `background[,;,;]` -#### `background[,;,;]` * Use a background. Inventory rectangles are not drawn then. -* Position and size units are inventory slots * Example for formspec 8x4 in 16x resolution: image shall be sized 8 times 16px times 4 times 16px. -#### `background[,;,;;]` +### `background[,;,;;]` + * Use a background. Inventory rectangles are not drawn then. -* Position and size units are inventory slots * Example for formspec 8x4 in 16x resolution: image shall be sized 8 times 16px times 4 times 16px -* If `true` the background is clipped to formspec size +* If `auto_clip` is `true`, the background is clipped to the formspec size (`x` and `y` are used as offset values, `w` and `h` are ignored) -#### `pwdfield[,;,;;