From ea30b89d3fcaf599a4d4c4e2f12f01a1d59f1072 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 4 Apr 2020 21:27:30 +0200 Subject: Builtin: Make item entities glow less (#9594) minor adjustment to #9200 --- builtin/game/item_entity.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index 1d66799f6..968daac97 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -59,7 +59,7 @@ core.register_entity(":__builtin:item", { local size = 0.2 + 0.1 * (count / max_count) ^ (1 / 3) local coll_height = size * 0.75 local def = core.registered_nodes[itemname] - local glow = def and def.light_source + local glow = def and math.floor(def.light_source / 2 + 0.5) self.object:set_properties({ is_visible = true, -- cgit v1.2.3 From 09b8f5d1be236990e86e800052b2c476cee22e7a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 5 Apr 2020 17:30:44 +0100 Subject: Update credits for 5.2.0 (#9593) --- builtin/mainmenu/tab_credits.lua | 81 +++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 47 deletions(-) (limited to 'builtin') diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua index 58db129fb..962d2a3b4 100644 --- a/builtin/mainmenu/tab_credits.lua +++ b/builtin/mainmenu/tab_credits.lua @@ -20,51 +20,31 @@ local core_developers = { "Perttu Ahola (celeron55) ", "sfan5 ", - "ShadowNinja ", "Nathanaël Courant (Nore/Ekdohibs) ", "Loic Blot (nerzhul/nrz) ", "paramat", "Auke Kok (sofar) ", - "rubenwardy ", + "Andrew Ward (rubenwardy) ", "Krock/SmallJoker ", "Lars Hofhansl ", } local active_contributors = { - "numberZero [Audiovisuals: meshgen]", - "stujones11 [Android UX improvements]", - "red-001 [CSM & Menu fixes]", - "Paul Ouellette (pauloue) [Docs, fixes]", - "Dániel Juhász (juhdanad) [Audiovisuals: lighting]", - "Hybrid Dog [API]", - "srifqi [Android]", - "Vincent Glize (Dumbeldor) [Cleanups, CSM APIs]", - "Ben Deutsch [Rendering, Fixes, SQLite auth]", - "Wuzzy [Translation, Slippery]", - "ANAND (ClobberXD) [Docs, Fixes]", - "Shara/Ezhh [Docs, Game API]", - "DTA7 [Fixes, mute key]", - "Thomas-S [Disconnected, Formspecs]", - "Raymoo [Tool Capabilities]", - "Elijah Duffy (octacian) [Mainmenu]", - "noob3167 [Fixes]", - "adelcoding1 [Formspecs]", - "adrido [Windows Installer, Formspecs]", - "Rui [Sound Pitch]", - "Jean-Patrick G (kilbith) [Audiovisuals]", - "Esteban (EXio4) [Cleanups]", - "Vaughan Lapsley (vlapsley) [Carpathian mapgen]", - "CoderForTheBetter [Add set_rotation]", - "Quentin Bazin (Unarelith) [Cleanups]", + "Hugues Ross [Formspecs]", "Maksim (MoNTE48) [Android]", - "Gaël-de-Sailly [Mapgen, pitch fly]", - "zeuner [Docs, Fixes]", - "ThomasMonroe314 (tre) [Fixes]", - "Rob Blanckaert (basicer) [Fixes]", - "Jozef Behran (osjc) [Fixes]", - "random-geek [Fixes]", - "Pedro Gimeno (pgimeno) [Fixes]", - "lisacvuk [Fixes]", + "DS [Formspecs]", + "pyrollo [Formspecs: Hypertext]", + "v-rob [Formspecs]", + "Jordach [set_sky]", + "random-geek [Formspecs]", + "Wuzzy [Pathfinder, builtin, translations]", + "ANAND (ClobberXD) [Fixes, per-player FOV]", + "Warr1024 [Fixes]", + "Paul Ouellette (pauloue) [Fixes, Script API]", + "Jean-Patrick G (kilbith) [Audiovisuals]", + "HybridDog [Script API]", + "dcbrwn [Object shading]", + "srifqi [Fixes]", } local previous_core_developers = { @@ -79,24 +59,31 @@ local previous_core_developers = { "Ryan Kwolek (kwolekr) ", "sapier", "Zeno", + "ShadowNinja ", } local previous_contributors = { - "Gregory Currie (gregorycu) [optimisation]", - "Diego Martínez (kaeza) ", - "T4im [Profiler]", - "TeTpaAka [Hand overriding, nametag colors]", - "Duane Robertson [MGValleys]", - "neoascetic [OS X Fixes]", - "TriBlade9 [Audiovisuals]", - "Jurgen Doser (doserj) [Fixes]", - "MirceaKitsune [Audiovisuals]", - "Guiseppe Bilotta (Oblomov) [Fixes]", - "matttpt [Fixes]", "Nils Dagsson Moskopp (erlehmann) [Minetest Logo]", + "Dániel Juhász (juhdanad) ", + "red-001 ", + "numberZero [Audiovisuals: meshgen]", + "Giuseppe Bilotta", + "MirceaKitsune ", + "Constantin Wenger (SpeedProg)", + "Ciaran Gultnieks (CiaranG)", + "stujones11 [Android UX improvements]", "Jeija [HTTP, particles]", - "bigfoot547 [CSM]", + "Vincent Glize (Dumbeldor) [Cleanups, CSM APIs]", + "Ben Deutsch [Rendering, Fixes, SQLite auth]", + "TeTpaAka [Hand overriding, nametag colors]", + "Rui [Sound Pitch]", + "Duane Robertson [MGValleys]", + "Raymoo [Tool Capabilities]", "Rogier [Fixes]", + "Gregory Currie (gregorycu) [optimisation]", + "TriBlade9 [Audiovisuals]", + "T4im [Profiler]", + "Jurgen Doser (doserj) ", } local function buildCreditList(source) -- cgit v1.2.3 From f91124a0c0d8c448b3d3d0767b3c8b2352c92d6e Mon Sep 17 00:00:00 2001 From: Wren Turkal Date: Mon, 6 Apr 2020 07:06:16 -0700 Subject: Add allowed_mapgens option in game.conf. (#9263) The game.conf has a disallowed_mapgens option. However, some games require a certain mapgen to be used, like the CTF plugin. This change adds an option to specify allowed mapgens so that the setting can be specified in a way that needn't be updated as map generators are added to Minetest. --- builtin/mainmenu/dlg_create_world.lua | 13 +++++++++++++ doc/lua_api.txt | 8 ++++++++ 2 files changed, 21 insertions(+) (limited to 'builtin') diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 31d41d693..f28ae6960 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -39,11 +39,24 @@ local function create_world_formspec(dialogdata) local gamepath = game_by_gameidx.path local gameconfig = Settings(gamepath.."/game.conf") + local allowed_mapgens = (gameconfig:get("allowed_mapgens") or ""):split() + for key, value in pairs(allowed_mapgens) do + allowed_mapgens[key] = value:trim() + end + local disallowed_mapgens = (gameconfig:get("disallowed_mapgens") or ""):split() for key, value in pairs(disallowed_mapgens) do disallowed_mapgens[key] = value:trim() end + if #allowed_mapgens > 0 then + for i = #mapgens, 1, -1 do + if table.indexof(allowed_mapgens, mapgens[i]) == -1 then + table.remove(mapgens, i) + end + end + end + if disallowed_mapgens then for i = #mapgens, 1, -1 do if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d0b07a4b2..ce9fc61b2 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -64,9 +64,17 @@ The game directory can contain the following files: * `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 + * `allowed_mapgens = ` + e.g. `allowed_mapgens = v5,v6,flat` + Mapgens not in this list are removed from the list of mapgens for + the game. + If not specified, all mapgens are allowed. * `disallowed_mapgens = ` e.g. `disallowed_mapgens = v5,v6,flat` These mapgens are removed from the list of mapgens for the game. + When both `allowed_mapgens` and `disallowed_mapgens` are + specified, `allowed_mapgens` is applied before + `disallowed_mapgens`. * `minetest.conf`: Used to set default settings when running this game. * `settingtypes.txt`: -- cgit v1.2.3 From f45ba78a72d86fd481a2d2064ac63858d69ad7ee Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 6 Apr 2020 16:54:12 +0200 Subject: Allow relative directories for `screenshot_path`, tweak default path (#9122) This will likely be more intuitive for users and should play better with sandboxed distributions such as Flatpak. In addition, the screenshot directory will now be created if it doesn't exist already. --- builtin/settingtypes.txt | 5 +++-- src/client/client.cpp | 13 ++++++++++++- src/defaultsettings.cpp | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 1f2889b45..a6cf8de60 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -903,8 +903,9 @@ fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255 # This font will be used for certain languages or if the default font is unavailable. fallback_font_path (Fallback font path) filepath fonts/DroidSansFallbackFull.ttf -# Path to save screenshots at. -screenshot_path (Screenshot folder) path +# Path to save screenshots at. Can be an absolute or relative path. +# The folder will be created if it doesn't already exist. +screenshot_path (Screenshot folder) path screenshots # Format of screenshots. screenshot_format (Screenshot format) enum png png,jpg,bmp,pcx,ppm,tga diff --git a/src/client/client.cpp b/src/client/client.cpp index c6d28ce80..e15391dde 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1780,13 +1780,24 @@ void Client::makeScreenshot() char timetstamp_c[64]; strftime(timetstamp_c, sizeof(timetstamp_c), "%Y%m%d_%H%M%S", tm); - std::string filename_base = g_settings->get("screenshot_path") + std::string screenshot_dir; + + if (fs::IsPathAbsolute(g_settings->get("screenshot_path"))) + screenshot_dir = g_settings->get("screenshot_path"); + else + screenshot_dir = porting::path_user + DIR_DELIM + g_settings->get("screenshot_path"); + + std::string filename_base = screenshot_dir + DIR_DELIM + std::string("screenshot_") + std::string(timetstamp_c); std::string filename_ext = "." + g_settings->get("screenshot_format"); std::string filename; + // Create the directory if it doesn't already exist. + // Otherwise, saving the screenshot would fail. + fs::CreateDir(screenshot_dir); + u32 quality = (u32)g_settings->getS32("screenshot_quality"); quality = MYMIN(MYMAX(quality, 0), 100) / 100.0 * 255; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 472522bf4..b6b1ce1f2 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -48,7 +48,7 @@ void set_default_settings(Settings *settings) settings->setDefault("pitch_move", "false"); settings->setDefault("fast_move", "false"); settings->setDefault("noclip", "false"); - settings->setDefault("screenshot_path", "."); + settings->setDefault("screenshot_path", "screenshots"); settings->setDefault("screenshot_format", "png"); settings->setDefault("screenshot_quality", "0"); settings->setDefault("client_unload_unused_data_timeout", "600"); -- cgit v1.2.3 From c1742b0901a0271b0d86b02b1f52c3428c0af291 Mon Sep 17 00:00:00 2001 From: DS Date: Wed, 8 Apr 2020 22:44:52 +0200 Subject: Allow to select en as language in settings menu (#9604) fixes #9599 --- builtin/settingtypes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index a6cf8de60..101b32a24 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1373,7 +1373,7 @@ name (Player name) string # Set the language. Leave empty to use the system language. # A restart is required after changing this. -language (Language) enum ,ar,ca,cs,da,de,dv,el,eo,es,et,eu,fil,fr,hu,id,it,ja,ja_KS,jbo,kk,kn,lo,lt,ms,my,nb,nl,nn,pl,pt,pt_BR,ro,ru,sl,sr_Cyrl,sv,sw,th,tr,uk,vi +language (Language) enum ,ar,ca,cs,da,de,dv,el,en,eo,es,et,eu,fil,fr,hu,id,it,ja,ja_KS,jbo,kk,kn,lo,lt,ms,my,nb,nl,nn,pl,pt,pt_BR,ro,ru,sl,sr_Cyrl,sv,sw,th,tr,uk,vi # Level of logging to be written to debug.txt: # - (no logging) -- cgit v1.2.3 From 3833396cfad7289b8c38ab64b69885b409d993ce Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 12 Apr 2020 00:05:55 +0100 Subject: Fix delayed error message in start game tab --- builtin/mainmenu/tab_local.lua | 53 +++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'builtin') diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua index 0969bccfb..cd6cbea46 100644 --- a/builtin/mainmenu/tab_local.lua +++ b/builtin/mainmenu/tab_local.lua @@ -207,40 +207,35 @@ local function main_button_handler(this, fields, name, tabdata) local selected = core.get_textlist_index("sp_worlds") gamedata.selected_world = menudata.worldlist:get_raw_index(selected) - if core.settings:get_bool("enable_server") then - if selected ~= nil and gamedata.selected_world ~= 0 then - gamedata.playername = fields["te_playername"] - gamedata.password = fields["te_passwd"] - gamedata.port = fields["te_serverport"] - gamedata.address = "" - - core.settings:set("port",gamedata.port) - if fields["te_serveraddr"] ~= nil then - core.settings:set("bind_address",fields["te_serveraddr"]) - end + if selected == nil or gamedata.selected_world == 0 then + gamedata.errormessage = + fgettext("No world created or selected!") + return true + end - --update last game - local world = menudata.worldlist:get_raw_element(gamedata.selected_world) - if world then - local game = pkgmgr.find_by_gameid(world.gameid) - core.settings:set("menu_last_game", game.id) - end + -- Update last game + local world = menudata.worldlist:get_raw_element(gamedata.selected_world) + if world then + local game = pkgmgr.find_by_gameid(world.gameid) + core.settings:set("menu_last_game", game.id) + end - core.start() - else - gamedata.errormessage = - fgettext("No world created or selected!") + if core.settings:get_bool("enable_server") then + gamedata.playername = fields["te_playername"] + gamedata.password = fields["te_passwd"] + gamedata.port = fields["te_serverport"] + gamedata.address = "" + + core.settings:set("port",gamedata.port) + if fields["te_serveraddr"] ~= nil then + core.settings:set("bind_address",fields["te_serveraddr"]) end else - if selected ~= nil and gamedata.selected_world ~= 0 then - gamedata.singleplayer = true - core.start() - else - gamedata.errormessage = - fgettext("No world created or selected!") - end - return true + gamedata.singleplayer = true end + + core.start() + return true end if fields["world_create"] ~= nil then -- cgit v1.2.3 From 27d611fe5561db20b380a16fdc6bcf1fefaf5d39 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 13 Apr 2020 10:53:10 +0200 Subject: Add default stack size setting (#8873) New setting "default_stack_max" to alter the default stack sizes of all items when desired. Co-authored-by: Pascal Abresch --- builtin/game/item.lua | 8 +++++--- builtin/settingtypes.txt | 4 ++++ doc/lua_api.txt | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'builtin') diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 513c3a5e1..3aaa71ef2 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -675,6 +675,8 @@ end -- Item definition defaults -- +local default_stack_max = tonumber(minetest.settings:get("default_stack_max")) or 99 + core.nodedef_default = { -- Item properties type="node", @@ -684,7 +686,7 @@ core.nodedef_default = { inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = default_stack_max, usable = false, liquids_pointable = false, tool_capabilities = nil, @@ -748,7 +750,7 @@ core.craftitemdef_default = { inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = default_stack_max, liquids_pointable = false, tool_capabilities = nil, @@ -786,7 +788,7 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = default_stack_max, liquids_pointable = false, tool_capabilities = nil, diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 101b32a24..b9228f384 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1079,6 +1079,10 @@ map-dir (Map directory) path # Setting it to -1 disables the feature. item_entity_ttl (Item entity TTL) int 900 +# Specifies the default stack size of nodes, items and tools. +# Note that mods or games may explicitly set a stack for certain (or all) items. +default_stack_max (Default stack size) int 99 + # Enable players getting damage and dying. enable_damage (Damage) bool false diff --git a/doc/lua_api.txt b/doc/lua_api.txt index f43987cd8..ccb605c8e 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -6735,6 +6735,8 @@ Used by `minetest.register_node`, `minetest.register_craftitem`, and wield_scale = {x = 1, y = 1, z = 1}, + -- The default value of 99 may be configured by + -- users using the setting "default_stack_max" stack_max = 99, range = 4.0, -- cgit v1.2.3 From 5355cb1d87f60bc5548a8a9311e597b9c6046013 Mon Sep 17 00:00:00 2001 From: HybridDog <3192173+HybridDog@users.noreply.github.com> Date: Wed, 22 Apr 2020 16:43:48 +0200 Subject: minetest.serialize: Reversible number serialization (#9722) * minetest.serialize: Reversible number to string conversion The %a format is not supported in Lua 5.1. This commit also adds two tests for number serialization. --- builtin/common/serialize.lua | 11 ++--------- builtin/common/tests/serialize_spec.lua | 12 ++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'builtin') diff --git a/builtin/common/serialize.lua b/builtin/common/serialize.lua index 163aa67ad..300b394c6 100644 --- a/builtin/common/serialize.lua +++ b/builtin/common/serialize.lua @@ -120,15 +120,8 @@ function core.serialize(x) elseif tp == "function" then return string.format("loadstring(%q)", string.dump(x)) elseif tp == "number" then - -- Serialize integers with string.format to prevent - -- scientific notation, which doesn't preserve - -- precision and breaks things like node position - -- hashes. Serialize floats normally. - if math.floor(x) == x then - return string.format("%d", x) - else - return tostring(x) - end + -- Serialize numbers reversibly with string.format + return string.format("%.17g", x) elseif tp == "table" then local vals = {} local idx_dumped = {} diff --git a/builtin/common/tests/serialize_spec.lua b/builtin/common/tests/serialize_spec.lua index c41b0a372..17c6a60f7 100644 --- a/builtin/common/tests/serialize_spec.lua +++ b/builtin/common/tests/serialize_spec.lua @@ -18,6 +18,18 @@ describe("serialize", function() assert.same(test_in, test_out) end) + it("handles precise numbers", function() + local test_in = 0.2695949158945771 + local test_out = core.deserialize(core.serialize(test_in)) + assert.same(test_in, test_out) + end) + + it("handles big integers", function() + local test_in = 269594915894577 + local test_out = core.deserialize(core.serialize(test_in)) + assert.same(test_in, test_out) + end) + it("handles recursive structures", function() local test_in = { hello = "world" } test_in.foo = test_in -- cgit v1.2.3 From 2fe4641c1e00d72c1f651b83898b093a9454d43c Mon Sep 17 00:00:00 2001 From: David Leal Date: Sun, 26 Apr 2020 14:15:05 -0500 Subject: Add new command /revokeme (#9584) --- builtin/game/chat.lua | 103 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 42 deletions(-) (limited to 'builtin') diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index fd1379162..b3edda0d2 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -239,57 +239,76 @@ core.register_chatcommand("grantme", { end, }) +local function handle_revoke_command(caller, revokename, revokeprivstr) + 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 + + if not core.get_auth_handler().get_auth(revokename) then + return false, "Player " .. revokename .. " does not exist." + end + + local revokeprivs = core.string_to_privs(revokeprivstr) + local privs = core.get_player_privs(revokename) + local basic_privs = + core.string_to_privs(core.settings:get("basic_privs") or "interact,shout") + for priv, _ in pairs(revokeprivs) do + if not basic_privs[priv] and not caller_privs.privs then + return false, "Your privileges are insufficient." + end + end + + if revokeprivstr == "all" then + revokeprivs = privs + privs = {} + else + for priv, _ in pairs(revokeprivs) do + privs[priv] = nil + end + end + + for priv, _ in pairs(revokeprivs) do + -- call the on_revoke callbacks + core.run_priv_callbacks(revokename, priv, caller, "revoke") + end + + core.set_player_privs(revokename, privs) + core.log("action", caller..' revoked (' + ..core.privs_to_string(revokeprivs, ', ') + ..') privileges from '..revokename) + if revokename ~= caller then + core.chat_send_player(revokename, caller + .. " revoked privileges from you: " + .. core.privs_to_string(revokeprivs, ' ')) + end + return true, "Privileges of " .. revokename .. ": " + .. core.privs_to_string( + core.get_player_privs(revokename), ' ') +end + core.register_chatcommand("revoke", { params = " ( | all)", description = "Remove privileges from player", privs = {}, func = function(name, param) - if not core.check_player_privs(name, {privs=true}) and - not core.check_player_privs(name, {basic_privs=true}) then - return false, "Your privileges are insufficient." - end - local revoke_name, revoke_priv_str = string.match(param, "([^ ]+) (.+)") - if not revoke_name or not revoke_priv_str then + local revokename, revokeprivstr = string.match(param, "([^ ]+) (.+)") + if not revokename or not revokeprivstr then return false, "Invalid parameters (see /help revoke)" - elseif not core.get_auth_handler().get_auth(revoke_name) then - return false, "Player " .. revoke_name .. " does not exist." - end - local revoke_privs = core.string_to_privs(revoke_priv_str) - local privs = core.get_player_privs(revoke_name) - local basic_privs = - core.string_to_privs(core.settings:get("basic_privs") or "interact,shout") - for priv, _ in pairs(revoke_privs) do - if not basic_privs[priv] and - not core.check_player_privs(name, {privs=true}) then - return false, "Your privileges are insufficient." - 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 - -- call the on_revoke callbacks - core.run_priv_callbacks(revoke_name, priv, name, "revoke") end + return handle_revoke_command(name, revokename, revokeprivstr) + end, +}) - core.set_player_privs(revoke_name, privs) - core.log("action", name..' revoked (' - ..core.privs_to_string(revoke_privs, ', ') - ..') privileges from '..revoke_name) - if revoke_name ~= name then - core.chat_send_player(revoke_name, name - .. " revoked privileges from you: " - .. core.privs_to_string(revoke_privs, ' ')) +core.register_chatcommand("revokeme", { + params = " | all", + description = "Revoke privileges from yourself", + privs = {}, + func = function(name, param) + if param == "" then + return false, "Invalid parameters (see /help revokeme)" end - return true, "Privileges of " .. revoke_name .. ": " - .. core.privs_to_string( - core.get_player_privs(revoke_name), ' ') + return handle_revoke_command(name, name, param) end, }) -- cgit v1.2.3 From d3f50f216f051186bcac34c7383829e1e7b929ff Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 26 Apr 2020 20:34:10 +0200 Subject: builtin: Correctly indicate failure in /spawnentity --- builtin/game/chat.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index b3edda0d2..a71f4b329 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -736,8 +736,9 @@ core.register_chatcommand("spawnentity", { end end p.y = p.y + 1 - core.add_entity(p, entityname) - return true, ("%q spawned."):format(entityname) + local obj = core.add_entity(p, entityname) + local msg = obj and "%q spawned." or "%q failed to spawn." + return true, msg:format(entityname) end, }) -- cgit v1.2.3 From 3475759d1adbd4a64c6250fd87981f783e64f69c Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 14 Apr 2020 14:11:33 +0200 Subject: Expose collision information to LuaEntity on_step --- builtin/game/features.lua | 1 + doc/lua_api.txt | 25 ++++++++++++++++++- src/script/common/c_content.cpp | 54 +++++++++++++++++++++++++++++++++++++++++ src/script/common/c_content.h | 4 ++- src/script/cpp_api/s_entity.cpp | 12 ++++++--- src/script/cpp_api/s_entity.h | 4 ++- src/server/luaentity_sao.cpp | 8 +++--- 7 files changed, 98 insertions(+), 10 deletions(-) (limited to 'builtin') diff --git a/builtin/game/features.lua b/builtin/game/features.lua index 623f8183b..a15475333 100644 --- a/builtin/game/features.lua +++ b/builtin/game/features.lua @@ -16,6 +16,7 @@ core.features = { formspec_version_element = true, area_store_persistent_ids = true, pathfinder_works = true, + object_step_has_moveresult = true, } function core.has_feature(arg) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 3ca32649a..5e4e18b62 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4147,6 +4147,8 @@ Utilities area_store_persistent_ids = true, -- Whether minetest.find_path is functional (5.2.0) pathfinder_works = true, + -- Whether Collision info is available to an objects' on_step (5.3.0) + object_step_has_moveresult = true, } * `minetest.has_feature(arg)`: returns `boolean, missing_features` @@ -6579,7 +6581,10 @@ Used by `minetest.register_entity`. on_activate = function(self, staticdata, dtime_s), - on_step = function(self, dtime), + on_step = function(self, dtime, moveresult), + -- Called every server step + -- dtime: Elapsed time + -- moveresult: Table with collision info (only available if physical=true) on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir), @@ -6594,6 +6599,24 @@ Used by `minetest.register_entity`. -- for more info) by using a '_' prefix } +Collision info passed to `on_step`: + + { + touching_ground = boolean, + collides = boolean, + standing_on_object = boolean, + collisions = { + { + type = string, -- "node" or "object", + axis = string, -- "x", "y" or "z" + node_pos = vector, -- if type is "node" + old_speed = vector, + new_speed = vector, + }, + ... + } + } + ABM (ActiveBlockModifier) definition ------------------------------------ diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 8335fccb5..6ff642738 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_types.h" #include "nodedef.h" #include "object_properties.h" +#include "collision.h" #include "cpp_api/s_node.h" #include "lua_api/l_object.h" #include "lua_api/l_item.h" @@ -2002,3 +2003,56 @@ HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) } return stat; } + +/******************************************************************************/ + +// Indices must match values in `enum CollisionType` exactly!! +static const char *collision_type_str[] = { + "node", + "object", +}; + +// Indices must match values in `enum CollisionAxis` exactly!! +static const char *collision_axis_str[] = { + "x", + "y", + "z", +}; + +void push_collision_move_result(lua_State *L, const collisionMoveResult &res) +{ + lua_createtable(L, 0, 4); + + setboolfield(L, -1, "touching_ground", res.touching_ground); + setboolfield(L, -1, "collides", res.collides); + setboolfield(L, -1, "standing_on_object", res.standing_on_object); + + /* collisions */ + lua_createtable(L, res.collisions.size(), 0); + int i = 1; + for (const auto &c : res.collisions) { + lua_createtable(L, 0, 5); + + lua_pushstring(L, collision_type_str[c.type]); + lua_setfield(L, -2, "type"); + + assert(c.axis != COLLISION_AXIS_NONE); + lua_pushstring(L, collision_axis_str[c.axis]); + lua_setfield(L, -2, "axis"); + + if (c.type == COLLISION_NODE) { + push_v3s16(L, c.node_p); + lua_setfield(L, -2, "node_pos"); + } + + push_v3f(L, c.old_speed / BS); + lua_setfield(L, -2, "old_speed"); + + push_v3f(L, c.new_speed / BS); + lua_setfield(L, -2, "new_speed"); + + lua_rawseti(L, -2, i++); + } + lua_setfield(L, -2, "collisions"); + /**/ +} diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h index 9e755682f..8f32e58eb 100644 --- a/src/script/common/c_content.h +++ b/src/script/common/c_content.h @@ -63,7 +63,9 @@ struct EnumString; struct NoiseParams; class Schematic; class ServerActiveObject; +struct collisionMoveResult; +extern struct EnumString es_TileAnimationType[]; ContentFeatures read_content_features (lua_State *L, int index); void push_content_features (lua_State *L, @@ -196,4 +198,4 @@ void push_hud_element (lua_State *L, HudElement *elem); HudElementStat read_hud_change (lua_State *L, HudElement *elem, void **value); -extern struct EnumString es_TileAnimationType[]; +void push_collision_move_result(lua_State *L, const collisionMoveResult &res); diff --git a/src/script/cpp_api/s_entity.cpp b/src/script/cpp_api/s_entity.cpp index 26c7e8cd4..ea9320051 100644 --- a/src/script/cpp_api/s_entity.cpp +++ b/src/script/cpp_api/s_entity.cpp @@ -178,12 +178,11 @@ void ScriptApiEntity::luaentity_GetProperties(u16 id, lua_pop(L, 1); } -void ScriptApiEntity::luaentity_Step(u16 id, float dtime) +void ScriptApiEntity::luaentity_Step(u16 id, float dtime, + const collisionMoveResult *moveresult) { SCRIPTAPI_PRECHECKHEADER - //infostream<<"scriptapi_luaentity_step: id="<getScriptIface()->luaentity_Step(m_id, dtime); + if(m_registered) { + m_env->getScriptIface()->luaentity_Step(m_id, dtime, moveresult_p); } if (!send_recommended) -- cgit v1.2.3 From b9377f26a198d0383b82c76cf6904bc1797e8187 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 14 Apr 2020 16:55:16 +0200 Subject: Rewrite builtin item entity to use collision info fixes #8967 --- builtin/game/item_entity.lua | 104 +++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 48 deletions(-) (limited to 'builtin') diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index 968daac97..a85eba977 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -34,7 +34,6 @@ core.register_entity(":__builtin:item", { itemstring = "", moving_state = true, - slippery_state = false, physical_state = true, -- Item expiry age = 0, @@ -157,7 +156,7 @@ core.register_entity(":__builtin:item", { end end, - on_step = function(self, dtime) + on_step = function(self, dtime, moveresult) self.age = self.age + dtime if time_to_live > 0 and self.age > time_to_live then self.itemstring = "" @@ -178,6 +177,36 @@ core.register_entity(":__builtin:item", { return end + if self.force_out then + -- This code runs after the entity got a push from the is_stuck code. + -- It makes sure the entity is entirely outside the solid node + local c = self.object:get_properties().collisionbox + local s = self.force_out_start + local f = self.force_out + local ok = (f.x > 0 and pos.x + c[1] > s.x + 0.5) or + (f.y > 0 and pos.y + c[2] > s.y + 0.5) or + (f.z > 0 and pos.z + c[3] > s.z + 0.5) or + (f.x < 0 and pos.x + c[4] < s.x - 0.5) or + (f.z < 0 and pos.z + c[6] < s.z - 0.5) + if ok then + -- Item was successfully forced out + self.force_out = nil + self:enable_physics() + return + end + end + + if not self.physical_state then + return -- Don't do anything + end + + assert(moveresult) + if not moveresult.collides then + -- future TODO: items should probably decelerate in air + return + end + + -- Push item out when stuck inside solid node local is_stuck = false local snode = core.get_node_or_nil(pos) if snode then @@ -187,7 +216,6 @@ core.register_entity(":__builtin:item", { and (sdef.node_box == nil or sdef.node_box.type == "regular") end - -- Push item out when stuck inside solid node if is_stuck then local shootdir local order = { @@ -223,69 +251,49 @@ core.register_entity(":__builtin:item", { self.force_out_start = vector.round(pos) return end - elseif self.force_out then - -- This code runs after the entity got a push from the above code. - -- It makes sure the entity is entirely outside the solid node - local c = self.object:get_properties().collisionbox - local s = self.force_out_start - local f = self.force_out - local ok = (f.x > 0 and pos.x + c[1] > s.x + 0.5) or - (f.y > 0 and pos.y + c[2] > s.y + 0.5) or - (f.z > 0 and pos.z + c[3] > s.z + 0.5) or - (f.x < 0 and pos.x + c[4] < s.x - 0.5) or - (f.z < 0 and pos.z + c[6] < s.z - 0.5) - if ok then - -- Item was successfully forced out - self.force_out = nil - self:enable_physics() - end end - if not self.physical_state then - return -- Don't do anything + node = nil -- ground node we're colliding with + if moveresult.touching_ground then + for _, info in ipairs(moveresult.collisions) do + if info.axis == "y" then + node = core.get_node(info.node_pos) + break + end + end end -- Slide on slippery nodes - local vel = self.object:get_velocity() local def = node and core.registered_nodes[node.name] - local is_moving = (def and not def.walkable) or - vel.x ~= 0 or vel.y ~= 0 or vel.z ~= 0 - local is_slippery = false + local keep_movement = false - if def and def.walkable then + if def 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 + local vel = self.object:get_velocity() + if slippery ~= 0 and (math.abs(vel.x) > 0.1 or math.abs(vel.z) > 0.1) then -- Horizontal deceleration - local slip_factor = 4.0 / (slippery + 4) - self.object:set_acceleration({ - x = -vel.x * slip_factor, + local factor = math.min(4 / (slippery + 4) * dtime, 1) + self.object:set_velocity({ + x = vel.x * (1 - factor), y = 0, - z = -vel.z * slip_factor + z = vel.z * (1 - factor) }) - elseif vel.y == 0 then - is_moving = false + keep_movement = true 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 + if not keep_movement then + self.object:set_velocity({x=0, y=0, z=0}) 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}) + if self.moving_state == keep_movement then + -- Do not update anything until the moving state changes + return end + self.moving_state = keep_movement - --Only collect items if not moving - if is_moving then + -- Only collect items if not moving + if self.moving_state then return end -- Collect the items around to merge with -- cgit v1.2.3 From a36c9c3e930608386b983ea76158793fe9d622f6 Mon Sep 17 00:00:00 2001 From: ANAND Date: Tue, 28 Apr 2020 23:00:57 +0530 Subject: Fix breath_bar scaling; delay breath_bar hiding by one second (#8271) PLAYER_MAX_BREATH_DEFAULT was earlier set to 11, so that 10 bubbles are shown before the breath bar disappears. Now, PLAYER_MAX_BREATH_DEFAULT is set to 10, and the breath_bar scaling code in builtin has been tweaked to show all 10 bubbles before hiding the breath_bar --- builtin/game/constants.lua | 2 +- builtin/game/statbars.lua | 36 +++++++++++++++++++++++------------- src/constants.h | 2 +- 3 files changed, 25 insertions(+), 15 deletions(-) (limited to 'builtin') diff --git a/builtin/game/constants.lua b/builtin/game/constants.lua index 0ee2a7237..54eeea50f 100644 --- a/builtin/game/constants.lua +++ b/builtin/game/constants.lua @@ -24,7 +24,7 @@ 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 +core.PLAYER_MAX_BREATH_DEFAULT = 10 -- light.h -- Maximum value for node 'light_source' parameter diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua index 46c947b60..6b5b54428 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -3,22 +3,22 @@ local enable_damage = core.settings:get_bool("enable_damage") local health_bar_definition = { hud_elem_type = "statbar", - position = { x=0.5, y=1 }, + position = {x = 0.5, y = 1}, text = "heart.png", number = core.PLAYER_MAX_HP_DEFAULT, direction = 0, - size = { x=24, y=24 }, - offset = { x=(-10*24)-25, y=-(48+24+16)}, + size = {x = 24, y = 24}, + offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)}, } local breath_bar_definition = { hud_elem_type = "statbar", - position = { x=0.5, y=1 }, + position = {x = 0.5, y = 1}, text = "bubble.png", number = core.PLAYER_MAX_BREATH_DEFAULT, direction = 0, - size = { x=24, y=24 }, - offset = {x=25,y=-(48+24+16)}, + size = {x = 24, y = 24}, + offset = {x = 25, y= -(48 + 24 + 16)}, } local hud_ids = {} @@ -26,7 +26,7 @@ local hud_ids = {} 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 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 @@ -49,6 +49,7 @@ local function update_builtin_statbars(player) local hud = hud_ids[name] local immortal = player:get_armor_groups().immortal == 1 + if flags.healthbar and enable_damage and not immortal then local number = scaleToDefault(player, "hp") if hud.id_healthbar == nil then @@ -63,19 +64,28 @@ local function update_builtin_statbars(player) hud.id_healthbar = nil end + local show_breathbar = flags.breathbar and enable_damage and not immortal + + local breath = player:get_breath() local breath_max = player:get_properties().breath_max - if flags.breathbar and enable_damage and not immortal and - player:get_breath() < breath_max then + if show_breathbar and breath <= breath_max then local number = 2 * scaleToDefault(player, "breath") - if hud.id_breathbar == nil then + if not hud.id_breathbar and breath < breath_max then local hud_def = table.copy(breath_bar_definition) hud_def.number = number hud.id_breathbar = player:hud_add(hud_def) - else + elseif hud.id_breathbar then player:hud_change(hud.id_breathbar, "number", number) end - elseif hud.id_breathbar then - player:hud_remove(hud.id_breathbar) + end + + if hud.id_breathbar and (not show_breathbar or breath == breath_max) then + minetest.after(1, function(player_name, breath_bar) + local player = minetest.get_player_by_name(player_name) + if player then + player:hud_remove(breath_bar) + end + end, name, hud.id_breathbar) hud.id_breathbar = nil end end diff --git a/src/constants.h b/src/constants.h index 0a8b22e15..c17f3b6af 100644 --- a/src/constants.h +++ b/src/constants.h @@ -93,7 +93,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define PLAYER_MAX_HP_DEFAULT 20 // Default maximal breath of a player -#define PLAYER_MAX_BREATH_DEFAULT 11 +#define PLAYER_MAX_BREATH_DEFAULT 10 // Number of different files to try to save a player to if the first fails // (because of a case-insensitive filesystem) -- cgit v1.2.3 From 56bababcdfce097a4e08cc3d1de8d798e7999ce7 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 27 Apr 2020 08:31:37 +0200 Subject: Add MetricsBackend with prometheus counter support --- Dockerfile | 22 +++++-- README.md | 1 + builtin/settingtypes.txt | 6 ++ src/CMakeLists.txt | 26 ++++++++ src/cmake_config.h.in | 1 + src/defaultsettings.cpp | 3 + src/map.cpp | 11 +++- src/map.h | 6 +- src/server.cpp | 57 ++++++++++++---- src/server.h | 21 ++++-- src/server/mods.cpp | 1 + src/server/mods.h | 3 + src/util/CMakeLists.txt | 1 + src/util/metricsbackend.cpp | 140 ++++++++++++++++++++++++++++++++++++++++ src/util/metricsbackend.h | 140 ++++++++++++++++++++++++++++++++++++++++ util/ci/build_prometheus_cpp.sh | 13 ++++ 16 files changed, 427 insertions(+), 25 deletions(-) create mode 100644 src/util/metricsbackend.cpp create mode 100644 src/util/metricsbackend.h create mode 100755 util/ci/build_prometheus_cpp.sh (limited to 'builtin') diff --git a/Dockerfile b/Dockerfile index 7c1107288..72343ab9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,15 +21,29 @@ WORKDIR /usr/src/minetest RUN apk add --no-cache git build-base irrlicht-dev cmake bzip2-dev libpng-dev \ jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev \ libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev \ - gmp-dev jsoncpp-dev postgresql-dev && \ + gmp-dev jsoncpp-dev postgresql-dev ca-certificates && \ git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \ - rm -fr ./games/minetest_game/.git && \ - mkdir build && \ + rm -fr ./games/minetest_game/.git + +WORKDIR /usr/src/ +RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \ + mkdir prometheus-cpp/build && \ + cd prometheus-cpp/build && \ + cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_TESTING=0 && \ + make -j2 && \ + make install + +WORKDIR /usr/src/minetest +RUN mkdir build && \ cd build && \ cmake .. \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SERVER=TRUE \ + -DENABLE_PROMETHEUS=TRUE \ -DBUILD_UNITTESTS=FALSE \ -DBUILD_CLIENT=FALSE && \ make -j2 && \ @@ -49,6 +63,6 @@ COPY --from=0 /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/ USER minetest:minetest -EXPOSE 30000/udp +EXPOSE 30000/udp 30000/tcp CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"] diff --git a/README.md b/README.md index b3b2b863e..024e7b691 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ General options and their default values: 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_PROMETHEUS=OFF - Build with Prometheus metrics exporter (listens on tcp/30000 by default) 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 diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index b9228f384..165ed8c06 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -955,6 +955,12 @@ address (Server address) string # Note that the port field in the main menu overrides this setting. remote_port (Remote port) int 30000 1 65535 +# Prometheus listener address. +# If minetest is compiled with ENABLE_PROMETHEUS option enabled, +# enable metrics listener for Prometheus on that address. +# Metrics can be fetch on http://127.0.0.1:30000/metrics +prometheus_listener_address (Prometheus listener address) string 127.0.0.1:30000 + # Save the map received by the client on disk. enable_local_map_saving (Saving map received from server) bool false diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b416faaf3..710d9e13e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -217,6 +217,26 @@ endif(ENABLE_REDIS) find_package(SQLite3 REQUIRED) +OPTION(ENABLE_PROMETHEUS "Enable prometheus client support" FALSE) +set(USE_PROMETHEUS FALSE) + +if(ENABLE_PROMETHEUS) + find_path(PROMETHEUS_CPP_INCLUDE_DIR NAMES prometheus/counter.h) + find_library(PROMETHEUS_PULL_LIBRARY NAMES prometheus-cpp-pull) + find_library(PROMETHEUS_CORE_LIBRARY NAMES prometheus-cpp-core) + if(PROMETHEUS_CPP_INCLUDE_DIR AND PROMETHEUS_PULL_LIBRARY AND PROMETHEUS_CORE_LIBRARY) + set(PROMETHEUS_LIBRARIES ${PROMETHEUS_PULL_LIBRARY} ${PROMETHEUS_CORE_LIBRARY}) + set(USE_PROMETHEUS TRUE) + include_directories(${PROMETHEUS_CPP_INCLUDE_DIR}) + endif(PROMETHEUS_CPP_INCLUDE_DIR AND PROMETHEUS_PULL_LIBRARY AND PROMETHEUS_CORE_LIBRARY) +endif(ENABLE_PROMETHEUS) + +if(USE_PROMETHEUS) + message(STATUS "Prometheus client enabled.") +else(USE_PROMETHEUS) + message(STATUS "Prometheus client disabled.") +endif(USE_PROMETHEUS) + OPTION(ENABLE_SPATIAL "Enable SpatialIndex AreaStore backend" TRUE) set(USE_SPATIAL FALSE) @@ -597,6 +617,9 @@ if(BUILD_CLIENT) if (USE_REDIS) target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY}) endif() + if (USE_PROMETHEUS) + target_link_libraries(${PROJECT_NAME} ${PROMETHEUS_LIBRARIES}) + endif() if (USE_SPATIAL) target_link_libraries(${PROJECT_NAME} ${SPATIAL_LIBRARY}) endif() @@ -632,6 +655,9 @@ if(BUILD_SERVER) if (USE_REDIS) target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY}) endif() + if (USE_PROMETHEUS) + target_link_libraries(${PROJECT_NAME}server ${PROMETHEUS_LIBRARIES}) + endif() if (USE_SPATIAL) target_link_libraries(${PROJECT_NAME}server ${SPATIAL_LIBRARY}) endif() diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in index cac6335d4..cfcee4b58 100644 --- a/src/cmake_config.h.in +++ b/src/cmake_config.h.in @@ -23,6 +23,7 @@ #cmakedefine01 USE_LEVELDB #cmakedefine01 USE_LUAJIT #cmakedefine01 USE_POSTGRESQL +#cmakedefine01 USE_PROMETHEUS #cmakedefine01 USE_SPATIAL #cmakedefine01 USE_SYSTEM_GMP #cmakedefine01 USE_REDIS diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index b6b1ce1f2..06daa3b94 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -334,6 +334,9 @@ void set_default_settings(Settings *settings) // Server settings->setDefault("disable_escape_sequences", "false"); settings->setDefault("strip_color_codes", "false"); +#if USE_PROMETHEUS + settings->setDefault("prometheus_listener_address", "127.0.0.1:30000"); +#endif // Network settings->setDefault("enable_ipv6", "true"); diff --git a/src/map.cpp b/src/map.cpp index 12e122124..5f1b984a4 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -144,7 +144,7 @@ bool Map::isNodeUnderground(v3s16 p) { v3s16 blockpos = getNodeBlockPos(p); MapBlock *block = getBlockNoCreateNoEx(blockpos); - return block && block->getIsUnderground(); + return block && block->getIsUnderground(); } bool Map::isValidPosition(v3s16 p) @@ -1187,7 +1187,7 @@ bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes) ServerMap */ ServerMap::ServerMap(const std::string &savedir, IGameDef *gamedef, - EmergeManager *emerge): + EmergeManager *emerge, MetricsBackend *mb): Map(dout_server, gamedef), settings_mgr(g_settings, savedir + DIR_DELIM + "map_meta.txt"), m_emerge(emerge) @@ -1221,6 +1221,8 @@ ServerMap::ServerMap(const std::string &savedir, IGameDef *gamedef, m_savedir = savedir; m_map_saving_enabled = false; + m_save_time_counter = mb->addCounter("minetest_core_map_save_time", "Map save time (in nanoseconds)"); + try { // If directory exists, check contents and load if possible if (fs::PathExists(m_savedir)) { @@ -1777,6 +1779,8 @@ void ServerMap::save(ModifiedState save_level) return; } + u64 start_time = porting::getTimeNs(); + if(save_level == MOD_STATE_CLEAN) infostream<<"ServerMap: Saving whole map, this can take time." <increment(end_time - start_time); } void ServerMap::listAllLoadableBlocks(std::vector &dst) diff --git a/src/map.h b/src/map.h index ff6b20c4f..77ee4da9e 100644 --- a/src/map.h +++ b/src/map.h @@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "voxel.h" #include "modifiedstate.h" #include "util/container.h" +#include "util/metricsbackend.h" #include "nodetimer.h" #include "map_settings_manager.h" #include "debug.h" @@ -45,6 +46,7 @@ class NodeMetadata; class IGameDef; class IRollbackManager; class EmergeManager; +class MetricsBackend; class ServerEnvironment; struct BlockMakeData; @@ -324,7 +326,7 @@ public: /* savedir: directory to which map data should be saved */ - ServerMap(const std::string &savedir, IGameDef *gamedef, EmergeManager *emerge); + ServerMap(const std::string &savedir, IGameDef *gamedef, EmergeManager *emerge, MetricsBackend *mb); ~ServerMap(); s32 mapType() const @@ -449,6 +451,8 @@ private: bool m_map_metadata_changed = true; MapDatabase *dbase = nullptr; MapDatabase *dbase_ro = nullptr; + + MetricCounterPtr m_save_time_counter; }; diff --git a/src/server.cpp b/src/server.cpp index af6d3e40d..a7eb52837 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -229,18 +229,46 @@ Server::Server( m_nodedef(createNodeDefManager()), m_craftdef(createCraftDefManager()), m_thread(new ServerThread(this)), - m_uptime(0), m_clients(m_con), m_admin_chat(iface), m_modchannel_mgr(new ModChannelMgr()) { - m_lag = g_settings->getFloat("dedicated_server_step"); - if (m_path_world.empty()) throw ServerError("Supplied empty world path"); if (!gamespec.isValid()) throw ServerError("Supplied invalid gamespec"); + +#if USE_PROMETHEUS + m_metrics_backend = std::unique_ptr(createPrometheusMetricsBackend()); +#else + m_metrics_backend = std::unique_ptr(new MetricsBackend()); +#endif + + m_uptime_counter = m_metrics_backend->addCounter("minetest_core_server_uptime", "Server uptime (in seconds)"); + m_player_gauge = m_metrics_backend->addGauge("minetest_core_player_number", "Number of connected players"); + + m_timeofday_gauge = m_metrics_backend->addGauge( + "minetest_core_timeofday", + "Time of day value"); + + m_lag_gauge = m_metrics_backend->addGauge( + "minetest_core_latency", + "Latency value (in seconds)"); + + m_aom_buffer_counter = m_metrics_backend->addCounter( + "minetest_core_aom_generated_count", + "Number of active object messages generated"); + + m_packet_recv_counter = m_metrics_backend->addCounter( + "minetest_core_server_packet_recv", + "Processable packets received"); + + m_packet_recv_processed_counter = m_metrics_backend->addCounter( + "minetest_core_server_packet_recv_processed", + "Valid received packets processed"); + + m_lag_gauge->set(g_settings->getFloat("dedicated_server_step")); } Server::~Server() @@ -353,7 +381,7 @@ void Server::init() MutexAutoLock envlock(m_env_mutex); // Create the Map (loads map_meta.txt, overriding configured mapgen params) - ServerMap *servermap = new ServerMap(m_path_world, this, m_emerge); + ServerMap *servermap = new ServerMap(m_path_world, this, m_emerge, m_metrics_backend.get()); // Initialize scripting infostream << "Server: Initializing Lua" << std::endl; @@ -511,9 +539,7 @@ void Server::AsyncRunStep(bool initial_step) /* Update uptime */ - { - m_uptime.set(m_uptime.get() + dtime); - } + m_uptime_counter->increment(dtime); handlePeerChanges(); @@ -527,11 +553,13 @@ void Server::AsyncRunStep(bool initial_step) */ m_time_of_day_send_timer -= dtime; - if(m_time_of_day_send_timer < 0.0) { + if (m_time_of_day_send_timer < 0.0) { m_time_of_day_send_timer = g_settings->getFloat("time_send_interval"); u16 time = m_env->getTimeOfDay(); float time_speed = g_settings->getFloat("time_speed"); SendTimeOfDay(PEER_ID_INEXISTENT, time, time_speed); + + m_timeofday_gauge->set(time); } { @@ -603,7 +631,7 @@ void Server::AsyncRunStep(bool initial_step) } m_clients.step(dtime); - m_lag += (m_lag > dtime ? -1 : 1) * dtime/100; + m_lag_gauge->increment((m_lag_gauge->get() > dtime ? -1 : 1) * dtime/100); #if USE_CURL // send masterserver announce { @@ -614,9 +642,9 @@ void Server::AsyncRunStep(bool initial_step) ServerList::AA_START, m_bind_addr.getPort(), m_clients.getPlayerNames(), - m_uptime.get(), + m_uptime_counter->get(), m_env->getGameTime(), - m_lag, + m_lag_gauge->get(), m_gamespec.id, Mapgen::getMapgenName(m_emerge->mgparams->mgtype), m_modmgr->getMods(), @@ -638,6 +666,7 @@ void Server::AsyncRunStep(bool initial_step) const RemoteClientMap &clients = m_clients.getClientList(); ScopeProfiler sp(g_profiler, "Server: update objects within range"); + m_player_gauge->set(clients.size()); for (const auto &client_it : clients) { RemoteClient *client = client_it.second; @@ -703,6 +732,8 @@ void Server::AsyncRunStep(bool initial_step) message_list->push_back(aom); } + m_aom_buffer_counter->increment(buffered_messages.size()); + m_clients.lock(); const RemoteClientMap &clients = m_clients.getClientList(); // Route data to every client @@ -943,7 +974,9 @@ void Server::Receive() } peer_id = pkt.getPeerId(); + m_packet_recv_counter->increment(); ProcessData(&pkt); + m_packet_recv_processed_counter->increment(); } catch (const con::InvalidIncomingDataException &e) { infostream << "Server::Receive(): InvalidIncomingDataException: what()=" << e.what() << std::endl; @@ -3127,7 +3160,7 @@ std::wstring Server::getStatusString() // Version os << L"version=" << narrow_to_wide(g_version_string); // Uptime - os << L", uptime=" << m_uptime.get(); + os << L", uptime=" << m_uptime_counter->get(); // Max lag estimate os << L", max_lag=" << (m_env ? m_env->getMaxLagEstimate() : 0); diff --git a/src/server.h b/src/server.h index b995aba28..71059dd30 100644 --- a/src/server.h +++ b/src/server.h @@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/numeric.h" #include "util/thread.h" #include "util/basic_macros.h" +#include "util/metricsbackend.h" #include "serverenvironment.h" #include "clientiface.h" #include "chatmessage.h" @@ -203,7 +204,7 @@ public: // Connection must be locked when called std::wstring getStatusString(); - inline double getUptime() const { return m_uptime.m_value; } + inline double getUptime() const { return m_uptime_counter->get(); } // read shutdown state inline bool isShutdownRequested() const { return m_shutdown_state.is_requested; } @@ -591,9 +592,6 @@ private: float m_step_dtime = 0.0f; std::mutex m_step_dtime_mutex; - // current server step lag counter - float m_lag; - // The server mainly operates in this thread ServerThread *m_thread = nullptr; @@ -602,8 +600,6 @@ private: */ // Timer for sending time of day over network float m_time_of_day_send_timer = 0.0f; - // Uptime of server in seconds - MutexedVariable m_uptime; /* Client interface @@ -677,6 +673,19 @@ private: // ModChannel manager std::unique_ptr m_modchannel_mgr; + + // Global server metrics backend + std::unique_ptr m_metrics_backend; + + // Server metrics + MetricCounterPtr m_uptime_counter; + MetricGaugePtr m_player_gauge; + MetricGaugePtr m_timeofday_gauge; + // current server step lag + MetricGaugePtr m_lag_gauge; + MetricCounterPtr m_aom_buffer_counter; + MetricCounterPtr m_packet_recv_counter; + MetricCounterPtr m_packet_recv_processed_counter; }; /* diff --git a/src/server/mods.cpp b/src/server/mods.cpp index c8d8a28e2..6ac530739 100644 --- a/src/server/mods.cpp +++ b/src/server/mods.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "scripting_server.h" #include "content/subgames.h" #include "porting.h" +#include "util/metricsbackend.h" /** * Manage server mods diff --git a/src/server/mods.h b/src/server/mods.h index 2bc1aa22f..54774bd86 100644 --- a/src/server/mods.h +++ b/src/server/mods.h @@ -20,7 +20,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "content/mods.h" +#include +class MetricsBackend; +class MetricCounter; class ServerScripting; /** diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 199d3aeaa..cd2e468d1 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -5,6 +5,7 @@ set(UTIL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/directiontables.cpp ${CMAKE_CURRENT_SOURCE_DIR}/enriched_string.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ieee_float.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/metricsbackend.cpp ${CMAKE_CURRENT_SOURCE_DIR}/numeric.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pointedthing.cpp ${CMAKE_CURRENT_SOURCE_DIR}/quicktune.cpp diff --git a/src/util/metricsbackend.cpp b/src/util/metricsbackend.cpp new file mode 100644 index 000000000..4454557a3 --- /dev/null +++ b/src/util/metricsbackend.cpp @@ -0,0 +1,140 @@ +/* +Minetest +Copyright (C) 2013-2020 Minetest core developers team + +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. +*/ + +#include "metricsbackend.h" +#if USE_PROMETHEUS +#include +#include +#include +#include +#include "log.h" +#include "settings.h" +#endif + +MetricCounterPtr MetricsBackend::addCounter( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str); +} + +MetricGaugePtr MetricsBackend::addGauge( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str); +} + +#if USE_PROMETHEUS + +class PrometheusMetricCounter : public MetricCounter +{ +public: + PrometheusMetricCounter() = delete; + + PrometheusMetricCounter(const std::string &name, const std::string &help_str, + std::shared_ptr registry) : + MetricCounter(), + m_family(prometheus::BuildCounter() + .Name(name) + .Help(help_str) + .Register(*registry)), + m_counter(m_family.Add({})) + { + } + + virtual ~PrometheusMetricCounter() {} + + virtual void increment(double number) { m_counter.Increment(number); } + virtual double get() const { return m_counter.Value(); } + +private: + prometheus::Family &m_family; + prometheus::Counter &m_counter; +}; + +class PrometheusMetricGauge : public MetricGauge +{ +public: + PrometheusMetricGauge() = delete; + + PrometheusMetricGauge(const std::string &name, const std::string &help_str, + std::shared_ptr registry) : + MetricGauge(), + m_family(prometheus::BuildGauge() + .Name(name) + .Help(help_str) + .Register(*registry)), + m_gauge(m_family.Add({})) + { + } + + virtual ~PrometheusMetricGauge() {} + + virtual void increment(double number) { m_gauge.Increment(number); } + virtual void decrement(double number) { m_gauge.Decrement(number); } + virtual void set(double number) { m_gauge.Set(number); } + virtual double get() const { return m_gauge.Value(); } + +private: + prometheus::Family &m_family; + prometheus::Gauge &m_gauge; +}; + +class PrometheusMetricsBackend : public MetricsBackend +{ +public: + PrometheusMetricsBackend(const std::string &addr) : + MetricsBackend(), m_exposer(std::unique_ptr( + new prometheus::Exposer(addr))), + m_registry(std::make_shared()) + { + m_exposer->RegisterCollectable(m_registry); + } + + virtual ~PrometheusMetricsBackend() {} + + virtual MetricCounterPtr addCounter( + const std::string &name, const std::string &help_str); + virtual MetricGaugePtr addGauge( + const std::string &name, const std::string &help_str); + +private: + std::unique_ptr m_exposer; + std::shared_ptr m_registry; +}; + +MetricCounterPtr PrometheusMetricsBackend::addCounter( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str, m_registry); +} + +MetricGaugePtr PrometheusMetricsBackend::addGauge( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str, m_registry); +} + +MetricsBackend *createPrometheusMetricsBackend() +{ + std::string addr; + g_settings->getNoEx("prometheus_listener_address", addr); + return new PrometheusMetricsBackend(addr); +} + +#endif diff --git a/src/util/metricsbackend.h b/src/util/metricsbackend.h new file mode 100644 index 000000000..c37306392 --- /dev/null +++ b/src/util/metricsbackend.h @@ -0,0 +1,140 @@ +/* +Minetest +Copyright (C) 2013-2020 Minetest core developers team + +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. +*/ + +#pragma once +#include +#include "config.h" +#include "util/thread.h" + +class MetricCounter +{ +public: + MetricCounter() = default; + + virtual ~MetricCounter() {} + + virtual void increment(double number = 1.0) = 0; + virtual double get() const = 0; +}; + +typedef std::shared_ptr MetricCounterPtr; + +class SimpleMetricCounter : public MetricCounter +{ +public: + SimpleMetricCounter() = delete; + + virtual ~SimpleMetricCounter() {} + + SimpleMetricCounter(const std::string &name, const std::string &help_str) : + MetricCounter(), m_name(name), m_help_str(help_str), + m_counter(0.0) + { + } + + virtual void increment(double number) + { + MutexAutoLock lock(m_mutex); + m_counter += number; + } + virtual double get() const + { + MutexAutoLock lock(m_mutex); + return m_counter; + } + +private: + std::string m_name; + std::string m_help_str; + + mutable std::mutex m_mutex; + double m_counter; +}; + +class MetricGauge +{ +public: + MetricGauge() = default; + virtual ~MetricGauge() {} + + virtual void increment(double number = 1.0) = 0; + virtual void decrement(double number = 1.0) = 0; + virtual void set(double number) = 0; + virtual double get() const = 0; +}; + +typedef std::shared_ptr MetricGaugePtr; + +class SimpleMetricGauge : public MetricGauge +{ +public: + SimpleMetricGauge() = delete; + + SimpleMetricGauge(const std::string &name, const std::string &help_str) : + MetricGauge(), m_name(name), m_help_str(help_str), m_gauge(0.0) + { + } + + virtual ~SimpleMetricGauge() {} + + virtual void increment(double number) + { + MutexAutoLock lock(m_mutex); + m_gauge += number; + } + virtual void decrement(double number) + { + MutexAutoLock lock(m_mutex); + m_gauge -= number; + } + virtual void set(double number) + { + MutexAutoLock lock(m_mutex); + m_gauge = number; + } + virtual double get() const + { + MutexAutoLock lock(m_mutex); + return m_gauge; + } + +private: + std::string m_name; + std::string m_help_str; + + mutable std::mutex m_mutex; + double m_gauge; +}; + +class MetricsBackend +{ +public: + MetricsBackend() = default; + + virtual ~MetricsBackend() {} + + virtual MetricCounterPtr addCounter( + const std::string &name, const std::string &help_str); + virtual MetricGaugePtr addGauge( + const std::string &name, const std::string &help_str); +}; + +#if USE_PROMETHEUS +MetricsBackend *createPrometheusMetricsBackend(); +#endif diff --git a/util/ci/build_prometheus_cpp.sh b/util/ci/build_prometheus_cpp.sh new file mode 100755 index 000000000..edfd574cd --- /dev/null +++ b/util/ci/build_prometheus_cpp.sh @@ -0,0 +1,13 @@ +#! /bin/bash -eu + +cd /tmp +git clone --recursive https://github.com/jupp0r/prometheus-cpp +mkdir prometheus-cpp/build +cd prometheus-cpp/build +cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_TESTING=0 +make -j2 +sudo make install + -- cgit v1.2.3 From 66c182531cf7ef06c98a25b4e12db770314bdc91 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 4 May 2020 08:45:31 +0200 Subject: Change default keys for cam/minimap to C/V (#9779) --- README.md | 6 +++--- builtin/settingtypes.txt | 4 ++-- src/defaultsettings.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'builtin') diff --git a/README.md b/README.md index 024e7b691..202ba4fe2 100644 --- a/README.md +++ b/README.md @@ -69,15 +69,15 @@ Some can be changed in the key config dialog in the settings tab. | J | Enable/disable fast mode (needs fast privilege) | | H | Enable/disable noclip mode (needs noclip privilege) | | E | Move fast in fast mode | +| C | Cycle through camera modes | +| V | Cycle through minimap modes | +| Shift + V | Change minimap orientation | | 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 | diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 165ed8c06..c983fb436 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -252,7 +252,7 @@ keymap_cinematic (Cinematic mode key) key # Key for toggling display of minimap. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_minimap (Minimap key) key KEY_F9 +keymap_minimap (Minimap key) key KEY_KEY_V # Key for taking screenshots. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 @@ -424,7 +424,7 @@ keymap_toggle_profiler (Profiler toggle key) key KEY_F6 # Key for switching between first- and third-person camera. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_camera_mode (Toggle camera mode key) key KEY_F7 +keymap_camera_mode (Toggle camera mode key) key KEY_KEY_C # Key for increasing the viewing range. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 06daa3b94..33654e213 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -80,7 +80,7 @@ void set_default_settings(Settings *settings) settings->setDefault("keymap_chat", "KEY_KEY_T"); settings->setDefault("keymap_cmd", "/"); settings->setDefault("keymap_cmd_local", "."); - settings->setDefault("keymap_minimap", "KEY_F9"); + settings->setDefault("keymap_minimap", "KEY_KEY_V"); settings->setDefault("keymap_console", "KEY_F10"); settings->setDefault("keymap_rangeselect", "KEY_KEY_R"); settings->setDefault("keymap_freemove", "KEY_KEY_K"); @@ -103,7 +103,7 @@ void set_default_settings(Settings *settings) #endif settings->setDefault("keymap_toggle_debug", "KEY_F5"); settings->setDefault("keymap_toggle_profiler", "KEY_F6"); - settings->setDefault("keymap_camera_mode", "KEY_F7"); + settings->setDefault("keymap_camera_mode", "KEY_KEY_C"); settings->setDefault("keymap_screenshot", "KEY_F12"); settings->setDefault("keymap_increase_viewing_range_min", "+"); settings->setDefault("keymap_decrease_viewing_range_min", "-"); -- cgit v1.2.3 From ab06880525eea98011341fbcaec31a0bd7517df5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 11 Apr 2020 23:38:54 +0200 Subject: Update num_emerge_threads description --- builtin/settingtypes.txt | 3 --- minetest.conf.example | 3 --- 2 files changed, 6 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index c983fb436..9e4473655 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -2120,9 +2120,6 @@ emergequeue_limit_diskonly (Limit of emerge queues on disk) int 64 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. diff --git a/minetest.conf.example b/minetest.conf.example index 1c1796a14..f04822c47 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -3261,9 +3261,6 @@ # emergequeue_limit_generate = 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. -- cgit v1.2.3 From 723926a995f8ee0428e4aaa95de37a46354f5249 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 27 Apr 2020 17:53:20 +0200 Subject: Rewrite falling entity to make use of collision info fixes #4781, fixes #9293 --- builtin/game/falling.lua | 194 +++++++++++++++++++++++++++++++---------------- 1 file changed, 128 insertions(+), 66 deletions(-) (limited to 'builtin') diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index ea02e3694..c340e769d 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -30,6 +30,8 @@ local facedir_to_euler = { {y = math.pi/2, x = math.pi, z = 0} } +local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81 + -- -- Falling stuff -- @@ -47,6 +49,7 @@ core.register_entity(":__builtin:falling_node", { node = {}, meta = {}, + floats = false, set_node = function(self, node, meta) self.node = node @@ -71,6 +74,11 @@ core.register_entity(":__builtin:falling_node", { return end self.meta = meta + + -- Cache whether we're supposed to float on water + self.floats = core.get_item_group(node.name, "float") ~= 0 + + -- Set entity visuals if def.drawtype == "torchlike" or def.drawtype == "signlike" then local textures if def.tiles and def.tiles[1] then @@ -113,6 +121,7 @@ core.register_entity(":__builtin:falling_node", { glow = def.light_source, }) end + -- Rotate entity if def.drawtype == "torchlike" then self.object:set_yaw(math.pi*0.25) @@ -172,6 +181,7 @@ core.register_entity(":__builtin:falling_node", { on_activate = function(self, staticdata) self.object:set_armor_groups({immortal = 1}) + self.object:set_acceleration({x = 0, y = -gravity, z = 0}) local ds = core.deserialize(staticdata) if ds and ds.node then @@ -183,85 +193,137 @@ core.register_entity(":__builtin:falling_node", { end end, - on_step = function(self, dtime) - -- Set gravity - local acceleration = self.object:get_acceleration() - if not vector.equals(acceleration, {x = 0, y = -10, z = 0}) then - self.object:set_acceleration({x = 0, y = -10, z = 0}) + try_place = function(self, bcp, bcn) + local bcd = core.registered_nodes[bcn.name] + -- Add levels if dropped on same leveled node + if bcd and bcd.leveled and + bcn.name == self.node.name then + local addlevel = self.node.level + if not addlevel or addlevel <= 0 then + addlevel = bcd.leveled + end + if core.add_node_level(bcp, addlevel) == 0 then + return true + end end - -- Turn to actual node when colliding with ground, or continue to move - 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 - local bcn = core.get_node_or_nil(bcp) - -- Delete on contact with ignore at world edges - if bcn and bcn.name == "ignore" then - self.object:remove() - return + + -- Decide if we're replacing the node or placing on top + local np = vector.new(bcp) + if bcd and bcd.buildable_to and + (not self.floats or bcd.liquidtype == "none") then + core.remove_node(bcp) + else + np.y = np.y + 1 end - local bcd = bcn and core.registered_nodes[bcn.name] - if bcn and - (not bcd or bcd.walkable or - (core.get_item_group(self.node.name, "float") ~= 0 and - bcd.liquidtype ~= "none")) then - if bcd and bcd.leveled and - bcn.name == self.node.name then - local addlevel = self.node.level - if not addlevel or addlevel <= 0 then - addlevel = bcd.leveled + + -- Check what's here + local n2 = core.get_node(np) + local nd = core.registered_nodes[n2.name] + -- If it's not air or liquid, remove node and replace it with + -- it's drops + if n2.name ~= "air" and (not nd or nd.liquidtype == "none") then + if nd and nd.buildable_to == false then + nd.on_dig(np, n2, nil) + -- If it's still there, it might be protected + if core.get_node(np).name == n2.name then + return false end - if core.add_node_level(bcp, addlevel) == 0 then + else + core.remove_node(np) + end + end + + -- Create node + local def = core.registered_nodes[self.node.name] + if def then + core.add_node(np, self.node) + if self.meta then + core.get_meta(np):from_table(self.meta) + end + if def.sounds and def.sounds.place then + core.sound_play(def.sounds.place, {pos = np}, true) + end + end + core.check_for_falling(np) + return true + end, + + on_step = function(self, dtime, moveresult) + -- Fallback code since collision detection can't tell us + -- about liquids (which do not collide) + if self.floats then + local pos = self.object:get_pos() + + local bcp = vector.round({x = pos.x, y = pos.y - 0.7, z = pos.z}) + local bcn = core.get_node(bcp) + + local bcd = core.registered_nodes[bcn.name] + if bcd and bcd.liquidtype ~= "none" then + if self:try_place(bcp, bcn) then self.object:remove() return end - elseif bcd and bcd.buildable_to and - (core.get_item_group(self.node.name, "float") == 0 or - bcd.liquidtype == "none") then - core.remove_node(bcp) - return end - local np = {x = bcp.x, y = bcp.y + 1, z = bcp.z} - -- Check what's here - local n2 = core.get_node(np) - local nd = core.registered_nodes[n2.name] - -- If it's not air or liquid, remove node and replace it with - -- it's drops - if n2.name ~= "air" and (not nd or nd.liquidtype == "none") then - core.remove_node(np) - if nd and nd.buildable_to == false then - -- Add dropped items - local drops = core.get_node_drops(n2, "") - for _, dropped_item in pairs(drops) do - core.add_item(np, dropped_item) - end - end - -- Run script hook - for _, callback in pairs(core.registered_on_dignodes) do - callback(np, n2) - end - end - -- Create node and remove entity - 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 then - core.sound_play(def.sounds.place, {pos = np}, true) + end + + assert(moveresult) + if not moveresult.collides then + return -- Nothing to do :) + end + + local bcp, bcn + if moveresult.touching_ground then + for _, info in ipairs(moveresult.collisions) do + if info.axis == "y" then + bcp = info.node_pos + bcn = core.get_node(bcp) + break end end + end + + if not bcp then + -- We're colliding with something, but not the ground. Irrelevant to us. + return + elseif bcn.name == "ignore" then + -- Delete on contact with ignore at world edges self.object:remove() - core.check_for_falling(np) return end - local vel = self.object:get_velocity() - if vector.equals(vel, {x = 0, y = 0, z = 0}) then - local npos = self.object:get_pos() - self.object:set_pos(vector.round(npos)) + + local failure = false + + local pos = self.object:get_pos() + local distance = vector.apply(vector.subtract(pos, bcp), math.abs) + if distance.x >= 1 or distance.z >= 1 then + -- We're colliding with some part of a node that's sticking out + -- Since we don't want to visually teleport, drop as item + failure = true + elseif distance.y >= 2 then + -- Doors consist of a hidden top node and a bottom node that is + -- the actual door. Despite the top node being solid, the moveresult + -- almost always indicates collision with the bottom node. + -- Compensate for this by checking the top node + bcp.y = bcp.y + 1 + bcn = core.get_node(bcp) + local def = core.registered_nodes[bcn.name] + if not (def and def.walkable) then + failure = true -- This is unexpected, fail + end + end + + -- Try to actually place ourselves + if not failure then + failure = not self:try_place(bcp, bcn) + end + + if failure then + local drops = core.get_node_drops(self.node, "") + for _, item in pairs(drops) do + core.add_item(pos, item) + end end + self.object:remove() end }) -- cgit v1.2.3 From e8e5d282da81a0c6bf37ece93dfa5f274aaaf041 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 1 May 2020 14:56:56 +0200 Subject: Enable collide_with_objects for falling entities falling nodes intentionally still fall through players fixes #5313 --- builtin/game/falling.lua | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index c340e769d..7037ae885 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -43,7 +43,7 @@ core.register_entity(":__builtin:falling_node", { textures = {}, physical = true, is_visible = false, - collide_with_objects = false, + collide_with_objects = true, collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, }, @@ -272,9 +272,14 @@ core.register_entity(":__builtin:falling_node", { end local bcp, bcn + local player_collision if moveresult.touching_ground then for _, info in ipairs(moveresult.collisions) do - if info.axis == "y" then + if info.type == "object" then + if info.axis == "y" and info.object:is_player() then + player_collision = info + end + elseif info.axis == "y" then bcp = info.node_pos bcn = core.get_node(bcp) break @@ -284,6 +289,20 @@ core.register_entity(":__builtin:falling_node", { if not bcp then -- We're colliding with something, but not the ground. Irrelevant to us. + if player_collision then + -- Continue falling through players by moving a little into + -- their collision box + -- TODO: this hack could be avoided in the future if objects + -- could choose who to collide with + local vel = self.object:get_velocity() + self.object:set_velocity({ + x = vel.x, + y = player_collision.old_velocity.y, + z = vel.z + }) + self.object:set_pos(vector.add(self.object:get_pos(), + {x = 0, y = -0.2, z = 0})) + end return elseif bcn.name == "ignore" then -- Delete on contact with ignore at world edges -- cgit v1.2.3 From 6e1372bd894d955300c40d69e5c882e9cc7d7523 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 11 May 2020 21:40:45 +0200 Subject: Add support for statbar “off state” icons (#9462) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds support for optional “off state” icons for statbars. “off state icons” can be used to denote the lack of something, like missing hearts or bubbles. Add "off state" textures to the builtin statbars. Co-authored-by: SmallJoker --- builtin/game/statbars.lua | 4 ++ doc/lua_api.txt | 16 ++++-- doc/texture_packs.txt | 4 ++ src/client/clientevent.h | 1 + src/client/game.cpp | 7 +++ src/client/hud.cpp | 96 ++++++++++++++++++++++++++++++------ src/client/hud.h | 5 +- src/hud.cpp | 1 + src/hud.h | 2 + src/network/clientpackethandler.cpp | 15 ++---- src/network/networkprotocol.h | 6 ++- src/script/common/c_content.cpp | 8 +++ src/server.cpp | 3 +- textures/base/pack/bubble_gone.png | Bin 0 -> 68 bytes textures/base/pack/heart_gone.png | Bin 0 -> 68 bytes 15 files changed, 132 insertions(+), 36 deletions(-) create mode 100644 textures/base/pack/bubble_gone.png create mode 100644 textures/base/pack/heart_gone.png (limited to 'builtin') diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua index 6b5b54428..d192029c5 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -5,7 +5,9 @@ local health_bar_definition = { hud_elem_type = "statbar", position = {x = 0.5, y = 1}, text = "heart.png", + text2 = "heart_gone.png", number = core.PLAYER_MAX_HP_DEFAULT, + item = core.PLAYER_MAX_HP_DEFAULT, direction = 0, size = {x = 24, y = 24}, offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)}, @@ -15,7 +17,9 @@ local breath_bar_definition = { hud_elem_type = "statbar", position = {x = 0.5, y = 1}, text = "bubble.png", + text2 = "bubble_gone.png", number = core.PLAYER_MAX_BREATH_DEFAULT, + item = core.PLAYER_MAX_BREATH_DEFAULT * 2, direction = 0, size = {x = 24, y = 24}, offset = {x = 25, y= -(48 + 24 + 16)}, diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 961e1ff37..4078e21a1 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1289,9 +1289,9 @@ 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 -is drawn. +HUD element represents. +The `direction` field is the direction in which something 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. @@ -1355,12 +1355,16 @@ Displays text on the HUD. ### `statbar` -Displays a horizontal bar made up of half-images. +Displays a horizontal bar made up of half-images with an optional background. -* `text`: The name of the texture that is used. +* `text`: The name of the texture to use. +* `text2`: Optional texture name to enable a background / "off state" + texture (useful to visualize the maximal value). Both textures + must have the same size. * `number`: The number of half-textures that are displayed. If odd, will end with a vertically center-split texture. -* `direction` +* `item`: Same as `number` but for the "off state" texture +* `direction`: To which direction the images will extend to * `offset`: offset in pixels from position. * `size`: If used, will force full-image size to this value (override texture pack image size) @@ -7772,6 +7776,8 @@ Used by `Player:hud_add`. Returned by `Player:hud_get`. text = "", + text2 = "", + number = 2, item = 3, diff --git a/doc/texture_packs.txt b/doc/texture_packs.txt index 4e7bc93c4..94151f1a4 100644 --- a/doc/texture_packs.txt +++ b/doc/texture_packs.txt @@ -64,6 +64,8 @@ by texture packs. All existing fallback textures can be found in the directory * `bubble.png`: the bubble texture when the player is drowning (default size: 12×12) +* `bubble_gone.png`: like `bubble.png`, but denotes lack of breath + (transparent by default, same size as bubble.png) * `crack_anylength.png`: node overlay texture when digging @@ -76,6 +78,8 @@ by texture packs. All existing fallback textures can be found in the directory * `heart.png`: used to display the health points of the player (default size: 12×12) +* `heart_gone.png`: like `heart.png`, but denotes lack of health points + (transparent by default, same size as heart.png) * `minimap_mask_round.png`: round minimap mask, white gets replaced by the map * `minimap_mask_square.png`: mask used for the square minimap diff --git a/src/client/clientevent.h b/src/client/clientevent.h index f5689c25b..7f3984b03 100644 --- a/src/client/clientevent.h +++ b/src/client/clientevent.h @@ -136,6 +136,7 @@ struct ClientEvent v3f *world_pos; v2s32 *size; s16 z_index; + std::string *text2; } hudadd; struct { diff --git a/src/client/game.cpp b/src/client/game.cpp index 4d7a85526..422e17d4f 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -2672,6 +2672,7 @@ void Game::handleClientEvent_HudAdd(ClientEvent *event, CameraOrientation *cam) delete event->hudadd.offset; delete event->hudadd.world_pos; delete event->hudadd.size; + delete event->hudadd.text2; return; } @@ -2689,6 +2690,7 @@ void Game::handleClientEvent_HudAdd(ClientEvent *event, CameraOrientation *cam) e->world_pos = *event->hudadd.world_pos; e->size = *event->hudadd.size; e->z_index = event->hudadd.z_index; + e->text2 = *event->hudadd.text2; hud_server_to_client[server_id] = player->addHud(e); delete event->hudadd.pos; @@ -2699,6 +2701,7 @@ void Game::handleClientEvent_HudAdd(ClientEvent *event, CameraOrientation *cam) delete event->hudadd.offset; delete event->hudadd.world_pos; delete event->hudadd.size; + delete event->hudadd.text2; } void Game::handleClientEvent_HudRemove(ClientEvent *event, CameraOrientation *cam) @@ -2771,6 +2774,10 @@ void Game::handleClientEvent_HudChange(ClientEvent *event, CameraOrientation *ca case HUD_STAT_Z_INDEX: e->z_index = event->hudchange.data; break; + + case HUD_STAT_TEXT2: + e->text2 = *event->hudchange.sdata; + break; } delete event->hudchange.v3fdata; diff --git a/src/client/hud.cpp b/src/client/hud.cpp index 56763e7e4..f8f712762 100644 --- a/src/client/hud.cpp +++ b/src/client/hud.cpp @@ -332,7 +332,8 @@ void Hud::drawLuaElements(const v3s16 &camera_offset) break; } case HUD_ELEM_STATBAR: { v2s32 offs(e->offset.X, e->offset.Y); - drawStatbar(pos, HUD_CORNER_UPPER, e->dir, e->text, e->number, offs, e->size); + drawStatbar(pos, HUD_CORNER_UPPER, e->dir, e->text, e->text2, + e->number, e->item, offs, e->size); break; } case HUD_ELEM_INVENTORY: { InventoryList *inv = inventory->getList(e->text); @@ -401,8 +402,9 @@ void Hud::drawLuaElements(const v3s16 &camera_offset) } -void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, const std::string &texture, - s32 count, v2s32 offset, v2s32 size) +void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, + const std::string &texture, const std::string &bgtexture, + s32 count, s32 maxcount, v2s32 offset, v2s32 size) { const video::SColor color(255, 255, 255, 255); const video::SColor colors[] = {color, color, color, color}; @@ -411,6 +413,11 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, const std::string &tex if (!stat_texture) return; + video::ITexture *stat_texture_bg = nullptr; + if (!bgtexture.empty()) { + stat_texture_bg = tsrc->getTexture(bgtexture); + } + core::dimension2di srcd(stat_texture->getOriginalSize()); core::dimension2di dstd; if (size == v2s32()) { @@ -430,43 +437,100 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, const std::string &tex p += offset; v2s32 steppos; - core::rect srchalfrect, dsthalfrect; switch (drawdir) { case HUD_DIR_RIGHT_LEFT: steppos = v2s32(-1, 0); - srchalfrect = core::rect(srcd.Width / 2, 0, srcd.Width, srcd.Height); - dsthalfrect = core::rect(dstd.Width / 2, 0, dstd.Width, dstd.Height); break; case HUD_DIR_TOP_BOTTOM: steppos = v2s32(0, 1); - srchalfrect = core::rect(0, 0, srcd.Width, srcd.Height / 2); - dsthalfrect = core::rect(0, 0, dstd.Width, dstd.Height / 2); break; case HUD_DIR_BOTTOM_TOP: steppos = v2s32(0, -1); - srchalfrect = core::rect(0, srcd.Height / 2, srcd.Width, srcd.Height); - dsthalfrect = core::rect(0, dstd.Height / 2, dstd.Width, dstd.Height); break; default: + // From left to right steppos = v2s32(1, 0); - srchalfrect = core::rect(0, 0, srcd.Width / 2, srcd.Height); - dsthalfrect = core::rect(0, 0, dstd.Width / 2, dstd.Height); + break; + } + + auto calculate_clipping_rect = [] (core::dimension2di src, + v2s32 steppos) -> core::rect { + + // Create basic rectangle + core::rect rect(0, 0, + src.Width - std::abs(steppos.X) * src.Width / 2, + src.Height - std::abs(steppos.Y) * src.Height / 2 + ); + // Move rectangle left or down + if (steppos.X == -1) + rect += v2s32(src.Width / 2, 0); + if (steppos.Y == -1) + rect += v2s32(0, src.Height / 2); + return rect; + }; + // Rectangles for 1/2 the actual value to display + core::rect srchalfrect, dsthalfrect; + // Rectangles for 1/2 the "off state" texture + core::rect srchalfrect2, dsthalfrect2; + + if (count % 2 == 1) { + // Need to draw halves: Calculate rectangles + srchalfrect = calculate_clipping_rect(srcd, steppos); + dsthalfrect = calculate_clipping_rect(dstd, steppos); + srchalfrect2 = calculate_clipping_rect(srcd, steppos * -1); + dsthalfrect2 = calculate_clipping_rect(dstd, steppos * -1); } + steppos.X *= dstd.Width; steppos.Y *= dstd.Height; + // Draw full textures for (s32 i = 0; i < count / 2; i++) { core::rect srcrect(0, 0, srcd.Width, srcd.Height); - core::rect dstrect(0,0, dstd.Width, dstd.Height); + core::rect dstrect(0, 0, dstd.Width, dstd.Height); dstrect += p; - draw2DImageFilterScaled(driver, stat_texture, dstrect, srcrect, NULL, colors, true); + draw2DImageFilterScaled(driver, stat_texture, + dstrect, srcrect, NULL, colors, true); p += steppos; } if (count % 2 == 1) { - dsthalfrect += p; - draw2DImageFilterScaled(driver, stat_texture, dsthalfrect, srchalfrect, NULL, colors, true); + // Draw half a texture + draw2DImageFilterScaled(driver, stat_texture, + dsthalfrect + p, srchalfrect, NULL, colors, true); + + if (stat_texture_bg && maxcount > count) { + draw2DImageFilterScaled(driver, stat_texture_bg, + dsthalfrect2 + p, srchalfrect2, + NULL, colors, true); + p += steppos; + } + } + + if (stat_texture_bg && maxcount > count / 2) { + // Draw "off state" textures + s32 start_offset; + if (count % 2 == 1) + start_offset = count / 2 + 1; + else + start_offset = count / 2; + for (s32 i = start_offset; i < maxcount / 2; i++) { + core::rect srcrect(0, 0, srcd.Width, srcd.Height); + core::rect dstrect(0, 0, dstd.Width, dstd.Height); + + dstrect += p; + draw2DImageFilterScaled(driver, stat_texture_bg, + dstrect, srcrect, + NULL, colors, true); + p += steppos; + } + + if (maxcount % 2 == 1) { + draw2DImageFilterScaled(driver, stat_texture_bg, + dsthalfrect + p, srchalfrect, + NULL, colors, true); + } } } diff --git a/src/client/hud.h b/src/client/hud.h index cab115990..6274b1a83 100644 --- a/src/client/hud.h +++ b/src/client/hud.h @@ -82,8 +82,9 @@ public: private: bool calculateScreenPos(const v3s16 &camera_offset, HudElement *e, v2s32 *pos); - void drawStatbar(v2s32 pos, u16 corner, u16 drawdir, const std::string &texture, - s32 count, v2s32 offset, v2s32 size = v2s32()); + void drawStatbar(v2s32 pos, u16 corner, u16 drawdir, + const std::string &texture, const std::string& bgtexture, + s32 count, s32 maxcount, v2s32 offset, v2s32 size = v2s32()); void drawItems(v2s32 upperleftpos, v2s32 screen_offset, s32 itemcount, s32 inv_offset, InventoryList *mainlist, u16 selectitem, diff --git a/src/hud.cpp b/src/hud.cpp index 39625b5fd..3079b5cd8 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -46,6 +46,7 @@ const struct EnumString es_HudElementStat[] = {HUD_STAT_WORLD_POS, "world_pos"}, {HUD_STAT_SIZE, "size"}, {HUD_STAT_Z_INDEX, "z_index"}, + {HUD_STAT_TEXT2, "text2"}, {0, NULL}, }; diff --git a/src/hud.h b/src/hud.h index b0977c6a4..bab420ed2 100644 --- a/src/hud.h +++ b/src/hud.h @@ -77,6 +77,7 @@ enum HudElementStat { HUD_STAT_WORLD_POS, HUD_STAT_SIZE, HUD_STAT_Z_INDEX, + HUD_STAT_TEXT2, }; struct HudElement { @@ -93,6 +94,7 @@ struct HudElement { v3f world_pos; v2s32 size; s16 z_index = 0; + std::string text2; }; extern const EnumString es_HudElementType[]; diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 8d0225a3d..7b1b1368c 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1102,22 +1102,16 @@ void Client::handleCommand_HudAdd(NetworkPacket* pkt) v3f world_pos; v2s32 size; s16 z_index = 0; + std::string text2; *pkt >> server_id >> type >> pos >> name >> scale >> text >> number >> item >> dir >> align >> offset; try { *pkt >> world_pos; - } - catch(SerializationError &e) {}; - - try { *pkt >> size; - } catch(SerializationError &e) {}; - - try { *pkt >> z_index; - } - catch(PacketError &e) {} + *pkt >> text2; + } catch(PacketError &e) {}; ClientEvent *event = new ClientEvent(); event->type = CE_HUDADD; @@ -1135,6 +1129,7 @@ void Client::handleCommand_HudAdd(NetworkPacket* pkt) event->hudadd.world_pos = new v3f(world_pos); event->hudadd.size = new v2s32(size); event->hudadd.z_index = z_index; + event->hudadd.text2 = new std::string(text2); m_client_event_queue.push(event); } @@ -1171,7 +1166,7 @@ void Client::handleCommand_HudChange(NetworkPacket* pkt) if (stat == HUD_STAT_POS || stat == HUD_STAT_SCALE || stat == HUD_STAT_ALIGN || stat == HUD_STAT_OFFSET) *pkt >> v2fdata; - else if (stat == HUD_STAT_NAME || stat == HUD_STAT_TEXT) + else if (stat == HUD_STAT_NAME || stat == HUD_STAT_TEXT || stat == HUD_STAT_TEXT2) *pkt >> sdata; else if (stat == HUD_STAT_WORLD_POS) *pkt >> v3fdata; diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index 527ebba7c..ab924f1db 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -560,10 +560,10 @@ enum ToClientCommand u32 id u8 type v2f1000 pos - u32 len + u16 len u8[len] name v2f1000 scale - u32 len2 + u16 len2 u8[len2] text u32 number u32 item @@ -573,6 +573,8 @@ enum ToClientCommand v3f1000 world_pos v2s32 size s16 z_index + u16 len3 + u8[len3] text2 */ TOCLIENT_HUDRM = 0x4a, diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index dac828316..540b7222f 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -1871,6 +1871,7 @@ void read_hud_element(lua_State *L, HudElement *elem) elem->dir = getintfield_default(L, 2, "direction", 0); elem->z_index = MYMAX(S16_MIN, MYMIN(S16_MAX, getintfield_default(L, 2, "z_index", 0))); + elem->text2 = getstringfield_default(L, 2, "text2", ""); // Deprecated, only for compatibility's sake if (elem->dir == 0) @@ -1939,6 +1940,9 @@ void push_hud_element(lua_State *L, HudElement *elem) lua_pushnumber(L, elem->z_index); lua_setfield(L, -2, "z_index"); + + lua_pushstring(L, elem->text2.c_str()); + lua_setfield(L, -2, "text2"); } HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) @@ -2000,6 +2004,10 @@ HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) elem->z_index = MYMAX(S16_MIN, MYMIN(S16_MAX, luaL_checknumber(L, 4))); *value = &elem->z_index; break; + case HUD_STAT_TEXT2: + elem->text2 = luaL_checkstring(L, 4); + *value = &elem->text2; + break; } return stat; } diff --git a/src/server.cpp b/src/server.cpp index 16e026ce2..b28c30e1e 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1621,7 +1621,7 @@ void Server::SendHUDAdd(session_t peer_id, u32 id, HudElement *form) pkt << id << (u8) form->type << form->pos << form->name << form->scale << form->text << form->number << form->item << form->dir << form->align << form->offset << form->world_pos << form->size - << form->z_index; + << form->z_index << form->text2; Send(&pkt); } @@ -1647,6 +1647,7 @@ void Server::SendHUDChange(session_t peer_id, u32 id, HudElementStat stat, void break; case HUD_STAT_NAME: case HUD_STAT_TEXT: + case HUD_STAT_TEXT2: pkt << *(std::string *) value; break; case HUD_STAT_WORLD_POS: diff --git a/textures/base/pack/bubble_gone.png b/textures/base/pack/bubble_gone.png new file mode 100644 index 000000000..240ca4f8d Binary files /dev/null and b/textures/base/pack/bubble_gone.png differ diff --git a/textures/base/pack/heart_gone.png b/textures/base/pack/heart_gone.png new file mode 100644 index 000000000..240ca4f8d Binary files /dev/null and b/textures/base/pack/heart_gone.png differ -- cgit v1.2.3 From 7ec76e530db9c3ed093e6edeca156e9311a6378a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 12 May 2020 03:52:52 +0200 Subject: Add mapgen settings to world creation dialog (#9254) --- builtin/mainmenu/dlg_create_world.lua | 328 +++++++++++++++++++++++++++++++--- doc/lua_api.txt | 4 + 2 files changed, 310 insertions(+), 22 deletions(-) (limited to 'builtin') diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index f28ae6960..0d977a17c 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -17,13 +17,110 @@ local worldname = "" +local function table_to_flags(ftable) + -- Convert e.g. { jungles = true, caves = false } to "jungles,nocaves" + local str = {} + for flag, is_set in pairs(ftable) do + str[#str + 1] = is_set and flag or ("no" .. flag) + end + return table.concat(str, ",") +end + +-- Same as check_flag but returns a string +local function strflag(flags, flag) + return (flags[flag] == true) and "true" or "false" +end + +local cb_caverns = { "caverns", fgettext("Caverns"), "caverns", + fgettext("Very large caverns deep in the underground") } +local tt_sea_rivers = fgettext("Sea level rivers") + +local flag_checkboxes = { + v5 = { + cb_caverns, + }, + v7 = { + cb_caverns, + { "ridges", fgettext("Rivers"), "ridges", tt_sea_rivers }, + { "mountains", fgettext("Mountains"), "mountains" }, + { "floatlands", fgettext("Floatlands (experimental)"), "floatlands", + fgettext("Floating landmasses in the sky") }, + }, + carpathian = { + cb_caverns, + { "rivers", fgettext("Rivers"), "rivers", tt_sea_rivers }, + }, + valleys = { + { "altitude-chill", fgettext("Altitude chill"), "altitude_chill", + fgettext("Reduces heat with altitude") }, + { "altitude-dry", fgettext("Altitude dry"), "altitude_dry", + fgettext("Reduces humidity with altitude") }, + { "humid-rivers", fgettext("Humid rivers"), "humid_rivers", + fgettext("Increases humidity around rivers") }, + { "vary-river-depth", fgettext("Vary river depth"), "vary_river_depth", + fgettext("Low humidity and high heat causes shallow or dry rivers") }, + }, + flat = { + { "hills", fgettext("Hills"), "hills" }, + { "lakes", fgettext("Lakes"), "lakes" }, + }, + fractal = { + { "terrain", fgettext("Additional terrain"), "terrain", + fgettext("Generate non-fractal terrain: Oceans and underground") }, + }, + v6 = { + { "trees", fgettext("Trees and jungle grass"), "trees" }, + { "flat", fgettext("Flat terrain"), "flat" }, + { "mudflow", fgettext("Mud flow"), "mudflow", + fgettext("Terrain surface erosion") }, + -- Biome settings are in mgv6_biomes below + }, +} + +local mgv6_biomes = { + { + fgettext("Temperate, Desert, Jungle, Tundra, Taiga"), + {jungles = true, snowbiomes = true} + }, + { + fgettext("Temperate, Desert, Jungle"), + {jungles = true, snowbiomes = false} + }, + { + fgettext("Temperate, Desert"), + {jungles = false, snowbiomes = false} + }, +} + local function create_world_formspec(dialogdata) + + -- Error out when no games found + if #pkgmgr.games == 0 then + return "size[12.25,3,true]" .. + "box[0,0;12,2;#ff8800]" .. + "textarea[0.3,0;11.7,2;;;".. + fgettext("You have no games installed.") .. "\n" .. + fgettext("Download one from minetest.net") .. "]" .. + "button[4.75,2.5;3,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]" + end + local mapgens = core.get_mapgen_names() local current_seed = core.settings:get("fixed_map_seed") or "" local current_mg = core.settings:get("mg_name") local gameid = core.settings:get("menu_last_game") + local flags = { + main = core.settings:get_flags("mg_flags"), + v5 = core.settings:get_flags("mgv5_spflags"), + v6 = core.settings:get_flags("mgv6_spflags"), + v7 = core.settings:get_flags("mgv7_spflags"), + fractal = core.settings:get_flags("mgfractal_spflags"), + carpathian = core.settings:get_flags("mgcarpathian_spflags"), + valleys = core.settings:get_flags("mgvalleys_spflags"), + flat = core.settings:get_flags("mgflat_spflags"), + } + local gameidx = 0 if gameid ~= nil then local _ @@ -35,6 +132,7 @@ local function create_world_formspec(dialogdata) end local game_by_gameidx = core.get_game(gameidx) + local disallowed_mapgen_settings = {} if game_by_gameidx ~= nil then local gamepath = game_by_gameidx.path local gameconfig = Settings(gamepath.."/game.conf") @@ -64,49 +162,193 @@ local function create_world_formspec(dialogdata) end end end + + local ds = (gameconfig:get("disallowed_mapgen_settings") or ""):split() + for _, value in pairs(ds) do + disallowed_mapgen_settings[value:trim()] = true + end end local mglist = "" - local selindex = 1 + local selindex local i = 1 + local first_mg for k,v in pairs(mapgens) do + if not first_mg then + first_mg = v + end if current_mg == v then selindex = i end i = i + 1 mglist = mglist .. v .. "," end + if not selindex then + selindex = 1 + current_mg = first_mg + end mglist = mglist:sub(1, -2) - current_seed = core.formspec_escape(current_seed) - local retval = - "size[11.5,6.5,true]" .. - "label[2,0;" .. fgettext("World name") .. "]".. - "field[4.5,0.4;6,0.5;te_world_name;;" .. minetest.formspec_escape(worldname) .. "]" .. + local mg_main_flags = function(mapgen, y) + if mapgen == "singlenode" then + return "", y + end + if disallowed_mapgen_settings["mg_flags"] then + return "", y + end - "label[2,1;" .. fgettext("Seed") .. "]".. - "field[4.5,1.4;6,0.5;te_seed;;".. current_seed .. "]" .. + local form = "checkbox[0," .. y .. ";flag_mg_caves;" .. + fgettext("Caves") .. ";"..strflag(flags.main, "caves").."]" + y = y + 0.5 - "label[2,2;" .. fgettext("Mapgen") .. "]".. - "dropdown[4.2,2;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" .. + form = form .. "checkbox[0,"..y..";flag_mg_dungeons;" .. + fgettext("Dungeons") .. ";"..strflag(flags.main, "dungeons").."]" + y = y + 0.5 - "label[2,3;" .. fgettext("Game") .. "]".. - "textlist[4.2,3;5.8,2.3;games;" .. pkgmgr.gamelist() .. - ";" .. gameidx .. ";true]" .. + local d_name = fgettext("Decorations") + local d_tt + if mapgen == "v6" then + d_tt = fgettext("Structures appearing on the terrain (no effect on trees and jungle grass created by v6)") + else + d_tt = fgettext("Structures appearing on the terrain, typically trees and plants") + end + form = form .. "checkbox[0,"..y..";flag_mg_decorations;" .. + d_name .. ";" .. + strflag(flags.main, "decorations").."]" .. + "tooltip[flag_mg_decorations;" .. + d_tt .. + "]" + y = y + 0.5 + + form = form .. "tooltip[flag_mg_caves;" .. + fgettext("Network of tunnels and caves") + .. "]" + return form, y + end - "button[3.25,6;2.5,0.5;world_create_confirm;" .. fgettext("Create") .. "]" .. - "button[5.75,6;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]" + local mg_specific_flags = function(mapgen, y) + if not flag_checkboxes[mapgen] then + return "", y + end + if disallowed_mapgen_settings["mg"..mapgen.."_spflags"] then + return "", y + end + local form = "" + for _,tab in pairs(flag_checkboxes[mapgen]) do + local id = "flag_mg"..mapgen.."_"..tab[1] + form = form .. ("checkbox[0,%f;%s;%s;%s]"): + format(y, id, tab[2], strflag(flags[mapgen], tab[3])) + + if tab[4] then + form = form .. "tooltip["..id..";"..tab[4].."]" + end + y = y + 0.5 + end - if #pkgmgr.games == 0 then - retval = retval .. "box[2,4;8,1;#ff8800]label[2.25,4;" .. - fgettext("You have no games installed.") .. "]label[2.25,4.4;" .. - fgettext("Download one from minetest.net") .. "]" - elseif #pkgmgr.games == 1 and pkgmgr.games[1].id == "minimal" then - retval = retval .. "box[1.75,4;8.7,1;#ff8800]label[2,4;" .. - fgettext("Warning: The minimal development test is meant for developers.") .. "]label[2,4.4;" .. + if mapgen ~= "v6" then + -- No special treatment + return form, y + end + -- Special treatment for v6 (add biome widgets) + + -- Biome type (jungles, snowbiomes) + local biometype + if flags.v6.snowbiomes == true then + biometype = 1 + elseif flags.v6.jungles == true then + biometype = 2 + else + biometype = 3 + end + y = y + 0.3 + + form = form .. "label[0,"..(y+0.1)..";" .. fgettext("Biomes") .. "]" + y = y + 0.6 + + form = form .. "dropdown[0,"..y..";6.3;mgv6_biomes;" + for b=1, #mgv6_biomes do + form = form .. mgv6_biomes[b][1] + if b < #mgv6_biomes then + form = form .. "," + end + end + form = form .. ";" .. biometype.. "]" + + -- biomeblend + y = y + 0.55 + form = form .. "checkbox[0,"..y..";flag_mgv6_biomeblend;" .. + fgettext("Biome blending") .. ";"..strflag(flags.v6, "biomeblend").."]" .. + "tooltip[flag_mgv6_biomeblend;" .. + fgettext("Smooth transition between biomes") .. "]" + + return form, y + end + + current_seed = core.formspec_escape(current_seed) + + local y_start = 0.0 + local y = y_start + local str_flags, str_spflags + local label_flags, label_spflags = "", "" + y = y + 0.3 + str_flags, y = mg_main_flags(current_mg, y) + if str_flags ~= "" then + label_flags = "label[0,"..y_start..";" .. fgettext("Mapgen flags") .. "]" + y_start = y + 0.4 + else + y_start = 0.0 + end + y = y_start + 0.3 + str_spflags = mg_specific_flags(current_mg, y) + if str_spflags ~= "" then + label_spflags = "label[0,"..y_start..";" .. fgettext("Mapgen-specific flags") .. "]" + end + + -- Warning if only minimal is installed + local minimal_only = "" + local gamelist_height = 2.3 + if #pkgmgr.games == 1 and pkgmgr.games[1].id == "minimal" then + minimal_only = "box[0,0;5.8,1.7;#ff8800]" .. + "textarea[0.3,0;6,1.8;;;".. + fgettext("Warning: The minimal development test is meant for developers.") .. "\n" .. fgettext("Download a game, such as Minetest Game, from minetest.net") .. "]" + gamelist_height = 0.5 end + local retval = + "size[12.25,7,true]" .. + + -- Left side + "container[0,0]".. + "field[0.3,0.6;6,0.5;te_world_name;" .. + fgettext("World name") .. + ";" .. core.formspec_escape(worldname) .. "]" .. + + "field[0.3,1.7;6,0.5;te_seed;" .. + fgettext("Seed") .. + ";".. current_seed .. "]" .. + + "label[0,2;" .. fgettext("Mapgen") .. "]".. + "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" .. + + "label[0,3.35;" .. fgettext("Game") .. "]".. + "textlist[0,3.85;5.8,"..gamelist_height..";games;" .. + pkgmgr.gamelist() .. ";" .. gameidx .. ";false]" .. + "container[0,4.5]" .. + minimal_only .. + "container_end[]" .. + "container_end[]" .. + + -- Right side + "container[6.2,0]".. + label_flags .. str_flags .. + label_spflags .. str_spflags .. + "container_end[]".. + + -- Menu buttons + "button[3.25,6.5;3,0.5;world_create_confirm;" .. fgettext("Create") .. "]" .. + "button[6.25,6.5;3,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]" + return retval end @@ -163,11 +405,53 @@ local function create_world_buttonhandler(this, fields) return true end + for k,v in pairs(fields) do + local split = string.split(k, "_", nil, 3) + if split and split[1] == "flag" then + local setting + if split[2] == "mg" then + setting = "mg_flags" + else + setting = split[2].."_spflags" + end + -- We replaced the underscore of flag names with a dash. + local flag = string.gsub(split[3], "-", "_") + local ftable = core.settings:get_flags(setting) + if v == "true" then + ftable[flag] = true + else + ftable[flag] = false + end + local flags = table_to_flags(ftable) + core.settings:set(setting, flags) + return true + end + end + if fields["world_create_cancel"] then this:delete() return true end + if fields["mgv6_biomes"] then + local entry = minetest.formspec_escape(fields["mgv6_biomes"]) + for b=1, #mgv6_biomes do + if entry == mgv6_biomes[b][1] then + local ftable = core.settings:get_flags("mgv6_spflags") + ftable.jungles = mgv6_biomes[b][2].jungles + ftable.snowbiomes = mgv6_biomes[b][2].snowbiomes + local flags = table_to_flags(ftable) + core.settings:set("mgv6_spflags", flags) + return true + end + end + end + + if fields["dd_mapgen"] then + core.settings:set("mg_name", fields["dd_mapgen"]) + return true + end + return false end diff --git a/doc/lua_api.txt b/doc/lua_api.txt index db13f4224..9685e8307 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -75,6 +75,10 @@ The game directory can contain the following files: When both `allowed_mapgens` and `disallowed_mapgens` are specified, `allowed_mapgens` is applied before `disallowed_mapgens`. + * `disallowed_mapgen_settings= ` + e.g. `disallowed_mapgen_settings = mgv5_spflags` + These settings are hidden for this game in the world creation + dialog and game start menu. * `minetest.conf`: Used to set default settings when running this game. * `settingtypes.txt`: -- cgit v1.2.3 From 4e997e9d047068bfccd30fb700e2b3b9f48fda4c Mon Sep 17 00:00:00 2001 From: Zughy <63455151+Zughy@users.noreply.github.com> Date: Wed, 13 May 2020 11:56:26 +0000 Subject: Document inf value in rollback commands (#9789) --- builtin/game/chat.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index a71f4b329..c8fa4175d 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -777,7 +777,7 @@ core.register_chatcommand("rollback_check", { 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", + .. " seconds = 86400 = 24h, limit = 5. Set to inf for no time limit", privs = {rollback=true}, func = function(name, param) if not core.settings:get_bool("enable_rollback_recording") then @@ -828,7 +828,7 @@ core.register_chatcommand("rollback_check", { core.register_chatcommand("rollback", { params = "( []) | (: [])", - description = "Revert actions of a player. Default for is 60", + description = "Revert actions of a player. Default for is 60. Set to inf for no time limit", privs = {rollback=true}, func = function(name, param) if not core.settings:get_bool("enable_rollback_recording") then -- cgit v1.2.3 From 6c607e20828f97f950038dfb86891a74afb6f755 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Wed, 13 May 2020 07:57:05 -0400 Subject: Allow placing auto-rotating nodes on other nodes in on_rightclick (#9859) --- builtin/common/misc_helpers.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index 715f89bc4..1a0c71efd 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -290,7 +290,8 @@ if INIT == "game" then return end local undef = core.registered_nodes[unode.name] - if undef and undef.on_rightclick then + local sneaking = placer and placer:get_player_control().sneak + if undef and undef.on_rightclick and not sneaking then return undef.on_rightclick(pointed_thing.under, unode, placer, itemstack, pointed_thing) end -- cgit v1.2.3 From 2d7e000cfe578340a126d7101ac98c0de29b66b6 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 14 May 2020 16:54:17 +0100 Subject: Item Entity: Add message to moveresult assertion (#9797) --- builtin/game/item_entity.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index a85eba977..5d2cd7c76 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -200,7 +200,9 @@ core.register_entity(":__builtin:item", { return -- Don't do anything end - assert(moveresult) + assert(moveresult, + "Collision info missing, this is caused by an out-of-date/buggy mod or game") + if not moveresult.collides then -- future TODO: items should probably decelerate in air return -- cgit v1.2.3 From 836dd4a1e4f97411519578cd9e59b6dbe3b2c00d Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Thu, 14 May 2020 19:26:15 +0200 Subject: Add chat_log_level setting (#9223) Log all higher levels in LogOutputBuffer Move StreamLogOutput::logRaw to source file like LogOutputBuffer::logRaw for compiling speed --- builtin/settingtypes.txt | 3 ++ src/client/game.cpp | 16 ++++------- src/defaultsettings.cpp | 1 + src/log.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ src/log.h | 52 ++++++++-------------------------- 5 files changed, 95 insertions(+), 51 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 9e4473655..b75bf2de5 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1401,6 +1401,9 @@ debug_log_level (Debug log level) enum action ,none,error,warning,action,info,ve # debug.txt is only moved if this setting is positive. debug_log_size_max (Debug log file size threshold) int 50 +# Minimal level of logging to be written to chat. +chat_log_level (Chat log level) enum error ,none,error,warning,action,info,verbose + # Enable IPv6 support (for both client and server). # Required for IPv6 connections to work at all. enable_ipv6 (IPv6) bool true diff --git a/src/client/game.cpp b/src/client/game.cpp index 422e17d4f..e7663a113 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -855,6 +855,7 @@ private: SoundMaker *soundmaker = nullptr; ChatBackend *chat_backend = nullptr; + LogOutputBuffer m_chat_log_buf; EventManager *eventmgr = nullptr; QuicktuneShortcutter *quicktune = nullptr; @@ -926,6 +927,7 @@ private: }; Game::Game() : + m_chat_log_buf(g_logger), m_game_ui(new GameUI()) { g_settings->registerChangedCallback("doubletap_jump", @@ -1192,6 +1194,7 @@ void Game::shutdown() chat_backend->addMessage(L"", L"# Disconnected."); chat_backend->addMessage(L"", L""); + m_chat_log_buf.clear(); if (client) { client->Stop(); @@ -2903,18 +2906,9 @@ void Game::processClientEvents(CameraOrientation *cam) void Game::updateChat(f32 dtime, const v2u32 &screensize) { - // Add chat log output for errors to be shown in chat - static LogOutputBuffer chat_log_error_buf(g_logger, LL_ERROR); - // Get new messages from error log buffer - while (!chat_log_error_buf.empty()) { - std::wstring error_message = utf8_to_wide(chat_log_error_buf.get()); - if (!g_settings->getBool("disable_escape_sequences")) { - error_message.insert(0, L"\x1b(c@red)"); - error_message.append(L"\x1b(c@white)"); - } - chat_backend->addMessage(L"", error_message); - } + while (!m_chat_log_buf.empty()) + chat_backend->addMessage(L"", utf8_to_wide(m_chat_log_buf.get())); // Get new messages from client std::wstring message; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 33654e213..1d0610c0f 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -400,6 +400,7 @@ void set_default_settings(Settings *settings) settings->setDefault("remote_media", ""); settings->setDefault("debug_log_level", "action"); settings->setDefault("debug_log_size_max", "50"); + settings->setDefault("chat_log_level", "error"); settings->setDefault("emergequeue_limit_total", "512"); settings->setDefault("emergequeue_limit_diskonly", "64"); settings->setDefault("emergequeue_limit_generate", "64"); diff --git a/src/log.cpp b/src/log.cpp index 30344b4df..54442c39b 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "debug.h" #include "gettime.h" #include "porting.h" +#include "settings.h" #include "config.h" #include "exceptions.h" #include "util/numeric.h" @@ -338,7 +339,80 @@ void FileLogOutput::setFile(const std::string &filename, s64 file_size_max) "-------------\n" << std::endl; } +void StreamLogOutput::logRaw(LogLevel lev, const std::string &line) +{ + bool colored_message = (Logger::color_mode == LOG_COLOR_ALWAYS) || + (Logger::color_mode == LOG_COLOR_AUTO && is_tty); + if (colored_message) { + switch (lev) { + case LL_ERROR: + // error is red + m_stream << "\033[91m"; + break; + case LL_WARNING: + // warning is yellow + m_stream << "\033[93m"; + break; + case LL_INFO: + // info is a bit dark + m_stream << "\033[37m"; + break; + case LL_VERBOSE: + // verbose is darker than info + m_stream << "\033[2m"; + break; + default: + // action is white + colored_message = false; + } + } + m_stream << line << std::endl; + + if (colored_message) { + // reset to white color + m_stream << "\033[0m"; + } +} + +void LogOutputBuffer::updateLogLevel() +{ + const std::string &conf_loglev = g_settings->get("chat_log_level"); + LogLevel log_level = Logger::stringToLevel(conf_loglev); + if (log_level == LL_MAX) { + warningstream << "Supplied unrecognized chat_log_level; " + "showing none." << std::endl; + log_level = LL_NONE; + } + + m_logger.removeOutput(this); + m_logger.addOutputMaxLevel(this, log_level); +} + +void LogOutputBuffer::logRaw(LogLevel lev, const std::string &line) +{ + std::string color; + + if (!g_settings->getBool("disable_escape_sequences")) { + switch (lev) { + case LL_ERROR: // red + color = "\x1b(c@#F00)"; + break; + case LL_WARNING: // yellow + color = "\x1b(c@#EE0)"; + break; + case LL_INFO: // grey + color = "\x1b(c@#BBB)"; + break; + case LL_VERBOSE: // dark grey + color = "\x1b(c@#888)"; + break; + default: break; + } + } + + m_buffer.push(color.append(line)); +} //// //// *Buffer methods diff --git a/src/log.h b/src/log.h index 6350d8a86..856d3479b 100644 --- a/src/log.h +++ b/src/log.h @@ -124,39 +124,7 @@ public: #endif } - void logRaw(LogLevel lev, const std::string &line) - { - bool colored_message = (Logger::color_mode == LOG_COLOR_ALWAYS) || - (Logger::color_mode == LOG_COLOR_AUTO && is_tty); - if (colored_message) - switch (lev) { - case LL_ERROR: - // error is red - m_stream << "\033[91m"; - break; - case LL_WARNING: - // warning is yellow - m_stream << "\033[93m"; - break; - case LL_INFO: - // info is a bit dark - m_stream << "\033[37m"; - break; - case LL_VERBOSE: - // verbose is darker than info - m_stream << "\033[2m"; - break; - default: - // action is white - colored_message = false; - } - - m_stream << line << std::endl; - - if (colored_message) - // reset to white color - m_stream << "\033[0m"; - } + void logRaw(LogLevel lev, const std::string &line); private: std::ostream &m_stream; @@ -178,23 +146,27 @@ private: class LogOutputBuffer : public ICombinedLogOutput { public: - LogOutputBuffer(Logger &logger, LogLevel lev) : + LogOutputBuffer(Logger &logger) : m_logger(logger) { - m_logger.addOutput(this, lev); - } + updateLogLevel(); + }; - ~LogOutputBuffer() + virtual ~LogOutputBuffer() { m_logger.removeOutput(this); } - void logRaw(LogLevel lev, const std::string &line) + void updateLogLevel(); + + void logRaw(LogLevel lev, const std::string &line); + + void clear() { - m_buffer.push(line); + m_buffer = std::queue(); } - bool empty() + bool empty() const { return m_buffer.empty(); } -- cgit v1.2.3 From af0f7ac4a2032780eb731918c8fe9dc9e1262b5f Mon Sep 17 00:00:00 2001 From: Paramat Date: Thu, 14 May 2020 22:27:54 +0100 Subject: Add new Mapgen V7 floatland implementation (#9296) Floatland structure is vertically-compressed 3D noise. Uses a lacunarity of 1.618 (the golden ratio) for high quality noise. Floatlands appear between user-settable Y limits, with smooth tapering at each limit. Simple user-settable density adjustment. Shadow propagation is disabled in and just below floatlands, no shadows are cast on the world surface. Can be reconfigured to create a solid upper world layer between the Y limits, lakes/seas can be optionally added to this. --- builtin/settingtypes.txt | 49 ++++++++++++++++++++++- src/mapgen/mapgen_v7.cpp | 102 ++++++++++++++++++++++++++++++++++++++++++----- src/mapgen/mapgen_v7.h | 21 +++++++++- 3 files changed, 160 insertions(+), 12 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index b75bf2de5..d3f2c60b5 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1607,12 +1607,53 @@ mgv6_np_apple_trees (Apple trees noise) noise_params_2d 0, 1, (100, 100, 100), 3 [*Mapgen V7] # Map generation attributes specific to Mapgen v7. -# 'ridges' enables the rivers. +# 'ridges': Rivers. +# 'floatlands': Floating land masses in the atmosphere. +# 'caverns': Giant caves deep underground. 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 +# Lower Y limit of floatlands. +mgv7_floatland_ymin (Floatland minimum Y) int 1024 + +# Upper Y limit of floatlands. +mgv7_floatland_ymax (Floatland maximum Y) int 4096 + +# Y-distance over which floatlands taper from full density to nothing. +# Tapering starts at this distance from the Y limit. +# For a solid floatland layer, this controls the height of hills/mountains. +# Must be less than or equal to half the distance between the Y limits. +mgv7_floatland_taper (Floatland tapering distance) int 256 + +# Exponent of the floatland tapering. Alters the tapering behaviour. +# Value = 1.0 creates a uniform, linear tapering. +# Values > 1.0 create a smooth tapering suitable for the default separated +# floatlands. +# Values < 1.0 (for example 0.25) create a more defined surface level with +# flatter lowlands, suitable for a solid floatland layer. +mgv7_float_taper_exp (Floatland taper exponent) float 2.0 + +# Adjusts the density of the floatland layer. +# Increase value to increase density. Can be positive or negative. +# Value = 0.0: 50% of volume is floatland. +# Value = 2.0 (can be higher depending on 'mgv7_np_floatland', always test +# to be sure) creates a solid floatland layer. +mgv7_floatland_density (Floatland density) float -0.9 + +# Surface level of optional water placed on a solid floatland layer. +# Water is disabled by default and will only be placed if this value is set +# to above 'mgv7_floatland_ymax' - 'mgv7_floatland_taper' (the start of the +# upper tapering). +# ***WARNING, POTENTIAL DANGER TO WORLDS AND SERVER PERFORMANCE***: +# When enabling water placement the floatlands must be configured and tested +# to be a solid layer by setting 'mgv7_floatland_density' to 2.0 (or other +# required value depending on 'mgv7_np_floatland'), to avoid +# server-intensive extreme water flow and to avoid vast flooding of the +# world surface below. +mgv7_floatland_ywater (Floatland water level) int -31000 + # Controls width of tunnels, a smaller value creates wider tunnels. # Value >= 10.0 completely disables generation of tunnels and avoids the # intensive noise calculations. @@ -1682,6 +1723,12 @@ mgv7_np_mountain (Mountain noise) noise_params_3d -0.6, 1, (250, 350, 250), 5333 # 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 structure of floatlands. +# If altered from the default, the noise 'scale' (0.7 by default) may need +# to be adjusted, as floatland tapering functions best when this noise has +# a value range of approximately -2.0 to 2.0. +mgv7_np_floatland (Floatland noise) noise_params_3d 0, 0.7, (384, 96, 384), 1009, 4, 0.75, 1.618 + # 3D noise defining giant caverns. mgv7_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 diff --git a/src/mapgen/mapgen_v7.cpp b/src/mapgen/mapgen_v7.cpp index 43d5d822f..e93dc9140 100644 --- a/src/mapgen/mapgen_v7.cpp +++ b/src/mapgen/mapgen_v7.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2013-2019 kwolekr, Ryan Kwolek -Copyright (C) 2014-2019 paramat +Copyright (C) 2014-2020 paramat +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek 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 @@ -56,6 +56,12 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeParams *emerge) { spflags = params->spflags; mount_zero_level = params->mount_zero_level; + floatland_ymin = params->floatland_ymin; + floatland_ymax = params->floatland_ymax; + floatland_taper = params->floatland_taper; + float_taper_exp = params->float_taper_exp; + floatland_density = params->floatland_density; + floatland_ywater = params->floatland_ywater; cave_width = params->cave_width; large_cave_depth = params->large_cave_depth; @@ -70,6 +76,9 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeParams *emerge) dungeon_ymin = params->dungeon_ymin; dungeon_ymax = params->dungeon_ymax; + // Allocate floatland noise offset cache + this->float_offset_cache = new float[csize.Y + 2]; + // 2D noise noise_terrain_base = new Noise(¶ms->np_terrain_base, seed, csize.X, csize.Z); @@ -100,6 +109,12 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeParams *emerge) new Noise(¶ms->np_ridge, seed, csize.X, csize.Y + 2, csize.Z); } + if (spflags & MGV7_FLOATLANDS) { + // 3D noise, 1 up, 1 down overgeneration + noise_floatland = + new Noise(¶ms->np_floatland, seed, csize.X, csize.Y + 2, csize.Z); + } + // 3D noise, 1 down overgeneration MapgenBasic::np_cave1 = params->np_cave1; MapgenBasic::np_cave2 = params->np_cave2; @@ -126,6 +141,12 @@ MapgenV7::~MapgenV7() delete noise_ridge_uwater; delete noise_ridge; } + + if (spflags & MGV7_FLOATLANDS) { + delete noise_floatland; + } + + delete []float_offset_cache; } @@ -139,6 +160,7 @@ MapgenV7Params::MapgenV7Params(): np_ridge_uwater (0.0, 1.0, v3f(1000, 1000, 1000), 85039, 5, 0.6, 2.0), np_mountain (-0.6, 1.0, v3f(250, 350, 250), 5333, 5, 0.63, 2.0), np_ridge (0.0, 1.0, v3f(100, 100, 100), 6467, 4, 0.75, 2.0), + np_floatland (0.0, 0.7, v3f(384, 96, 384), 1009, 4, 0.75, 1.618), np_cavern (0.0, 1.0, v3f(384, 128, 384), 723, 5, 0.63, 2.0), np_cave1 (0.0, 12.0, v3f(61, 61, 61), 52534, 3, 0.5, 2.0), np_cave2 (0.0, 12.0, v3f(67, 67, 67), 10325, 3, 0.5, 2.0), @@ -151,6 +173,13 @@ void MapgenV7Params::readParams(const Settings *settings) { settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7); settings->getS16NoEx("mgv7_mount_zero_level", mount_zero_level); + settings->getS16NoEx("mgv7_floatland_ymin", floatland_ymin); + settings->getS16NoEx("mgv7_floatland_ymax", floatland_ymax); + settings->getS16NoEx("mgv7_floatland_taper", floatland_taper); + settings->getFloatNoEx("mgv7_float_taper_exp", float_taper_exp); + settings->getFloatNoEx("mgv7_floatland_density", floatland_density); + settings->getS16NoEx("mgv7_floatland_ywater", floatland_ywater); + settings->getFloatNoEx("mgv7_cave_width", cave_width); settings->getS16NoEx("mgv7_large_cave_depth", large_cave_depth); settings->getU16NoEx("mgv7_small_cave_num_min", small_cave_num_min); @@ -173,6 +202,7 @@ void MapgenV7Params::readParams(const Settings *settings) settings->getNoiseParams("mgv7_np_ridge_uwater", np_ridge_uwater); settings->getNoiseParams("mgv7_np_mountain", np_mountain); settings->getNoiseParams("mgv7_np_ridge", np_ridge); + settings->getNoiseParams("mgv7_np_floatland", np_floatland); settings->getNoiseParams("mgv7_np_cavern", np_cavern); settings->getNoiseParams("mgv7_np_cave1", np_cave1); settings->getNoiseParams("mgv7_np_cave2", np_cave2); @@ -184,6 +214,13 @@ void MapgenV7Params::writeParams(Settings *settings) const { settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7); settings->setS16("mgv7_mount_zero_level", mount_zero_level); + settings->setS16("mgv7_floatland_ymin", floatland_ymin); + settings->setS16("mgv7_floatland_ymax", floatland_ymax); + settings->setS16("mgv7_floatland_taper", floatland_taper); + settings->setFloat("mgv7_float_taper_exp", float_taper_exp); + settings->setFloat("mgv7_floatland_density", floatland_density); + settings->setS16("mgv7_floatland_ywater", floatland_ywater); + settings->setFloat("mgv7_cave_width", cave_width); settings->setS16("mgv7_large_cave_depth", large_cave_depth); settings->setU16("mgv7_small_cave_num_min", small_cave_num_min); @@ -206,6 +243,7 @@ void MapgenV7Params::writeParams(Settings *settings) const settings->setNoiseParams("mgv7_np_ridge_uwater", np_ridge_uwater); settings->setNoiseParams("mgv7_np_mountain", np_mountain); settings->setNoiseParams("mgv7_np_ridge", np_ridge); + settings->setNoiseParams("mgv7_np_floatland", np_floatland); settings->setNoiseParams("mgv7_np_cavern", np_cavern); settings->setNoiseParams("mgv7_np_cave1", np_cave1); settings->setNoiseParams("mgv7_np_cave2", np_cave2); @@ -357,8 +395,9 @@ void MapgenV7::makeChunk(BlockMakeData *data) updateLiquid(&data->transforming_liquid, full_node_min, full_node_max); // Calculate lighting - // TODO disable in and just below floatlands - bool propagate_shadow = true; + // Limit floatland shadows + bool propagate_shadow = !((spflags & MGV7_FLOATLANDS) && + node_max.Y >= floatland_ymin - csize.Y * 2 && node_min.Y <= floatland_ymax); if (flags & MG_LIGHT) calcLighting(node_min - v3s16(0, 1, 0), node_max + v3s16(0, 1, 0), @@ -427,6 +466,12 @@ bool MapgenV7::getMountainTerrainFromMap(int idx_xyz, int idx_xz, s16 y) } +bool MapgenV7::getFloatlandTerrainFromMap(int idx_xyz, float float_offset) +{ + return noise_floatland->result[idx_xyz] + floatland_density - float_offset >= 0.0f; +} + + int MapgenV7::generateTerrain() { MapNode n_air(CONTENT_AIR); @@ -446,6 +491,35 @@ int MapgenV7::generateTerrain() noise_mountain->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z); } + //// Floatlands + // 'Generate floatlands in this mapchunk' bool for + // simplification of condition checks in y-loop. + bool gen_floatlands = false; + u8 cache_index = 0; + // Y values where floatland tapering starts + s16 float_taper_ymax = floatland_ymax - floatland_taper; + s16 float_taper_ymin = floatland_ymin + floatland_taper; + + if ((spflags & MGV7_FLOATLANDS) && + node_max.Y >= floatland_ymin && node_min.Y <= floatland_ymax) { + gen_floatlands = true; + // Calculate noise for floatland generation + noise_floatland->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z); + + // Cache floatland noise offset values, for floatland tapering + for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++, cache_index++) { + float float_offset = 0.0f; + if (y > float_taper_ymax) { + float_offset = std::pow((y - float_taper_ymax) / (float)floatland_taper, + float_taper_exp) * 4.0f; + } else if (y < float_taper_ymin) { + float_offset = std::pow((float_taper_ymin - y) / (float)floatland_taper, + float_taper_exp) * 4.0f; + } + float_offset_cache[cache_index] = float_offset; + } + } + //// Place nodes const v3s16 &em = vm->m_area.getExtent(); s16 stone_surface_max_y = -MAX_MAP_GENERATION_LIMIT; @@ -457,13 +531,15 @@ int MapgenV7::generateTerrain() if (surface_y > stone_surface_max_y) stone_surface_max_y = surface_y; + cache_index = 0; u32 vi = vm->m_area.index(x, node_min.Y - 1, z); u32 index3d = (z - node_min.Z) * zstride_1u1d + (x - node_min.X); for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++, index3d += ystride, - VoxelArea::add_y(em, vi, 1)) { + VoxelArea::add_y(em, vi, 1), + cache_index++) { if (vm->m_data[vi].getContent() != CONTENT_IGNORE) continue; @@ -474,10 +550,18 @@ int MapgenV7::generateTerrain() vm->m_data[vi] = n_stone; // Mountain terrain if (y > stone_surface_max_y) stone_surface_max_y = y; - } else if (y <= water_level) { + } else if (gen_floatlands && + getFloatlandTerrainFromMap(index3d, + float_offset_cache[cache_index])) { + vm->m_data[vi] = n_stone; // Floatland terrain + if (y > stone_surface_max_y) + stone_surface_max_y = y; + } else if (y <= water_level) { // Surface water vm->m_data[vi] = n_water; + } else if (gen_floatlands && y >= float_taper_ymax && y <= floatland_ywater) { + vm->m_data[vi] = n_water; // Water for solid floatland layer only } else { - vm->m_data[vi] = n_air; + vm->m_data[vi] = n_air; // Air } } } @@ -488,8 +572,8 @@ int MapgenV7::generateTerrain() void MapgenV7::generateRidgeTerrain() { - // TODO disable river canyons in floatlands - if (node_max.Y < water_level - 16) + if (node_max.Y < water_level - 16 || + (node_max.Y >= floatland_ymin && node_min.Y <= floatland_ymax)) return; noise_ridge->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z); diff --git a/src/mapgen/mapgen_v7.h b/src/mapgen/mapgen_v7.h index eeae3a956..4020cd935 100644 --- a/src/mapgen/mapgen_v7.h +++ b/src/mapgen/mapgen_v7.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2013-2018 kwolekr, Ryan Kwolek -Copyright (C) 2014-2018 paramat +Copyright (C) 2014-2020 paramat +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek 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 @@ -36,6 +36,12 @@ extern FlagDesc flagdesc_mapgen_v7[]; struct MapgenV7Params : public MapgenParams { s16 mount_zero_level = 0; + s16 floatland_ymin = 1024; + s16 floatland_ymax = 4096; + s16 floatland_taper = 256; + float float_taper_exp = 2.0f; + float floatland_density = -0.6f; + s16 floatland_ywater = -31000; float cave_width = 0.09f; s16 large_cave_depth = -33; @@ -59,6 +65,7 @@ struct MapgenV7Params : public MapgenParams { NoiseParams np_ridge_uwater; NoiseParams np_mountain; NoiseParams np_ridge; + NoiseParams np_floatland; NoiseParams np_cavern; NoiseParams np_cave1; NoiseParams np_cave2; @@ -87,12 +94,21 @@ public: float baseTerrainLevelFromMap(int index); bool getMountainTerrainAtPoint(s16 x, s16 y, s16 z); bool getMountainTerrainFromMap(int idx_xyz, int idx_xz, s16 y); + bool getFloatlandTerrainFromMap(int idx_xyz, float float_offset); int generateTerrain(); void generateRidgeTerrain(); private: s16 mount_zero_level; + s16 floatland_ymin; + s16 floatland_ymax; + s16 floatland_taper; + float float_taper_exp; + float floatland_density; + s16 floatland_ywater; + + float *float_offset_cache = nullptr; Noise *noise_terrain_base; Noise *noise_terrain_alt; @@ -102,4 +118,5 @@ private: Noise *noise_ridge_uwater; Noise *noise_mountain; Noise *noise_ridge; + Noise *noise_floatland; }; -- cgit v1.2.3 From ab745685c79cd7b0fa8f74b96e190c528d620608 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 16 May 2020 21:41:41 +0200 Subject: Error msg if trying to teleport attached player (#9824) --- builtin/game/chat.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'builtin') diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index c8fa4175d..b9f84e522 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -443,6 +443,9 @@ core.register_chatcommand("teleport", { end local teleportee = core.get_player_by_name(name) if teleportee then + if teleportee:get_attach() then + return false, "Can't teleport, you're attached to an object!" + end teleportee:set_pos(p) return true, "Teleporting to "..core.pos_to_string(p) end @@ -460,6 +463,9 @@ core.register_chatcommand("teleport", { end if teleportee and p then + if teleportee:get_attach() then + return false, "Can't teleport, you're attached to an object!" + end p = find_free_position_near(p) teleportee:set_pos(p) return true, "Teleporting to " .. target_name @@ -480,6 +486,9 @@ 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 + if teleportee:get_attach() then + return false, "Can't teleport, player is attached to an object!" + end teleportee:set_pos(p) return true, "Teleporting " .. teleportee_name .. " to " .. core.pos_to_string(p) @@ -498,6 +507,9 @@ core.register_chatcommand("teleport", { end end if teleportee and p then + if teleportee:get_attach() then + return false, "Can't teleport, player is attached to an object!" + end p = find_free_position_near(p) teleportee:set_pos(p) return true, "Teleporting " .. teleportee_name -- cgit v1.2.3 From a9c3a423231e26ea3edee51d5f0bf949ca8e529b Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 17 May 2020 19:09:10 +0100 Subject: Add core.open_url() to main menu API (#8592) --- .../java/net/minetest/minetest/GameActivity.java | 6 ++ builtin/mainmenu/dlg_contentstore.lua | 113 ++++----------------- builtin/mainmenu/tab_credits.lua | 11 +- doc/menu_lua_api.txt | 5 + src/porting.cpp | 30 +++++- src/porting.h | 3 + src/porting_android.cpp | 12 +++ src/porting_android.h | 2 + src/script/lua_api/l_mainmenu.cpp | 9 ++ src/script/lua_api/l_mainmenu.h | 3 + 10 files changed, 98 insertions(+), 96 deletions(-) (limited to 'builtin') diff --git a/build/android/app/src/main/java/net/minetest/minetest/GameActivity.java b/build/android/app/src/main/java/net/minetest/minetest/GameActivity.java index 02b61b598..635512569 100644 --- a/build/android/app/src/main/java/net/minetest/minetest/GameActivity.java +++ b/build/android/app/src/main/java/net/minetest/minetest/GameActivity.java @@ -22,6 +22,7 @@ package net.minetest.minetest; import android.app.NativeActivity; import android.content.Intent; +import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.view.View; @@ -117,4 +118,9 @@ public class GameActivity extends NativeActivity { public int getDisplayWidth() { return getResources().getDisplayMetrics().widthPixels; } + + public void openURL(String url) { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + startActivity(browserIntent); + } } diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 3bc5f60bb..ce5c061c6 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -16,7 +16,6 @@ --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. local store = { packages = {}, packages_full = {} } -local package_dialog = {} -- Screenshot local screenshot_dir = core.get_cache_path() .. DIR_DELIM .. "cdb" @@ -44,8 +43,6 @@ local filter_types_type = { } - - local function download_package(param) if core.download_file(param.package.url, param.filename) then return { @@ -195,74 +192,6 @@ local function get_screenshot(package) return defaulttexturedir .. "loading_screenshot.png" end - - -function package_dialog.get_formspec() - local package = package_dialog.package - - store.update_paths() - - local formspec = { - "size[9,4;true]", - "image[0,1;4.5,3;", core.formspec_escape(get_screenshot(package)), ']', - "label[3.8,1;", - minetest.colorize(mt_color_green, core.formspec_escape(package.title)), "\n", - minetest.colorize('#BFBFBF', "by " .. core.formspec_escape(package.author)), "]", - "textarea[4,2;5.3,2;;;", core.formspec_escape(package.short_description), "]", - "button[0,0;2,1;back;", fgettext("Back"), "]", - } - - if not package.path then - formspec[#formspec + 1] = "button[7,0;2,1;install;" - formspec[#formspec + 1] = fgettext("Install") - formspec[#formspec + 1] = "]" - elseif package.installed_release < package.release then - -- The install_ action also handles updating - formspec[#formspec + 1] = "button[7,0;2,1;install;" - formspec[#formspec + 1] = fgettext("Update") - formspec[#formspec + 1] = "]" - formspec[#formspec + 1] = "button[5,0;2,1;uninstall;" - formspec[#formspec + 1] = fgettext("Uninstall") - formspec[#formspec + 1] = "]" - else - formspec[#formspec + 1] = "button[7,0;2,1;uninstall;" - formspec[#formspec + 1] = fgettext("Uninstall") - formspec[#formspec + 1] = "]" - end - - return table.concat(formspec, "") -end - -function package_dialog.handle_submit(this, fields) - if fields.back then - this:delete() - return true - end - - if fields.install then - start_install(this, package_dialog.package) - return true - end - - if fields.uninstall then - local dlg_delmod = create_delete_content_dlg(package_dialog.package) - dlg_delmod:set_parent(this) - this:hide() - dlg_delmod:show() - return true - end - - return false -end - -function package_dialog.create(package) - package_dialog.package = package - return dialog_create("package_view", - package_dialog.get_formspec, - package_dialog.handle_submit, - nil) -end - function store.load() local tmpdir = os.tempfolder() local target = tmpdir .. DIR_DELIM .. "packages.json" @@ -462,44 +391,45 @@ function store.get_formspec(dlgdata) minetest.colorize("#BFBFBF", " by " .. package.author)) formspec[#formspec + 1] = "]" - -- description - if package.path and package.installed_release < package.release then - formspec[#formspec + 1] = "textarea[1.25,0.3;7.5,1;;;" - else - formspec[#formspec + 1] = "textarea[1.25,0.3;9,1;;;" - end - formspec[#formspec + 1] = core.formspec_escape(package.short_description) - formspec[#formspec + 1] = "]" - -- buttons + local description_width = 7.5 if not package.path then - formspec[#formspec + 1] = "button[9.9,0;1.5,1;install_" + formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Install") formspec[#formspec + 1] = "]" else if package.installed_release < package.release then + description_width = 6 + -- The install_ action also handles updating - formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_" + formspec[#formspec + 1] = "button[6.9,0;1.5,1;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Update") formspec[#formspec + 1] = "]" end - formspec[#formspec + 1] = "button[9.9,0;1.5,1;uninstall_" + formspec[#formspec + 1] = "button[8.4,0;1.5,1;uninstall_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Uninstall") formspec[#formspec + 1] = "]" end - --formspec[#formspec + 1] = "button[9.9,0;1.5,1;view_" - --formspec[#formspec + 1] = tostring(i) - --formspec[#formspec + 1] = ";" - --formspec[#formspec + 1] = fgettext("View") - --formspec[#formspec + 1] = "]" + formspec[#formspec + 1] = "button[9.9,0;1.5,1;view_" + formspec[#formspec + 1] = tostring(i) + formspec[#formspec + 1] = ";" + formspec[#formspec + 1] = fgettext("View") + formspec[#formspec + 1] = "]" + + -- description + formspec[#formspec + 1] = "textarea[1.25,0.3;" + formspec[#formspec + 1] = tostring(description_width) + formspec[#formspec + 1] = ",1;;;" + formspec[#formspec + 1] = core.formspec_escape(package.short_description) + formspec[#formspec + 1] = "]" formspec[#formspec + 1] = "container_end[]" end @@ -576,10 +506,9 @@ function store.handle_submit(this, fields) end if fields["view_" .. i] then - local dlg = package_dialog.create(package) - dlg:set_parent(this) - this:hide() - dlg:show() + local url = ("%s/packages/%s?protocol_version=%d"):format( + core.settings:get("contentdb_url"), package.id, core.get_max_supp_proto()) + core.open_url(url) return true end end diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua index 962d2a3b4..c2b7e503a 100644 --- a/builtin/mainmenu/tab_credits.lua +++ b/builtin/mainmenu/tab_credits.lua @@ -101,8 +101,8 @@ return { local logofile = defaulttexturedir .. "logo.png" local version = core.get_version() return "image[0.5,1;" .. core.formspec_escape(logofile) .. "]" .. - "label[0.5,3.2;" .. version.project .. " " .. version.string .. "]" .. - "label[0.5,3.5;http://minetest.net]" .. + "label[0.5,2.8;" .. version.project .. " " .. version.string .. "]" .. + "button[0.5,3;2,2;homepage;minetest.net]" .. "tablecolumns[color;text]" .. "tableoptions[background=#00000000;highlight=#00000000;border=false]" .. "table[3.5,-0.25;8.5,6.05;list_credits;" .. @@ -115,5 +115,10 @@ return { "#FFFF00," .. fgettext("Previous Contributors") .. ",," .. buildCreditList(previous_contributors) .. "," .. ";1]" - end + end, + cbf_button_handler = function(this, fields, name, tabdata) + if fields.homepage then + core.open_url("https://www.minetest.net") + end + end, } diff --git a/doc/menu_lua_api.txt b/doc/menu_lua_api.txt index 8f5460acb..485c50110 100644 --- a/doc/menu_lua_api.txt +++ b/doc/menu_lua_api.txt @@ -234,6 +234,11 @@ core.get_min_supp_proto() core.get_max_supp_proto() ^ returns the maximum supported network protocol version +Other: +core.open_url(url) +^ opens the URL in a web browser, returns false on failure. +^ Must begin with http:// or https:// + Async: core.handle_async(async_job,parameters,finished) ^ execute a function asynchronously diff --git a/src/porting.cpp b/src/porting.cpp index c0381ad06..ef1640467 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -33,22 +33,28 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include + #include #endif #if !defined(_WIN32) #include #include + #if !defined(__ANDROID__) + #include + #endif #endif #if defined(__hpux) #define _PSTAT64 #include #endif +#if defined(__ANDROID__) + #include "porting_android.h" +#endif #include "config.h" #include "debug.h" #include "filesys.h" #include "log.h" #include "util/string.h" -#include "settings.h" #include #include #include @@ -697,6 +703,28 @@ int mt_snprintf(char *buf, const size_t buf_size, const char *fmt, ...) return c; } +bool openURL(const std::string &url) +{ + if ((url.substr(0, 7) != "http://" && url.substr(0, 8) != "https://") || + url.find_first_of("\r\n") != std::string::npos) { + errorstream << "Invalid url: " << url << std::endl; + return false; + } + +#if defined(_WIN32) + return (intptr_t)ShellExecuteA(NULL, NULL, url.c_str(), NULL, NULL, SW_SHOWNORMAL) > 32; +#elif defined(__ANDROID__) + openURLAndroid(url); + return true; +#elif defined(__APPLE__) + const char *argv[] = {"open", url.c_str(), NULL}; + return posix_spawnp(NULL, "open", NULL, NULL, (char**)argv, environ) == 0; +#else + const char *argv[] = {"xdg-open", url.c_str(), NULL}; + return posix_spawnp(NULL, "xdg-open", NULL, NULL, (char**)argv, environ) == 0; +#endif +} + // Load performance counter frequency only once at startup #ifdef _WIN32 diff --git a/src/porting.h b/src/porting.h index 4d30a5970..f50f0a950 100644 --- a/src/porting.h +++ b/src/porting.h @@ -329,6 +329,9 @@ bool secure_rand_fill_buf(void *buf, size_t len); void attachOrCreateConsole(); int mt_snprintf(char *buf, const size_t buf_size, const char *fmt, ...); + +bool openURL(const std::string &url); + } // namespace porting #ifdef __ANDROID__ diff --git a/src/porting_android.cpp b/src/porting_android.cpp index 2c91df235..41b521ec2 100644 --- a/src/porting_android.cpp +++ b/src/porting_android.cpp @@ -213,6 +213,18 @@ void showInputDialog(const std::string &acceptButton, const std::string &hint, jacceptButton, jhint, jcurrent, jeditType); } +void openURLAndroid(const std::string &url) +{ + jmethodID url_open = jnienv->GetMethodID(nativeActivity, "openURL", + "(Ljava/lang/String;)V"); + + FATAL_ERROR_IF(url_open == nullptr, + "porting::openURLAndroid unable to find java openURL method"); + + jstring jurl = jnienv->NewStringUTF(url.c_str()); + jnienv->CallVoidMethod(app_global->activity->clazz, url_open, jurl); +} + int getInputDialogState() { jmethodID dialogstate = jnienv->GetMethodID(nativeActivity, diff --git a/src/porting_android.h b/src/porting_android.h index 42f90b60b..6eb054041 100644 --- a/src/porting_android.h +++ b/src/porting_android.h @@ -58,6 +58,8 @@ void initializePathsAndroid(); void showInputDialog(const std::string &acceptButton, const std::string &hint, const std::string ¤t, int editType); +void openURLAndroid(const std::string &url); + /** * WORKAROUND for not working callbacks from java -> c++ * get current state of input dialog diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index a76e9f079..f32c477c2 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -1063,6 +1063,14 @@ int ModApiMainMenu::l_get_max_supp_proto(lua_State *L) return 1; } +/******************************************************************************/ +int ModApiMainMenu::l_open_url(lua_State *L) +{ + std::string url = luaL_checkstring(L, 1); + lua_pushboolean(L, porting::openURL(url)); + return 1; +} + /******************************************************************************/ int ModApiMainMenu::l_do_async_callback(lua_State *L) { @@ -1125,6 +1133,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(get_screen_info); API_FCT(get_min_supp_proto); API_FCT(get_max_supp_proto); + API_FCT(open_url); API_FCT(do_async_callback); } diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index b2ca49320..5a16b3bfe 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -145,6 +145,9 @@ private: static int l_get_max_supp_proto(lua_State *L); + // other + static int l_open_url(lua_State *L); + // async static int l_do_async_callback(lua_State *L); -- cgit v1.2.3 From 11723cffe011e99c1092388958fb1a047ab1c09c Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 15 May 2020 16:38:19 +0200 Subject: builtin: Move common/async_event.lua to mainmenu/async_event.lua It only works in the context of the mainmenu. --- builtin/common/async_event.lua | 40 ---------------------------------------- builtin/mainmenu/async_event.lua | 32 ++++++++++++++++++++++++++++++++ builtin/mainmenu/init.lua | 4 +--- 3 files changed, 33 insertions(+), 43 deletions(-) delete mode 100644 builtin/common/async_event.lua create mode 100644 builtin/mainmenu/async_event.lua (limited to 'builtin') diff --git a/builtin/common/async_event.lua b/builtin/common/async_event.lua deleted file mode 100644 index 988af79b9..000000000 --- a/builtin/common/async_event.lua +++ /dev/null @@ -1,40 +0,0 @@ - -core.async_jobs = {} - -local function handle_job(jobid, serialized_retval) - local retval = core.deserialize(serialized_retval) - assert(type(core.async_jobs[jobid]) == "function") - core.async_jobs[jobid](retval) - core.async_jobs[jobid] = nil -end - -if core.register_globalstep then - core.register_globalstep(function(dtime) - for i, job in ipairs(core.get_finished_jobs()) do - handle_job(job.jobid, job.retval) - end - end) -else - core.async_event_handler = handle_job -end - -function core.handle_async(func, parameter, callback) - -- Serialize function - local serialized_func = string.dump(func) - - assert(serialized_func ~= nil) - - -- Serialize parameters - local serialized_param = core.serialize(parameter) - - if serialized_param == nil then - return false - end - - local jobid = core.do_async_callback(serialized_func, serialized_param) - - core.async_jobs[jobid] = callback - - return true -end - diff --git a/builtin/mainmenu/async_event.lua b/builtin/mainmenu/async_event.lua new file mode 100644 index 000000000..04bfb78d6 --- /dev/null +++ b/builtin/mainmenu/async_event.lua @@ -0,0 +1,32 @@ + +core.async_jobs = {} + +local function handle_job(jobid, serialized_retval) + local retval = core.deserialize(serialized_retval) + assert(type(core.async_jobs[jobid]) == "function") + core.async_jobs[jobid](retval) + core.async_jobs[jobid] = nil +end + +core.async_event_handler = handle_job + +function core.handle_async(func, parameter, callback) + -- Serialize function + local serialized_func = string.dump(func) + + assert(serialized_func ~= nil) + + -- Serialize parameters + local serialized_param = core.serialize(parameter) + + if serialized_param == nil then + return false + end + + local jobid = core.do_async_callback(serialized_func, serialized_param) + + core.async_jobs[jobid] = callback + + return true +end + diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua index 130c3e73c..c17e79270 100644 --- a/builtin/mainmenu/init.lua +++ b/builtin/mainmenu/init.lua @@ -20,20 +20,18 @@ mt_color_blue = "#6389FF" mt_color_green = "#72FF63" mt_color_dark_green = "#25C191" ---for all other colors ask sfan5 to complete his work! - local menupath = core.get_mainmenu_path() local basepath = core.get_builtin_path() local menustyle = core.settings:get("main_menu_style") defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" .. DIR_DELIM .. "pack" .. DIR_DELIM -dofile(basepath .. "common" .. DIR_DELIM .. "async_event.lua") dofile(basepath .. "common" .. DIR_DELIM .. "filterlist.lua") dofile(basepath .. "fstk" .. DIR_DELIM .. "buttonbar.lua") dofile(basepath .. "fstk" .. DIR_DELIM .. "dialog.lua") dofile(basepath .. "fstk" .. DIR_DELIM .. "tabview.lua") dofile(basepath .. "fstk" .. DIR_DELIM .. "ui.lua") +dofile(menupath .. DIR_DELIM .. "async_event.lua") dofile(menupath .. DIR_DELIM .. "common.lua") dofile(menupath .. DIR_DELIM .. "pkgmgr.lua") dofile(menupath .. DIR_DELIM .. "textures.lua") -- cgit v1.2.3 From c94d37827dd3a8be9dcc59bb693032ba7ea07922 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 19 May 2020 21:08:37 +0200 Subject: Rework functionality of leveled nodes (#9852) Co-authored-by: sfan5 Co-authored-by: SmallJoker --- builtin/game/falling.lua | 58 ++++++++++++++++++++++++++++++----------- doc/lua_api.txt | 10 ++++--- src/mapnode.cpp | 21 ++++++++------- src/mapnode.h | 6 ++--- src/nodedef.cpp | 6 +++++ src/nodedef.h | 4 ++- src/script/common/c_content.cpp | 4 +++ src/script/lua_api/l_env.cpp | 4 +-- 8 files changed, 79 insertions(+), 34 deletions(-) (limited to 'builtin') diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 7037ae885..cdbb13acc 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -109,6 +109,7 @@ core.register_entity(":__builtin:falling_node", { if core.is_colored_paramtype(def.paramtype2) then itemstring = core.itemstring_with_palette(itemstring, node.param2) end + -- FIXME: solution needed for paramtype2 == "leveled" local vsize if def.visual_scale then local s = def.visual_scale * SCALE @@ -122,6 +123,24 @@ core.register_entity(":__builtin:falling_node", { }) end + -- Set collision box (certain nodeboxes only for now) + local nb_types = {fixed=true, leveled=true, connected=true} + if def.drawtype == "nodebox" and def.node_box and + nb_types[def.node_box.type] then + local box = table.copy(def.node_box.fixed) + if type(box[1]) == "table" then + box = #box == 1 and box[1] or nil -- We can only use a single box + end + if box then + if def.paramtype2 == "leveled" and (self.node.level or 0) > 0 then + box[5] = -0.5 + self.node.level / 64 + end + self.object:set_properties({ + collisionbox = box + }) + end + end + -- Rotate entity if def.drawtype == "torchlike" then self.object:set_yaw(math.pi*0.25) @@ -196,13 +215,16 @@ core.register_entity(":__builtin:falling_node", { try_place = function(self, bcp, bcn) local bcd = core.registered_nodes[bcn.name] -- Add levels if dropped on same leveled node - if bcd and bcd.leveled and + if bcd and bcd.paramtype2 == "leveled" and bcn.name == self.node.name then local addlevel = self.node.level - if not addlevel or addlevel <= 0 then + if (addlevel or 0) <= 0 then addlevel = bcd.leveled end - if core.add_node_level(bcp, addlevel) == 0 then + if core.add_node_level(bcp, addlevel) < addlevel then + return true + elseif bcd.buildable_to then + -- Node level has already reached max, don't place anything return true end end @@ -351,6 +373,7 @@ local function convert_to_falling_node(pos, node) if not obj then return false end + -- remember node level, the entities' set_node() uses this node.level = core.get_node_level(pos) local meta = core.get_meta(pos) local metatable = meta and meta:to_table() or {} @@ -436,18 +459,23 @@ function core.check_single_for_falling(p) -- Only spawn falling node if node below is loaded local n_bottom = core.get_node_or_nil(p_bottom) local d_bottom = n_bottom and core.registered_nodes[n_bottom.name] - if d_bottom and - - (core.get_item_group(n.name, "float") == 0 or - d_bottom.liquidtype == "none") and - - (n.name ~= n_bottom.name or (d_bottom.leveled and - core.get_node_level(p_bottom) < - core.get_node_max_level(p_bottom))) and - - (not d_bottom.walkable or d_bottom.buildable_to) then - convert_to_falling_node(p, n) - return true + if d_bottom then + local same = n.name == n_bottom.name + -- Let leveled nodes fall if it can merge with the bottom node + if same and d_bottom.paramtype2 == "leveled" and + core.get_node_level(p_bottom) < + core.get_node_max_level(p_bottom) then + convert_to_falling_node(p, n) + return true + end + -- Otherwise only if the bottom node is considered "fall through" + if not same and + (not d_bottom.walkable or d_bottom.buildable_to) and + (core.get_item_group(n.name, "float") == 0 or + d_bottom.liquidtype == "none") then + convert_to_falling_node(p, n) + return true + end end end diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 9c7c42436..8b7c412ab 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4882,7 +4882,7 @@ Environment access * `minetest.add_node_level(pos, level)` * increase level of leveled node by level, default `level` equals `1` * if `totallevel > maxlevel`, returns rest (`total-max`) - * can be negative for decreasing + * `level` must be between -127 and 127 * `minetest.fix_light(pos1, pos2)`: returns `true`/`false` * resets the light in a cuboid-shaped part of the map and removes lighting bugs. @@ -7012,11 +7012,15 @@ Used by `minetest.register_node`. -- If true, a new liquid source can be created by placing two or more -- sources nearby - leveled = 16, + leveled = 0, -- Only valid for "nodebox" drawtype with 'type = "leveled"'. -- Allows defining the nodebox height without using param2. -- The nodebox height is 'leveled' / 64 nodes. - -- The maximum value of 'leveled' is 127. + -- The maximum value of 'leveled' is `leveled_max`. + + leveled_max = 127, + -- Maximum value for `leveled` (0-127), enforced in + -- `minetest.set_node_level` and `minetest.add_node_level`. liquid_range = 8, -- Number of flowing nodes around source (max. 8) diff --git a/src/mapnode.cpp b/src/mapnode.cpp index bf7e79a71..24d62b504 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -584,7 +584,7 @@ u8 MapNode::getMaxLevel(const NodeDefManager *nodemgr) const if( f.liquid_type == LIQUID_FLOWING || f.param_type_2 == CPT2_FLOWINGLIQUID) return LIQUID_LEVEL_MAX; if(f.leveled || f.param_type_2 == CPT2_LEVELED) - return LEVELED_MAX; + return f.leveled_max; return 0; } @@ -603,14 +603,15 @@ u8 MapNode::getLevel(const NodeDefManager *nodemgr) const if (level) return level; } - if (f.leveled > LEVELED_MAX) - return LEVELED_MAX; + // Return static value from nodedef if param2 isn't used for level + if (f.leveled > f.leveled_max) + return f.leveled_max; return f.leveled; } -u8 MapNode::setLevel(const NodeDefManager *nodemgr, s8 level) +s8 MapNode::setLevel(const NodeDefManager *nodemgr, s16 level) { - u8 rest = 0; + s8 rest = 0; const ContentFeatures &f = nodemgr->get(*this); if (f.param_type_2 == CPT2_FLOWINGLIQUID || f.liquid_type == LIQUID_FLOWING @@ -631,18 +632,18 @@ u8 MapNode::setLevel(const NodeDefManager *nodemgr, s8 level) if (level < 0) { // zero means default for a leveled nodebox rest = level; level = 0; - } else if (level > LEVELED_MAX) { - rest = level - LEVELED_MAX; - level = LEVELED_MAX; + } else if (level > f.leveled_max) { + rest = level - f.leveled_max; + level = f.leveled_max; } setParam2((level & LEVELED_MASK) | (getParam2() & ~LEVELED_MASK)); } return rest; } -u8 MapNode::addLevel(const NodeDefManager *nodemgr, s8 add) +s8 MapNode::addLevel(const NodeDefManager *nodemgr, s16 add) { - s8 level = getLevel(nodemgr); + s16 level = getLevel(nodemgr); level += add; return setLevel(nodemgr, level); } diff --git a/src/mapnode.h b/src/mapnode.h index 7a3d30ddc..32ac1b4f6 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -268,12 +268,12 @@ struct MapNode std::vector *boxes, u8 neighbors = 0) const; /* - Liquid helpers + Liquid/leveled helpers */ u8 getMaxLevel(const NodeDefManager *nodemgr) const; u8 getLevel(const NodeDefManager *nodemgr) const; - u8 setLevel(const NodeDefManager *nodemgr, s8 level = 1); - u8 addLevel(const NodeDefManager *nodemgr, s8 add = 1); + s8 setLevel(const NodeDefManager *nodemgr, s16 level = 1); + s8 addLevel(const NodeDefManager *nodemgr, s16 add = 1); /* Serialization functions diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 65199830f..b8211fceb 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -368,6 +368,7 @@ void ContentFeatures::reset() floodable = false; rightclickable = true; leveled = 0; + leveled_max = LEVELED_MAX; liquid_type = LIQUID_NONE; liquid_alternative_flowing = ""; liquid_alternative_source = ""; @@ -478,6 +479,7 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const writeU8(os, legacy_wallmounted); os << serializeString(node_dig_prediction); + writeU8(os, leveled_max); } void ContentFeatures::correctAlpha(TileDef *tiles, int length) @@ -586,6 +588,10 @@ void ContentFeatures::deSerialize(std::istream &is) try { node_dig_prediction = deSerializeString(is); + u8 tmp_leveled_max = readU8(is); + if (is.eof()) /* readU8 doesn't throw exceptions so we have to do this */ + throw SerializationError(""); + leveled_max = tmp_leveled_max; } catch(SerializationError &e) {}; } diff --git a/src/nodedef.h b/src/nodedef.h index 0fce6eab1..497e7ee0e 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -326,8 +326,10 @@ struct ContentFeatures std::vector connects_to_ids; // Post effect color, drawn when the camera is inside the node. video::SColor post_effect_color; - // Flowing liquid or snow, value = default level + // Flowing liquid or leveled nodebox, value = default level u8 leveled; + // Maximum value for leveled nodes + u8 leveled_max; // --- LIGHTING-RELATED --- diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index de9634c42..116a59c09 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -694,6 +694,8 @@ ContentFeatures read_content_features(lua_State *L, int index) f.liquid_range = getintfield_default(L, index, "liquid_range", f.liquid_range); f.leveled = getintfield_default(L, index, "leveled", f.leveled); + f.leveled_max = getintfield_default(L, index, + "leveled_max", f.leveled_max); getboolfield(L, index, "liquid_renewable", f.liquid_renewable); f.drowning = getintfield_default(L, index, @@ -860,6 +862,8 @@ void push_content_features(lua_State *L, const ContentFeatures &c) lua_setfield(L, -2, "post_effect_color"); lua_pushnumber(L, c.leveled); lua_setfield(L, -2, "leveled"); + lua_pushnumber(L, c.leveled_max); + lua_setfield(L, -2, "leveled_max"); lua_pushboolean(L, c.sunlight_propagates); lua_setfield(L, -2, "sunlight_propagates"); lua_pushnumber(L, c.light_source); diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index b8a8a5ce1..89ec9dc7e 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -529,13 +529,13 @@ int ModApiEnvMod::l_set_node_level(lua_State *L) // add_node_level(pos, level) // pos = {x=num, y=num, z=num} -// level: 0..63 +// level: -127..127 int ModApiEnvMod::l_add_node_level(lua_State *L) { GET_ENV_PTR; v3s16 pos = read_v3s16(L, 1); - u8 level = 1; + s16 level = 1; if(lua_isnumber(L, 2)) level = lua_tonumber(L, 2); MapNode n = env->getMap().getNode(pos); -- cgit v1.2.3 From 1bcdc2d7e9d91f21cd9be2836b777c5088313fa8 Mon Sep 17 00:00:00 2001 From: Paramat Date: Fri, 22 May 2020 01:32:20 +0100 Subject: Various documentation fixes in settingtypes.txt (#9910) Fix incorrect value of 'mgv7_floatland_density'. Use correct spelling of 'persistence'. Move '3d_paralax_strength' into correct section (3D mode). Refer to 'active_object_send_range_blocks' instead of non-existent 'active_object_range'. --- builtin/settingtypes.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index d3f2c60b5..28ea58ffd 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -42,10 +42,10 @@ # Flags are always separated by comma without spaces. # - default possible_flags # * noise_params_2d: -# Format is , , (, , ), , , , [, ] +# Format is , , (, , ), , , , [, ] # - default # * noise_params_3d: -# Format is , , (, , ), , , , [, ] +# Format is , , (, , ), , , , [, ] # - default # * v3f: # Format is (, , ) @@ -561,9 +561,6 @@ enable_parallax_occlusion (Parallax occlusion) bool false # 1 = relief mapping (slower, more accurate). parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1 -# Strength of parallax. -3d_paralax_strength (Parallax occlusion strength) float 0.025 - # Number of parallax occlusion iterations. parallax_occlusion_iterations (Parallax occlusion iterations) int 4 @@ -713,6 +710,9 @@ fall_bobbing_amount (Fall bobbing factor) float 0.03 # Note that the interlaced mode requires shaders to be enabled. 3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,crossview,pageflip +# Strength of 3D mode parallax. +3d_paralax_strength (3D mode parallax strength) float 0.025 + # In-game chat console height, between 0.1 (10%) and 1.0 (100%). console_height (Console height) float 0.6 0.1 1.0 @@ -1160,7 +1160,7 @@ active_object_send_range_blocks (Active object send range) int 4 # 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. +# This should be configured together with active_object_send_range_blocks. active_block_range (Active block range) int 3 # From how far blocks are sent to clients, stated in mapblocks (16 nodes). @@ -1640,7 +1640,7 @@ mgv7_float_taper_exp (Floatland taper exponent) float 2.0 # Value = 0.0: 50% of volume is floatland. # Value = 2.0 (can be higher depending on 'mgv7_np_floatland', always test # to be sure) creates a solid floatland layer. -mgv7_floatland_density (Floatland density) float -0.9 +mgv7_floatland_density (Floatland density) float -0.6 # Surface level of optional water placed on a solid floatland layer. # Water is disabled by default and will only be placed if this value is set -- cgit v1.2.3 From 15ba75e4cf1d1b8ceaa9d8ce33dcfdd7dbe80741 Mon Sep 17 00:00:00 2001 From: sorcerykid Date: Sat, 23 May 2020 06:24:06 -0500 Subject: Add on_authplayer callback and 'last_login' to on_joinplayer (#9574) Replace on_auth_fail callback with more versatile on_authplayer Better clarify account login process in Lua API documentation Change initial timestamp for newly registered accounts to -1 --- builtin/game/auth.lua | 3 +-- builtin/game/chat.lua | 2 +- builtin/game/deprecated.lua | 16 ++++++++++++++ builtin/game/register.lua | 2 +- doc/lua_api.txt | 20 ++++++++++------- src/network/serverpackethandler.cpp | 44 +++++++++++++++++++------------------ src/script/cpp_api/s_player.cpp | 19 +++++++++++----- src/script/cpp_api/s_player.h | 4 ++-- src/script/cpp_api/s_server.cpp | 14 ++++++++---- src/script/cpp_api/s_server.h | 3 ++- 10 files changed, 81 insertions(+), 46 deletions(-) (limited to 'builtin') diff --git a/builtin/game/auth.lua b/builtin/game/auth.lua index 7aedfc82e..fc061666c 100644 --- a/builtin/game/auth.lua +++ b/builtin/game/auth.lua @@ -41,7 +41,6 @@ core.builtin_auth_handler = { return { password = auth_entry.password, privileges = privileges, - -- Is set to nil if unknown last_login = auth_entry.last_login, } end, @@ -53,7 +52,7 @@ core.builtin_auth_handler = { name = name, password = password, privileges = core.string_to_privs(core.settings:get("default_privs")), - last_login = os.time(), + last_login = -1, -- Defer login time calculation until record_login (called by on_joinplayer) }) end, delete_auth = function(name) diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index b9f84e522..aae811794 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -1068,7 +1068,7 @@ core.register_chatcommand("last-login", { param = name end local pauth = core.get_auth_handler().get_auth(param) - if pauth and pauth.last_login then + if pauth and pauth.last_login and pauth.last_login ~= -1 then -- Time in UTC, ISO 8601 format return true, "Last login time was " .. os.date("!%Y-%m-%dT%H:%M:%SZ", pauth.last_login) diff --git a/builtin/game/deprecated.lua b/builtin/game/deprecated.lua index 73e105eb8..20f0482eb 100644 --- a/builtin/game/deprecated.lua +++ b/builtin/game/deprecated.lua @@ -70,3 +70,19 @@ core.setting_get = setting_proxy("get") core.setting_setbool = setting_proxy("set_bool") core.setting_getbool = setting_proxy("get_bool") core.setting_save = setting_proxy("write") + +-- +-- core.register_on_auth_fail +-- + +function core.register_on_auth_fail(func) + core.log("deprecated", "core.register_on_auth_fail " .. + "is obsolete and should be replaced by " .. + "core.register_on_authplayer instead.") + + core.register_on_authplayer(function (player_name, ip, is_success) + if not is_success then + func(player_name, ip) + end + end) +end diff --git a/builtin/game/register.lua b/builtin/game/register.lua index eb6c2897c..1034d4f2b 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -607,9 +607,9 @@ 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_on_authplayers, core.register_on_authplayer = 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() diff --git a/doc/lua_api.txt b/doc/lua_api.txt index bd0cb8acb..26061eccb 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4374,7 +4374,7 @@ Call these functions only at load time! * Called after generating a piece of world. Modifying nodes inside the area is a bit faster than usually. * `minetest.register_on_newplayer(function(ObjectRef))` - * Called after a new player has been created + * Called when a new player enters the world for the first time * `minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))` * Called when a player is punched * Note: This callback is invoked even if the punched player is dead. @@ -4415,19 +4415,23 @@ Call these functions only at load time! * Called _before_ repositioning of player occurs * return true in func to disable regular player placement * `minetest.register_on_prejoinplayer(function(name, ip))` - * Called before a player joins the game - * If it returns a string, the player is disconnected with that string as + * Called when a client connects to the server, prior to authentication + * If it returns a string, the client is disconnected with that string as reason. -* `minetest.register_on_joinplayer(function(ObjectRef))` +* `minetest.register_on_joinplayer(function(ObjectRef, last_login))` * Called when a player joins the game + * `last_login`: The timestamp of the previous login, or nil if player is new * `minetest.register_on_leaveplayer(function(ObjectRef, timed_out))` * Called when a player leaves the game * `timed_out`: True for timeout, false for other reasons. +* `minetest.register_on_authplayer(function(name, ip, is_success))` + * Called when a client attempts to log into an account. + * `name`: The name of the account being authenticated. + * `ip`: The IP address of the client + * `is_success`: Whether the client was successfully authenticated + * For newly registered accounts, `is_success` will always be true * `minetest.register_on_auth_fail(function(name, ip))` - * Called when a client attempts to log into an account but supplies the - wrong password. - * `ip`: The IP address of the client. - * `name`: The account the client attempted to log into. + * Deprecated: use `minetest.register_on_authplayer(name, ip, is_success)` instead. * `minetest.register_on_cheat(function(ObjectRef, cheat))` * Called when a player cheats * `cheat`: `{type=}`, where `` is one of: diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 2fa9d4196..fed3b6f85 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -409,9 +409,12 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt) // (u16) 1 + std::string represents a pseudo vector serialization representation notice_pkt << (u8) PLAYER_LIST_ADD << (u16) 1 << std::string(playersao->getPlayer()->getName()); m_clients.sendToAll(¬ice_pkt); - m_clients.event(peer_id, CSE_SetClientReady); - m_script->on_joinplayer(playersao); + + s64 last_login; + m_script->getAuth(playersao->getPlayer()->getName(), nullptr, nullptr, &last_login); + m_script->on_joinplayer(playersao, last_login); + // Send shutdown timer if shutdown has been scheduled if (m_shutdown_state.isTimerRunning()) { SendChatMessage(peer_id, m_shutdown_state.getShutdownTimerMessage()); @@ -1512,6 +1515,7 @@ void Server::handleCommand_FirstSrp(NetworkPacket* pkt) initial_ver_key = encode_srp_verifier(verification_key, salt); m_script->createAuth(playername, initial_ver_key); + m_script->on_authplayer(playername, addr_s, true); acceptAuth(peer_id, false); } else { @@ -1648,24 +1652,25 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt) session_t peer_id = pkt->getPeerId(); RemoteClient *client = getClient(peer_id, CS_Invalid); ClientState cstate = client->getState(); + std::string addr_s = getPeerAddress(pkt->getPeerId()).serializeString(); + std::string playername = client->getName(); bool wantSudo = (cstate == CS_Active); verbosestream << "Server: Received TOCLIENT_SRP_BYTES_M." << std::endl; if (!((cstate == CS_HelloSent) || (cstate == CS_Active))) { - actionstream << "Server: got SRP _M packet in wrong state " << cstate << - " from " << getPeerAddress(peer_id).serializeString() << - ". Ignoring." << std::endl; + actionstream << "Server: got SRP _M packet in wrong state " + << cstate << " from " << addr_s + << ". Ignoring." << std::endl; return; } if (client->chosen_mech != AUTH_MECHANISM_SRP && client->chosen_mech != AUTH_MECHANISM_LEGACY_PASSWORD) { - actionstream << "Server: got SRP _M packet, while auth is going on " - "with mech " << client->chosen_mech << " from " << - getPeerAddress(peer_id).serializeString() << - " (wantSudo=" << wantSudo << "). Denying." << std::endl; + actionstream << "Server: got SRP _M packet, while auth" + << "is going on with mech " << client->chosen_mech << " from " + << addr_s << " (wantSudo=" << wantSudo << "). Denying." << std::endl; if (wantSudo) { DenySudoAccess(peer_id); return; @@ -1680,9 +1685,8 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt) if (srp_verifier_get_session_key_length((SRPVerifier *) client->auth_data) != bytes_M.size()) { - actionstream << "Server: User " << client->getName() << " at " << - getPeerAddress(peer_id).serializeString() << - " sent bytes_M with invalid length " << bytes_M.size() << std::endl; + actionstream << "Server: User " << playername << " at " << addr_s + << " sent bytes_M with invalid length " << bytes_M.size() << std::endl; DenyAccess(peer_id, SERVER_ACCESSDENIED_UNEXPECTED_DATA); return; } @@ -1694,24 +1698,21 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt) if (!bytes_HAMK) { if (wantSudo) { - actionstream << "Server: User " << client->getName() << " at " << - getPeerAddress(peer_id).serializeString() << - " tried to change their password, but supplied wrong (SRP) " - "password for authentication." << std::endl; + actionstream << "Server: User " << playername << " at " << addr_s + << " tried to change their password, but supplied wrong" + << " (SRP) password for authentication." << std::endl; DenySudoAccess(peer_id); return; } - std::string ip = getPeerAddress(peer_id).serializeString(); - actionstream << "Server: User " << client->getName() << " at " << ip << - " supplied wrong password (auth mechanism: SRP)." << std::endl; - m_script->on_auth_failure(client->getName(), ip); + actionstream << "Server: User " << playername << " at " << addr_s + << " supplied wrong password (auth mechanism: SRP)." << std::endl; + m_script->on_authplayer(playername, addr_s, false); DenyAccess(peer_id, SERVER_ACCESSDENIED_WRONG_PASSWORD); return; } if (client->create_player_on_auth_success) { - std::string playername = client->getName(); m_script->createAuth(playername, client->enc_pwd); std::string checkpwd; // not used, but needed for passing something @@ -1725,6 +1726,7 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt) client->create_player_on_auth_success = false; } + m_script->on_authplayer(playername, addr_s, true); acceptAuth(peer_id, wantSudo); } diff --git a/src/script/cpp_api/s_player.cpp b/src/script/cpp_api/s_player.cpp index df67ea00c..712120c61 100644 --- a/src/script/cpp_api/s_player.cpp +++ b/src/script/cpp_api/s_player.cpp @@ -147,7 +147,7 @@ bool ScriptApiPlayer::can_bypass_userlimit(const std::string &name, const std::s return lua_toboolean(L, -1); } -void ScriptApiPlayer::on_joinplayer(ServerActiveObject *player) +void ScriptApiPlayer::on_joinplayer(ServerActiveObject *player, s64 last_login) { SCRIPTAPI_PRECHECKHEADER @@ -156,7 +156,11 @@ void ScriptApiPlayer::on_joinplayer(ServerActiveObject *player) lua_getfield(L, -1, "registered_on_joinplayers"); // Call callbacks objectrefGetOrCreate(L, player); - runCallbacks(1, RUN_CALLBACKS_MODE_FIRST); + if (last_login != -1) + lua_pushinteger(L, last_login); + else + lua_pushnil(L); + runCallbacks(2, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiPlayer::on_leaveplayer(ServerActiveObject *player, @@ -216,16 +220,19 @@ void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player, runCallbacks(3, RUN_CALLBACKS_MODE_OR_SC); } -void ScriptApiPlayer::on_auth_failure(const std::string &name, const std::string &ip) +void ScriptApiPlayer::on_authplayer(const std::string &name, const std::string &ip, bool is_success) { SCRIPTAPI_PRECHECKHEADER - // Get core.registered_on_auth_failure + // Get core.registered_on_authplayers lua_getglobal(L, "core"); - lua_getfield(L, -1, "registered_on_auth_fail"); + lua_getfield(L, -1, "registered_on_authplayers"); + + // Call callbacks lua_pushstring(L, name.c_str()); lua_pushstring(L, ip.c_str()); - runCallbacks(2, RUN_CALLBACKS_MODE_FIRST); + lua_pushboolean(L, is_success); + runCallbacks(3, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiPlayer::pushMoveArguments( diff --git a/src/script/cpp_api/s_player.h b/src/script/cpp_api/s_player.h index 7ca3d8f30..a337f975b 100644 --- a/src/script/cpp_api/s_player.h +++ b/src/script/cpp_api/s_player.h @@ -41,7 +41,7 @@ public: bool on_prejoinplayer(const std::string &name, const std::string &ip, std::string *reason); bool can_bypass_userlimit(const std::string &name, const std::string &ip); - void on_joinplayer(ServerActiveObject *player); + void on_joinplayer(ServerActiveObject *player, s64 last_login); void on_leaveplayer(ServerActiveObject *player, bool timeout); void on_cheat(ServerActiveObject *player, const std::string &cheat_type); bool on_punchplayer(ServerActiveObject *player, ServerActiveObject *hitter, @@ -51,7 +51,7 @@ public: const PlayerHPChangeReason &reason); void on_playerReceiveFields(ServerActiveObject *player, const std::string &formname, const StringMap &fields); - void on_auth_failure(const std::string &name, const std::string &ip); + void on_authplayer(const std::string &name, const std::string &ip, bool is_success); // Player inventory callbacks // Return number of accepted items to be moved diff --git a/src/script/cpp_api/s_server.cpp b/src/script/cpp_api/s_server.cpp index 1ce2f9d45..96cb28b28 100644 --- a/src/script/cpp_api/s_server.cpp +++ b/src/script/cpp_api/s_server.cpp @@ -23,7 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., bool ScriptApiServer::getAuth(const std::string &playername, std::string *dst_password, - std::set *dst_privs) + std::set *dst_privs, + s64 *dst_last_login) { SCRIPTAPI_PRECHECKHEADER @@ -43,8 +44,7 @@ bool ScriptApiServer::getAuth(const std::string &playername, luaL_checktype(L, -1, LUA_TTABLE); std::string password; - bool found = getstringfield(L, -1, "password", password); - if (!found) + if (!getstringfield(L, -1, "password", password)) throw LuaError("Authentication handler didn't return password"); if (dst_password) *dst_password = password; @@ -54,7 +54,13 @@ bool ScriptApiServer::getAuth(const std::string &playername, throw LuaError("Authentication handler didn't return privilege table"); if (dst_privs) readPrivileges(-1, *dst_privs); - lua_pop(L, 1); + lua_pop(L, 1); // Remove key from privs table + + s64 last_login; + if(!getintfield(L, -1, "last_login", last_login)) + throw LuaError("Authentication handler didn't return last_login"); + if (dst_last_login) + *dst_last_login = (s64)last_login; return true; } diff --git a/src/script/cpp_api/s_server.h b/src/script/cpp_api/s_server.h index a4cede84d..d8639cba7 100644 --- a/src/script/cpp_api/s_server.h +++ b/src/script/cpp_api/s_server.h @@ -43,7 +43,8 @@ public: /* auth */ bool getAuth(const std::string &playername, std::string *dst_password, - std::set *dst_privs); + std::set *dst_privs, + s64 *dst_last_login = nullptr); void createAuth(const std::string &playername, const std::string &password); bool setPassword(const std::string &playername, -- cgit v1.2.3 From a9d6be8b6f769c1b795262f45e81bcb4a2cea4a1 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 11 May 2020 20:19:02 +0200 Subject: Fix documentation of emergequeue_limit settings --- builtin/settingtypes.txt | 10 +++++----- minetest.conf.example | 4 ++-- src/emerge.cpp | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 28ea58ffd..e18de3382 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -2159,15 +2159,15 @@ chunksize (Chunk size) int 5 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 +emergequeue_limit_total (Absolute limit of queued blocks to emerge) 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 +# This limit is enforced per player. +emergequeue_limit_diskonly (Per-player limit of queued blocks load from 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 +# This limit is enforced per player. +emergequeue_limit_generate (Per-player limit of queued blocks to generate) int 64 # Number of emerge threads to use. # Value 0: diff --git a/minetest.conf.example b/minetest.conf.example index f04822c47..17d24a566 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -3251,12 +3251,12 @@ # emergequeue_limit_total = 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. +# This limit is enforced per player. # type: int # emergequeue_limit_diskonly = 64 # Maximum number of blocks to be queued that are to be generated. -# Set to blank for an appropriate amount to be chosen automatically. +# This limit is enforced per player. # type: int # emergequeue_limit_generate = 64 diff --git a/src/emerge.cpp b/src/emerge.cpp index a9fc0a4de..0ac26a682 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -159,6 +159,7 @@ EmergeManager::EmergeManager(Server *server) nthreads = 1; m_qlimit_total = g_settings->getU16("emergequeue_limit_total"); + // FIXME: these fallback values are probably not good if (!g_settings->getU16NoEx("emergequeue_limit_diskonly", m_qlimit_diskonly)) m_qlimit_diskonly = nthreads * 5 + 1; if (!g_settings->getU16NoEx("emergequeue_limit_generate", m_qlimit_generate)) -- cgit v1.2.3 From a9b74f4c3966ad38c2f9a97364d3fdda0e514c93 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 24 May 2020 14:24:13 +0200 Subject: Add chat_font_size setting (#9736) Default font sizes are used when the setting value is 0 or below (clamped by Settings). --- builtin/settingtypes.txt | 4 ++++ src/client/gameui.cpp | 23 +++++++++++++---------- src/defaultsettings.cpp | 4 ++++ src/gui/guiChatConsole.cpp | 4 +++- 4 files changed, 24 insertions(+), 11 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index e18de3382..c787aea2c 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -903,6 +903,10 @@ fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255 # This font will be used for certain languages or if the default font is unavailable. fallback_font_path (Fallback font path) filepath fonts/DroidSansFallbackFull.ttf +# Font size of the recent chat text and chat prompt in point (pt). +# Value 0 will use the default font size. +chat_font_size (Chat font size) int 0 + # Path to save screenshots at. Can be an absolute or relative path. # The folder will be created if it doesn't already exist. screenshot_path (Screenshot folder) path screenshots diff --git a/src/client/gameui.cpp b/src/client/gameui.cpp index bbe7caeb1..c216f405d 100644 --- a/src/client/gameui.cpp +++ b/src/client/gameui.cpp @@ -76,6 +76,11 @@ void GameUI::init() m_guitext_chat = gui::StaticText::add(guienv, L"", core::rect(0, 0, 0, 0), //false, false); // Disable word wrap as of now false, true, guiroot); + u16 chat_font_size = g_settings->getU16("chat_font_size"); + if (chat_font_size != 0) { + m_guitext_chat->setOverrideFont(g_fontengine->getFont( + chat_font_size, FM_Unspecified)); + } // Profiler text (size is updated when text is updated) m_guitext_profiler = gui::StaticText::add(guienv, L"", @@ -213,7 +218,6 @@ void GameUI::showTranslatedStatusText(const char *str) void GameUI::setChatText(const EnrichedString &chat_text, u32 recent_chat_count) { - setStaticText(m_guitext_chat, chat_text); // Update gui element size and position s32 chat_y = 5; @@ -221,16 +225,15 @@ void GameUI::setChatText(const EnrichedString &chat_text, u32 recent_chat_count) if (m_flags.show_debug) chat_y += 2 * g_fontengine->getLineHeight(); - // first pass to calculate height of text to be set const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize(); - s32 width = std::min(g_fontengine->getTextWidth(chat_text.c_str()) + 10, - window_size.X - 20); - m_guitext_chat->setRelativePosition(core::rect(10, chat_y, width, - chat_y + window_size.Y)); - - // now use real height of text and adjust rect according to this size - m_guitext_chat->setRelativePosition(core::rect(10, chat_y, width, - chat_y + m_guitext_chat->getTextHeight())); + + core::rect chat_size(10, chat_y, + window_size.X - 20, 0); + chat_size.LowerRightCorner.Y = std::min((s32)window_size.Y, + m_guitext_chat->getTextHeight() + chat_y); + + m_guitext_chat->setRelativePosition(chat_size); + setStaticText(m_guitext_chat, chat_text); m_recent_chat_count = recent_chat_count; } diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 1d0610c0f..5d1795003 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -321,8 +321,12 @@ void set_default_settings(Settings *settings) std::string font_size_str = std::to_string(DEFAULT_FONT_SIZE); #endif + // General font settings settings->setDefault("font_size", font_size_str); settings->setDefault("mono_font_size", font_size_str); + settings->setDefault("chat_font_size", "0"); // Default "font_size" + + // ContentDB settings->setDefault("contentdb_url", "https://content.minetest.net"); #ifdef __ANDROID__ settings->setDefault("contentdb_flag_blacklist", "nonfree, android_default"); diff --git a/src/gui/guiChatConsole.cpp b/src/gui/guiChatConsole.cpp index e67fae3c6..8de00c12f 100644 --- a/src/gui/guiChatConsole.cpp +++ b/src/gui/guiChatConsole.cpp @@ -74,7 +74,9 @@ GUIChatConsole::GUIChatConsole( m_background_color.setBlue(clamp_u8(myround(console_color.Z))); } - m_font = g_fontengine->getFont(FONT_SIZE_UNSPECIFIED, FM_Mono); + u16 chat_font_size = g_settings->getU16("chat_font_size"); + m_font = g_fontengine->getFont(chat_font_size != 0 ? + chat_font_size : FONT_SIZE_UNSPECIFIED, FM_Mono); if (!m_font) { errorstream << "GUIChatConsole: Unable to load mono font" << std::endl; -- cgit v1.2.3 From b3c79906d4b63a2a1a296b6aad6657e86619b300 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 24 May 2020 14:46:50 +0100 Subject: Add engine version string to ContentDB API request (#9890) --- builtin/mainmenu/dlg_contentstore.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index ce5c061c6..3f01d4474 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -198,10 +198,11 @@ function store.load() assert(core.create_dir(tmpdir)) - local base_url = core.settings:get("contentdb_url") + local version = core.get_version() + local base_url = core.settings:get("contentdb_url") local url = base_url .. "/api/packages/?type=mod&type=game&type=txp&protocol_version=" .. - core.get_max_supp_proto() + core.get_max_supp_proto() .. "&engine_version=" .. version.string for _, item in pairs(core.settings:get("contentdb_flag_blacklist"):split(",")) do item = item:trim() -- cgit v1.2.3 From 083b285f4319c470f307f0b52f03a2fb68facd38 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 26 May 2020 00:17:52 +0200 Subject: Rename “Minimal development test” to “Development Test” (#9928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 +- README.md | 2 +- builtin/mainmenu/dlg_create_world.lua | 12 +- doc/lua_api.txt | 2 +- games/devtest/LICENSE.txt | 4 + games/devtest/README.md | 52 ++ games/devtest/game.conf | 2 + games/devtest/menu/background.png | Bin 0 -> 152 bytes games/devtest/menu/header.png | Bin 0 -> 404 bytes games/devtest/menu/icon.png | Bin 0 -> 217 bytes games/devtest/mods/basenodes/init.lua | 334 ++++++++++ games/devtest/mods/basenodes/mod.conf | 2 + .../textures/basenodes_dirt_with_grass_bottom.png | Bin 0 -> 187 bytes .../textures/basenodes_dirt_with_snow.png | Bin 0 -> 166 bytes .../textures/basenodes_dirt_with_snow_bottom.png | Bin 0 -> 177 bytes .../basenodes/textures/basenodes_snow_sheet.png | Bin 0 -> 166 bytes .../mods/basenodes/textures/default_apple.png | Bin 0 -> 102 bytes .../mods/basenodes/textures/default_cobble.png | Bin 0 -> 340 bytes .../basenodes/textures/default_desert_sand.png | Bin 0 -> 293 bytes .../basenodes/textures/default_desert_stone.png | Bin 0 -> 584 bytes .../mods/basenodes/textures/default_dirt.png | Bin 0 -> 790 bytes .../mods/basenodes/textures/default_grass.png | Bin 0 -> 697 bytes .../mods/basenodes/textures/default_grass_side.png | Bin 0 -> 796 bytes .../mods/basenodes/textures/default_gravel.png | Bin 0 -> 171 bytes .../mods/basenodes/textures/default_ice.png | Bin 0 -> 369 bytes .../basenodes/textures/default_junglegrass.png | Bin 0 -> 201 bytes .../basenodes/textures/default_jungleleaves.png | Bin 0 -> 399 bytes .../mods/basenodes/textures/default_jungletree.png | Bin 0 -> 730 bytes .../basenodes/textures/default_jungletree_top.png | Bin 0 -> 714 bytes .../mods/basenodes/textures/default_lava.png | Bin 0 -> 172 bytes .../basenodes/textures/default_lava_flowing.png | Bin 0 -> 91 bytes .../mods/basenodes/textures/default_leaves.png | Bin 0 -> 883 bytes .../basenodes/textures/default_mossycobble.png | Bin 0 -> 574 bytes .../basenodes/textures/default_pine_needles.png | Bin 0 -> 648 bytes .../mods/basenodes/textures/default_pine_tree.png | Bin 0 -> 604 bytes .../basenodes/textures/default_pine_tree_top.png | Bin 0 -> 174 bytes .../basenodes/textures/default_river_water.png | Bin 0 -> 496 bytes .../textures/default_river_water_flowing.png | Bin 0 -> 99 bytes .../mods/basenodes/textures/default_sand.png | Bin 0 -> 554 bytes .../mods/basenodes/textures/default_snow.png | Bin 0 -> 166 bytes .../mods/basenodes/textures/default_snow_side.png | Bin 0 -> 152 bytes .../mods/basenodes/textures/default_stone.png | Bin 0 -> 313 bytes .../mods/basenodes/textures/default_tree.png | Bin 0 -> 659 bytes .../mods/basenodes/textures/default_tree_top.png | Bin 0 -> 175 bytes .../mods/basenodes/textures/default_water.png | Bin 0 -> 302 bytes .../basenodes/textures/default_water_flowing.png | Bin 0 -> 115 bytes games/devtest/mods/basetools/init.lua | 295 +++++++++ games/devtest/mods/basetools/mod.conf | 2 + .../mods/basetools/textures/basetools_dirtpick.png | Bin 0 -> 307 bytes .../basetools/textures/basetools_firesword.png | Bin 0 -> 190 bytes .../mods/basetools/textures/basetools_icesword.png | Bin 0 -> 190 bytes .../mods/basetools/textures/basetools_mesepick.png | Bin 0 -> 155 bytes .../mods/basetools/textures/basetools_steelaxe.png | Bin 0 -> 131 bytes .../basetools/textures/basetools_steeldagger.png | Bin 0 -> 154 bytes .../basetools/textures/basetools_steelpick.png | Bin 0 -> 159 bytes .../basetools/textures/basetools_steelpick_l1.png | Bin 0 -> 190 bytes .../basetools/textures/basetools_steelpick_l2.png | Bin 0 -> 177 bytes .../basetools/textures/basetools_steelshears.png | Bin 0 -> 208 bytes .../basetools/textures/basetools_steelshovel.png | Bin 0 -> 140 bytes .../basetools/textures/basetools_steelsword.png | Bin 0 -> 163 bytes .../mods/basetools/textures/basetools_stoneaxe.png | Bin 0 -> 130 bytes .../basetools/textures/basetools_stonepick.png | Bin 0 -> 155 bytes .../basetools/textures/basetools_stoneshears.png | Bin 0 -> 224 bytes .../basetools/textures/basetools_stoneshovel.png | Bin 0 -> 134 bytes .../basetools/textures/basetools_stonesword.png | Bin 0 -> 159 bytes .../mods/basetools/textures/basetools_woodaxe.png | Bin 0 -> 121 bytes .../mods/basetools/textures/basetools_woodpick.png | Bin 0 -> 149 bytes .../basetools/textures/basetools_woodshears.png | Bin 0 -> 212 bytes .../basetools/textures/basetools_woodshovel.png | Bin 0 -> 133 bytes .../basetools/textures/basetools_woodsword.png | Bin 0 -> 139 bytes games/devtest/mods/bucket/init.lua | 26 + games/devtest/mods/bucket/mod.conf | 2 + games/devtest/mods/bucket/textures/bucket.png | Bin 0 -> 163 bytes games/devtest/mods/bucket/textures/bucket_lava.png | Bin 0 -> 168 bytes .../devtest/mods/bucket/textures/bucket_water.png | Bin 0 -> 168 bytes games/devtest/mods/chest/init.lua | 27 + games/devtest/mods/chest/mod.conf | 2 + games/devtest/mods/chest/textures/chest_chest.png | Bin 0 -> 163 bytes games/devtest/mods/chest_of_everything/init.lua | 135 ++++ games/devtest/mods/chest_of_everything/mod.conf | 2 + .../textures/chest_of_everything_chest.png | Bin 0 -> 210 bytes games/devtest/mods/dignodes/init.lua | 37 ++ games/devtest/mods/dignodes/mod.conf | 2 + .../mods/dignodes/textures/dignodes_choppy.png | Bin 0 -> 187 bytes .../mods/dignodes/textures/dignodes_cracky.png | Bin 0 -> 193 bytes .../mods/dignodes/textures/dignodes_crumbly.png | Bin 0 -> 172 bytes .../dignodes/textures/dignodes_dig_immediate.png | Bin 0 -> 170 bytes .../mods/dignodes/textures/dignodes_none.png | Bin 0 -> 201 bytes .../mods/dignodes/textures/dignodes_rating1.png | Bin 0 -> 94 bytes .../mods/dignodes/textures/dignodes_rating2.png | Bin 0 -> 92 bytes .../mods/dignodes/textures/dignodes_rating3.png | Bin 0 -> 93 bytes games/devtest/mods/experimental/commands.lua | 215 +++++++ games/devtest/mods/experimental/detached.lua | 29 + games/devtest/mods/experimental/init.lua | 23 + games/devtest/mods/experimental/items.lua | 103 +++ games/devtest/mods/experimental/mod.conf | 2 + .../textures/experimental_callback_node.png | Bin 0 -> 139 bytes .../textures/experimental_particle_sheet.png | Bin 0 -> 208 bytes .../textures/experimental_particle_vertical.png | Bin 0 -> 308 bytes .../textures/experimental_tester_tool_1.png | Bin 0 -> 138 bytes games/devtest/mods/give_initial_stuff/init.lua | 37 ++ games/devtest/mods/give_initial_stuff/mod.conf | 3 + games/devtest/mods/initial_message/init.lua | 9 + games/devtest/mods/initial_message/mod.conf | 2 + games/devtest/mods/mapgen/init.lua | 81 +++ games/devtest/mods/mapgen/mod.conf | 3 + games/devtest/mods/modchannels/init.lua | 14 + games/devtest/mods/modchannels/mod.conf | 2 + games/devtest/mods/soundstuff/init.lua | 170 +++++ games/devtest/mods/soundstuff/mod.conf | 2 + .../mods/soundstuff/sounds/soundstuff_mono.ogg | Bin 0 -> 4362 bytes .../mods/soundstuff/textures/soundstuff_eat.png | Bin 0 -> 113 bytes .../soundstuff/textures/soundstuff_node_blank.png | Bin 0 -> 83 bytes .../textures/soundstuff_node_climbable.png | Bin 0 -> 189 bytes .../soundstuff/textures/soundstuff_node_dig.png | Bin 0 -> 126 bytes .../soundstuff/textures/soundstuff_node_dug.png | Bin 0 -> 132 bytes .../soundstuff/textures/soundstuff_node_fall.png | Bin 0 -> 100 bytes .../textures/soundstuff_node_footstep.png | Bin 0 -> 120 bytes .../soundstuff/textures/soundstuff_node_place.png | Bin 0 -> 115 bytes .../textures/soundstuff_node_place_failed.png | Bin 0 -> 143 bytes .../soundstuff/textures/soundstuff_node_sound.png | Bin 0 -> 116 bytes games/devtest/mods/stairs/init.lua | 65 ++ games/devtest/mods/stairs/mod.conf | 3 + games/devtest/mods/testentities/armor.lua | 41 ++ games/devtest/mods/testentities/callbacks.lua | 75 +++ games/devtest/mods/testentities/init.lua | 3 + games/devtest/mods/testentities/mod.conf | 2 + .../textures/testentities_armorball.png | Bin 0 -> 561 bytes .../textures/testentities_callback.png | Bin 0 -> 156 bytes .../textures/testentities_callback_step.png | Bin 0 -> 166 bytes .../testentities/textures/testentities_cube1.png | Bin 0 -> 130 bytes .../testentities/textures/testentities_cube2.png | Bin 0 -> 128 bytes .../testentities/textures/testentities_cube3.png | Bin 0 -> 124 bytes .../testentities/textures/testentities_cube4.png | Bin 0 -> 126 bytes .../testentities/textures/testentities_cube5.png | Bin 0 -> 126 bytes .../testentities/textures/testentities_cube6.png | Bin 0 -> 126 bytes .../textures/testentities_dungeon_master.png | Bin 0 -> 2855 bytes .../testentities/textures/testentities_sprite.png | Bin 0 -> 120 bytes .../textures/testentities_upright_sprite1.png | Bin 0 -> 114 bytes .../textures/testentities_upright_sprite2.png | Bin 0 -> 119 bytes games/devtest/mods/testentities/visuals.lua | 74 +++ games/devtest/mods/testfood/init.lua | 24 + games/devtest/mods/testfood/mod.conf | 2 + .../mods/testfood/textures/testfood_bad.png | Bin 0 -> 126 bytes .../mods/testfood/textures/testfood_bad2.png | Bin 0 -> 133 bytes .../mods/testfood/textures/testfood_good.png | Bin 0 -> 129 bytes .../mods/testfood/textures/testfood_good2.png | Bin 0 -> 145 bytes games/devtest/mods/testformspec/callbacks.lua | 51 ++ games/devtest/mods/testformspec/dummy_items.lua | 14 + games/devtest/mods/testformspec/formspec.lua | 381 ++++++++++++ games/devtest/mods/testformspec/init.lua | 3 + games/devtest/mods/testformspec/mod.conf | 2 + .../textures/testformspec_animation.jpg | Bin 0 -> 4376 bytes .../textures/testformspec_animation.png | Bin 0 -> 214 bytes .../mods/testformspec/textures/testformspec_bg.png | Bin 0 -> 92 bytes .../textures/testformspec_bg_9slice.png | Bin 0 -> 146 bytes .../textures/testformspec_bg_9slice_hovered.png | Bin 0 -> 146 bytes .../textures/testformspec_bg_9slice_pressed.png | Bin 0 -> 146 bytes .../textures/testformspec_bg_hovered.png | Bin 0 -> 92 bytes .../textures/testformspec_bg_pressed.png | Bin 0 -> 91 bytes .../textures/testformspec_button_image.png | Bin 0 -> 146 bytes .../testformspec/textures/testformspec_hovered.png | Bin 0 -> 195 bytes .../testformspec/textures/testformspec_item.png | Bin 0 -> 182 bytes .../testformspec/textures/testformspec_node.png | Bin 0 -> 113 bytes .../testformspec/textures/testformspec_pressed.png | Bin 0 -> 165 bytes games/devtest/mods/testnodes/README.md | 11 + games/devtest/mods/testnodes/drawtypes.lua | 517 +++++++++++++++ games/devtest/mods/testnodes/init.lua | 10 + games/devtest/mods/testnodes/light.lua | 48 ++ games/devtest/mods/testnodes/liquids.lua | 91 +++ games/devtest/mods/testnodes/meshes.lua | 145 +++++ games/devtest/mods/testnodes/mod.conf | 2 + .../mods/testnodes/models/testnodes_ocorner.obj | 23 + .../mods/testnodes/models/testnodes_pyramid.obj | 24 + games/devtest/mods/testnodes/nodeboxes.lua | 80 +++ games/devtest/mods/testnodes/param2.lua | 168 +++++ games/devtest/mods/testnodes/properties.lua | 270 ++++++++ games/devtest/mods/testnodes/settingtypes.txt | 4 + games/devtest/mods/testnodes/textures.lua | 67 ++ .../mods/testnodes/textures/testnodes_1.png | Bin 0 -> 107 bytes .../mods/testnodes/textures/testnodes_1g.png | Bin 0 -> 104 bytes .../mods/testnodes/textures/testnodes_1w.png | Bin 0 -> 121 bytes .../mods/testnodes/textures/testnodes_1wg.png | Bin 0 -> 122 bytes .../mods/testnodes/textures/testnodes_2.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_2g.png | Bin 0 -> 110 bytes .../mods/testnodes/textures/testnodes_2w.png | Bin 0 -> 134 bytes .../mods/testnodes/textures/testnodes_2wg.png | Bin 0 -> 135 bytes .../mods/testnodes/textures/testnodes_3.png | Bin 0 -> 105 bytes .../mods/testnodes/textures/testnodes_3g.png | Bin 0 -> 103 bytes .../mods/testnodes/textures/testnodes_3w.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_3wg.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_4.png | Bin 0 -> 97 bytes .../mods/testnodes/textures/testnodes_4g.png | Bin 0 -> 95 bytes .../mods/testnodes/textures/testnodes_4w.png | Bin 0 -> 128 bytes .../mods/testnodes/textures/testnodes_4wg.png | Bin 0 -> 128 bytes .../mods/testnodes/textures/testnodes_5.png | Bin 0 -> 98 bytes .../mods/testnodes/textures/testnodes_5g.png | Bin 0 -> 98 bytes .../mods/testnodes/textures/testnodes_5w.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_5wg.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_6.png | Bin 0 -> 100 bytes .../mods/testnodes/textures/testnodes_6g.png | Bin 0 -> 98 bytes .../mods/testnodes/textures/testnodes_6w.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_6wg.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_airlike.png | Bin 0 -> 92 bytes .../mods/testnodes/textures/testnodes_allfaces.png | Bin 0 -> 150 bytes .../textures/testnodes_allfaces_optional.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_alpha.png | Bin 0 -> 96 bytes .../mods/testnodes/textures/testnodes_alpha128.png | Bin 0 -> 136 bytes .../mods/testnodes/textures/testnodes_alpha191.png | Bin 0 -> 132 bytes .../mods/testnodes/textures/testnodes_alpha64.png | Bin 0 -> 134 bytes .../mods/testnodes/textures/testnodes_anim.png | Bin 0 -> 274 bytes .../textures/testnodes_attached_bottom.png | Bin 0 -> 86 bytes .../testnodes/textures/testnodes_attached_side.png | Bin 0 -> 98 bytes .../testnodes/textures/testnodes_attached_top.png | Bin 0 -> 87 bytes .../textures/testnodes_attachedw_bottom.png | Bin 0 -> 130 bytes .../textures/testnodes_attachedw_side.png | Bin 0 -> 122 bytes .../testnodes/textures/testnodes_attachedw_top.png | Bin 0 -> 109 bytes .../mods/testnodes/textures/testnodes_bouncy.png | Bin 0 -> 106 bytes .../testnodes/textures/testnodes_buildable_to.png | Bin 0 -> 89 bytes .../textures/testnodes_climbable_nojump_side.png | Bin 0 -> 164 bytes .../textures/testnodes_climbable_side.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_damage.png | Bin 0 -> 108 bytes .../testnodes/textures/testnodes_damage_neg.png | Bin 0 -> 121 bytes .../mods/testnodes/textures/testnodes_drowning.png | Bin 0 -> 127 bytes .../textures/testnodes_fall_damage_minus.png | Bin 0 -> 116 bytes .../textures/testnodes_fall_damage_plus.png | Bin 0 -> 117 bytes .../testnodes/textures/testnodes_fencelike.png | Bin 0 -> 90 bytes .../mods/testnodes/textures/testnodes_firelike.png | Bin 0 -> 149 bytes .../testnodes/textures/testnodes_glasslike.png | Bin 0 -> 117 bytes .../textures/testnodes_glasslike_detail.png | Bin 0 -> 167 bytes .../textures/testnodes_glasslike_framed.png | Bin 0 -> 88 bytes .../textures/testnodes_glasslike_framed2.png | Bin 0 -> 118 bytes .../testnodes_glasslike_framed_optional.png | Bin 0 -> 128 bytes .../textures/testnodes_glasslikeliquid.png | Bin 0 -> 122 bytes .../mods/testnodes/textures/testnodes_light.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_light_1.png | Bin 0 -> 158 bytes .../mods/testnodes/textures/testnodes_light_10.png | Bin 0 -> 147 bytes .../mods/testnodes/textures/testnodes_light_11.png | Bin 0 -> 149 bytes .../mods/testnodes/textures/testnodes_light_12.png | Bin 0 -> 138 bytes .../mods/testnodes/textures/testnodes_light_13.png | Bin 0 -> 137 bytes .../mods/testnodes/textures/testnodes_light_14.png | Bin 0 -> 132 bytes .../mods/testnodes/textures/testnodes_light_2.png | Bin 0 -> 152 bytes .../mods/testnodes/textures/testnodes_light_3.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_light_4.png | Bin 0 -> 157 bytes .../mods/testnodes/textures/testnodes_light_5.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_light_6.png | Bin 0 -> 154 bytes .../mods/testnodes/textures/testnodes_light_7.png | Bin 0 -> 146 bytes .../mods/testnodes/textures/testnodes_light_8.png | Bin 0 -> 139 bytes .../mods/testnodes/textures/testnodes_light_9.png | Bin 0 -> 149 bytes .../testnodes/textures/testnodes_line_crossing.png | Bin 0 -> 130 bytes .../testnodes/textures/testnodes_line_curved.png | Bin 0 -> 123 bytes .../testnodes/textures/testnodes_line_straight.png | Bin 0 -> 115 bytes .../textures/testnodes_line_t_junction.png | Bin 0 -> 128 bytes .../mods/testnodes/textures/testnodes_liquid.png | Bin 0 -> 95 bytes .../testnodes/textures/testnodes_liquidflowing.png | Bin 0 -> 132 bytes .../textures/testnodes_liquidflowing_r0.png | Bin 0 -> 162 bytes .../textures/testnodes_liquidflowing_r1.png | Bin 0 -> 160 bytes .../textures/testnodes_liquidflowing_r2.png | Bin 0 -> 154 bytes .../textures/testnodes_liquidflowing_r3.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidflowing_r4.png | Bin 0 -> 154 bytes .../textures/testnodes_liquidflowing_r5.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidflowing_r6.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidflowing_r7.png | Bin 0 -> 157 bytes .../textures/testnodes_liquidflowing_r8.png | Bin 0 -> 152 bytes .../testnodes/textures/testnodes_liquidsource.png | Bin 0 -> 128 bytes .../textures/testnodes_liquidsource_r0.png | Bin 0 -> 149 bytes .../textures/testnodes_liquidsource_r1.png | Bin 0 -> 152 bytes .../textures/testnodes_liquidsource_r2.png | Bin 0 -> 152 bytes .../textures/testnodes_liquidsource_r3.png | Bin 0 -> 152 bytes .../textures/testnodes_liquidsource_r4.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidsource_r5.png | Bin 0 -> 150 bytes .../textures/testnodes_liquidsource_r6.png | Bin 0 -> 148 bytes .../textures/testnodes_liquidsource_r7.png | Bin 0 -> 154 bytes .../textures/testnodes_liquidsource_r8.png | Bin 0 -> 148 bytes .../testnodes/textures/testnodes_mesh_stripes.png | Bin 0 -> 150 bytes .../testnodes/textures/testnodes_mesh_stripes2.png | Bin 0 -> 144 bytes .../testnodes/textures/testnodes_mesh_stripes3.png | Bin 0 -> 85 bytes .../testnodes/textures/testnodes_mesh_stripes4.png | Bin 0 -> 93 bytes .../mods/testnodes/textures/testnodes_node.png | Bin 0 -> 89 bytes .../testnodes/textures/testnodes_node_falling.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_nodebox.png | Bin 0 -> 112 bytes .../testnodes/textures/testnodes_nojump_side.png | Bin 0 -> 94 bytes .../testnodes/textures/testnodes_nojump_top.png | Bin 0 -> 121 bytes .../mods/testnodes/textures/testnodes_normal.png | Bin 0 -> 92 bytes .../mods/testnodes/textures/testnodes_normal1.png | Bin 0 -> 114 bytes .../mods/testnodes/textures/testnodes_normal2.png | Bin 0 -> 122 bytes .../mods/testnodes/textures/testnodes_normal3.png | Bin 0 -> 114 bytes .../mods/testnodes/textures/testnodes_normal4.png | Bin 0 -> 106 bytes .../mods/testnodes/textures/testnodes_normal5.png | Bin 0 -> 109 bytes .../mods/testnodes/textures/testnodes_normal6.png | Bin 0 -> 111 bytes .../textures/testnodes_palette_facedir.png | Bin 0 -> 87 bytes .../testnodes/textures/testnodes_palette_full.png | Bin 0 -> 568 bytes .../textures/testnodes_palette_wallmounted.png | Bin 0 -> 136 bytes .../testnodes/textures/testnodes_plantlike.png | Bin 0 -> 183 bytes .../textures/testnodes_plantlike_degrotate.png | Bin 0 -> 176 bytes .../textures/testnodes_plantlike_leveled.png | Bin 0 -> 163 bytes .../textures/testnodes_plantlike_meshoptions.png | Bin 0 -> 164 bytes .../textures/testnodes_plantlike_rooted.png | Bin 0 -> 182 bytes .../textures/testnodes_plantlike_rooted_base.png | Bin 0 -> 101 bytes ...tnodes_plantlike_rooted_base_side_degrotate.png | Bin 0 -> 145 bytes ...estnodes_plantlike_rooted_base_side_leveled.png | Bin 0 -> 127 bytes ...odes_plantlike_rooted_base_side_meshoptions.png | Bin 0 -> 128 bytes ...testnodes_plantlike_rooted_base_side_waving.png | Bin 0 -> 126 bytes .../testnodes_plantlike_rooted_degrotate.png | Bin 0 -> 176 bytes .../testnodes_plantlike_rooted_leveled.png | Bin 0 -> 162 bytes .../testnodes_plantlike_rooted_meshoptions.png | Bin 0 -> 162 bytes .../textures/testnodes_plantlike_rooted_waving.png | Bin 0 -> 125 bytes .../textures/testnodes_plantlike_waving.png | Bin 0 -> 127 bytes .../textures/testnodes_rail2_crossing.png | Bin 0 -> 246 bytes .../testnodes/textures/testnodes_rail2_curved.png | Bin 0 -> 253 bytes .../textures/testnodes_rail2_straight.png | Bin 0 -> 246 bytes .../textures/testnodes_rail2_t_junction.png | Bin 0 -> 254 bytes .../testnodes/textures/testnodes_rail_crossing.png | Bin 0 -> 151 bytes .../testnodes/textures/testnodes_rail_curved.png | Bin 0 -> 164 bytes .../testnodes/textures/testnodes_rail_straight.png | Bin 0 -> 133 bytes .../textures/testnodes_rail_t_junction.png | Bin 0 -> 202 bytes .../mods/testnodes/textures/testnodes_signlike.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_slippery.png | Bin 0 -> 111 bytes .../textures/testnodes_street_crossing.png | Bin 0 -> 137 bytes .../testnodes/textures/testnodes_street_curved.png | Bin 0 -> 115 bytes .../textures/testnodes_street_straight.png | Bin 0 -> 101 bytes .../textures/testnodes_street_t_junction.png | Bin 0 -> 126 bytes .../textures/testnodes_sunlight_filter.png | Bin 0 -> 113 bytes .../textures/testnodes_torchlike_ceiling.png | Bin 0 -> 157 bytes .../textures/testnodes_torchlike_floor.png | Bin 0 -> 141 bytes .../textures/testnodes_torchlike_wall.png | Bin 0 -> 158 bytes games/devtest/mods/testpathfinder/README.md | 15 + games/devtest/mods/testpathfinder/init.lua | 132 ++++ games/devtest/mods/testpathfinder/mod.conf | 2 + .../textures/testpathfinder_testpathfinder.png | Bin 0 -> 159 bytes .../textures/testpathfinder_waypoint.png | Bin 0 -> 99 bytes .../textures/testpathfinder_waypoint_end.png | Bin 0 -> 147 bytes .../textures/testpathfinder_waypoint_start.png | Bin 0 -> 139 bytes games/devtest/mods/testtools/README.md | 99 +++ games/devtest/mods/testtools/init.lua | 691 +++++++++++++++++++++ games/devtest/mods/testtools/mod.conf | 2 + .../textures/testtools_entity_rotator.png | Bin 0 -> 151 bytes .../testtools/textures/testtools_entity_scaler.png | Bin 0 -> 182 bytes .../textures/testtools_entity_spawner.png | Bin 0 -> 189 bytes .../textures/testtools_falling_node_tool.png | Bin 0 -> 140 bytes .../testtools/textures/testtools_node_setter.png | Bin 0 -> 146 bytes .../textures/testtools_object_attacher.png | Bin 0 -> 173 bytes .../testtools/textures/testtools_object_editor.png | Bin 0 -> 180 bytes .../testtools/textures/testtools_object_mover.png | Bin 0 -> 175 bytes .../testtools/textures/testtools_param2tool.png | Bin 0 -> 127 bytes .../mods/testtools/textures/testtools_remover.png | Bin 0 -> 129 bytes games/devtest/mods/tiled/init.lua | 33 + games/devtest/mods/tiled/mod.conf | 3 + games/devtest/mods/tiled/textures/tiled_tiled.png | Bin 0 -> 410 bytes games/devtest/mods/unittests/crafting.lua | 120 ++++ games/devtest/mods/unittests/crafting_prepare.lua | 88 +++ games/devtest/mods/unittests/init.lua | 16 + games/devtest/mods/unittests/mod.conf | 2 + games/devtest/mods/unittests/player.lua | 73 +++ games/devtest/mods/unittests/random.lua | 10 + .../unittests/textures/unittests_coal_lump.png | Bin 0 -> 160 bytes .../unittests/textures/unittests_iron_lump.png | Bin 0 -> 154 bytes .../textures/unittests_repairable_tool.png | Bin 0 -> 160 bytes .../unittests/textures/unittests_steel_ingot.png | Bin 0 -> 159 bytes .../mods/unittests/textures/unittests_stick.png | Bin 0 -> 147 bytes .../mods/unittests/textures/unittests_torch.png | Bin 0 -> 155 bytes .../textures/unittests_unrepairable_tool.png | Bin 0 -> 157 bytes games/devtest/mods/util_commands/init.lua | 137 ++++ games/devtest/mods/util_commands/mod.conf | 2 + games/devtest/screenshot.png | Bin 0 -> 133364 bytes games/devtest/settingtypes.txt | 37 ++ games/minimal/LICENSE.txt | 4 - games/minimal/README.md | 52 -- games/minimal/game.conf | 2 - games/minimal/menu/background.png | Bin 152 -> 0 bytes games/minimal/menu/header.png | Bin 210 -> 0 bytes games/minimal/menu/icon.png | Bin 217 -> 0 bytes games/minimal/mods/basenodes/init.lua | 334 ---------- games/minimal/mods/basenodes/mod.conf | 2 - .../textures/basenodes_dirt_with_grass_bottom.png | Bin 187 -> 0 bytes .../textures/basenodes_dirt_with_snow.png | Bin 166 -> 0 bytes .../textures/basenodes_dirt_with_snow_bottom.png | Bin 177 -> 0 bytes .../basenodes/textures/basenodes_snow_sheet.png | Bin 166 -> 0 bytes .../mods/basenodes/textures/default_apple.png | Bin 102 -> 0 bytes .../mods/basenodes/textures/default_cobble.png | Bin 340 -> 0 bytes .../basenodes/textures/default_desert_sand.png | Bin 293 -> 0 bytes .../basenodes/textures/default_desert_stone.png | Bin 584 -> 0 bytes .../mods/basenodes/textures/default_dirt.png | Bin 790 -> 0 bytes .../mods/basenodes/textures/default_grass.png | Bin 697 -> 0 bytes .../mods/basenodes/textures/default_grass_side.png | Bin 796 -> 0 bytes .../mods/basenodes/textures/default_gravel.png | Bin 171 -> 0 bytes .../mods/basenodes/textures/default_ice.png | Bin 369 -> 0 bytes .../basenodes/textures/default_junglegrass.png | Bin 201 -> 0 bytes .../basenodes/textures/default_jungleleaves.png | Bin 399 -> 0 bytes .../mods/basenodes/textures/default_jungletree.png | Bin 730 -> 0 bytes .../basenodes/textures/default_jungletree_top.png | Bin 714 -> 0 bytes .../mods/basenodes/textures/default_lava.png | Bin 172 -> 0 bytes .../basenodes/textures/default_lava_flowing.png | Bin 91 -> 0 bytes .../mods/basenodes/textures/default_leaves.png | Bin 883 -> 0 bytes .../basenodes/textures/default_mossycobble.png | Bin 574 -> 0 bytes .../basenodes/textures/default_pine_needles.png | Bin 648 -> 0 bytes .../mods/basenodes/textures/default_pine_tree.png | Bin 604 -> 0 bytes .../basenodes/textures/default_pine_tree_top.png | Bin 174 -> 0 bytes .../basenodes/textures/default_river_water.png | Bin 496 -> 0 bytes .../textures/default_river_water_flowing.png | Bin 99 -> 0 bytes .../mods/basenodes/textures/default_sand.png | Bin 554 -> 0 bytes .../mods/basenodes/textures/default_snow.png | Bin 166 -> 0 bytes .../mods/basenodes/textures/default_snow_side.png | Bin 152 -> 0 bytes .../mods/basenodes/textures/default_stone.png | Bin 313 -> 0 bytes .../mods/basenodes/textures/default_tree.png | Bin 659 -> 0 bytes .../mods/basenodes/textures/default_tree_top.png | Bin 175 -> 0 bytes .../mods/basenodes/textures/default_water.png | Bin 302 -> 0 bytes .../basenodes/textures/default_water_flowing.png | Bin 115 -> 0 bytes games/minimal/mods/basetools/init.lua | 295 --------- games/minimal/mods/basetools/mod.conf | 2 - .../mods/basetools/textures/basetools_dirtpick.png | Bin 307 -> 0 bytes .../basetools/textures/basetools_firesword.png | Bin 190 -> 0 bytes .../mods/basetools/textures/basetools_icesword.png | Bin 190 -> 0 bytes .../mods/basetools/textures/basetools_mesepick.png | Bin 155 -> 0 bytes .../mods/basetools/textures/basetools_steelaxe.png | Bin 131 -> 0 bytes .../basetools/textures/basetools_steeldagger.png | Bin 154 -> 0 bytes .../basetools/textures/basetools_steelpick.png | Bin 159 -> 0 bytes .../basetools/textures/basetools_steelpick_l1.png | Bin 190 -> 0 bytes .../basetools/textures/basetools_steelpick_l2.png | Bin 177 -> 0 bytes .../basetools/textures/basetools_steelshears.png | Bin 208 -> 0 bytes .../basetools/textures/basetools_steelshovel.png | Bin 140 -> 0 bytes .../basetools/textures/basetools_steelsword.png | Bin 163 -> 0 bytes .../mods/basetools/textures/basetools_stoneaxe.png | Bin 130 -> 0 bytes .../basetools/textures/basetools_stonepick.png | Bin 155 -> 0 bytes .../basetools/textures/basetools_stoneshears.png | Bin 224 -> 0 bytes .../basetools/textures/basetools_stoneshovel.png | Bin 134 -> 0 bytes .../basetools/textures/basetools_stonesword.png | Bin 159 -> 0 bytes .../mods/basetools/textures/basetools_woodaxe.png | Bin 121 -> 0 bytes .../mods/basetools/textures/basetools_woodpick.png | Bin 149 -> 0 bytes .../basetools/textures/basetools_woodshears.png | Bin 212 -> 0 bytes .../basetools/textures/basetools_woodshovel.png | Bin 133 -> 0 bytes .../basetools/textures/basetools_woodsword.png | Bin 139 -> 0 bytes games/minimal/mods/bucket/init.lua | 26 - games/minimal/mods/bucket/mod.conf | 2 - games/minimal/mods/bucket/textures/bucket.png | Bin 163 -> 0 bytes games/minimal/mods/bucket/textures/bucket_lava.png | Bin 168 -> 0 bytes .../minimal/mods/bucket/textures/bucket_water.png | Bin 168 -> 0 bytes games/minimal/mods/chest/init.lua | 27 - games/minimal/mods/chest/mod.conf | 2 - games/minimal/mods/chest/textures/chest_chest.png | Bin 163 -> 0 bytes games/minimal/mods/chest_of_everything/init.lua | 135 ---- games/minimal/mods/chest_of_everything/mod.conf | 2 - .../textures/chest_of_everything_chest.png | Bin 210 -> 0 bytes games/minimal/mods/dignodes/init.lua | 37 -- games/minimal/mods/dignodes/mod.conf | 2 - .../mods/dignodes/textures/dignodes_choppy.png | Bin 187 -> 0 bytes .../mods/dignodes/textures/dignodes_cracky.png | Bin 193 -> 0 bytes .../mods/dignodes/textures/dignodes_crumbly.png | Bin 172 -> 0 bytes .../dignodes/textures/dignodes_dig_immediate.png | Bin 170 -> 0 bytes .../mods/dignodes/textures/dignodes_none.png | Bin 201 -> 0 bytes .../mods/dignodes/textures/dignodes_rating1.png | Bin 94 -> 0 bytes .../mods/dignodes/textures/dignodes_rating2.png | Bin 92 -> 0 bytes .../mods/dignodes/textures/dignodes_rating3.png | Bin 93 -> 0 bytes games/minimal/mods/experimental/commands.lua | 215 ------- games/minimal/mods/experimental/detached.lua | 29 - games/minimal/mods/experimental/init.lua | 23 - games/minimal/mods/experimental/items.lua | 103 --- games/minimal/mods/experimental/mod.conf | 2 - .../textures/experimental_callback_node.png | Bin 139 -> 0 bytes .../textures/experimental_particle_sheet.png | Bin 208 -> 0 bytes .../textures/experimental_particle_vertical.png | Bin 308 -> 0 bytes .../textures/experimental_tester_tool_1.png | Bin 138 -> 0 bytes games/minimal/mods/give_initial_stuff/init.lua | 37 -- games/minimal/mods/give_initial_stuff/mod.conf | 3 - games/minimal/mods/initial_message/init.lua | 9 - games/minimal/mods/initial_message/mod.conf | 2 - games/minimal/mods/mapgen/init.lua | 81 --- games/minimal/mods/mapgen/mod.conf | 3 - games/minimal/mods/modchannels/init.lua | 14 - games/minimal/mods/modchannels/mod.conf | 2 - games/minimal/mods/soundstuff/init.lua | 170 ----- games/minimal/mods/soundstuff/mod.conf | 2 - .../mods/soundstuff/sounds/soundstuff_mono.ogg | Bin 4362 -> 0 bytes .../mods/soundstuff/textures/soundstuff_eat.png | Bin 113 -> 0 bytes .../soundstuff/textures/soundstuff_node_blank.png | Bin 83 -> 0 bytes .../textures/soundstuff_node_climbable.png | Bin 189 -> 0 bytes .../soundstuff/textures/soundstuff_node_dig.png | Bin 126 -> 0 bytes .../soundstuff/textures/soundstuff_node_dug.png | Bin 132 -> 0 bytes .../soundstuff/textures/soundstuff_node_fall.png | Bin 100 -> 0 bytes .../textures/soundstuff_node_footstep.png | Bin 120 -> 0 bytes .../soundstuff/textures/soundstuff_node_place.png | Bin 115 -> 0 bytes .../textures/soundstuff_node_place_failed.png | Bin 143 -> 0 bytes .../soundstuff/textures/soundstuff_node_sound.png | Bin 116 -> 0 bytes games/minimal/mods/stairs/init.lua | 65 -- games/minimal/mods/stairs/mod.conf | 3 - games/minimal/mods/testentities/armor.lua | 41 -- games/minimal/mods/testentities/callbacks.lua | 75 --- games/minimal/mods/testentities/init.lua | 3 - games/minimal/mods/testentities/mod.conf | 2 - .../textures/testentities_armorball.png | Bin 561 -> 0 bytes .../textures/testentities_callback.png | Bin 156 -> 0 bytes .../textures/testentities_callback_step.png | Bin 166 -> 0 bytes .../testentities/textures/testentities_cube1.png | Bin 130 -> 0 bytes .../testentities/textures/testentities_cube2.png | Bin 128 -> 0 bytes .../testentities/textures/testentities_cube3.png | Bin 124 -> 0 bytes .../testentities/textures/testentities_cube4.png | Bin 126 -> 0 bytes .../testentities/textures/testentities_cube5.png | Bin 126 -> 0 bytes .../testentities/textures/testentities_cube6.png | Bin 126 -> 0 bytes .../textures/testentities_dungeon_master.png | Bin 2855 -> 0 bytes .../testentities/textures/testentities_sprite.png | Bin 120 -> 0 bytes .../textures/testentities_upright_sprite1.png | Bin 114 -> 0 bytes .../textures/testentities_upright_sprite2.png | Bin 119 -> 0 bytes games/minimal/mods/testentities/visuals.lua | 74 --- games/minimal/mods/testfood/init.lua | 24 - games/minimal/mods/testfood/mod.conf | 2 - .../mods/testfood/textures/testfood_bad.png | Bin 126 -> 0 bytes .../mods/testfood/textures/testfood_bad2.png | Bin 133 -> 0 bytes .../mods/testfood/textures/testfood_good.png | Bin 129 -> 0 bytes .../mods/testfood/textures/testfood_good2.png | Bin 145 -> 0 bytes games/minimal/mods/testformspec/callbacks.lua | 51 -- games/minimal/mods/testformspec/dummy_items.lua | 14 - games/minimal/mods/testformspec/formspec.lua | 381 ------------ games/minimal/mods/testformspec/init.lua | 3 - games/minimal/mods/testformspec/mod.conf | 2 - .../textures/testformspec_animation.jpg | Bin 4376 -> 0 bytes .../textures/testformspec_animation.png | Bin 214 -> 0 bytes .../mods/testformspec/textures/testformspec_bg.png | Bin 92 -> 0 bytes .../textures/testformspec_bg_9slice.png | Bin 146 -> 0 bytes .../textures/testformspec_bg_9slice_hovered.png | Bin 146 -> 0 bytes .../textures/testformspec_bg_9slice_pressed.png | Bin 146 -> 0 bytes .../textures/testformspec_bg_hovered.png | Bin 92 -> 0 bytes .../textures/testformspec_bg_pressed.png | Bin 91 -> 0 bytes .../textures/testformspec_button_image.png | Bin 146 -> 0 bytes .../testformspec/textures/testformspec_hovered.png | Bin 195 -> 0 bytes .../testformspec/textures/testformspec_item.png | Bin 182 -> 0 bytes .../testformspec/textures/testformspec_node.png | Bin 113 -> 0 bytes .../testformspec/textures/testformspec_pressed.png | Bin 165 -> 0 bytes games/minimal/mods/testnodes/README.md | 11 - games/minimal/mods/testnodes/drawtypes.lua | 517 --------------- games/minimal/mods/testnodes/init.lua | 10 - games/minimal/mods/testnodes/light.lua | 48 -- games/minimal/mods/testnodes/liquids.lua | 91 --- games/minimal/mods/testnodes/meshes.lua | 145 ----- games/minimal/mods/testnodes/mod.conf | 2 - .../mods/testnodes/models/testnodes_ocorner.obj | 23 - .../mods/testnodes/models/testnodes_pyramid.obj | 24 - games/minimal/mods/testnodes/nodeboxes.lua | 80 --- games/minimal/mods/testnodes/param2.lua | 168 ----- games/minimal/mods/testnodes/properties.lua | 270 -------- games/minimal/mods/testnodes/settingtypes.txt | 4 - games/minimal/mods/testnodes/textures.lua | 67 -- .../mods/testnodes/textures/testnodes_1.png | Bin 107 -> 0 bytes .../mods/testnodes/textures/testnodes_1g.png | Bin 104 -> 0 bytes .../mods/testnodes/textures/testnodes_1w.png | Bin 121 -> 0 bytes .../mods/testnodes/textures/testnodes_1wg.png | Bin 122 -> 0 bytes .../mods/testnodes/textures/testnodes_2.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_2g.png | Bin 110 -> 0 bytes .../mods/testnodes/textures/testnodes_2w.png | Bin 134 -> 0 bytes .../mods/testnodes/textures/testnodes_2wg.png | Bin 135 -> 0 bytes .../mods/testnodes/textures/testnodes_3.png | Bin 105 -> 0 bytes .../mods/testnodes/textures/testnodes_3g.png | Bin 103 -> 0 bytes .../mods/testnodes/textures/testnodes_3w.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_3wg.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_4.png | Bin 97 -> 0 bytes .../mods/testnodes/textures/testnodes_4g.png | Bin 95 -> 0 bytes .../mods/testnodes/textures/testnodes_4w.png | Bin 128 -> 0 bytes .../mods/testnodes/textures/testnodes_4wg.png | Bin 128 -> 0 bytes .../mods/testnodes/textures/testnodes_5.png | Bin 98 -> 0 bytes .../mods/testnodes/textures/testnodes_5g.png | Bin 98 -> 0 bytes .../mods/testnodes/textures/testnodes_5w.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_5wg.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_6.png | Bin 100 -> 0 bytes .../mods/testnodes/textures/testnodes_6g.png | Bin 98 -> 0 bytes .../mods/testnodes/textures/testnodes_6w.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_6wg.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_airlike.png | Bin 92 -> 0 bytes .../mods/testnodes/textures/testnodes_allfaces.png | Bin 150 -> 0 bytes .../textures/testnodes_allfaces_optional.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha.png | Bin 96 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha128.png | Bin 136 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha191.png | Bin 132 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha64.png | Bin 134 -> 0 bytes .../mods/testnodes/textures/testnodes_anim.png | Bin 274 -> 0 bytes .../textures/testnodes_attached_bottom.png | Bin 86 -> 0 bytes .../testnodes/textures/testnodes_attached_side.png | Bin 98 -> 0 bytes .../testnodes/textures/testnodes_attached_top.png | Bin 87 -> 0 bytes .../textures/testnodes_attachedw_bottom.png | Bin 130 -> 0 bytes .../textures/testnodes_attachedw_side.png | Bin 122 -> 0 bytes .../testnodes/textures/testnodes_attachedw_top.png | Bin 109 -> 0 bytes .../mods/testnodes/textures/testnodes_bouncy.png | Bin 106 -> 0 bytes .../testnodes/textures/testnodes_buildable_to.png | Bin 89 -> 0 bytes .../textures/testnodes_climbable_nojump_side.png | Bin 164 -> 0 bytes .../textures/testnodes_climbable_side.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_damage.png | Bin 108 -> 0 bytes .../testnodes/textures/testnodes_damage_neg.png | Bin 121 -> 0 bytes .../mods/testnodes/textures/testnodes_drowning.png | Bin 127 -> 0 bytes .../textures/testnodes_fall_damage_minus.png | Bin 116 -> 0 bytes .../textures/testnodes_fall_damage_plus.png | Bin 117 -> 0 bytes .../testnodes/textures/testnodes_fencelike.png | Bin 90 -> 0 bytes .../mods/testnodes/textures/testnodes_firelike.png | Bin 149 -> 0 bytes .../testnodes/textures/testnodes_glasslike.png | Bin 117 -> 0 bytes .../textures/testnodes_glasslike_detail.png | Bin 167 -> 0 bytes .../textures/testnodes_glasslike_framed.png | Bin 88 -> 0 bytes .../textures/testnodes_glasslike_framed2.png | Bin 118 -> 0 bytes .../testnodes_glasslike_framed_optional.png | Bin 128 -> 0 bytes .../textures/testnodes_glasslikeliquid.png | Bin 122 -> 0 bytes .../mods/testnodes/textures/testnodes_light.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_light_1.png | Bin 158 -> 0 bytes .../mods/testnodes/textures/testnodes_light_10.png | Bin 147 -> 0 bytes .../mods/testnodes/textures/testnodes_light_11.png | Bin 149 -> 0 bytes .../mods/testnodes/textures/testnodes_light_12.png | Bin 138 -> 0 bytes .../mods/testnodes/textures/testnodes_light_13.png | Bin 137 -> 0 bytes .../mods/testnodes/textures/testnodes_light_14.png | Bin 132 -> 0 bytes .../mods/testnodes/textures/testnodes_light_2.png | Bin 152 -> 0 bytes .../mods/testnodes/textures/testnodes_light_3.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_light_4.png | Bin 157 -> 0 bytes .../mods/testnodes/textures/testnodes_light_5.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_light_6.png | Bin 154 -> 0 bytes .../mods/testnodes/textures/testnodes_light_7.png | Bin 146 -> 0 bytes .../mods/testnodes/textures/testnodes_light_8.png | Bin 139 -> 0 bytes .../mods/testnodes/textures/testnodes_light_9.png | Bin 149 -> 0 bytes .../testnodes/textures/testnodes_line_crossing.png | Bin 130 -> 0 bytes .../testnodes/textures/testnodes_line_curved.png | Bin 123 -> 0 bytes .../testnodes/textures/testnodes_line_straight.png | Bin 115 -> 0 bytes .../textures/testnodes_line_t_junction.png | Bin 128 -> 0 bytes .../mods/testnodes/textures/testnodes_liquid.png | Bin 95 -> 0 bytes .../testnodes/textures/testnodes_liquidflowing.png | Bin 132 -> 0 bytes .../textures/testnodes_liquidflowing_r0.png | Bin 162 -> 0 bytes .../textures/testnodes_liquidflowing_r1.png | Bin 160 -> 0 bytes .../textures/testnodes_liquidflowing_r2.png | Bin 154 -> 0 bytes .../textures/testnodes_liquidflowing_r3.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidflowing_r4.png | Bin 154 -> 0 bytes .../textures/testnodes_liquidflowing_r5.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidflowing_r6.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidflowing_r7.png | Bin 157 -> 0 bytes .../textures/testnodes_liquidflowing_r8.png | Bin 152 -> 0 bytes .../testnodes/textures/testnodes_liquidsource.png | Bin 128 -> 0 bytes .../textures/testnodes_liquidsource_r0.png | Bin 149 -> 0 bytes .../textures/testnodes_liquidsource_r1.png | Bin 152 -> 0 bytes .../textures/testnodes_liquidsource_r2.png | Bin 152 -> 0 bytes .../textures/testnodes_liquidsource_r3.png | Bin 152 -> 0 bytes .../textures/testnodes_liquidsource_r4.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidsource_r5.png | Bin 150 -> 0 bytes .../textures/testnodes_liquidsource_r6.png | Bin 148 -> 0 bytes .../textures/testnodes_liquidsource_r7.png | Bin 154 -> 0 bytes .../textures/testnodes_liquidsource_r8.png | Bin 148 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes.png | Bin 150 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes2.png | Bin 144 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes3.png | Bin 85 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes4.png | Bin 93 -> 0 bytes .../mods/testnodes/textures/testnodes_node.png | Bin 89 -> 0 bytes .../testnodes/textures/testnodes_node_falling.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_nodebox.png | Bin 112 -> 0 bytes .../testnodes/textures/testnodes_nojump_side.png | Bin 94 -> 0 bytes .../testnodes/textures/testnodes_nojump_top.png | Bin 121 -> 0 bytes .../mods/testnodes/textures/testnodes_normal.png | Bin 92 -> 0 bytes .../mods/testnodes/textures/testnodes_normal1.png | Bin 114 -> 0 bytes .../mods/testnodes/textures/testnodes_normal2.png | Bin 122 -> 0 bytes .../mods/testnodes/textures/testnodes_normal3.png | Bin 114 -> 0 bytes .../mods/testnodes/textures/testnodes_normal4.png | Bin 106 -> 0 bytes .../mods/testnodes/textures/testnodes_normal5.png | Bin 109 -> 0 bytes .../mods/testnodes/textures/testnodes_normal6.png | Bin 111 -> 0 bytes .../textures/testnodes_palette_facedir.png | Bin 87 -> 0 bytes .../testnodes/textures/testnodes_palette_full.png | Bin 568 -> 0 bytes .../textures/testnodes_palette_wallmounted.png | Bin 136 -> 0 bytes .../testnodes/textures/testnodes_plantlike.png | Bin 183 -> 0 bytes .../textures/testnodes_plantlike_degrotate.png | Bin 176 -> 0 bytes .../textures/testnodes_plantlike_leveled.png | Bin 163 -> 0 bytes .../textures/testnodes_plantlike_meshoptions.png | Bin 164 -> 0 bytes .../textures/testnodes_plantlike_rooted.png | Bin 182 -> 0 bytes .../textures/testnodes_plantlike_rooted_base.png | Bin 101 -> 0 bytes ...tnodes_plantlike_rooted_base_side_degrotate.png | Bin 145 -> 0 bytes ...estnodes_plantlike_rooted_base_side_leveled.png | Bin 127 -> 0 bytes ...odes_plantlike_rooted_base_side_meshoptions.png | Bin 128 -> 0 bytes ...testnodes_plantlike_rooted_base_side_waving.png | Bin 126 -> 0 bytes .../testnodes_plantlike_rooted_degrotate.png | Bin 176 -> 0 bytes .../testnodes_plantlike_rooted_leveled.png | Bin 162 -> 0 bytes .../testnodes_plantlike_rooted_meshoptions.png | Bin 162 -> 0 bytes .../textures/testnodes_plantlike_rooted_waving.png | Bin 125 -> 0 bytes .../textures/testnodes_plantlike_waving.png | Bin 127 -> 0 bytes .../textures/testnodes_rail2_crossing.png | Bin 246 -> 0 bytes .../testnodes/textures/testnodes_rail2_curved.png | Bin 253 -> 0 bytes .../textures/testnodes_rail2_straight.png | Bin 246 -> 0 bytes .../textures/testnodes_rail2_t_junction.png | Bin 254 -> 0 bytes .../testnodes/textures/testnodes_rail_crossing.png | Bin 151 -> 0 bytes .../testnodes/textures/testnodes_rail_curved.png | Bin 164 -> 0 bytes .../testnodes/textures/testnodes_rail_straight.png | Bin 133 -> 0 bytes .../textures/testnodes_rail_t_junction.png | Bin 202 -> 0 bytes .../mods/testnodes/textures/testnodes_signlike.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_slippery.png | Bin 111 -> 0 bytes .../textures/testnodes_street_crossing.png | Bin 137 -> 0 bytes .../testnodes/textures/testnodes_street_curved.png | Bin 115 -> 0 bytes .../textures/testnodes_street_straight.png | Bin 101 -> 0 bytes .../textures/testnodes_street_t_junction.png | Bin 126 -> 0 bytes .../textures/testnodes_sunlight_filter.png | Bin 113 -> 0 bytes .../textures/testnodes_torchlike_ceiling.png | Bin 157 -> 0 bytes .../textures/testnodes_torchlike_floor.png | Bin 141 -> 0 bytes .../textures/testnodes_torchlike_wall.png | Bin 158 -> 0 bytes games/minimal/mods/testpathfinder/README.md | 15 - games/minimal/mods/testpathfinder/init.lua | 132 ---- games/minimal/mods/testpathfinder/mod.conf | 2 - .../textures/testpathfinder_testpathfinder.png | Bin 159 -> 0 bytes .../textures/testpathfinder_waypoint.png | Bin 99 -> 0 bytes .../textures/testpathfinder_waypoint_end.png | Bin 147 -> 0 bytes .../textures/testpathfinder_waypoint_start.png | Bin 139 -> 0 bytes games/minimal/mods/testtools/README.md | 99 --- games/minimal/mods/testtools/init.lua | 691 --------------------- games/minimal/mods/testtools/mod.conf | 2 - .../textures/testtools_entity_rotator.png | Bin 151 -> 0 bytes .../testtools/textures/testtools_entity_scaler.png | Bin 182 -> 0 bytes .../textures/testtools_entity_spawner.png | Bin 189 -> 0 bytes .../textures/testtools_falling_node_tool.png | Bin 140 -> 0 bytes .../testtools/textures/testtools_node_setter.png | Bin 146 -> 0 bytes .../textures/testtools_object_attacher.png | Bin 173 -> 0 bytes .../testtools/textures/testtools_object_editor.png | Bin 180 -> 0 bytes .../testtools/textures/testtools_object_mover.png | Bin 175 -> 0 bytes .../testtools/textures/testtools_param2tool.png | Bin 127 -> 0 bytes .../mods/testtools/textures/testtools_remover.png | Bin 129 -> 0 bytes games/minimal/mods/tiled/init.lua | 33 - games/minimal/mods/tiled/mod.conf | 3 - games/minimal/mods/tiled/textures/tiled_tiled.png | Bin 410 -> 0 bytes games/minimal/mods/unittests/crafting.lua | 120 ---- games/minimal/mods/unittests/crafting_prepare.lua | 88 --- games/minimal/mods/unittests/init.lua | 16 - games/minimal/mods/unittests/mod.conf | 2 - games/minimal/mods/unittests/player.lua | 73 --- games/minimal/mods/unittests/random.lua | 10 - .../unittests/textures/unittests_coal_lump.png | Bin 160 -> 0 bytes .../unittests/textures/unittests_iron_lump.png | Bin 154 -> 0 bytes .../textures/unittests_repairable_tool.png | Bin 160 -> 0 bytes .../unittests/textures/unittests_steel_ingot.png | Bin 159 -> 0 bytes .../mods/unittests/textures/unittests_stick.png | Bin 147 -> 0 bytes .../mods/unittests/textures/unittests_torch.png | Bin 155 -> 0 bytes .../textures/unittests_unrepairable_tool.png | Bin 157 -> 0 bytes games/minimal/mods/util_commands/init.lua | 137 ---- games/minimal/mods/util_commands/mod.conf | 2 - games/minimal/screenshot.png | Bin 133364 -> 0 bytes games/minimal/settingtypes.txt | 37 -- src/unittest/CMakeLists.txt | 2 +- src/unittest/test_servermodmanager.cpp | 10 +- util/test_multiplayer.sh | 2 +- 731 files changed, 5299 insertions(+), 5299 deletions(-) create mode 100644 games/devtest/LICENSE.txt create mode 100644 games/devtest/README.md create mode 100644 games/devtest/game.conf create mode 100644 games/devtest/menu/background.png create mode 100644 games/devtest/menu/header.png create mode 100644 games/devtest/menu/icon.png create mode 100644 games/devtest/mods/basenodes/init.lua create mode 100644 games/devtest/mods/basenodes/mod.conf create mode 100644 games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png create mode 100644 games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png create mode 100644 games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png create mode 100644 games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png create mode 100644 games/devtest/mods/basenodes/textures/default_apple.png create mode 100644 games/devtest/mods/basenodes/textures/default_cobble.png create mode 100644 games/devtest/mods/basenodes/textures/default_desert_sand.png create mode 100644 games/devtest/mods/basenodes/textures/default_desert_stone.png create mode 100644 games/devtest/mods/basenodes/textures/default_dirt.png create mode 100644 games/devtest/mods/basenodes/textures/default_grass.png create mode 100644 games/devtest/mods/basenodes/textures/default_grass_side.png create mode 100644 games/devtest/mods/basenodes/textures/default_gravel.png create mode 100644 games/devtest/mods/basenodes/textures/default_ice.png create mode 100644 games/devtest/mods/basenodes/textures/default_junglegrass.png create mode 100644 games/devtest/mods/basenodes/textures/default_jungleleaves.png create mode 100644 games/devtest/mods/basenodes/textures/default_jungletree.png create mode 100644 games/devtest/mods/basenodes/textures/default_jungletree_top.png create mode 100644 games/devtest/mods/basenodes/textures/default_lava.png create mode 100644 games/devtest/mods/basenodes/textures/default_lava_flowing.png create mode 100644 games/devtest/mods/basenodes/textures/default_leaves.png create mode 100644 games/devtest/mods/basenodes/textures/default_mossycobble.png create mode 100644 games/devtest/mods/basenodes/textures/default_pine_needles.png create mode 100644 games/devtest/mods/basenodes/textures/default_pine_tree.png create mode 100644 games/devtest/mods/basenodes/textures/default_pine_tree_top.png create mode 100644 games/devtest/mods/basenodes/textures/default_river_water.png create mode 100644 games/devtest/mods/basenodes/textures/default_river_water_flowing.png create mode 100644 games/devtest/mods/basenodes/textures/default_sand.png create mode 100644 games/devtest/mods/basenodes/textures/default_snow.png create mode 100644 games/devtest/mods/basenodes/textures/default_snow_side.png create mode 100644 games/devtest/mods/basenodes/textures/default_stone.png create mode 100644 games/devtest/mods/basenodes/textures/default_tree.png create mode 100644 games/devtest/mods/basenodes/textures/default_tree_top.png create mode 100644 games/devtest/mods/basenodes/textures/default_water.png create mode 100644 games/devtest/mods/basenodes/textures/default_water_flowing.png create mode 100644 games/devtest/mods/basetools/init.lua create mode 100644 games/devtest/mods/basetools/mod.conf create mode 100644 games/devtest/mods/basetools/textures/basetools_dirtpick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_firesword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_icesword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_mesepick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelaxe.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steeldagger.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelpick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelpick_l1.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelpick_l2.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelshears.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelshovel.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelsword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stoneaxe.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stonepick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stoneshears.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stoneshovel.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stonesword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodaxe.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodpick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodshears.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodshovel.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodsword.png create mode 100644 games/devtest/mods/bucket/init.lua create mode 100644 games/devtest/mods/bucket/mod.conf create mode 100644 games/devtest/mods/bucket/textures/bucket.png create mode 100644 games/devtest/mods/bucket/textures/bucket_lava.png create mode 100644 games/devtest/mods/bucket/textures/bucket_water.png create mode 100644 games/devtest/mods/chest/init.lua create mode 100644 games/devtest/mods/chest/mod.conf create mode 100644 games/devtest/mods/chest/textures/chest_chest.png create mode 100644 games/devtest/mods/chest_of_everything/init.lua create mode 100644 games/devtest/mods/chest_of_everything/mod.conf create mode 100644 games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png create mode 100644 games/devtest/mods/dignodes/init.lua create mode 100644 games/devtest/mods/dignodes/mod.conf create mode 100644 games/devtest/mods/dignodes/textures/dignodes_choppy.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_cracky.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_crumbly.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_none.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_rating1.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_rating2.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_rating3.png create mode 100644 games/devtest/mods/experimental/commands.lua create mode 100644 games/devtest/mods/experimental/detached.lua create mode 100644 games/devtest/mods/experimental/init.lua create mode 100644 games/devtest/mods/experimental/items.lua create mode 100644 games/devtest/mods/experimental/mod.conf create mode 100644 games/devtest/mods/experimental/textures/experimental_callback_node.png create mode 100644 games/devtest/mods/experimental/textures/experimental_particle_sheet.png create mode 100644 games/devtest/mods/experimental/textures/experimental_particle_vertical.png create mode 100644 games/devtest/mods/experimental/textures/experimental_tester_tool_1.png create mode 100644 games/devtest/mods/give_initial_stuff/init.lua create mode 100644 games/devtest/mods/give_initial_stuff/mod.conf create mode 100644 games/devtest/mods/initial_message/init.lua create mode 100644 games/devtest/mods/initial_message/mod.conf create mode 100644 games/devtest/mods/mapgen/init.lua create mode 100644 games/devtest/mods/mapgen/mod.conf create mode 100644 games/devtest/mods/modchannels/init.lua create mode 100644 games/devtest/mods/modchannels/mod.conf create mode 100644 games/devtest/mods/soundstuff/init.lua create mode 100644 games/devtest/mods/soundstuff/mod.conf create mode 100644 games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_eat.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_place.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png create mode 100644 games/devtest/mods/stairs/init.lua create mode 100644 games/devtest/mods/stairs/mod.conf create mode 100644 games/devtest/mods/testentities/armor.lua create mode 100644 games/devtest/mods/testentities/callbacks.lua create mode 100644 games/devtest/mods/testentities/init.lua create mode 100644 games/devtest/mods/testentities/mod.conf create mode 100644 games/devtest/mods/testentities/textures/testentities_armorball.png create mode 100644 games/devtest/mods/testentities/textures/testentities_callback.png create mode 100644 games/devtest/mods/testentities/textures/testentities_callback_step.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube1.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube2.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube3.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube4.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube5.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube6.png create mode 100644 games/devtest/mods/testentities/textures/testentities_dungeon_master.png create mode 100644 games/devtest/mods/testentities/textures/testentities_sprite.png create mode 100644 games/devtest/mods/testentities/textures/testentities_upright_sprite1.png create mode 100644 games/devtest/mods/testentities/textures/testentities_upright_sprite2.png create mode 100644 games/devtest/mods/testentities/visuals.lua create mode 100644 games/devtest/mods/testfood/init.lua create mode 100644 games/devtest/mods/testfood/mod.conf create mode 100644 games/devtest/mods/testfood/textures/testfood_bad.png create mode 100644 games/devtest/mods/testfood/textures/testfood_bad2.png create mode 100644 games/devtest/mods/testfood/textures/testfood_good.png create mode 100644 games/devtest/mods/testfood/textures/testfood_good2.png create mode 100644 games/devtest/mods/testformspec/callbacks.lua create mode 100644 games/devtest/mods/testformspec/dummy_items.lua create mode 100644 games/devtest/mods/testformspec/formspec.lua create mode 100644 games/devtest/mods/testformspec/init.lua create mode 100644 games/devtest/mods/testformspec/mod.conf create mode 100644 games/devtest/mods/testformspec/textures/testformspec_animation.jpg create mode 100644 games/devtest/mods/testformspec/textures/testformspec_animation.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_button_image.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_hovered.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_item.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_node.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_pressed.png create mode 100644 games/devtest/mods/testnodes/README.md create mode 100644 games/devtest/mods/testnodes/drawtypes.lua create mode 100644 games/devtest/mods/testnodes/init.lua create mode 100644 games/devtest/mods/testnodes/light.lua create mode 100644 games/devtest/mods/testnodes/liquids.lua create mode 100644 games/devtest/mods/testnodes/meshes.lua create mode 100644 games/devtest/mods/testnodes/mod.conf create mode 100644 games/devtest/mods/testnodes/models/testnodes_ocorner.obj create mode 100644 games/devtest/mods/testnodes/models/testnodes_pyramid.obj create mode 100644 games/devtest/mods/testnodes/nodeboxes.lua create mode 100644 games/devtest/mods/testnodes/param2.lua create mode 100644 games/devtest/mods/testnodes/properties.lua create mode 100644 games/devtest/mods/testnodes/settingtypes.txt create mode 100644 games/devtest/mods/testnodes/textures.lua create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_airlike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_allfaces.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha128.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha191.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha64.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_anim.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attached_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attached_top.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_bouncy.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_buildable_to.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_climbable_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_damage.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_damage_neg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_drowning.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_fencelike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_firelike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_10.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_11.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_12.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_13.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_14.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_7.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_8.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_9.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquid.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_node.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_node_falling.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_nodebox.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_nojump_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_nojump_top.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_palette_full.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_signlike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_slippery.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png create mode 100644 games/devtest/mods/testpathfinder/README.md create mode 100644 games/devtest/mods/testpathfinder/init.lua create mode 100644 games/devtest/mods/testpathfinder/mod.conf create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png create mode 100644 games/devtest/mods/testtools/README.md create mode 100644 games/devtest/mods/testtools/init.lua create mode 100644 games/devtest/mods/testtools/mod.conf create mode 100644 games/devtest/mods/testtools/textures/testtools_entity_rotator.png create mode 100644 games/devtest/mods/testtools/textures/testtools_entity_scaler.png create mode 100644 games/devtest/mods/testtools/textures/testtools_entity_spawner.png create mode 100644 games/devtest/mods/testtools/textures/testtools_falling_node_tool.png create mode 100644 games/devtest/mods/testtools/textures/testtools_node_setter.png create mode 100644 games/devtest/mods/testtools/textures/testtools_object_attacher.png create mode 100644 games/devtest/mods/testtools/textures/testtools_object_editor.png create mode 100644 games/devtest/mods/testtools/textures/testtools_object_mover.png create mode 100644 games/devtest/mods/testtools/textures/testtools_param2tool.png create mode 100644 games/devtest/mods/testtools/textures/testtools_remover.png create mode 100644 games/devtest/mods/tiled/init.lua create mode 100644 games/devtest/mods/tiled/mod.conf create mode 100644 games/devtest/mods/tiled/textures/tiled_tiled.png create mode 100644 games/devtest/mods/unittests/crafting.lua create mode 100644 games/devtest/mods/unittests/crafting_prepare.lua create mode 100644 games/devtest/mods/unittests/init.lua create mode 100644 games/devtest/mods/unittests/mod.conf create mode 100644 games/devtest/mods/unittests/player.lua create mode 100644 games/devtest/mods/unittests/random.lua create mode 100644 games/devtest/mods/unittests/textures/unittests_coal_lump.png create mode 100644 games/devtest/mods/unittests/textures/unittests_iron_lump.png create mode 100644 games/devtest/mods/unittests/textures/unittests_repairable_tool.png create mode 100644 games/devtest/mods/unittests/textures/unittests_steel_ingot.png create mode 100644 games/devtest/mods/unittests/textures/unittests_stick.png create mode 100644 games/devtest/mods/unittests/textures/unittests_torch.png create mode 100644 games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png create mode 100644 games/devtest/mods/util_commands/init.lua create mode 100644 games/devtest/mods/util_commands/mod.conf create mode 100644 games/devtest/screenshot.png create mode 100644 games/devtest/settingtypes.txt delete mode 100644 games/minimal/LICENSE.txt delete mode 100644 games/minimal/README.md delete mode 100644 games/minimal/game.conf delete mode 100644 games/minimal/menu/background.png delete mode 100644 games/minimal/menu/header.png delete mode 100644 games/minimal/menu/icon.png delete mode 100644 games/minimal/mods/basenodes/init.lua delete mode 100644 games/minimal/mods/basenodes/mod.conf delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png delete mode 100644 games/minimal/mods/basenodes/textures/default_apple.png delete mode 100644 games/minimal/mods/basenodes/textures/default_cobble.png delete mode 100644 games/minimal/mods/basenodes/textures/default_desert_sand.png delete mode 100644 games/minimal/mods/basenodes/textures/default_desert_stone.png delete mode 100644 games/minimal/mods/basenodes/textures/default_dirt.png delete mode 100644 games/minimal/mods/basenodes/textures/default_grass.png delete mode 100644 games/minimal/mods/basenodes/textures/default_grass_side.png delete mode 100644 games/minimal/mods/basenodes/textures/default_gravel.png delete mode 100644 games/minimal/mods/basenodes/textures/default_ice.png delete mode 100644 games/minimal/mods/basenodes/textures/default_junglegrass.png delete mode 100644 games/minimal/mods/basenodes/textures/default_jungleleaves.png delete mode 100644 games/minimal/mods/basenodes/textures/default_jungletree.png delete mode 100644 games/minimal/mods/basenodes/textures/default_jungletree_top.png delete mode 100644 games/minimal/mods/basenodes/textures/default_lava.png delete mode 100644 games/minimal/mods/basenodes/textures/default_lava_flowing.png delete mode 100644 games/minimal/mods/basenodes/textures/default_leaves.png delete mode 100644 games/minimal/mods/basenodes/textures/default_mossycobble.png delete mode 100644 games/minimal/mods/basenodes/textures/default_pine_needles.png delete mode 100644 games/minimal/mods/basenodes/textures/default_pine_tree.png delete mode 100644 games/minimal/mods/basenodes/textures/default_pine_tree_top.png delete mode 100644 games/minimal/mods/basenodes/textures/default_river_water.png delete mode 100644 games/minimal/mods/basenodes/textures/default_river_water_flowing.png delete mode 100644 games/minimal/mods/basenodes/textures/default_sand.png delete mode 100644 games/minimal/mods/basenodes/textures/default_snow.png delete mode 100644 games/minimal/mods/basenodes/textures/default_snow_side.png delete mode 100644 games/minimal/mods/basenodes/textures/default_stone.png delete mode 100644 games/minimal/mods/basenodes/textures/default_tree.png delete mode 100644 games/minimal/mods/basenodes/textures/default_tree_top.png delete mode 100644 games/minimal/mods/basenodes/textures/default_water.png delete mode 100644 games/minimal/mods/basenodes/textures/default_water_flowing.png delete mode 100644 games/minimal/mods/basetools/init.lua delete mode 100644 games/minimal/mods/basetools/mod.conf delete mode 100644 games/minimal/mods/basetools/textures/basetools_dirtpick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_firesword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_icesword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_mesepick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelaxe.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steeldagger.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelpick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelpick_l1.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelpick_l2.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelshears.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelshovel.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelsword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stoneaxe.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stonepick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stoneshears.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stoneshovel.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stonesword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodaxe.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodpick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodshears.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodshovel.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodsword.png delete mode 100644 games/minimal/mods/bucket/init.lua delete mode 100644 games/minimal/mods/bucket/mod.conf delete mode 100644 games/minimal/mods/bucket/textures/bucket.png delete mode 100644 games/minimal/mods/bucket/textures/bucket_lava.png delete mode 100644 games/minimal/mods/bucket/textures/bucket_water.png delete mode 100644 games/minimal/mods/chest/init.lua delete mode 100644 games/minimal/mods/chest/mod.conf delete mode 100644 games/minimal/mods/chest/textures/chest_chest.png delete mode 100644 games/minimal/mods/chest_of_everything/init.lua delete mode 100644 games/minimal/mods/chest_of_everything/mod.conf delete mode 100644 games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png delete mode 100644 games/minimal/mods/dignodes/init.lua delete mode 100644 games/minimal/mods/dignodes/mod.conf delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_choppy.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_cracky.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_crumbly.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_none.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_rating1.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_rating2.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_rating3.png delete mode 100644 games/minimal/mods/experimental/commands.lua delete mode 100644 games/minimal/mods/experimental/detached.lua delete mode 100644 games/minimal/mods/experimental/init.lua delete mode 100644 games/minimal/mods/experimental/items.lua delete mode 100644 games/minimal/mods/experimental/mod.conf delete mode 100644 games/minimal/mods/experimental/textures/experimental_callback_node.png delete mode 100644 games/minimal/mods/experimental/textures/experimental_particle_sheet.png delete mode 100644 games/minimal/mods/experimental/textures/experimental_particle_vertical.png delete mode 100644 games/minimal/mods/experimental/textures/experimental_tester_tool_1.png delete mode 100644 games/minimal/mods/give_initial_stuff/init.lua delete mode 100644 games/minimal/mods/give_initial_stuff/mod.conf delete mode 100644 games/minimal/mods/initial_message/init.lua delete mode 100644 games/minimal/mods/initial_message/mod.conf delete mode 100644 games/minimal/mods/mapgen/init.lua delete mode 100644 games/minimal/mods/mapgen/mod.conf delete mode 100644 games/minimal/mods/modchannels/init.lua delete mode 100644 games/minimal/mods/modchannels/mod.conf delete mode 100644 games/minimal/mods/soundstuff/init.lua delete mode 100644 games/minimal/mods/soundstuff/mod.conf delete mode 100644 games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_eat.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_place.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png delete mode 100644 games/minimal/mods/stairs/init.lua delete mode 100644 games/minimal/mods/stairs/mod.conf delete mode 100644 games/minimal/mods/testentities/armor.lua delete mode 100644 games/minimal/mods/testentities/callbacks.lua delete mode 100644 games/minimal/mods/testentities/init.lua delete mode 100644 games/minimal/mods/testentities/mod.conf delete mode 100644 games/minimal/mods/testentities/textures/testentities_armorball.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_callback.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_callback_step.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube1.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube2.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube3.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube4.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube5.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube6.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_dungeon_master.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_sprite.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_upright_sprite1.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_upright_sprite2.png delete mode 100644 games/minimal/mods/testentities/visuals.lua delete mode 100644 games/minimal/mods/testfood/init.lua delete mode 100644 games/minimal/mods/testfood/mod.conf delete mode 100644 games/minimal/mods/testfood/textures/testfood_bad.png delete mode 100644 games/minimal/mods/testfood/textures/testfood_bad2.png delete mode 100644 games/minimal/mods/testfood/textures/testfood_good.png delete mode 100644 games/minimal/mods/testfood/textures/testfood_good2.png delete mode 100644 games/minimal/mods/testformspec/callbacks.lua delete mode 100644 games/minimal/mods/testformspec/dummy_items.lua delete mode 100644 games/minimal/mods/testformspec/formspec.lua delete mode 100644 games/minimal/mods/testformspec/init.lua delete mode 100644 games/minimal/mods/testformspec/mod.conf delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_animation.jpg delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_animation.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_button_image.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_hovered.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_item.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_node.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_pressed.png delete mode 100644 games/minimal/mods/testnodes/README.md delete mode 100644 games/minimal/mods/testnodes/drawtypes.lua delete mode 100644 games/minimal/mods/testnodes/init.lua delete mode 100644 games/minimal/mods/testnodes/light.lua delete mode 100644 games/minimal/mods/testnodes/liquids.lua delete mode 100644 games/minimal/mods/testnodes/meshes.lua delete mode 100644 games/minimal/mods/testnodes/mod.conf delete mode 100644 games/minimal/mods/testnodes/models/testnodes_ocorner.obj delete mode 100644 games/minimal/mods/testnodes/models/testnodes_pyramid.obj delete mode 100644 games/minimal/mods/testnodes/nodeboxes.lua delete mode 100644 games/minimal/mods/testnodes/param2.lua delete mode 100644 games/minimal/mods/testnodes/properties.lua delete mode 100644 games/minimal/mods/testnodes/settingtypes.txt delete mode 100644 games/minimal/mods/testnodes/textures.lua delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_airlike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_allfaces.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha128.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha191.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha64.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_anim.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attached_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attached_top.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_bouncy.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_buildable_to.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_climbable_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_damage.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_damage_neg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_drowning.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_fencelike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_firelike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_10.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_11.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_12.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_13.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_14.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_7.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_8.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_9.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquid.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_node.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_node_falling.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_nodebox.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_nojump_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_nojump_top.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_palette_full.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_signlike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_slippery.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png delete mode 100644 games/minimal/mods/testpathfinder/README.md delete mode 100644 games/minimal/mods/testpathfinder/init.lua delete mode 100644 games/minimal/mods/testpathfinder/mod.conf delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png delete mode 100644 games/minimal/mods/testtools/README.md delete mode 100644 games/minimal/mods/testtools/init.lua delete mode 100644 games/minimal/mods/testtools/mod.conf delete mode 100644 games/minimal/mods/testtools/textures/testtools_entity_rotator.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_entity_scaler.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_entity_spawner.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_falling_node_tool.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_node_setter.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_object_attacher.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_object_editor.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_object_mover.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_param2tool.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_remover.png delete mode 100644 games/minimal/mods/tiled/init.lua delete mode 100644 games/minimal/mods/tiled/mod.conf delete mode 100644 games/minimal/mods/tiled/textures/tiled_tiled.png delete mode 100644 games/minimal/mods/unittests/crafting.lua delete mode 100644 games/minimal/mods/unittests/crafting_prepare.lua delete mode 100644 games/minimal/mods/unittests/init.lua delete mode 100644 games/minimal/mods/unittests/mod.conf delete mode 100644 games/minimal/mods/unittests/player.lua delete mode 100644 games/minimal/mods/unittests/random.lua delete mode 100644 games/minimal/mods/unittests/textures/unittests_coal_lump.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_iron_lump.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_repairable_tool.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_steel_ingot.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_stick.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_torch.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png delete mode 100644 games/minimal/mods/util_commands/init.lua delete mode 100644 games/minimal/mods/util_commands/mod.conf delete mode 100644 games/minimal/screenshot.png delete mode 100644 games/minimal/settingtypes.txt (limited to 'builtin') diff --git a/CMakeLists.txt b/CMakeLists.txt index ae842918b..a5f644652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,7 +167,7 @@ endif() install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/" COMPONENT "SUBGAME_MINETEST_GAME" OPTIONAL PATTERN ".git*" EXCLUDE ) -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minimal" DESTINATION "${SHAREDIR}/games/" +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/devtest" DESTINATION "${SHAREDIR}/games/" COMPONENT "SUBGAME_MINIMAL" OPTIONAL PATTERN ".git*" EXCLUDE ) if(BUILD_CLIENT) @@ -254,8 +254,8 @@ cpack_add_component(SUBGAME_MINETEST_GAME ) cpack_add_component(SUBGAME_MINIMAL - DISPLAY_NAME "Minimal development test" - DESCRIPTION "A minimal subgame helping to develop the engine." + DISPLAY_NAME "Development Test" + DESCRIPTION "A minimal test game helping to develop the engine." DISABLED #DISABLED does not mean it is disabled, and is just not selected by default. GROUP "Subgames" ) diff --git a/README.md b/README.md index 202ba4fe2..6a3c11f40 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ Download source (this is the URL to the latest of source repository, which might 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: +Download minetest_game (otherwise only the "Development Test" game is available) using Git: git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 0d977a17c..36df23cce 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -304,13 +304,13 @@ local function create_world_formspec(dialogdata) label_spflags = "label[0,"..y_start..";" .. fgettext("Mapgen-specific flags") .. "]" end - -- Warning if only minimal is installed - local minimal_only = "" + -- Warning if only devtest is installed + local devtest_only = "" local gamelist_height = 2.3 - if #pkgmgr.games == 1 and pkgmgr.games[1].id == "minimal" then - minimal_only = "box[0,0;5.8,1.7;#ff8800]" .. + if #pkgmgr.games == 1 and pkgmgr.games[1].id == "devtest" then + devtest_only = "box[0,0;5.8,1.7;#ff8800]" .. "textarea[0.3,0;6,1.8;;;".. - fgettext("Warning: The minimal development test is meant for developers.") .. "\n" .. + fgettext("Warning: The Development Test is meant for developers.") .. "\n" .. fgettext("Download a game, such as Minetest Game, from minetest.net") .. "]" gamelist_height = 0.5 end @@ -335,7 +335,7 @@ local function create_world_formspec(dialogdata) "textlist[0,3.85;5.8,"..gamelist_height..";games;" .. pkgmgr.gamelist() .. ";" .. gameidx .. ";false]" .. "container[0,4.5]" .. - minimal_only .. + devtest_only .. "container_end[]" .. "container_end[]" .. diff --git a/doc/lua_api.txt b/doc/lua_api.txt index a77c7567e..c4310aa5b 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1069,7 +1069,7 @@ Node drawtypes There are a bunch of different looking node types. -Look for examples in `games/minimal` or `games/minetest_game`. +Look for examples in `games/devtest` or `games/minetest_game`. * `normal` * A node-sized cube. diff --git a/games/devtest/LICENSE.txt b/games/devtest/LICENSE.txt new file mode 100644 index 000000000..71bd0e596 --- /dev/null +++ b/games/devtest/LICENSE.txt @@ -0,0 +1,4 @@ +License information for Development Test +---------------------------------------- + +The same license as for Minetest applies. diff --git a/games/devtest/README.md b/games/devtest/README.md new file mode 100644 index 000000000..a7e93cf11 --- /dev/null +++ b/games/devtest/README.md @@ -0,0 +1,52 @@ +# Development Test (devtest) + +This is a basic testing environment that contains a bunch of things to test the engine, but it could also be used as a minimal testbed for testing out mods. + +## Features + +* Basic nodes for mapgen +* Basic, minimal map generator +* Lots of example nodes for testing drawtypes, param2, light level, and many other node properties +* Example entities +* Other example items +* Formspec test (via `/test_formspec` command) +* Automated unit tests (disabled by default) +* Tools for manipulating nodes and entities, like the "Param2 Tool" + +## Getting started + +Basically, just create a world and start. A few important things to note: + +* Items are gotten from the “Chest of Everything” (`chest_of_everything:chest`) +* When you lost your initial items, type in `/stuff` command to get them back +* By default, Creative Mode activates infinite node placement. This behavior can be changed with the `devtest_infplace` setting +* Use the `/infplace` command to toggle infinite node placement in-game +* Use the Param2 Tool to change the param2 of nodes; it's useful to experiment with the various drawtype test nodes +* Check out the game settings and server commands for additional tests and features +* Creative Mode does nothing (apart from default engine behavior) + +Confused by a certain node or item? Check out for inline code comments. + +### Example tests + +* You can use this to test what happens if a player is simultaneously in 2 nodes with `damage_per_second` but with a different value. +* Or use the Falling Node Tool on various test nodes to see how they behave when falling. +* You could also use this as a testbed for dependency-free mods, e.g. to test out how your formspecs behave without theming. + +## Random notes + +* Experimental/strange/unstructured tests can be found in the `experimental` mod +* Textures of drawtype test nodes have a red dot at the top left corner. This is to see whether the textures are oriented properly + +## Design philosophy + +This should loosely follow the following principles: + +* Engine testing: The main focus of this is to aid testing of *engine* features, such as mapgen or node drawtypes +* Mod testing: The secondary focus is to help modders as well, either as a minimal testbed for mods or even as a code example +* Minimal interference: Under default settings, it shall not interfere with APIs except on explicit user wish. Non-trivial tests and features need to be enabled by a setting first +* Convenience: Have various tools to make usage easier and more convenient +* Reproducing engine bugs: When an engine bug was found, consider creating a test case +* Clarity: Textures and names need to be designed to keep different things clearly visually apart at a glance +* Low loading time: It must load blazing-fast so stuff can be tested quickly + diff --git a/games/devtest/game.conf b/games/devtest/game.conf new file mode 100644 index 000000000..d6e382ad7 --- /dev/null +++ b/games/devtest/game.conf @@ -0,0 +1,2 @@ +name = Development Test +description = Testing environment to help with testing the engine features of Minetest. It can also be helpful in mod development. diff --git a/games/devtest/menu/background.png b/games/devtest/menu/background.png new file mode 100644 index 000000000..415bb3d14 Binary files /dev/null and b/games/devtest/menu/background.png differ diff --git a/games/devtest/menu/header.png b/games/devtest/menu/header.png new file mode 100644 index 000000000..c80ed71f1 Binary files /dev/null and b/games/devtest/menu/header.png differ diff --git a/games/devtest/menu/icon.png b/games/devtest/menu/icon.png new file mode 100644 index 000000000..f854b9c31 Binary files /dev/null and b/games/devtest/menu/icon.png differ diff --git a/games/devtest/mods/basenodes/init.lua b/games/devtest/mods/basenodes/init.lua new file mode 100644 index 000000000..8156c4bec --- /dev/null +++ b/games/devtest/mods/basenodes/init.lua @@ -0,0 +1,334 @@ +local WATER_ALPHA = 160 +local WATER_VISC = 1 +local LAVA_VISC = 7 + +-- +-- Node definitions +-- + +-- Register nodes + +minetest.register_node("basenodes:stone", { + description = "Stone", + tiles = {"default_stone.png"}, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:desert_stone", { + description = "Desert Stone", + tiles = {"default_desert_stone.png"}, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:dirt_with_grass", { + description = "Dirt with Grass", + tiles ={"default_grass.png", + -- a little dot on the bottom to distinguish it from dirt + "default_dirt.png^basenodes_dirt_with_grass_bottom.png", + {name = "default_dirt.png^default_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly=3, soil=1}, +}) + +minetest.register_node("basenodes:dirt_with_snow", { + description = "Dirt with Snow", + tiles ={"basenodes_dirt_with_snow.png", + -- a little dot on the bottom to distinguish it from dirt + "default_dirt.png^basenodes_dirt_with_snow_bottom.png", + {name = "default_dirt.png^default_snow_side.png", + tileable_vertical = false}}, + groups = {crumbly=3, soil=1}, +}) + +minetest.register_node("basenodes:dirt", { + description = "Dirt", + tiles ={"default_dirt.png"}, + groups = {crumbly=3, soil=1}, +}) + +minetest.register_node("basenodes:sand", { + description = "Sand", + tiles ={"default_sand.png"}, + groups = {crumbly=3}, +}) + +minetest.register_node("basenodes:desert_sand", { + description = "Desert Sand", + tiles ={"default_desert_sand.png"}, + groups = {crumbly=3}, +}) + +minetest.register_node("basenodes:gravel", { + description = "Gravel", + tiles ={"default_gravel.png"}, + groups = {crumbly=2}, +}) + +minetest.register_node("basenodes:junglegrass", { + description = "Jungle Grass", + drawtype = "plantlike", + tiles ={"default_junglegrass.png"}, + inventory_image = "default_junglegrass.png", + wield_image = "default_junglegrass.png", + paramtype = "light", + walkable = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:tree", { + description = "Normal Tree Trunk", + tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=1}, +}) + +minetest.register_node("basenodes:leaves", { + description = "Normal Leaves", + drawtype = "allfaces_optional", + tiles = {"default_leaves.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:jungletree", { + description = "Jungle Tree Trunk", + tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=1}, +}) + +minetest.register_node("basenodes:jungleleaves", { + description = "Jungle Leaves", + drawtype = "allfaces_optional", + tiles = {"default_jungleleaves.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:pine_tree", { + description = "Pine Tree Trunk", + tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", "default_pine_tree.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=1}, +}) + +minetest.register_node("basenodes:pine_needles", { + description = "Pine Needles", + drawtype = "allfaces_optional", + tiles = {"default_pine_needles.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:water_source", { + description = "Water Source", + drawtype = "liquid", + tiles = {"default_water.png"}, + special_tiles = { + {name = "default_water.png", backface_culling = false}, + {name = "default_water.png", backface_culling = true}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "basenodes:water_flowing", + liquid_alternative_source = "basenodes:water_source", + liquid_viscosity = WATER_VISC, + post_effect_color = {a = 64, r = 100, g = 100, b = 200}, + groups = {water = 3, liquid = 3}, +}) + +minetest.register_node("basenodes:water_flowing", { + description = "Flowing Water", + drawtype = "flowingliquid", + tiles = {"default_water_flowing.png"}, + special_tiles = { + {name = "default_water_flowing.png", backface_culling = false}, + {name = "default_water_flowing.png", backface_culling = false}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "basenodes:water_flowing", + liquid_alternative_source = "basenodes:water_source", + liquid_viscosity = WATER_VISC, + post_effect_color = {a = 64, r = 100, g = 100, b = 200}, + groups = {water = 3, liquid = 3}, +}) + +minetest.register_node("basenodes:river_water_source", { + description = "River Water Source", + drawtype = "liquid", + tiles = { "default_river_water.png" }, + special_tiles = { + {name = "default_river_water.png", backface_culling = false}, + {name = "default_river_water.png", backface_culling = true}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "basenodes:river_water_flowing", + liquid_alternative_source = "basenodes:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, }, +}) + +minetest.register_node("basenodes:river_water_flowing", { + description = "Flowing River Water", + drawtype = "flowingliquid", + tiles = {"default_river_water_flowing.png"}, + special_tiles = { + {name = "default_river_water_flowing.png", backface_culling = false}, + {name = "default_river_water_flowing.png", backface_culling = false}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "basenodes:river_water_flowing", + liquid_alternative_source = "basenodes:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, }, +}) + +minetest.register_node("basenodes:lava_flowing", { + description = "Flowing Lava", + drawtype = "flowingliquid", + tiles = {"default_lava_flowing.png"}, + special_tiles = { + {name="default_lava_flowing.png", backface_culling = false}, + {name="default_lava_flowing.png", backface_culling = false}, + }, + paramtype = "light", + light_source = minetest.LIGHT_MAX, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + damage_per_second = 4, + liquidtype = "flowing", + liquid_alternative_flowing = "basenodes:lava_flowing", + liquid_alternative_source = "basenodes:lava_source", + liquid_viscosity = LAVA_VISC, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=1}, +}) + +minetest.register_node("basenodes:lava_source", { + description = "Lava Source", + drawtype = "liquid", + tiles = { "default_lava.png" }, + special_tiles = { + {name = "default_lava.png", backface_culling = false}, + {name = "default_lava.png", backface_culling = true}, + }, + paramtype = "light", + light_source = minetest.LIGHT_MAX, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + damage_per_second = 4, + liquidtype = "source", + liquid_alternative_flowing = "basenodes:lava_flowing", + liquid_alternative_source = "basenodes:lava_source", + liquid_viscosity = LAVA_VISC, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=1}, +}) + +minetest.register_node("basenodes:cobble", { + description = "Cobblestone", + tiles ={"default_cobble.png"}, + is_ground_content = false, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:mossycobble", { + description = "Mossy Cobblestone", + tiles ={"default_mossycobble.png"}, + is_ground_content = false, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:apple", { + description = "Apple", + drawtype = "plantlike", + tiles ={"default_apple.png"}, + inventory_image = "default_apple.png", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + walkable = false, + groups = {dig_immediate=3}, + + -- Make eatable because why not? + on_use = minetest.item_eat(2), +}) + +minetest.register_node("basenodes:ice", { + description = "Ice", + tiles ={"default_ice.png"}, + groups = {cracky=3}, +}) + +-- The snow nodes intentionally have different tints to make them more +-- distinguishable +minetest.register_node("basenodes:snow", { + description = "Snow Sheet", + tiles = {"basenodes_snow_sheet.png"}, + groups = {crumbly=3}, + walkable = false, + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, +}) + +minetest.register_node("basenodes:snowblock", { + description = "Snow Block", + tiles ={"default_snow.png"}, + groups = {crumbly=3}, +}) + + diff --git a/games/devtest/mods/basenodes/mod.conf b/games/devtest/mods/basenodes/mod.conf new file mode 100644 index 000000000..25024dc63 --- /dev/null +++ b/games/devtest/mods/basenodes/mod.conf @@ -0,0 +1,2 @@ +name = basenodes +description = Contains basic nodes for mapgen diff --git a/games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png new file mode 100644 index 000000000..5e8fc41a9 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png differ diff --git a/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png new file mode 100644 index 000000000..7ea2d8d31 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png differ diff --git a/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png new file mode 100644 index 000000000..447c94e98 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png differ diff --git a/games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png b/games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png new file mode 100644 index 000000000..455332093 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png differ diff --git a/games/devtest/mods/basenodes/textures/default_apple.png b/games/devtest/mods/basenodes/textures/default_apple.png new file mode 100644 index 000000000..9c115dae4 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_apple.png differ diff --git a/games/devtest/mods/basenodes/textures/default_cobble.png b/games/devtest/mods/basenodes/textures/default_cobble.png new file mode 100644 index 000000000..5b859e9c2 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_cobble.png differ diff --git a/games/devtest/mods/basenodes/textures/default_desert_sand.png b/games/devtest/mods/basenodes/textures/default_desert_sand.png new file mode 100644 index 000000000..19ec87dc0 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_desert_sand.png differ diff --git a/games/devtest/mods/basenodes/textures/default_desert_stone.png b/games/devtest/mods/basenodes/textures/default_desert_stone.png new file mode 100644 index 000000000..5126fb61c Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_desert_stone.png differ diff --git a/games/devtest/mods/basenodes/textures/default_dirt.png b/games/devtest/mods/basenodes/textures/default_dirt.png new file mode 100644 index 000000000..58670305d Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_dirt.png differ diff --git a/games/devtest/mods/basenodes/textures/default_grass.png b/games/devtest/mods/basenodes/textures/default_grass.png new file mode 100644 index 000000000..3d6397186 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_grass.png differ diff --git a/games/devtest/mods/basenodes/textures/default_grass_side.png b/games/devtest/mods/basenodes/textures/default_grass_side.png new file mode 100644 index 000000000..04770b6f6 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_grass_side.png differ diff --git a/games/devtest/mods/basenodes/textures/default_gravel.png b/games/devtest/mods/basenodes/textures/default_gravel.png new file mode 100644 index 000000000..7e5ff616f Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_gravel.png differ diff --git a/games/devtest/mods/basenodes/textures/default_ice.png b/games/devtest/mods/basenodes/textures/default_ice.png new file mode 100644 index 000000000..c4bddd223 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_ice.png differ diff --git a/games/devtest/mods/basenodes/textures/default_junglegrass.png b/games/devtest/mods/basenodes/textures/default_junglegrass.png new file mode 100644 index 000000000..d64e33abc Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_junglegrass.png differ diff --git a/games/devtest/mods/basenodes/textures/default_jungleleaves.png b/games/devtest/mods/basenodes/textures/default_jungleleaves.png new file mode 100644 index 000000000..1fa67e83a Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_jungleleaves.png differ diff --git a/games/devtest/mods/basenodes/textures/default_jungletree.png b/games/devtest/mods/basenodes/textures/default_jungletree.png new file mode 100644 index 000000000..053850fa7 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_jungletree.png differ diff --git a/games/devtest/mods/basenodes/textures/default_jungletree_top.png b/games/devtest/mods/basenodes/textures/default_jungletree_top.png new file mode 100644 index 000000000..e80de8a69 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_jungletree_top.png differ diff --git a/games/devtest/mods/basenodes/textures/default_lava.png b/games/devtest/mods/basenodes/textures/default_lava.png new file mode 100644 index 000000000..a4cf649f1 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_lava.png differ diff --git a/games/devtest/mods/basenodes/textures/default_lava_flowing.png b/games/devtest/mods/basenodes/textures/default_lava_flowing.png new file mode 100644 index 000000000..07066a6e3 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_lava_flowing.png differ diff --git a/games/devtest/mods/basenodes/textures/default_leaves.png b/games/devtest/mods/basenodes/textures/default_leaves.png new file mode 100644 index 000000000..c0475d4d2 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_leaves.png differ diff --git a/games/devtest/mods/basenodes/textures/default_mossycobble.png b/games/devtest/mods/basenodes/textures/default_mossycobble.png new file mode 100644 index 000000000..69585e37b Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_mossycobble.png differ diff --git a/games/devtest/mods/basenodes/textures/default_pine_needles.png b/games/devtest/mods/basenodes/textures/default_pine_needles.png new file mode 100644 index 000000000..137caa2a3 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_pine_needles.png differ diff --git a/games/devtest/mods/basenodes/textures/default_pine_tree.png b/games/devtest/mods/basenodes/textures/default_pine_tree.png new file mode 100644 index 000000000..5743183c0 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_pine_tree.png differ diff --git a/games/devtest/mods/basenodes/textures/default_pine_tree_top.png b/games/devtest/mods/basenodes/textures/default_pine_tree_top.png new file mode 100644 index 000000000..cc18f3462 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_pine_tree_top.png differ diff --git a/games/devtest/mods/basenodes/textures/default_river_water.png b/games/devtest/mods/basenodes/textures/default_river_water.png new file mode 100644 index 000000000..e1074d2ef Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_river_water.png differ diff --git a/games/devtest/mods/basenodes/textures/default_river_water_flowing.png b/games/devtest/mods/basenodes/textures/default_river_water_flowing.png new file mode 100644 index 000000000..4a756b2bd Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_river_water_flowing.png differ diff --git a/games/devtest/mods/basenodes/textures/default_sand.png b/games/devtest/mods/basenodes/textures/default_sand.png new file mode 100644 index 000000000..0ed0e4ceb Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_sand.png differ diff --git a/games/devtest/mods/basenodes/textures/default_snow.png b/games/devtest/mods/basenodes/textures/default_snow.png new file mode 100644 index 000000000..c42e0eecb Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_snow.png differ diff --git a/games/devtest/mods/basenodes/textures/default_snow_side.png b/games/devtest/mods/basenodes/textures/default_snow_side.png new file mode 100644 index 000000000..f34d10991 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_snow_side.png differ diff --git a/games/devtest/mods/basenodes/textures/default_stone.png b/games/devtest/mods/basenodes/textures/default_stone.png new file mode 100644 index 000000000..763b4396a Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_stone.png differ diff --git a/games/devtest/mods/basenodes/textures/default_tree.png b/games/devtest/mods/basenodes/textures/default_tree.png new file mode 100644 index 000000000..189ec1593 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_tree.png differ diff --git a/games/devtest/mods/basenodes/textures/default_tree_top.png b/games/devtest/mods/basenodes/textures/default_tree_top.png new file mode 100644 index 000000000..d1a4fa704 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_tree_top.png differ diff --git a/games/devtest/mods/basenodes/textures/default_water.png b/games/devtest/mods/basenodes/textures/default_water.png new file mode 100644 index 000000000..3e385ae8b Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_water.png differ diff --git a/games/devtest/mods/basenodes/textures/default_water_flowing.png b/games/devtest/mods/basenodes/textures/default_water_flowing.png new file mode 100644 index 000000000..7cdafd51d Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_water_flowing.png differ diff --git a/games/devtest/mods/basetools/init.lua b/games/devtest/mods/basetools/init.lua new file mode 100644 index 000000000..d9d9afb07 --- /dev/null +++ b/games/devtest/mods/basetools/init.lua @@ -0,0 +1,295 @@ +-- +-- Tool definitions +-- + +--[[ TOOLS SUMMARY: + +Tool types: + +* Hand: basic tool/weapon (just for convenience, not optimized for testing) +* Pickaxe: dig cracky +* Axe: dig choppy +* Shovel: dig crumbly +* Shears: dig snappy +* Sword: deal damage +* Dagger: deal damage, but faster + +Tool materials: + +* Dirt: dig nodes of rating 3, one use only +* Wood: dig nodes of rating 3 +* Stone: dig nodes of rating 3 or 2 +* Steel: dig nodes of rating 3, 2 or 1 +* Mese: dig "everything" instantly +]] + +-- The hand +minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level = 0, + groupcaps = { + crumbly = {times={[3]=1.50}, uses=0, maxlevel=0}, + snappy = {times={[3]=1.50}, uses=0, maxlevel=0}, + oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=2.00}, uses=0, maxlevel=0}, + }, + damage_groups = {fleshy=1}, + } +}) + +-- Mese Pickaxe: special tool that digs "everything" instantly +minetest.register_tool("basetools:pick_mese", { + description = "Mese Pickaxe", + inventory_image = "basetools_mesepick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + }, + }, +}) + + +-- +-- Pickaxes: Dig cracky +-- + +-- This should break after only 1 use +minetest.register_tool("basetools:pick_dirt", { + description = "Dirt Pickaxe", + inventory_image = "basetools_dirtpick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[3]=2.00}, uses=1, maxlevel=0} + }, + }, +}) + +minetest.register_tool("basetools:pick_wood", { + description = "Wooden Pickaxe", + inventory_image = "basetools_woodpick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[3]=2.00}, uses=30, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:pick_stone", { + description = "Stone Pickaxe", + inventory_image = "basetools_stonepick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:pick_steel", { + description = "Steel Pickaxe", + inventory_image = "basetools_steelpick.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:pick_steel_l1", { + description = "Steel Pickaxe Level 1", + inventory_image = "basetools_steelpick_l1.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1} + }, + }, +}) +minetest.register_tool("basetools:pick_steel_l2", { + description = "Steel Pickaxe Level 2", + inventory_image = "basetools_steelpick_l2.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2} + }, + }, +}) + +-- +-- Shovels (dig crumbly) +-- + +minetest.register_tool("basetools:shovel_wood", { + description = "Wooden Shovel", + inventory_image = "basetools_woodshovel.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + crumbly={times={[3]=0.50}, uses=30, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:shovel_stone", { + description = "Stone Shovel", + inventory_image = "basetools_stoneshovel.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + crumbly={times={[2]=0.50, [3]=0.30}, uses=60, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:shovel_steel", { + description = "Steel Shovel", + inventory_image = "basetools_steelshovel.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=90, maxlevel=0} + }, + }, +}) + +-- +-- Axes (dig choppy) +-- + +minetest.register_tool("basetools:axe_wood", { + description = "Wooden Axe", + inventory_image = "basetools_woodaxe.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + choppy={times={[3]=0.80}, uses=30, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:axe_stone", { + description = "Stone Axe", + inventory_image = "basetools_stoneaxe.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:axe_steel", { + description = "Steel Axe", + inventory_image = "basetools_steelaxe.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0}, + }, + }, +}) + +-- +-- Shears (dig snappy) +-- + +minetest.register_tool("basetools:shears_wood", { + description = "Wooden Shears", + inventory_image = "basetools_woodshears.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + snappy={times={[3]=1.00}, uses=30, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:shears_stone", { + description = "Stone Shears", + inventory_image = "basetools_stoneshears.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:shears_steel", { + description = "Steel Shears", + inventory_image = "basetools_steelshears.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0}, + }, + }, +}) + +-- +-- Swords (deal damage) +-- + +minetest.register_tool("basetools:sword_wood", { + description = "Wooden Sword", + inventory_image = "basetools_woodsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + damage_groups = {fleshy=2}, + } +}) +minetest.register_tool("basetools:sword_stone", { + description = "Stone Sword", + inventory_image = "basetools_stonesword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + damage_groups = {fleshy=4}, + } +}) +minetest.register_tool("basetools:sword_steel", { + description = "Steel Sword", + inventory_image = "basetools_steelsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + damage_groups = {fleshy=6}, + } +}) + +-- Fire/Ice sword: Deal damage to non-fleshy damage groups +minetest.register_tool("basetools:sword_fire", { + description = "Fire Sword", + inventory_image = "basetools_firesword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + damage_groups = {icy=6}, + } +}) +minetest.register_tool("basetools:sword_ice", { + description = "Ice Sword", + inventory_image = "basetools_icesword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + damage_groups = {firy=6}, + } +}) + +-- +-- Dagger: Low damage, fast punch interval +-- +minetest.register_tool("basetools:dagger_steel", { + description = "Steel Dagger", + inventory_image = "basetools_steeldagger.png", + tool_capabilities = { + full_punch_interval = 0.5, + max_drop_level=0, + damage_groups = {fleshy=2}, + } +}) diff --git a/games/devtest/mods/basetools/mod.conf b/games/devtest/mods/basetools/mod.conf new file mode 100644 index 000000000..f0d9f657d --- /dev/null +++ b/games/devtest/mods/basetools/mod.conf @@ -0,0 +1,2 @@ +name = basetools +description = Contains basic digging tools diff --git a/games/devtest/mods/basetools/textures/basetools_dirtpick.png b/games/devtest/mods/basetools/textures/basetools_dirtpick.png new file mode 100644 index 000000000..20a021d72 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_dirtpick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_firesword.png b/games/devtest/mods/basetools/textures/basetools_firesword.png new file mode 100644 index 000000000..ee2809ab7 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_firesword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_icesword.png b/games/devtest/mods/basetools/textures/basetools_icesword.png new file mode 100644 index 000000000..35ba8214b Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_icesword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_mesepick.png b/games/devtest/mods/basetools/textures/basetools_mesepick.png new file mode 100644 index 000000000..2b5e12cdb Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_mesepick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelaxe.png b/games/devtest/mods/basetools/textures/basetools_steelaxe.png new file mode 100644 index 000000000..aac594d84 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelaxe.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steeldagger.png b/games/devtest/mods/basetools/textures/basetools_steeldagger.png new file mode 100644 index 000000000..4c9173094 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steeldagger.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelpick.png b/games/devtest/mods/basetools/textures/basetools_steelpick.png new file mode 100644 index 000000000..bc02aac3e Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelpick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelpick_l1.png b/games/devtest/mods/basetools/textures/basetools_steelpick_l1.png new file mode 100644 index 000000000..dc03f3f65 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelpick_l1.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelpick_l2.png b/games/devtest/mods/basetools/textures/basetools_steelpick_l2.png new file mode 100644 index 000000000..011df4584 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelpick_l2.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelshears.png b/games/devtest/mods/basetools/textures/basetools_steelshears.png new file mode 100644 index 000000000..04c86c370 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelshears.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelshovel.png b/games/devtest/mods/basetools/textures/basetools_steelshovel.png new file mode 100644 index 000000000..8cab60784 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelshovel.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelsword.png b/games/devtest/mods/basetools/textures/basetools_steelsword.png new file mode 100644 index 000000000..9909365c3 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelsword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stoneaxe.png b/games/devtest/mods/basetools/textures/basetools_stoneaxe.png new file mode 100644 index 000000000..a374c547d Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stoneaxe.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stonepick.png b/games/devtest/mods/basetools/textures/basetools_stonepick.png new file mode 100644 index 000000000..d9156ee3a Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stonepick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stoneshears.png b/games/devtest/mods/basetools/textures/basetools_stoneshears.png new file mode 100644 index 000000000..0b4bd3b74 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stoneshears.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stoneshovel.png b/games/devtest/mods/basetools/textures/basetools_stoneshovel.png new file mode 100644 index 000000000..3c1bb48cb Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stoneshovel.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stonesword.png b/games/devtest/mods/basetools/textures/basetools_stonesword.png new file mode 100644 index 000000000..6f3e94cda Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stonesword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodaxe.png b/games/devtest/mods/basetools/textures/basetools_woodaxe.png new file mode 100644 index 000000000..4015e910f Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodaxe.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodpick.png b/games/devtest/mods/basetools/textures/basetools_woodpick.png new file mode 100644 index 000000000..15c61f408 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodpick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodshears.png b/games/devtest/mods/basetools/textures/basetools_woodshears.png new file mode 100644 index 000000000..4ff92fd7c Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodshears.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodshovel.png b/games/devtest/mods/basetools/textures/basetools_woodshovel.png new file mode 100644 index 000000000..6cc52f8a1 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodshovel.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodsword.png b/games/devtest/mods/basetools/textures/basetools_woodsword.png new file mode 100644 index 000000000..364016ed6 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodsword.png differ diff --git a/games/devtest/mods/bucket/init.lua b/games/devtest/mods/bucket/init.lua new file mode 100644 index 000000000..3189d4aa6 --- /dev/null +++ b/games/devtest/mods/bucket/init.lua @@ -0,0 +1,26 @@ +-- Bucket: Punch liquid source or flowing liquid to collect it + +minetest.register_tool("bucket:bucket", { + description = "Bucket", + inventory_image = "bucket.png", + stack_max = 1, + liquids_pointable = true, + groups = { disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + -- Check if pointing to a liquid + local n = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[n.name] + if def ~= nil and (def.liquidtype == "source" or def.liquidtype == "flowing") then + minetest.add_node(pointed_thing.under, {name="air"}) + local inv = user:get_inventory() + if inv then + inv:add_item("main", ItemStack(n.name)) + end + end + end, +}) + diff --git a/games/devtest/mods/bucket/mod.conf b/games/devtest/mods/bucket/mod.conf new file mode 100644 index 000000000..d14deb4ea --- /dev/null +++ b/games/devtest/mods/bucket/mod.conf @@ -0,0 +1,2 @@ +name = bucket +description = Minimal bucket to pick up liquids diff --git a/games/devtest/mods/bucket/textures/bucket.png b/games/devtest/mods/bucket/textures/bucket.png new file mode 100644 index 000000000..677952875 Binary files /dev/null and b/games/devtest/mods/bucket/textures/bucket.png differ diff --git a/games/devtest/mods/bucket/textures/bucket_lava.png b/games/devtest/mods/bucket/textures/bucket_lava.png new file mode 100644 index 000000000..dfcae65fb Binary files /dev/null and b/games/devtest/mods/bucket/textures/bucket_lava.png differ diff --git a/games/devtest/mods/bucket/textures/bucket_water.png b/games/devtest/mods/bucket/textures/bucket_water.png new file mode 100644 index 000000000..e164b0a50 Binary files /dev/null and b/games/devtest/mods/bucket/textures/bucket_water.png differ diff --git a/games/devtest/mods/chest/init.lua b/games/devtest/mods/chest/init.lua new file mode 100644 index 000000000..c44522cb9 --- /dev/null +++ b/games/devtest/mods/chest/init.lua @@ -0,0 +1,27 @@ +minetest.register_node("chest:chest", { + description = "Chest", + tiles ={"chest_chest.png^[sheet:2x2:0,0", "chest_chest.png^[sheet:2x2:0,0", + "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:1,0", + "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:0,1"}, + paramtype2 = "facedir", + groups = {dig_immediate=2,choppy=3}, + is_ground_content = false, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]" .. + "listring[]") + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, +}) + + diff --git a/games/devtest/mods/chest/mod.conf b/games/devtest/mods/chest/mod.conf new file mode 100644 index 000000000..0d7500164 --- /dev/null +++ b/games/devtest/mods/chest/mod.conf @@ -0,0 +1,2 @@ +name = chest +description = A simple chest to store items diff --git a/games/devtest/mods/chest/textures/chest_chest.png b/games/devtest/mods/chest/textures/chest_chest.png new file mode 100644 index 000000000..824b4d502 Binary files /dev/null and b/games/devtest/mods/chest/textures/chest_chest.png differ diff --git a/games/devtest/mods/chest_of_everything/init.lua b/games/devtest/mods/chest_of_everything/init.lua new file mode 100644 index 000000000..7d61abebf --- /dev/null +++ b/games/devtest/mods/chest_of_everything/init.lua @@ -0,0 +1,135 @@ +local F = minetest.formspec_escape + +-- Create a detached inventory +local inv_everything = minetest.create_detached_inventory("everything", { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + return 0 + end, + allow_put = function(inv, listname, index, stack, player) + return 0 + end, + allow_take = function(inv, listname, index, stack, player) + return -1 + end, +}) +local inv_trash = minetest.create_detached_inventory("trash", { + allow_take = function(inv, listname, index, stack, player) + return 0 + end, + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + return 0 + end, + on_put = function(inv, listname, index, stack, player) + inv:set_list("main", {}) + end, +}) +inv_trash:set_size("main", 1) + +local max_page = 1 + +local function get_chest_formspec(page) + local start = 0 + (page-1)*32 + return "size[8,9]".. + "list[detached:everything;main;0,0;8,4;"..start.."]".. + "list[current_player;main;0,5;8,4;]" .. + "label[6,4;Trash:]" .. + "list[detached:trash;main;7,4;1,1]" .. + "button[0,4;1,1;chest_of_everything_prev;"..F("<").."]".. + "button[1,4;1,1;chest_of_everything_next;"..F(">").."]".. + "label[2,4;"..F("Page: "..page).."]".. + "listring[detached:everything;main]".. + "listring[current_player;main]".. + "listring[detached:trash;main]" +end + +minetest.register_node("chest_of_everything:chest", { + description = "Chest of Everything", + tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0", + "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:1,0", + "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:0,1"}, + paramtype2 = "facedir", + groups = {dig_immediate=2,choppy=3}, + is_ground_content = false, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Chest of Everything") + meta:set_int("page", 1) + meta:set_string("formspec", get_chest_formspec(1)) + end, + on_receive_fields = function(pos, formname, fields, sender) + if formname == "" then + local meta = minetest.get_meta(pos) + local page = meta:get_int("page") + if fields.chest_of_everything_prev then + page = page - 1 + elseif fields.chest_of_everything_next then + page = page + 1 + end + if page < 1 then + page = 1 + end + if page > max_page then + page = max_page + end + meta:set_int("page", page) + meta:set_string("formspec", get_chest_formspec(page)) + end + end, +}) + +minetest.register_on_mods_loaded(function() + local items = {} + for itemstring,_ in pairs(minetest.registered_items) do + if itemstring ~= "" and itemstring ~= "unknown" and itemstring ~= "ignore" then + table.insert(items, itemstring) + end + end + --[[ Sort items in this order: + * Chest of Everything + * Test tools + * Other tools + * Craftitems + * Other items + * Dummy items ]] + local function compare(item1, item2) + local def1 = minetest.registered_items[item1] + local def2 = minetest.registered_items[item2] + local tool1 = def1.type == "tool" + local tool2 = def2.type == "tool" + local testtool1 = minetest.get_item_group(item1, "testtool") == 1 + local testtool2 = minetest.get_item_group(item2, "testtool") == 1 + local dummy1 = minetest.get_item_group(item1, "dummy") == 1 + local dummy2 = minetest.get_item_group(item2, "dummy") == 1 + local craftitem1 = def1.type == "craft" + local craftitem2 = def2.type == "craft" + if item1 == "chest_of_everything:chest" then + return true + elseif item2 == "chest_of_everything:chest" then + return false + elseif dummy1 and not dummy2 then + return false + elseif not dummy1 and dummy2 then + return true + elseif testtool1 and not testtool2 then + return true + elseif not testtool1 and testtool2 then + return false + elseif tool1 and not tool2 then + return true + elseif not tool1 and tool2 then + return false + elseif craftitem1 and not craftitem2 then + return true + elseif not craftitem1 and craftitem2 then + return false + else + return item1 < item2 + end + end + table.sort(items, compare) + inv_everything:set_size("main", #items) + max_page = math.ceil(#items / 32) + for i=1, #items do + inv_everything:add_item("main", items[i]) + end +end) diff --git a/games/devtest/mods/chest_of_everything/mod.conf b/games/devtest/mods/chest_of_everything/mod.conf new file mode 100644 index 000000000..4a4425e05 --- /dev/null +++ b/games/devtest/mods/chest_of_everything/mod.conf @@ -0,0 +1,2 @@ +name = chest_of_everything +description = Adds the chest of everything from which you can take all items diff --git a/games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png b/games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png new file mode 100644 index 000000000..6b2fd58d5 Binary files /dev/null and b/games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png differ diff --git a/games/devtest/mods/dignodes/init.lua b/games/devtest/mods/dignodes/init.lua new file mode 100644 index 000000000..833150873 --- /dev/null +++ b/games/devtest/mods/dignodes/init.lua @@ -0,0 +1,37 @@ +local groups = { + "cracky", "dig_immediate" +} + +-- Register dig nodes with 1 digging group, a rating between 1-3 and a level between 0-2 +for g=1, #groups do + local gr = groups[g] + for r=1, 3 do + for l=0, 2 do + if not (gr=="dig_immediate" and (l>0 or r==1)) then + local d + if l > 0 then + d = string.format("Dig Test Node: %s=%d, level=%d", gr, r, l) + else + d = string.format("Dig Test Node: %s=%d", gr, r) + end + local tile = "dignodes_"..gr..".png^dignodes_rating"..r..".png" + if l==1 then + tile = tile .. "^[colorize:#FFFF00:127" + elseif l==2 then + tile = tile .. "^[colorize:#FF0000:127" + end + minetest.register_node("dignodes:"..gr.."_"..r.."_"..l, { + description = d, + tiles = { tile }, + groups = { [gr] = r, level = l }, + }) + end + end + end +end + +-- Node without any digging groups +minetest.register_node("dignodes:none", { + description = "Dig Test Node: groupless", + tiles = {"dignodes_none.png"}, +}) diff --git a/games/devtest/mods/dignodes/mod.conf b/games/devtest/mods/dignodes/mod.conf new file mode 100644 index 000000000..52a80d66e --- /dev/null +++ b/games/devtest/mods/dignodes/mod.conf @@ -0,0 +1,2 @@ +name = dignodes +description = Nodes with different digging groups diff --git a/games/devtest/mods/dignodes/textures/dignodes_choppy.png b/games/devtest/mods/dignodes/textures/dignodes_choppy.png new file mode 100644 index 000000000..a73fc2424 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_choppy.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_cracky.png b/games/devtest/mods/dignodes/textures/dignodes_cracky.png new file mode 100644 index 000000000..eb84e3079 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_cracky.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_crumbly.png b/games/devtest/mods/dignodes/textures/dignodes_crumbly.png new file mode 100644 index 000000000..23f2f7c71 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_crumbly.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png b/games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png new file mode 100644 index 000000000..a532ad90b Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_none.png b/games/devtest/mods/dignodes/textures/dignodes_none.png new file mode 100644 index 000000000..60f13650b Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_none.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_rating1.png b/games/devtest/mods/dignodes/textures/dignodes_rating1.png new file mode 100644 index 000000000..d2fee3a23 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_rating1.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_rating2.png b/games/devtest/mods/dignodes/textures/dignodes_rating2.png new file mode 100644 index 000000000..15329b93f Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_rating2.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_rating3.png b/games/devtest/mods/dignodes/textures/dignodes_rating3.png new file mode 100644 index 000000000..37216bfd1 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_rating3.png differ diff --git a/games/devtest/mods/experimental/commands.lua b/games/devtest/mods/experimental/commands.lua new file mode 100644 index 000000000..96f8cbe39 --- /dev/null +++ b/games/devtest/mods/experimental/commands.lua @@ -0,0 +1,215 @@ +minetest.register_chatcommand("test_inv", { + params = "", + description = "Test: Modify player's inventory formspec", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + player:set_inventory_formspec( + "size[13,7.5]".. + "image[6,0.6;1,2;player.png]".. + "list[current_player;main;5,3.5;8,4;]".. + "list[current_player;craft;8,0;3,3;]".. + "list[current_player;craftpreview;12,1;1,1;]".. + "list[detached:test_inventory;main;0,0;4,6;0]".. + "button[0.5,7;2,1;button1;Button 1]".. + "button_exit[2.5,7;2,1;button2;Exit Button]") + return true, "Done." + end, +}) + +minetest.register_chatcommand("test_bulk_set_node", { + params = "", + description = "Test: Bulk-set 9×9×9 stone nodes", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local pos_list = {} + local ppos = player:get_pos() + local i = 1 + for x=2,10 do + for y=2,10 do + for z=2,10 do + pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} + i = i + 1 + end + end + end + minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) + return true, "Done." + end, +}) + +minetest.register_chatcommand("bench_bulk_set_node", { + params = "", + description = "Benchmark: Bulk-set 99×99×99 stone nodes", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local pos_list = {} + local ppos = player:get_pos() + local i = 1 + for x=2,100 do + for y=2,100 do + for z=2,100 do + pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} + i = i + 1 + end + end + end + + minetest.chat_send_player(name, "Benchmarking minetest.bulk_set_node. Warming up ..."); + + -- warm up with stone to prevent having different callbacks + -- due to different node topology + minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) + + minetest.chat_send_player(name, "Warming up finished, now benchmarking ..."); + + local start_time = minetest.get_us_time() + for i=1,#pos_list do + minetest.set_node(pos_list[i], {name = "mapgen_stone"}) + end + local middle_time = minetest.get_us_time() + minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) + local end_time = minetest.get_us_time() + local msg = string.format("Benchmark results: minetest.set_node loop: %.2f ms; minetest.bulk_set_node: %.2f ms", + ((middle_time - start_time)) / 1000, + ((end_time - middle_time)) / 1000 + ) + return true, msg + end, +}) + +local function advance_pos(pos, start_pos, advance_z) + if advance_z then + pos.z = pos.z + 2 + pos.x = start_pos.x + else + pos.x = pos.x + 2 + end + if pos.x > 30900 or pos.x - start_pos.x > 46 then + pos.x = start_pos.x + pos.z = pos.z + 2 + end + if pos.z > 30900 then + -- We ran out of space! Aborting + aborted = true + return false + end + return pos +end + +local function place_nodes(param) + local nodes = param.nodes + local name = param.name + local pos = param.pos + local start_pos = param.start_pos + table.sort(nodes) + minetest.chat_send_player(name, "Placing nodes …") + local nodes_placed = 0 + for n=1, #nodes do + local itemstring = nodes[n] + local def = minetest.registered_nodes[itemstring] + local p2_max = 0 + if param.param ~= "no_param2" then + -- Also test the param2 values of the nodes + -- ... but we only use permissible param2 values + if def.paramtype2 == "wallmounted" then + p2_max = 5 + elseif def.paramtype2 == "facedir" then + p2_max = 23 + elseif def.paramtype2 == "glasslikeliquidlevel" then + p2_max = 63 + elseif def.paramtype2 == "meshoptions" and def.drawtype == "plantlike" then + p2_max = 63 + elseif def.paramtype2 == "leveled" then + p2_max = 127 + elseif def.paramtype2 == "degrotate" and def.drawtype == "plantlike" then + p2_max = 179 + elseif def.paramtype2 == "colorfacedir" or + def.paramtype2 == "colorwallmounted" or + def.paramtype2 == "color" then + p2_max = 255 + end + end + for p2 = 0, p2_max do + -- Skip undefined param2 values + if not ((def.paramtype2 == "meshoptions" and p2 % 8 > 4) or + (def.paramtype2 == "colorwallmounted" and p2 % 8 > 5) or + (def.paramtype2 == "colorfacedir" and p2 % 32 > 23)) then + + minetest.set_node(pos, { name = itemstring, param2 = p2 }) + nodes_placed = nodes_placed + 1 + pos = advance_pos(pos, start_pos) + if not pos then + aborted = true + break + end + end + end + if aborted then + break + end + end + if aborted then + minetest.chat_send_player(name, "Not all nodes could be placed, please move further away from the world boundary. Nodes placed: "..nodes_placed) + end + minetest.chat_send_player(name, "Nodes placed: "..nodes_placed..".") +end + +local function after_emerge(blockpos, action, calls_remaining, param) + if calls_remaining == 0 then + place_nodes(param) + end +end + +minetest.register_chatcommand("test_place_nodes", { + params = "[ no_param2 ]", + description = "Test: Place all non-experimental nodes and optionally their permissible param2 variants", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local pos = vector.floor(player:get_pos()) + pos.x = math.ceil(pos.x + 3) + pos.z = math.ceil(pos.z + 3) + pos.y = math.ceil(pos.y + 1) + local start_pos = table.copy(pos) + if pos.x > 30800 then + return false, "Too close to world boundary (+X). Please move to X < 30800." + end + if pos.z > 30800 then + return false, "Too close to world boundary (+Z). Please move to Z < 30800." + end + + local aborted = false + local nodes = {} + local emerge_estimate = 0 + for itemstring, def in pairs(minetest.registered_nodes) do + if itemstring ~= "ignore" and string.sub(itemstring, 1, 13) ~= "experimental:" then + table.insert(nodes, itemstring) + if def.paramtype2 == 0 then + emerge_estimate = emerge_estimate + 1 + else + emerge_estimate = emerge_estimate + 255 + end + end + end + -- Emerge area to make sure that all nodes are being placed. + -- Note we will emerge much more than we need to (overestimation), + -- the estimation code could be improved performance-wise … + local length = 16 + math.ceil(emerge_estimate / 24) * 2 + minetest.emerge_area(start_pos, + { x = start_pos.x + 46, y = start_pos.y, z = start_pos.z + length }, + after_emerge, { nodes = nodes, name = name, pos = pos, start_pos = start_pos, param = param }) + return true, "Emerging area …" + end, +}) + diff --git a/games/devtest/mods/experimental/detached.lua b/games/devtest/mods/experimental/detached.lua new file mode 100644 index 000000000..673adfdd4 --- /dev/null +++ b/games/devtest/mods/experimental/detached.lua @@ -0,0 +1,29 @@ +-- Create a detached inventory +local inv = minetest.create_detached_inventory("test_inventory", { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + experimental.print_to_everything("allow move asked") + return count -- Allow all + end, + allow_put = function(inv, listname, index, stack, player) + experimental.print_to_everything("allow put asked") + return 1 -- Allow only 1 + end, + allow_take = function(inv, listname, index, stack, player) + experimental.print_to_everything("allow take asked") + return 4 -- Allow 4 at max + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player) + experimental.print_to_everything(player:get_player_name().." moved items") + end, + on_put = function(inv, listname, index, stack, player) + experimental.print_to_everything(player:get_player_name().." put items") + end, + on_take = function(inv, listname, index, stack, player) + experimental.print_to_everything(player:get_player_name().." took items") + end, +}) +inv:set_size("main", 4*6) +inv:add_item("main", "experimental:callback_node") +inv:add_item("main", "experimental:particle_spawner") + + diff --git a/games/devtest/mods/experimental/init.lua b/games/devtest/mods/experimental/init.lua new file mode 100644 index 000000000..b292f792e --- /dev/null +++ b/games/devtest/mods/experimental/init.lua @@ -0,0 +1,23 @@ +-- +-- Experimental things +-- + +experimental = {} + +dofile(minetest.get_modpath("experimental").."/detached.lua") +dofile(minetest.get_modpath("experimental").."/items.lua") +dofile(minetest.get_modpath("experimental").."/commands.lua") + +function experimental.print_to_everything(msg) + minetest.log("action", msg) + minetest.chat_send_all(msg) +end + +minetest.log("info", "[experimental] modname="..dump(minetest.get_current_modname())) +minetest.log("info", "[experimental] modpath="..dump(minetest.get_modpath("experimental"))) +minetest.log("info", "[experimental] worldpath="..dump(minetest.get_worldpath())) + + +minetest.register_on_mods_loaded(function() + minetest.log("action", "[experimental] on_mods_loaded()") +end) diff --git a/games/devtest/mods/experimental/items.lua b/games/devtest/mods/experimental/items.lua new file mode 100644 index 000000000..51b063ba2 --- /dev/null +++ b/games/devtest/mods/experimental/items.lua @@ -0,0 +1,103 @@ +minetest.register_node("experimental:callback_node", { + description = "Callback Test Node (construct/destruct/timer)", + tiles = {"experimental_callback_node.png"}, + groups = {dig_immediate=3}, + -- This was known to cause a bug in minetest.item_place_node() when used + -- via minetest.place_node(), causing a placer with no position + paramtype2 = "facedir", + drop = "", + + on_construct = function(pos) + experimental.print_to_everything("experimental:callback_node:on_construct("..minetest.pos_to_string(pos)..")") + local meta = minetest.get_meta(pos) + meta:set_string("mine", "test") + local timer = minetest.get_node_timer(pos) + timer:start(4, 3) + end, + + after_place_node = function(pos, placer) + experimental.print_to_everything("experimental:callback_node:after_place_node("..minetest.pos_to_string(pos)..")") + local meta = minetest.get_meta(pos) + if meta:get_string("mine") == "test" then + experimental.print_to_everything("correct metadata found") + else + experimental.print_to_everything("incorrect metadata found") + end + end, + + on_destruct = function(pos) + experimental.print_to_everything("experimental:callback_node:on_destruct("..minetest.pos_to_string(pos)..")") + end, + + after_destruct = function(pos) + experimental.print_to_everything("experimental:callback_node:after_destruct("..minetest.pos_to_string(pos)..")") + end, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + experimental.print_to_everything("experimental:callback_node:after_dig_node("..minetest.pos_to_string(pos)..")") + end, + + on_timer = function(pos, elapsed) + experimental.print_to_everything("on_timer(): elapsed="..dump(elapsed)) + return true + end, +}) + +minetest.register_tool("experimental:privatizer", { + description = "Node Meta Privatizer", + inventory_image = "experimental_tester_tool_1.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type == "node" then + local node = minetest.get_node(pointed_thing.under) + if node.name == "chest:chest" then + local p = pointed_thing.under + minetest.log("action", "Privatizer used at "..minetest.pos_to_string(p)) + minetest.get_meta(p):mark_as_private({"infotext", "formspec"}) + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), "Chest metadata (infotext, formspec) set private!") + end + return + end + end + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), "Privatizer can only be used on chest!") + end + end, +}) + +minetest.register_tool("experimental:particle_spawner", { + description = "Particle Spawner", + inventory_image = "experimental_tester_tool_1.png^[invert:g", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing, true) + if pos == nil then + if user then + pos = user:get_pos() + end + end + pos = vector.add(pos, {x=0, y=0.5, z=0}) + local tex, anim + if math.random(0, 1) == 0 then + tex = "experimental_particle_sheet.png" + anim = {type="sheet_2d", frames_w=3, frames_h=2, frame_length=0.5} + else + tex = "experimental_particle_vertical.png" + anim = {type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3} + end + + minetest.add_particle({ + pos = pos, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=0.04, z=0}, + expirationtime = 6, + collisiondetection = true, + texture = tex, + animation = anim, + size = 4, + glow = math.random(0, 5), + }) + end, +}) + diff --git a/games/devtest/mods/experimental/mod.conf b/games/devtest/mods/experimental/mod.conf new file mode 100644 index 000000000..cf0f9cb42 --- /dev/null +++ b/games/devtest/mods/experimental/mod.conf @@ -0,0 +1,2 @@ +name = experimental +description = Chaotic mod containing unstructured tests for testing out engine features. The features in this mod should be moved to other mods. diff --git a/games/devtest/mods/experimental/textures/experimental_callback_node.png b/games/devtest/mods/experimental/textures/experimental_callback_node.png new file mode 100644 index 000000000..e9d87434c Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_callback_node.png differ diff --git a/games/devtest/mods/experimental/textures/experimental_particle_sheet.png b/games/devtest/mods/experimental/textures/experimental_particle_sheet.png new file mode 100644 index 000000000..6d70394e4 Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_particle_sheet.png differ diff --git a/games/devtest/mods/experimental/textures/experimental_particle_vertical.png b/games/devtest/mods/experimental/textures/experimental_particle_vertical.png new file mode 100644 index 000000000..0320b7545 Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_particle_vertical.png differ diff --git a/games/devtest/mods/experimental/textures/experimental_tester_tool_1.png b/games/devtest/mods/experimental/textures/experimental_tester_tool_1.png new file mode 100644 index 000000000..5df416a58 Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_tester_tool_1.png differ diff --git a/games/devtest/mods/give_initial_stuff/init.lua b/games/devtest/mods/give_initial_stuff/init.lua new file mode 100644 index 000000000..491a531e4 --- /dev/null +++ b/games/devtest/mods/give_initial_stuff/init.lua @@ -0,0 +1,37 @@ +local give_if_not_gotten_already = function(inv, list, item) + if not inv:contains_item(list, item) then + inv:add_item(list, item) + end +end + +local give_initial_stuff = function(player) + local inv = player:get_inventory() + give_if_not_gotten_already(inv, "main", "basetools:pick_mese") + give_if_not_gotten_already(inv, "main", "basetools:axe_steel") + give_if_not_gotten_already(inv, "main", "basetools:shovel_steel") + give_if_not_gotten_already(inv, "main", "bucket:bucket") + give_if_not_gotten_already(inv, "main", "testnodes:light14") + give_if_not_gotten_already(inv, "main", "chest_of_everything:chest") + minetest.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name()) +end + +minetest.register_on_newplayer(function(player) + if minetest.settings:get_bool("give_initial_stuff", true) then + give_initial_stuff(player) + end +end) + +minetest.register_chatcommand("stuff", { + params = "", + privs = { give = true }, + description = "Give yourself initial items", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player or not player:is_player() then + return false, "No player." + end + give_initial_stuff(player) + return true + end, +}) + diff --git a/games/devtest/mods/give_initial_stuff/mod.conf b/games/devtest/mods/give_initial_stuff/mod.conf new file mode 100644 index 000000000..1ba49f52a --- /dev/null +++ b/games/devtest/mods/give_initial_stuff/mod.conf @@ -0,0 +1,3 @@ +name = give_initial_stuff +description = Gives items to players on join +depends = basetools, bucket, chest_of_everything, testnodes diff --git a/games/devtest/mods/initial_message/init.lua b/games/devtest/mods/initial_message/init.lua new file mode 100644 index 000000000..59e9f5f4b --- /dev/null +++ b/games/devtest/mods/initial_message/init.lua @@ -0,0 +1,9 @@ +minetest.register_on_joinplayer(function(player) + local cb = function(player) + if not player or not player:is_player() then + return + end + minetest.chat_send_player(player:get_player_name(), "This is the \"Development Test\" [devtest], meant only for testing and development. Use Minetest Game for the real thing.") + end + minetest.after(2.0, cb, player) +end) diff --git a/games/devtest/mods/initial_message/mod.conf b/games/devtest/mods/initial_message/mod.conf new file mode 100644 index 000000000..32aa2ac4e --- /dev/null +++ b/games/devtest/mods/initial_message/mod.conf @@ -0,0 +1,2 @@ +name = initial_message +description = Show message to joining players explaining what this testing game is about diff --git a/games/devtest/mods/mapgen/init.lua b/games/devtest/mods/mapgen/init.lua new file mode 100644 index 000000000..13a186a50 --- /dev/null +++ b/games/devtest/mods/mapgen/init.lua @@ -0,0 +1,81 @@ +-- +-- Aliases for map generator outputs +-- + +-- ESSENTIAL node aliases +-- Basic nodes +minetest.register_alias("mapgen_stone", "basenodes:stone") +minetest.register_alias("mapgen_water_source", "basenodes:water_source") +minetest.register_alias("mapgen_river_water_source", "basenodes:river_water_source") + +-- Additional essential aliases for v6 +minetest.register_alias("mapgen_lava_source", "basenodes:lava_source") +minetest.register_alias("mapgen_dirt", "basenodes:dirt") +minetest.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass") +minetest.register_alias("mapgen_sand", "basenodes:sand") +minetest.register_alias("mapgen_tree", "basenodes:tree") +minetest.register_alias("mapgen_leaves", "basenodes:leaves") +minetest.register_alias("mapgen_apple", "basenodes:apple") + +-- Essential alias for dungeons +minetest.register_alias("mapgen_cobble", "basenodes:cobble") + +-- Optional aliases for v6 (they all have fallback values in the engine) +if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then + minetest.register_alias("mapgen_gravel", "basenodes:gravel") + minetest.register_alias("mapgen_desert_stone", "basenodes:desert_stone") + minetest.register_alias("mapgen_desert_sand", "basenodes:desert_sand") + minetest.register_alias("mapgen_dirt_with_snow", "basenodes:dirt_with_snow") + minetest.register_alias("mapgen_snowblock", "basenodes:snowblock") + minetest.register_alias("mapgen_snow", "basenodes:snow") + minetest.register_alias("mapgen_ice", "basenodes:ice") + minetest.register_alias("mapgen_junglegrass", "basenodes:junglegrass") + minetest.register_alias("mapgen_jungletree", "basenodes:jungletree") + minetest.register_alias("mapgen_jungleleaves", "basenodes:jungleleaves") + minetest.register_alias("mapgen_pine_tree", "basenodes:pine_tree") + minetest.register_alias("mapgen_pine_needles", "basenodes:pine_needles") +end +-- Optional alias for mossycobble (should fall back to cobble) +if minetest.settings:get_bool("devtest_dungeon_mossycobble", false) then + minetest.register_alias("mapgen_mossycobble", "basenodes:mossycobble") +end +-- Optional aliases for dungeon stairs (should fall back to full nodes) +if minetest.settings:get_bool("devtest_dungeon_stairs", false) then + minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") + if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then + minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone") + end +end + +-- +-- Register biomes for biome API +-- + +minetest.clear_registered_biomes() +minetest.clear_registered_decorations() + +if minetest.settings:get_bool("devtest_register_biomes", true) then + minetest.register_biome({ + name = "mapgen:grassland", + node_top = "basenodes:dirt_with_grass", + depth_top = 1, + node_filler = "basenodes:dirt", + depth_filler = 1, + y_min = 5, + y_max = 31000, + heat_point = 50, + humidity_point = 50, + }) + + minetest.register_biome({ + name = "mapgen:grassland_ocean", + node_top = "basenodes:sand", + depth_top = 1, + node_filler = "basenodes:sand", + depth_filler = 2, + y_min = -31000, + y_max = 4, + heat_point = 50, + humidity_point = 50, + }) +end diff --git a/games/devtest/mods/mapgen/mod.conf b/games/devtest/mods/mapgen/mod.conf new file mode 100644 index 000000000..15750ccbe --- /dev/null +++ b/games/devtest/mods/mapgen/mod.conf @@ -0,0 +1,3 @@ +name = mapgen +description = Minimal map generator +depends = basenodes diff --git a/games/devtest/mods/modchannels/init.lua b/games/devtest/mods/modchannels/init.lua new file mode 100644 index 000000000..ee925f09b --- /dev/null +++ b/games/devtest/mods/modchannels/init.lua @@ -0,0 +1,14 @@ +-- +-- Mod channels experimental handlers +-- +local mod_channel = minetest.mod_channel_join("experimental_preview") + +minetest.register_on_modchannel_message(function(channel, sender, message) + minetest.log("action", "[modchannels] Server received message `" .. message + .. "` on channel `" .. channel .. "` from sender `" .. sender .. "`") + + if mod_channel:is_writeable() then + mod_channel:send_all("experimental answers to preview") + mod_channel:leave() + end +end) diff --git a/games/devtest/mods/modchannels/mod.conf b/games/devtest/mods/modchannels/mod.conf new file mode 100644 index 000000000..7c13aadfb --- /dev/null +++ b/games/devtest/mods/modchannels/mod.conf @@ -0,0 +1,2 @@ +name = modchannels +description = Add experimental mod channel handlers diff --git a/games/devtest/mods/soundstuff/init.lua b/games/devtest/mods/soundstuff/init.lua new file mode 100644 index 000000000..22012ba14 --- /dev/null +++ b/games/devtest/mods/soundstuff/init.lua @@ -0,0 +1,170 @@ +local simple_nodes = { + footstep = { "Footstep Sound Node", "soundstuff_node_footstep.png" }, + dig = { "Dig Sound Node", "soundstuff_node_dig.png" }, + dug = { "Dug Sound Node", "soundstuff_node_dug.png" }, + place = { "Place Sound Node", "soundstuff_node_place.png" }, + place_failed = { "Place Failed Sound Node", "soundstuff_node_place_failed.png" }, +} + +for k,v in pairs(simple_nodes) do + minetest.register_node("soundstuff:"..k, { + description = v[1], + tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]}, + groups = {dig_immediate=2}, + sounds = { + [k] = { name = "soundstuff_mono", gain = 1.0 }, + } + }) +end + +minetest.register_node("soundstuff:place_failed_attached", { + description = "Attached Place Failed Sound Node", + tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"}, + groups = {dig_immediate=2, attached_node=1}, + drawtype = "nodebox", + paramtype = "light", + node_box = { type = "fixed", fixed = { + { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, + { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, + }}, + sounds = { + place_failed = { name = "soundstuff_mono", gain = 1.0 }, + }, +}) + +minetest.register_node("soundstuff:fall", { + description = "Fall Sound Node", + tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, + groups = {dig_immediate=2, falling_node=1}, + sounds = { + fall = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_node("soundstuff:fall_attached", { + description = "Attached Fall Sound Node", + tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, + groups = {dig_immediate=2, attached_node=1}, + drawtype = "nodebox", + paramtype = "light", + node_box = { type = "fixed", fixed = { + { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, + { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, + }}, + sounds = { + fall = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_node("soundstuff:footstep_liquid", { + description = "Liquid Footstep Sound Node", + drawtype = "liquid", + tiles = { + "soundstuff_node_sound.png^[colorize:#0000FF:127", + }, + special_tiles = { + {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = false}, + {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = true}, + }, + liquids_pointable = true, + liquidtype = "source", + liquid_alternative_flowing = "soundstuff:footstep_liquid", + liquid_alternative_source = "soundstuff:footstep_liquid", + liquid_renewable = false, + liquid_range = 0, + liquid_viscosity = 0, + alpha = 190, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + post_effect_color = {a = 64, r = 0, g = 0, b = 200}, + sounds = { + footstep = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_node("soundstuff:footstep_climbable", { + description = "Climbable Footstep Sound Node", + drawtype = "allfaces", + tiles = { + "soundstuff_node_climbable.png", + }, + alpha = 120, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + groups = { dig_immediate = 2 }, + sounds = { + footstep = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + + + +minetest.register_craftitem("soundstuff:eat", { + description = "Eat Sound Item", + inventory_image = "soundstuff_eat.png", + on_use = minetest.item_eat(0), + sound = { + eat = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_tool("soundstuff:breaks", { + description = "Break Sound Tool", + inventory_image = "soundstuff_node_dug.png", + sound = { + breaks = { name = "soundstuff_mono", gain = 1.0 }, + }, + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + choppy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + snappy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + crumbly={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + }, + }, +}) + +-- Plays sound repeatedly +minetest.register_node("soundstuff:positional", { + description = "Positional Sound Node", + on_construct = function(pos) + local timer = minetest.get_node_timer(pos) + timer:start(0) + end, + on_timer = function(pos, elapsed) + local node = minetest.get_node(pos) + local dist = node.param2 + if dist == 0 then + dist = nil + end + minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist }) + local timer = minetest.get_node_timer(pos) + timer:start(0.7) + end, + on_rightclick = function(pos, node, clicker) + node.param2 = (node.param2 + 1) % 64 + minetest.set_node(pos, node) + if clicker and clicker:is_player() then + local dist = node.param2 + local diststr + if dist == 0 then + diststr = "" + else + diststr = tostring(dist) + end + minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr) + end + end, + + groups = { dig_immediate = 2 }, + tiles = { "soundstuff_node_sound.png" }, +}) + diff --git a/games/devtest/mods/soundstuff/mod.conf b/games/devtest/mods/soundstuff/mod.conf new file mode 100644 index 000000000..2c631e2da --- /dev/null +++ b/games/devtest/mods/soundstuff/mod.conf @@ -0,0 +1,2 @@ +name = soundstuff +description = Example items and nodes for testing sound effects diff --git a/games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg b/games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg new file mode 100644 index 000000000..43428d566 Binary files /dev/null and b/games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_eat.png b/games/devtest/mods/soundstuff/textures/soundstuff_eat.png new file mode 100644 index 000000000..aed205422 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_eat.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png new file mode 100644 index 000000000..4dffacc4c Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png new file mode 100644 index 000000000..3888f793c Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png new file mode 100644 index 000000000..67ba111d8 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png new file mode 100644 index 000000000..bab5fbe51 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png new file mode 100644 index 000000000..17b14f1e4 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png new file mode 100644 index 000000000..6367ae909 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_place.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_place.png new file mode 100644 index 000000000..d159ad533 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_place.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png new file mode 100644 index 000000000..780ba946d Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png new file mode 100644 index 000000000..0592a0299 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png differ diff --git a/games/devtest/mods/stairs/init.lua b/games/devtest/mods/stairs/init.lua new file mode 100644 index 000000000..2701cabab --- /dev/null +++ b/games/devtest/mods/stairs/init.lua @@ -0,0 +1,65 @@ +stairs = {} + +-- Node will be called stairs:stair_ +function stairs.register_stair(subname, recipeitem, groups, images, description) + minetest.register_node(":stairs:stair_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + }) +end + +-- Node will be called stairs:slab_ +function stairs.register_slab(subname, recipeitem, groups, images, description) + minetest.register_node(":stairs:slab_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + is_ground_content = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + }) +end + +-- Nodes will be called stairs:{stair,slab}_ +function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab) + stairs.register_stair(subname, recipeitem, groups, images, desc_stair) + stairs.register_slab(subname, recipeitem, groups, images, desc_slab) +end + +stairs.register_stair_and_slab("stone", "basenodes:stone", + {cracky=3}, + {"default_stone.png"}, + "Stone Stair", + "Stone Slab") + +stairs.register_stair_and_slab("desert_stone", "basenodes:desert_stone", + {cracky=3}, + {"default_desert_stone.png"}, + "Desert Stone Stair", + "Desert Stone Slab") + +stairs.register_stair_and_slab("cobble", "basenodes:cobble", + {cracky=3}, + {"default_cobble.png"}, + "Cobblestone Stair", + "Cobblestone Slab") diff --git a/games/devtest/mods/stairs/mod.conf b/games/devtest/mods/stairs/mod.conf new file mode 100644 index 000000000..724bff881 --- /dev/null +++ b/games/devtest/mods/stairs/mod.conf @@ -0,0 +1,3 @@ +name = stairs +description = Adds stairs and slabs +depends = basenodes diff --git a/games/devtest/mods/testentities/armor.lua b/games/devtest/mods/testentities/armor.lua new file mode 100644 index 000000000..4c30cec8d --- /dev/null +++ b/games/devtest/mods/testentities/armor.lua @@ -0,0 +1,41 @@ +-- Armorball: Test entity for testing armor groups +-- Rightclick to change armor group + +local phasearmor = { + [0]={icy=100}, + [1]={firy=100}, + [2]={fleshy=100}, + [3]={immortal=1}, + [4]={punch_operable=1}, +} + +minetest.register_entity("testentities:armorball", { + initial_properties = { + hp_max = 20, + physical = false, + collisionbox = {-0.4,-0.4,-0.4, 0.4,0.4,0.4}, + visual = "sprite", + visual_size = {x=1, y=1}, + textures = {"testentities_armorball.png"}, + spritediv = {x=1, y=5}, + initial_sprite_basepos = {x=0, y=0}, + }, + + _phase = 2, + + on_activate = function(self, staticdata) + minetest.log("action", "[testentities] armorball.on_activate") + self.object:set_armor_groups(phasearmor[self._phase]) + self.object:set_sprite({x=0, y=self._phase}) + end, + + on_rightclick = function(self, clicker) + -- Change armor group and sprite + self._phase = self._phase + 1 + if self._phase >= 5 then + self._phase = 0 + end + self.object:set_sprite({x=0, y=self._phase}) + self.object:set_armor_groups(phasearmor[self._phase]) + end, +}) diff --git a/games/devtest/mods/testentities/callbacks.lua b/games/devtest/mods/testentities/callbacks.lua new file mode 100644 index 000000000..711079f87 --- /dev/null +++ b/games/devtest/mods/testentities/callbacks.lua @@ -0,0 +1,75 @@ +-- Entities that test their callbacks + +local message = function(msg) + minetest.log("action", msg) + minetest.chat_send_all(msg) +end + +local get_object_name = function(obj) + local name = "" + if obj then + if obj:is_player() then + name = obj:get_player_name() + else + name = "" + end + end + return name +end + +local spos = function(self) + return minetest.pos_to_string(vector.round(self.object:get_pos())) +end + +-- Callback test entity (all callbacks except on_step) +minetest.register_entity("testentities:callback", { + initial_properties = { + visual = "upright_sprite", + textures = { "testentities_callback.png" }, + }, + + on_activate = function(self, staticdata, dtime_s) + message("Callback entity: on_activate! pos="..spos(self).."; dtime_s="..dtime_s) + end, + on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) + local name = get_object_name(puncher) + message( + "Callback entity: on_punch! ".. + "pos="..spos(self).."; puncher="..name.."; ".. + "time_from_last_punch="..time_from_last_punch.."; ".. + "tool_capabilities="..tostring(dump(tool_capabilities)).."; ".. + "dir="..tostring(dump(dir)).."; damage="..damage) + end, + on_rightclick = function(self, clicker) + local name = get_object_name(clicker) + message("Callback entity: on_rightclick! pos="..spos(self).."; clicker="..name) + end, + on_death = function(self, killer) + local name = get_object_name(killer) + message("Callback entity: on_death! pos="..spos(self).."; killer="..name) + end, + on_attach_child = function(self, child) + local name = get_object_name(child) + message("Callback entity: on_attach_child! pos="..spos(self).."; child="..name) + end, + on_detach_child = function(self, child) + local name = get_object_name(child) + message("Callback entity: on_detach_child! pos="..spos(self).."; child="..name) + end, + on_detach = function(self, parent) + local name = get_object_name(parent) + message("Callback entity: on_detach! pos="..spos(self).."; parent="..name) + end, + get_staticdata = function(self) + message("Callback entity: get_staticdata! pos="..spos(self)) + end, +}) + +-- Only test on_step callback +minetest.register_entity("testentities:callback_step", { + visual = "upright_sprite", + textures = { "testentities_callback_step.png" }, + on_step = function(self, dtime) + message("on_step callback entity: on_step! pos="..spos(self).."; dtime="..dtime) + end, +}) diff --git a/games/devtest/mods/testentities/init.lua b/games/devtest/mods/testentities/init.lua new file mode 100644 index 000000000..df8c72ea7 --- /dev/null +++ b/games/devtest/mods/testentities/init.lua @@ -0,0 +1,3 @@ +dofile(minetest.get_modpath("testentities").."/visuals.lua") +dofile(minetest.get_modpath("testentities").."/armor.lua") +dofile(minetest.get_modpath("testentities").."/callbacks.lua") diff --git a/games/devtest/mods/testentities/mod.conf b/games/devtest/mods/testentities/mod.conf new file mode 100644 index 000000000..7a8cb5a3e --- /dev/null +++ b/games/devtest/mods/testentities/mod.conf @@ -0,0 +1,2 @@ +name = testentities +description = Example entities for testing diff --git a/games/devtest/mods/testentities/textures/testentities_armorball.png b/games/devtest/mods/testentities/textures/testentities_armorball.png new file mode 100644 index 000000000..88147bd1f Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_armorball.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_callback.png b/games/devtest/mods/testentities/textures/testentities_callback.png new file mode 100644 index 000000000..c4c9066d1 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_callback.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_callback_step.png b/games/devtest/mods/testentities/textures/testentities_callback_step.png new file mode 100644 index 000000000..b67506a97 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_callback_step.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube1.png b/games/devtest/mods/testentities/textures/testentities_cube1.png new file mode 100644 index 000000000..c667e425f Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube1.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube2.png b/games/devtest/mods/testentities/textures/testentities_cube2.png new file mode 100644 index 000000000..481823420 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube2.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube3.png b/games/devtest/mods/testentities/textures/testentities_cube3.png new file mode 100644 index 000000000..03b5daa15 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube3.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube4.png b/games/devtest/mods/testentities/textures/testentities_cube4.png new file mode 100644 index 000000000..639204896 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube4.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube5.png b/games/devtest/mods/testentities/textures/testentities_cube5.png new file mode 100644 index 000000000..d8acdf0b6 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube5.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube6.png b/games/devtest/mods/testentities/textures/testentities_cube6.png new file mode 100644 index 000000000..5f81a64d9 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube6.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_dungeon_master.png b/games/devtest/mods/testentities/textures/testentities_dungeon_master.png new file mode 100644 index 000000000..1e3107746 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_dungeon_master.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_sprite.png b/games/devtest/mods/testentities/textures/testentities_sprite.png new file mode 100644 index 000000000..a4b019699 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_sprite.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_upright_sprite1.png b/games/devtest/mods/testentities/textures/testentities_upright_sprite1.png new file mode 100644 index 000000000..6242511df Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_upright_sprite1.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_upright_sprite2.png b/games/devtest/mods/testentities/textures/testentities_upright_sprite2.png new file mode 100644 index 000000000..a79a760e3 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_upright_sprite2.png differ diff --git a/games/devtest/mods/testentities/visuals.lua b/games/devtest/mods/testentities/visuals.lua new file mode 100644 index 000000000..de346fd68 --- /dev/null +++ b/games/devtest/mods/testentities/visuals.lua @@ -0,0 +1,74 @@ +-- Minimal test entities to test visuals + +minetest.register_entity("testentities:sprite", { + initial_properties = { + visual = "sprite", + textures = { "testentities_sprite.png" }, + }, +}) + +minetest.register_entity("testentities:upright_sprite", { + initial_properties = { + visual = "upright_sprite", + textures = { + "testentities_upright_sprite1.png", + "testentities_upright_sprite2.png", + }, + }, +}) + +minetest.register_entity("testentities:cube", { + initial_properties = { + visual = "cube", + textures = { + "testentities_cube1.png", + "testentities_cube2.png", + "testentities_cube3.png", + "testentities_cube4.png", + "testentities_cube5.png", + "testentities_cube6.png", + }, + }, +}) + +minetest.register_entity("testentities:item", { + initial_properties = { + visual = "item", + wield_item = "testnodes:normal", + }, +}) + +minetest.register_entity("testentities:wielditem", { + initial_properties = { + visual = "wielditem", + wield_item = "testnodes:normal", + }, +}) + +minetest.register_entity("testentities:mesh", { + initial_properties = { + visual = "mesh", + mesh = "testnodes_pyramid.obj", + textures = { + "testnodes_mesh_stripes2.png" + }, + }, +}) + +-- Advanced visual tests + +-- A test entity for testing animated and yaw-modulated sprites +minetest.register_entity("testentities:yawsprite", { + initial_properties = { + selectionbox = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}, + visual = "sprite", + visual_size = {x=0.6666, y=1}, + textures = {"testentities_dungeon_master.png^[makealpha:128,0,0^[makealpha:128,128,0"}, + spritediv = {x=6, y=5}, + initial_sprite_basepos = {x=0, y=0}, + on_activate = function(self, staticdata) + self.object:set_sprite({x=0, y=0}, 1, 0, true) + end, + }, +}) + diff --git a/games/devtest/mods/testfood/init.lua b/games/devtest/mods/testfood/init.lua new file mode 100644 index 000000000..a6236ff68 --- /dev/null +++ b/games/devtest/mods/testfood/init.lua @@ -0,0 +1,24 @@ +local S = minetest.get_translator("testfood") + +minetest.register_craftitem("testfood:good1", { + description = S("Good Food (+1)"), + inventory_image = "testfood_good.png", + on_use = minetest.item_eat(1), +}) +minetest.register_craftitem("testfood:good5", { + description = S("Good Food (+5)"), + inventory_image = "testfood_good2.png", + on_use = minetest.item_eat(5), +}) + +minetest.register_craftitem("testfood:bad1", { + description = S("Bad Food (-1)"), + inventory_image = "testfood_bad.png", + on_use = minetest.item_eat(-1), +}) +minetest.register_craftitem("testfood:bad5", { + description = S("Bad Food (-5)"), + inventory_image = "testfood_bad2.png", + on_use = minetest.item_eat(-5), +}) + diff --git a/games/devtest/mods/testfood/mod.conf b/games/devtest/mods/testfood/mod.conf new file mode 100644 index 000000000..7bff21b6e --- /dev/null +++ b/games/devtest/mods/testfood/mod.conf @@ -0,0 +1,2 @@ +name = testfood +description = For testing food items diff --git a/games/devtest/mods/testfood/textures/testfood_bad.png b/games/devtest/mods/testfood/textures/testfood_bad.png new file mode 100644 index 000000000..6e9251440 Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_bad.png differ diff --git a/games/devtest/mods/testfood/textures/testfood_bad2.png b/games/devtest/mods/testfood/textures/testfood_bad2.png new file mode 100644 index 000000000..22b567890 Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_bad2.png differ diff --git a/games/devtest/mods/testfood/textures/testfood_good.png b/games/devtest/mods/testfood/textures/testfood_good.png new file mode 100644 index 000000000..31df7f5dd Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_good.png differ diff --git a/games/devtest/mods/testfood/textures/testfood_good2.png b/games/devtest/mods/testfood/textures/testfood_good2.png new file mode 100644 index 000000000..e43dda209 Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_good2.png differ diff --git a/games/devtest/mods/testformspec/callbacks.lua b/games/devtest/mods/testformspec/callbacks.lua new file mode 100644 index 000000000..559380580 --- /dev/null +++ b/games/devtest/mods/testformspec/callbacks.lua @@ -0,0 +1,51 @@ +local callback_test = 0 + +local out = function(player, formname, fields, number) + local snum = "" + if number then + snum = " "..number + end + local msg = "Formspec callback"..snum..": player="..player:get_player_name()..", formname=\""..tostring(formname).."\", fields="..dump(fields) + minetest.chat_send_player(player:get_player_name(), msg) + minetest.log("action", msg) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if callback_test == 1 then + out(player, formname, fields) + elseif callback_test == 2 then + out(player, formname, fields, 1) + end +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if callback_test == 2 then + out(player, formname, fields, 2) + return true -- Disable the first callback + end +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if callback_test == 2 then + out(player, formname, fields, 3) + end +end) + +minetest.register_chatcommand("test_formspec_callbacks", { + params = "[ 0 | 1 | 2 ]", + description = "Test: Change formspec callbacks testing mode", + func = function(name, param) + local mode = tonumber(param) + if not mode then + callback_test = (callback_test + 1 % 3) + else + callback_test = mode + end + if callback_test == 1 then + minetest.chat_send_player(name, "Formspec callback test mode 1 enabled: Logging only") + elseif callback_test == 2 then + minetest.chat_send_player(name, "Formspec callback test mode 2 enabled: Three callbacks, disable pre-registered callbacks") + else + callback_test = 0 + minetest.chat_send_player(name, "Formspec callback test disabled!") + end + end +}) diff --git a/games/devtest/mods/testformspec/dummy_items.lua b/games/devtest/mods/testformspec/dummy_items.lua new file mode 100644 index 000000000..2037ae9cf --- /dev/null +++ b/games/devtest/mods/testformspec/dummy_items.lua @@ -0,0 +1,14 @@ +-- This code adds dummy items that are supposed to be used in formspecs +-- for testing item_image formspec elements. + +minetest.register_node("testformspec:node", { + description = "Formspec Test Node", + tiles = { "testformspec_node.png" }, + groups = { dig_immediate = 3, dummy = 1 }, +}) + +minetest.register_craftitem("testformspec:item", { + description = "Formspec Test Item", + inventory_image = "testformspec_item.png", + groups = { dummy = 1 }, +}) diff --git a/games/devtest/mods/testformspec/formspec.lua b/games/devtest/mods/testformspec/formspec.lua new file mode 100644 index 000000000..08c1b6dc0 --- /dev/null +++ b/games/devtest/mods/testformspec/formspec.lua @@ -0,0 +1,381 @@ +local color = minetest.colorize + +local clip_fs = [[ + style_type[label,button,image_button,item_image_button, + tabheader,scrollbar,table,animated_image + ,field,textarea,checkbox,dropdown;noclip=%c] + + label[0,0;A clipping test] + button[0,1;3,0.8;clip_button;A clipping test] + image_button[0,2;3,0.8;testformspec_button_image.png;clip_image_button;A clipping test] + item_image_button[0,3;3,0.8;testformspec:item;clip_item_image_button;A clipping test] + tabheader[0,4.7;3,0.63;clip_tabheader;Clip,Test,Text,Tabs;1;false;false] + field[0,5;3,0.8;clip_field;Title;] + textarea[0,6;3,1;clip_textarea;Title;] + checkbox[0,7.5;clip_checkbox;This is a test;true] + dropdown[0,8;3,0.8;clip_dropdown;Select An Item,One,Two,Three,Four,Five;1] + scrollbar[0,9;3,0.8;horizontal;clip_scrollbar;3] + tablecolumns[text;text] + table[0,10;3,1;clip_table;one,two,three,four;1] + animated_image[-0.5,11;4.5,1;clip_animated_image;testformspec_animation.png;4;100] +]] + +local tabheaders_fs = [[ + tabheader[0,0;10,0.63;tabs_opaque;Opaque,Without,Border;1;false;false] + tabheader[0,1;10,0.63;tabs_opaque_border;Opaque,With,Border;1;false;true] + tabheader[0,2;10,0.63;tabs_transparent;Transparent,Without,Border;1;true;false] + tabheader[0,3;10,0.63;tabs_transparent_border;Transparent,With,Border;1;true;true] + tabheader[0,4;tabs_default;Default,Tabs;1] + tabheader[0,6;10,0.5;tabs_size1;Height=0.5;1;false;false] + tabheader[2,6;10,0.75;tabs_size1;Height=0.75;1;false;false] + tabheader[4,6;10,1;tabs_size2;Height=1;1;false;false] + tabheader[6,6;10,1.25;tabs_size2;Height=1.25;1;false;false] + tabheader[8,6;10,1.5;tabs_size2;Height=1.5;1;false;false] +]] + +local hypertext_basic = [[ +Normal test +This is a normal text. + +style test + + . + + +Tag test +normal +mono +bold +italic +underlined +big +bigger +left +
center
+right +justify. Here comes a blind text: Lorem testum dolor sit amet consecutor celeron fiftifahivus e shadoninia e smalus jokus anrus relsocutoti rubenwardus. Erasputinus hara holisti dominus wusi. Grumarinsti erltusmuate ol fortitusti fla flo, blani burki e sfani fahif. Ultae ratii, e megus gigae don anonimus. Grinus dimondus krockus e nore. Endus finalus nowus comus endus o blindus tekstus. + +Custom tag test + + + + + +color=green +Action: color=green +Action: hovercolor=yellow +size=24 +font=mono +color=green font=mono size=24 + +action test +action + +img test +Normal: + +width=48 height=48: + +float=left: + +float=right: + + +item test +Normal: + +width=48 height=48 + +angle=30,0,0: + +angle=0,30,0: + +angle=0,0,30: + +rotate=yes: + +rotate=100,0,0: + +rotate=0,100,0: + +rotate=0,0,100: + +rotate=50,75,100: + +angle=-30,-45,90 rotate=100,150,-50: +]] + +local hypertext_global = [[ + +This is a test of the global tag. The parameters are: +background=gray margin=20 valign=bottom halign=right color=pink hovercolor=purple size=12 font=mono +action]] + +local hypertext_fs = "hypertext[0,0;11,9;hypertext;"..minetest.formspec_escape(hypertext_basic).."]".. + "hypertext[0,9.5;11,2.5;hypertext;"..minetest.formspec_escape(hypertext_global).."]" + +local style_fs = [[ + style[one_btn1;bgcolor=red;textcolor=yellow;bgcolor_hovered=orange; + bgcolor_pressed=purple] + button[0,0;2.5,0.8;one_btn1;Button] + + style[one_btn2;border=false;textcolor=cyan] ]].. + "button[0,1.05;2.5,0.8;one_btn2;Text " .. color("#FF0", "Yellow") .. [[] + + style[one_btn3;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; + bgimg_pressed=testformspec_pressed.png] + button[0,2.1;1,1;one_btn3;Border] + + style[one_btn4;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; + bgimg_pressed=testformspec_pressed.png;border=false] + button[1.25,2.1;1,1;one_btn4;NoBor] + + style[one_btn5;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; + bgimg_pressed=testformspec_pressed.png;border=false;alpha=false] + button[0,3.35;1,1;one_btn5;Alph] + + style[one_btn6;border=true] + image_button[0,4.6;1,1;testformspec_button_image.png;one_btn6;Border] + + style[one_btn7;border=false] + image_button[1.25,4.6;1,1;testformspec_button_image.png;one_btn7;NoBor] + + style[one_btn8;border=false] + image_button[0,5.85;1,1;testformspec_button_image.png;one_btn8;Border;false;true;testformspec_pressed.png] + + style[one_btn9;border=true] + image_button[1.25,5.85;1,1;testformspec_button_image.png;one_btn9;NoBor;false;false;testformspec_pressed.png] + + style[one_btn10;alpha=false] + image_button[0,7.1;1,1;testformspec_button_image.png;one_btn10;NoAlpha] + + style[one_btn11;alpha=true] + image_button[1.25,7.1;1,1;testformspec_button_image.png;one_btn11;Alpha] + + style[one_btn12;border=true] + item_image_button[0,8.35;1,1;testformspec:item;one_btn12;Border] + + style[one_btn13;border=false] + item_image_button[1.25,8.35;1,1;testformspec:item;one_btn13;NoBor] + + style[one_btn14;border=false;bgimg=testformspec_bg.png;fgimg=testformspec_button_image.png] + style[one_btn14:hovered;bgimg=testformspec_bg_hovered.png;fgimg=testformspec_hovered.png;textcolor=yellow] + style[one_btn14:pressed;bgimg=testformspec_bg_pressed.png;fgimg=testformspec_pressed.png;textcolor=blue] + style[one_btn14:hovered+pressed;textcolor=purple] + image_button[0,9.6;1,1;testformspec_button_image.png;one_btn14;Bg] + + style[one_btn15;border=false;bgimg=testformspec_bg.png;bgimg_hovered=testformspec_bg_hovered.png;bgimg_pressed=testformspec_bg_pressed.png] + item_image_button[1.25,9.6;1,1;testformspec:item;one_btn15;Bg] + + style[one_btn16;border=false;bgimg=testformspec_bg_9slice.png;bgimg_hovered=testformspec_bg_9slice_hovered.png;bgimg_pressed=testformspec_bg_9slice_pressed.png;bgimg_middle=4,6] + button[2.5,9.6;2,1;one_btn16;9-Slice Bg] + + + + container[2.75,0] + + style[one_tb1;textcolor=Yellow] + tabheader[0,3;2.5,0.63;one_tb1;Yellow,Text,Tabs;1;false;false] + + style[one_f1;textcolor=yellow] + field[0,4.25;2.5,0.8;one_f1;Field One;Yellow Text] + + style[one_f2;border=false;textcolor=cyan] + field[0,5.75;2.5,0.8;one_f2;Field Two;Borderless Cyan Text] + + style[one_f3;textcolor=yellow] + textarea[0,7.025;2.5,0.8;one_f3;Label;]] .. + minetest.formspec_escape("Yellow Text\nLine two") .. [[ ] + + style[one_f4;border=false;textcolor=cyan] + textarea[0,8.324999999999999;2.5,0.8;one_f4;Label;]] .. + minetest.formspec_escape("Borderless Cyan Text\nLine two") .. [[ ] + + container_end[] +]] + +local scroll_fs = + "button[8.5,1;4,1;outside;Outside of container]".. + "box[1,1;8,6;#00aa]".. + "scroll_container[1,1;8,6;scrbar;vertical]".. + "button[0,1;1,1;lorem;Lorem]".. + "button[0,10;1,1;ipsum;Ipsum]".. + "pwdfield[2,2;1,1;lorem2;Lorem]".. + "list[current_player;main;4,4;1,5;]".. + "box[2,5;3,2;#ffff00]".. + "image[1,10;3,2;testformspec_item.png]".. + "image[3,1;testformspec_item.png]".. + "item_image[2,6;3,2;testformspec:node]".. + "label[2,15;bla Bli\nfoo bar]".. + "item_image_button[2,3;1,1;testformspec:node;itemimagebutton;ItemImageButton]".. + "tooltip[0,11;3,2;Buz;#f00;#000]".. + "box[0,11;3,2;#00ff00]".. + "hypertext[3,13;3,3;;" .. hypertext_basic .. "]" .. + "container[0,18]".. + "box[1,2;3,2;#0a0a]".. + "scroll_container[1,2;3,2;scrbar2;horizontal;0.06]".. + "button[0,0;6,1;butnest;Nest]".. + "label[10,0.5;nest]".. + "scroll_container_end[]".. + "scrollbar[1,0;3.5,0.3;horizontal;scrbar2;0]".. + "container_end[]".. + "dropdown[0,6;2;hmdrpdwn;apple,bulb;1]".. + "image_button[0,4;2,2;testformspec_button_image.png;imagebutton;bbbbtt;false;true;testformspec_pressed.png]".. + "box[1,22.5;4,1;#a00a]".. + "scroll_container_end[]".. + "scrollbaroptions[max=170]".. -- lowest seen pos is: 0.1*170+6=23 (factor*max+height) + "scrollbar[7.5,0;0.3,4;vertical;scrbar;0]".. + "scrollbar[8,0;0.3,4;vertical;scrbarhmmm;0]".. + "dropdown[0,6;2;hmdrpdwnnn;Outside,of,container;1]" + +--style_type[label;textcolor=green] +--label[0,0;Green] +--style_type[label;textcolor=blue] +--label[0,1;Blue] +--style_type[label;textcolor=;border=true] +--label[1.2,0;Border] +--style_type[label;border=true;bgcolor=red] +--label[1.2,1;Background] +--style_type[label;border=;bgcolor=] +--label[0.75,2;Reset] + + +local pages = { + -- Real Coordinates + [[ + formspec_version[3] + size[12,13] + image_button[0,0;1,1;logo.png;rc_image_button_1x1;1x1] + image_button[1,0;2,2;logo.png;rc_image_button_2x2;2x2] + button[0,2;1,1;rc_button_1x1;1x1] + button[1,2;2,2;rc_button_2x2;2x2] + item_image[0,4;1,1;air] + item_image[1,4;2,2;air] + item_image_button[0,6;1,1;testformspec:node;rc_item_image_button_1x1;1x1] + item_image_button[1,6;2,2;testformspec:node;rc_item_image_button_2x2;2x2] + field[3,.5;3,.5;rc_field;Field;text] + pwdfield[6,.5;3,1;rc_pwdfield;Password Field] + field[3,1;3,1;;Read-Only Field;text] + textarea[3,2;3,.5;rc_textarea_small;Textarea;text] + textarea[6,2;3,2;rc_textarea_big;Textarea;text\nmore text] + textarea[3,3;3,1;;Read-Only Textarea;text\nmore text] + textlist[3,4;3,2;rc_textlist;Textlist,Perfect Coordinates;1;false] + tableoptions[highlight=#ABCDEF75;background=#00000055;border=false] + table[6,4;3,2;rc_table;Table,Cool Stuff,Foo,Bar;2] + dropdown[3,6;3,1;rc_dropdown_small;This,is,a,dropdown;1] + dropdown[6,6;3,2;rc_dropdown_big;I,am,a,bigger,dropdown;5] + image[0,8;3,2;ignore.png] + box[3,7;3,1;#00A3FF] + checkbox[3,8;rc_checkbox_1;Check me!;false] + checkbox[3,9;rc_checkbox_2;Uncheck me now!;true] + scrollbar[0,11.5;11.5,.5;horizontal;rc_scrollbar_horizontal;500] + scrollbar[11.5,0;.5,11.5;vertical;rc_scrollbar_vertical;0] + list[current_player;main;6,8;3,2;1] + button[9,0;2.5,1;rc_empty_button_1;] + button[9,1;2.5,1;rc_empty_button_2;] + button[9,2;2.5,1;rc_empty_button_3;] ]].. + "label[9,0.5;This is a label.\nLine\nLine\nLine\nEnd]".. + [[button[9,3;1,1;rc_empty_button_4;] + vertlabel[9,4;VERT] + label[10,3;HORIZ] + tabheader[8,0;6,0.65;rc_tabheader;Tab 1,Tab 2,Tab 3,Secrets;1;false;false] + ]], + -- Style + + "formspec_version[3]size[12,13]" .. + ("label[0.375,0.375;Styled - %s %s]"):format( + color("#F00", "red text"), + color("#77FF00CC", "green text")) .. + "label[6.375,0.375;Unstyled]" .. + "box[0,0.75;12,0.1;#999]" .. + "box[6,0.85;0.1,11.15;#999]" .. + "container[0.375,1.225]" .. + style_fs .. + "container_end[]container[6.375,1.225]" .. + style_fs:gsub("one_", "two_"):gsub("style%[[^%]]+%]", ""):gsub("style_type%[[^%]]+%]", "") .. + "container_end[]", + + -- Noclip + "formspec_version[3]size[12,13]" .. + "label[0.1,0.5;Clip]" .. + "container[-2.5,1]" .. clip_fs:gsub("%%c", "false") .. "container_end[]" .. + "label[11,0.5;Noclip]" .. + "container[11.5,1]" .. clip_fs:gsub("%%c", "true") .. "container_end[]", + + -- Hypertext + "size[12,13]real_coordinates[true]" .. + "container[0.5,0.5]" .. hypertext_fs .. "container_end[]", + + -- Tabheaders + "size[12,13]real_coordinates[true]" .. + "container[0.5,1.5]" .. tabheaders_fs .. "container_end[]", + + -- Animation + [[ + formspec_version[3] + size[12,13] + animated_image[0.5,0.5;1,1;;testformspec_animation.png;4;100] + animated_image[0.5,1.75;1,1;;testformspec_animation.jpg;4;100] + animated_image[1.75,0.5;1,1;;testformspec_animation.png;100;100] + animated_image[3,0.5;1,1;ani_img_1;testformspec_animation.png;4;1000] + button[4.25,0.5;1,1;ani_btn_1;Current +Number] + animated_image[3,1.75;1,1;ani_img_2;testformspec_animation.png;4;1000;2] + button[4.25,1.75;1,1;ani_btn_2;Current +Number] + animated_image[3,3;1,1;;testformspec_animation.png;4;0] + animated_image[3,4.25;1,1;;testformspec_animation.png;4;0;3] + animated_image[5.5,0.5;5,2;;testformspec_animation.png;4;100] + animated_image[5.5,2.75;5,2;;testformspec_animation.jpg;4;100] + ]], + + -- Scroll containers + "formspec_version[3]size[12,13]" .. + scroll_fs, +} + +local function show_test_formspec(pname, page_id) + page_id = page_id or 2 + + local fs = pages[page_id] .. "tabheader[0,0;8,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Anim,ScrollC;" .. page_id .. ";false;false]" + + minetest.show_formspec(pname, "testformspec:formspec", fs) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "testformspec:formspec" then + return false + end + + + if fields.maintabs then + show_test_formspec(player:get_player_name(), tonumber(fields.maintabs)) + return true + end + + if fields.ani_img_1 and fields.ani_btn_1 then + minetest.chat_send_player(player:get_player_name(), "ani_img_1 = " .. tostring(fields.ani_img_1)) + return true + elseif fields.ani_img_2 and fields.ani_btn_2 then + minetest.chat_send_player(player:get_player_name(), "ani_img_2 = " .. tostring(fields.ani_img_2)) + return true + end + + if fields.hypertext then + minetest.chat_send_player(player:get_player_name(), "Hypertext action received: " .. tostring(fields.hypertext)) + return true + end +end) + +minetest.register_chatcommand("test_formspec", { + params = "", + description = "Open the test formspec", + func = function(name) + if not minetest.get_player_by_name(name) then + return false, "You need to be online!" + end + + show_test_formspec(name) + return true + end, +}) diff --git a/games/devtest/mods/testformspec/init.lua b/games/devtest/mods/testformspec/init.lua new file mode 100644 index 000000000..23b565f08 --- /dev/null +++ b/games/devtest/mods/testformspec/init.lua @@ -0,0 +1,3 @@ +dofile(minetest.get_modpath("testformspec").."/dummy_items.lua") +dofile(minetest.get_modpath("testformspec").."/formspec.lua") +dofile(minetest.get_modpath("testformspec").."/callbacks.lua") diff --git a/games/devtest/mods/testformspec/mod.conf b/games/devtest/mods/testformspec/mod.conf new file mode 100644 index 000000000..00eac307a --- /dev/null +++ b/games/devtest/mods/testformspec/mod.conf @@ -0,0 +1,2 @@ +name = testformspec +description = Contains an example formspec to test all the features of formspecs diff --git a/games/devtest/mods/testformspec/textures/testformspec_animation.jpg b/games/devtest/mods/testformspec/textures/testformspec_animation.jpg new file mode 100644 index 000000000..b98ca2677 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_animation.jpg differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_animation.png b/games/devtest/mods/testformspec/textures/testformspec_animation.png new file mode 100644 index 000000000..b972e5dbb Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_animation.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg.png b/games/devtest/mods/testformspec/textures/testformspec_bg.png new file mode 100644 index 000000000..cd1e50900 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png new file mode 100644 index 000000000..34433ac82 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png new file mode 100644 index 000000000..01c2dc777 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png new file mode 100644 index 000000000..0cbac7536 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png b/games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png new file mode 100644 index 000000000..3ebbb988c Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png b/games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png new file mode 100644 index 000000000..2fb5fc21e Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_button_image.png b/games/devtest/mods/testformspec/textures/testformspec_button_image.png new file mode 100644 index 000000000..75c438a9a Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_button_image.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_hovered.png b/games/devtest/mods/testformspec/textures/testformspec_hovered.png new file mode 100644 index 000000000..3ccad30a2 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_hovered.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_item.png b/games/devtest/mods/testformspec/textures/testformspec_item.png new file mode 100644 index 000000000..4fd823b55 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_item.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_node.png b/games/devtest/mods/testformspec/textures/testformspec_node.png new file mode 100644 index 000000000..c107f28a3 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_node.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_pressed.png b/games/devtest/mods/testformspec/textures/testformspec_pressed.png new file mode 100644 index 000000000..45c504f27 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_pressed.png differ diff --git a/games/devtest/mods/testnodes/README.md b/games/devtest/mods/testnodes/README.md new file mode 100644 index 000000000..13ed972c0 --- /dev/null +++ b/games/devtest/mods/testnodes/README.md @@ -0,0 +1,11 @@ +# Test Nodes + +This mod contains a bunch of basic nodes to test development stuff. +Most nodes are kept as minimal as possible in order to show off one particular feature of the engine, to make testing stuff easier. + +This mod includes tests for: + +* drawtypes +* paramtype2's +* node properties such as damage, drowning, falling, etc. +* other random stuff diff --git a/games/devtest/mods/testnodes/drawtypes.lua b/games/devtest/mods/testnodes/drawtypes.lua new file mode 100644 index 000000000..35fda960f --- /dev/null +++ b/games/devtest/mods/testnodes/drawtypes.lua @@ -0,0 +1,517 @@ +--[[ Drawtype Test: This file tests out and provides examples for +all drawtypes in Minetest. It is attempted to keep the node +definitions as simple and minimal as possible to keep +side-effects to a minimum. + +How to read the node definitions: +There are two parts which are separated by 2 newlines: +The first part contains the things that are more or less essential +for defining the drawtype (except description, which is +at the top for readability). +The second part (after the 2 newlines) contains stuff that are +unrelated to the drawtype, stuff that is mostly there to make +testing this node easier and more convenient. +]] + +local S = minetest.get_translator("testnodes") + +-- If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. +-- This is due to . +-- This is only added to make the items more visible to avoid confusion, but you will no longer see +-- the default inventory images for these items. When you want to test the default inventory image of drawtypes, +-- this should be turned off. +-- TODO: Remove support for fallback inventory image as soon #9209 is fixed. +local SHOW_FALLBACK_IMAGE = minetest.settings:get_bool("testnodes_show_fallback_image", false) + +local fallback_image = function(img) + if SHOW_FALLBACK_IMAGE then + return img + else + return nil + end +end + +-- A regular cube +minetest.register_node("testnodes:normal", { + description = S("Normal Drawtype Test Node"), + drawtype = "normal", + tiles = { "testnodes_normal.png" }, + + groups = { dig_immediate = 3 }, +}) + +-- Standard glasslike node +minetest.register_node("testnodes:glasslike", { + description = S("Glasslike Drawtype Test Node"), + drawtype = "glasslike", + paramtype = "light", + tiles = { "testnodes_glasslike.png" }, + + groups = { dig_immediate = 3 }, +}) + +-- Glasslike framed with the two textures (normal and "detail") +minetest.register_node("testnodes:glasslike_framed", { + description = S("Glasslike Framed Drawtype Test Node"), + drawtype = "glasslike_framed", + paramtype = "light", + tiles = { + "testnodes_glasslike_framed.png", + "testnodes_glasslike_detail.png", + }, + + + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +-- Like the one above, but without the "detail" texture (texture 2). +-- This node was added to see how the engine behaves when the "detail" texture +-- is missing. +minetest.register_node("testnodes:glasslike_framed_no_detail", { + description = S("Glasslike Framed without Detail Drawtype Test Node"), + drawtype = "glasslike_framed", + paramtype = "light", + tiles = { "testnodes_glasslike_framed2.png" }, + + + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + + +minetest.register_node("testnodes:glasslike_framed_optional", { + description = S("Glasslike Framed Optional Drawtype Test Node"), + drawtype = "glasslike_framed_optional", + paramtype = "light", + tiles = { + "testnodes_glasslike_framed_optional.png", + "testnodes_glasslike_detail.png", + }, + + + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + + + +minetest.register_node("testnodes:allfaces", { + description = S("Allfaces Drawtype Test Node"), + drawtype = "allfaces", + paramtype = "light", + tiles = { "testnodes_allfaces.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:allfaces_optional", { + description = S("Allfaces Optional Drawtype Test Node"), + drawtype = "allfaces_optional", + paramtype = "light", + tiles = { "testnodes_allfaces_optional.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:allfaces_optional_waving", { + description = S("Waving Allfaces Optional Drawtype Test Node"), + drawtype = "allfaces_optional", + paramtype = "light", + tiles = { "testnodes_allfaces_optional.png^[brighten" }, + waving = 2, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:firelike", { + description = S("Firelike Drawtype Test Node"), + drawtype = "firelike", + paramtype = "light", + tiles = { "testnodes_firelike.png" }, + + + walkable = false, + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:fencelike", { + description = S("Fencelike Drawtype Test Node"), + drawtype = "fencelike", + paramtype = "light", + tiles = { "testnodes_fencelike.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:torchlike", { + description = S("Wallmounted Torchlike Drawtype Test Node"), + drawtype = "torchlike", + paramtype = "light", + paramtype2 = "wallmounted", + tiles = { + "testnodes_torchlike_floor.png", + "testnodes_torchlike_ceiling.png", + "testnodes_torchlike_wall.png", + }, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, + inventory_image = fallback_image("testnodes_torchlike_floor.png"), +}) + +minetest.register_node("testnodes:signlike", { + description = S("Wallmounted Signlike Drawtype Test Node"), + drawtype = "signlike", + paramtype = "light", + paramtype2 = "wallmounted", + tiles = { "testnodes_signlike.png" }, + + + walkable = false, + groups = { dig_immediate = 3 }, + sunlight_propagates = true, + inventory_image = fallback_image("testnodes_signlike.png"), +}) + +minetest.register_node("testnodes:plantlike", { + description = S("Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + tiles = { "testnodes_plantlike.png" }, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:plantlike_waving", { + description = S("Waving Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + tiles = { "testnodes_plantlike_waving.png" }, + waving = 1, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + + + +-- param2 will rotate +minetest.register_node("testnodes:plantlike_degrotate", { + description = S("Degrotate Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + paramtype2 = "degrotate", + tiles = { "testnodes_plantlike_degrotate.png" }, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +-- param2 will change height +minetest.register_node("testnodes:plantlike_leveled", { + description = S("Leveled Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + paramtype2 = "leveled", + tiles = { + { name = "testnodes_plantlike_leveled.png", tileable_vertical = true }, + }, + + + -- We set a default param2 here only for convenience, to make the "plant" visible after placement + place_param2 = 8, + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +-- param2 changes shape +minetest.register_node("testnodes:plantlike_meshoptions", { + description = S("Meshoptions Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + paramtype2 = "meshoptions", + tiles = { "testnodes_plantlike_meshoptions.png" }, + + + walkable = false, + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:plantlike_rooted", { + description = S("Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + tiles = { "testnodes_plantlike_rooted_base.png" }, + special_tiles = { "testnodes_plantlike_rooted.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:plantlike_rooted_waving", { + description = S("Waving Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_waving.png", + }, + special_tiles = { "testnodes_plantlike_rooted_waving.png" }, + waving = 1, + + groups = { dig_immediate = 3 }, +}) + +-- param2 changes height +minetest.register_node("testnodes:plantlike_rooted_leveled", { + description = S("Leveled Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + paramtype2 = "leveled", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_leveled.png", + }, + special_tiles = { + { name = "testnodes_plantlike_rooted_leveled.png", tileable_vertical = true }, + }, + + + -- We set a default param2 here only for convenience, to make the "plant" visible after placement + place_param2 = 8, + groups = { dig_immediate = 3 }, +}) + +-- param2 changes shape +minetest.register_node("testnodes:plantlike_rooted_meshoptions", { + description = S("Meshoptions Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + paramtype2 = "meshoptions", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_meshoptions.png", + }, + special_tiles = { + "testnodes_plantlike_rooted_meshoptions.png", + }, + + groups = { dig_immediate = 3 }, +}) + +-- param2 changes rotation +minetest.register_node("testnodes:plantlike_rooted_degrotate", { + description = S("Degrotate Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + paramtype2 = "degrotate", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_degrotate.png", + }, + special_tiles = { + "testnodes_plantlike_rooted_degrotate.png", + }, + + groups = { dig_immediate = 3 }, +}) + +-- Demonstrative liquid nodes, source and flowing form. This is only the +-- drawtype, no physical liquid properties are used +minetest.register_node("testnodes:liquid", { + description = S("Source Liquid Drawtype Test Node"), + drawtype = "liquid", + paramtype = "light", + tiles = { + "testnodes_liquidsource.png", + }, + special_tiles = { + {name="testnodes_liquidsource.png", backface_culling=false}, + {name="testnodes_liquidsource.png", backface_culling=true}, + }, + use_texture_alpha = true, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) +minetest.register_node("testnodes:liquid_flowing", { + description = S("Flowing Liquid Drawtype Test Node"), + drawtype = "flowingliquid", + paramtype = "light", + paramtype2 = "flowingliquid", + tiles = { + "testnodes_liquidflowing.png", + }, + special_tiles = { + {name="testnodes_liquidflowing.png", backface_culling=false}, + {name="testnodes_liquidflowing.png", backface_culling=false}, + }, + use_texture_alpha = true, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) +minetest.register_node("testnodes:liquid_waving", { + description = S("Waving Source Liquid Drawtype Test Node"), + drawtype = "liquid", + paramtype = "light", + tiles = { + "testnodes_liquidsource.png^[brighten", + }, + special_tiles = { + {name="testnodes_liquidsource.png^[brighten", backface_culling=false}, + {name="testnodes_liquidsource.png^[brighten", backface_culling=true}, + }, + use_texture_alpha = true, + waving = 3, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) +minetest.register_node("testnodes:liquid_flowing_waving", { + description = S("Waving Flowing Liquid Drawtype Test Node"), + drawtype = "flowingliquid", + paramtype = "light", + paramtype2 = "flowingliquid", + tiles = { + "testnodes_liquidflowing.png^[brighten", + }, + special_tiles = { + {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, + {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, + }, + use_texture_alpha = true, + waving = 3, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) + + + +-- Invisible node +minetest.register_node("testnodes:airlike", { + description = S("Airlike Drawtype Test Node"), + drawtype = "airlike", + paramtype = "light", + + + walkable = false, + groups = { dig_immediate = 3 }, + sunlight_propagates = true, + inventory_image = fallback_image("testnodes_airlike.png"), +}) + +-- param2 changes liquid height +minetest.register_node("testnodes:glassliquid", { + description = S("Glasslike Liquid Level Drawtype Test Node"), + drawtype = "glasslike_framed", + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + tiles = { + "testnodes_glasslikeliquid.png", + }, + special_tiles = { + "testnodes_liquid.png", + }, + + groups = { dig_immediate = 3 }, +}) + +-- Adding many raillike examples, primarily to demonstrate the behavior of +-- "raillike groups". Nodes of the same type (rail, groupless, line, street) +-- should connect to nodes of the same "rail type" (=same shape, different +-- color) only. +local rails = { + { "rail", {"testnodes_rail_straight.png", "testnodes_rail_curved.png", "testnodes_rail_t_junction.png", "testnodes_rail_crossing.png"} }, + { "line", {"testnodes_line_straight.png", "testnodes_line_curved.png", "testnodes_line_t_junction.png", "testnodes_line_crossing.png"}, }, + { "street", {"testnodes_street_straight.png", "testnodes_street_curved.png", "testnodes_street_t_junction.png", "testnodes_street_crossing.png"}, }, + -- the "groupless" nodes are nodes in which the "connect_to_raillike" group is not set + { "groupless", {"testnodes_rail2_straight.png", "testnodes_rail2_curved.png", "testnodes_rail2_t_junction.png", "testnodes_rail2_crossing.png"} }, +} +local colors = { "", "cyan", "red" } + +for r=1, #rails do + local id = rails[r][1] + local tiles = rails[r][2] + local raillike_group + if id ~= "groupless" then + raillike_group = minetest.raillike_group(id) + end + for c=1, #colors do + local color + if colors[c] ~= "" then + color = colors[c] + end + minetest.register_node("testnodes:raillike_"..id..c, { + description = S("Raillike Drawtype Test Node: @1 @2", id, c), + drawtype = "raillike", + paramtype = "light", + tiles = tiles, + groups = { connect_to_raillike = raillike_group, dig_immediate = 3 }, + + + color = color, + selection_box = { + type = "fixed", + fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}}, + }, + sunlight_propagates = true, + walkable = false, + }) + end +end + + + +-- Add visual_scale variants of previous nodes for half and double size +local scale = function(subname, desc_double, desc_half) + local original = "testnodes:"..subname + local def = table.copy(minetest.registered_items[original]) + def.visual_scale = 2.0 + def.description = desc_double + minetest.register_node("testnodes:"..subname.."_double", def) + def = table.copy(minetest.registered_items[original]) + def.visual_scale = 0.5 + def.description = desc_half + minetest.register_node("testnodes:"..subname.."_half", def) +end + +scale("plantlike", + S("Double-sized Plantlike Drawtype Test Node"), + S("Half-sized Plantlike Drawtype Test Node")) +scale("torchlike", + S("Double-sized Wallmounted Torchlike Drawtype Test Node"), + S("Half-sized Wallmounted Torchlike Drawtype Test Node")) +scale("signlike", + S("Double-sized Wallmounted Signlike Drawtype Test Node"), + S("Half-sized Wallmounted Signlike Drawtype Test Node")) +scale("firelike", + S("Double-sized Firelike Drawtype Test Node"), + S("Half-sized Firelike Drawtype Test Node")) diff --git a/games/devtest/mods/testnodes/init.lua b/games/devtest/mods/testnodes/init.lua new file mode 100644 index 000000000..92e2c5630 --- /dev/null +++ b/games/devtest/mods/testnodes/init.lua @@ -0,0 +1,10 @@ +local path = minetest.get_modpath(minetest.get_current_modname()) + +dofile(path.."/drawtypes.lua") +dofile(path.."/meshes.lua") +dofile(path.."/nodeboxes.lua") +dofile(path.."/param2.lua") +dofile(path.."/properties.lua") +dofile(path.."/liquids.lua") +dofile(path.."/light.lua") +dofile(path.."/textures.lua") diff --git a/games/devtest/mods/testnodes/light.lua b/games/devtest/mods/testnodes/light.lua new file mode 100644 index 000000000..94409e83f --- /dev/null +++ b/games/devtest/mods/testnodes/light.lua @@ -0,0 +1,48 @@ +-- Test Nodes: Light test + +local S = minetest.get_translator("testnodes") + +-- All possible light levels +for i=1, minetest.LIGHT_MAX do + minetest.register_node("testnodes:light"..i, { + description = S("Light Source (@1)", i), + paramtype = "light", + light_source = i, + + + tiles ={"testnodes_light_"..i..".png"}, + drawtype = "glasslike", + walkable = false, + sunlight_propagates = true, + is_ground_content = false, + groups = {dig_immediate=3}, + }) +end + +-- Lets light through, but not sunlight, leading to a +-- reduction in light level when light passes through +minetest.register_node("testnodes:sunlight_filter", { + description = S("Sunlight Filter"), + paramtype = "light", + + + drawtype = "glasslike", + tiles = { + "testnodes_sunlight_filter.png", + }, + groups = { dig_immediate = 3 }, +}) + +-- Lets light and sunlight through without obstruction +minetest.register_node("testnodes:sunlight_propagator", { + description = S("Sunlight Propagator"), + paramtype = "light", + sunlight_propagates = true, + + + drawtype = "glasslike", + tiles = { + "testnodes_sunlight_filter.png^[brighten", + }, + groups = { dig_immediate = 3 }, +}) diff --git a/games/devtest/mods/testnodes/liquids.lua b/games/devtest/mods/testnodes/liquids.lua new file mode 100644 index 000000000..e316782ad --- /dev/null +++ b/games/devtest/mods/testnodes/liquids.lua @@ -0,0 +1,91 @@ +-- Add liquids for ranges and viscosity levels 0-8 + +for d=0, 8 do + minetest.register_node("testnodes:rliquid_"..d, { + description = "Test Liquid Source, Range "..d, + drawtype = "liquid", + tiles = {"testnodes_liquidsource_r"..d..".png"}, + special_tiles = { + {name = "testnodes_liquidsource_r"..d..".png", backface_culling = false}, + {name = "testnodes_liquidsource_r"..d..".png", backface_culling = true}, + }, + alpha = 192, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "source", + liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, + liquid_alternative_source = "testnodes:rliquid_"..d, + liquid_range = d, + }) + + minetest.register_node("testnodes:rliquid_flowing_"..d, { + description = "Flowing Test Liquid, Range "..d, + drawtype = "flowingliquid", + tiles = {"testnodes_liquidflowing_r"..d..".png"}, + special_tiles = { + {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, + {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, + }, + alpha = 192, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "flowing", + liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, + liquid_alternative_source = "testnodes:rliquid_"..d, + liquid_range = d, + }) + + local mod = "^[colorize:#000000:127" + minetest.register_node("testnodes:vliquid_"..d, { + description = "Test Liquid Source, Viscosity "..d, + drawtype = "liquid", + tiles = {"testnodes_liquidsource_r"..d..".png"..mod}, + special_tiles = { + {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false}, + {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true}, + }, + alpha = 192, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "source", + liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, + liquid_alternative_source = "testnodes:vliquid_"..d, + liquid_viscosity = d, + }) + + minetest.register_node("testnodes:vliquid_flowing_"..d, { + description = "Flowing Test Liquid, Viscosity "..d, + drawtype = "flowingliquid", + tiles = {"testnodes_liquidflowing_r"..d..".png"..mod}, + special_tiles = { + {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, + {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, + }, + alpha = 192, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "flowing", + liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, + liquid_alternative_source = "testnodes:vliquid_"..d, + liquid_viscosity = d, + }) + +end diff --git a/games/devtest/mods/testnodes/meshes.lua b/games/devtest/mods/testnodes/meshes.lua new file mode 100644 index 000000000..900abc180 --- /dev/null +++ b/games/devtest/mods/testnodes/meshes.lua @@ -0,0 +1,145 @@ +-- Meshes + +local S = minetest.get_translator("testnodes") + +local ocorner_cbox = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -0.25, 0.25, 0, 0.5}, + {-0.5, 0, 0, 0, 0.25, 0.5}, + {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5} + } +} + +local tall_pyr_cbox = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, + { -0.375, -0.25, -0.375, 0.375, 0, 0.375}, + { -0.25, 0, -0.25, 0.25, 0.25, 0.25}, + { -0.125, 0.25, -0.125, 0.125, 0.5, 0.125} + } +} + +-- Normal mesh +minetest.register_node("testnodes:mesh", { + description = S("Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + + groups = {dig_immediate=3}, +}) + +-- Facedir mesh: outer corner slope +minetest.register_node("testnodes:mesh_facedir", { + description = S("Facedir Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_ocorner.obj", + tiles = {"testnodes_mesh_stripes.png"}, + paramtype = "light", + paramtype2 = "facedir", + collision_box = ocorner_cbox, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:mesh_colorfacedir", { + description = S("Color Facedir Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_ocorner.obj", + tiles = {"testnodes_mesh_stripes3.png"}, + paramtype = "light", + paramtype2 = "colorfacedir", + palette = "testnodes_palette_facedir.png", + collision_box = ocorner_cbox, + + groups = {dig_immediate=3}, +}) + +-- Wallmounted mesh: pyramid +minetest.register_node("testnodes:mesh_wallmounted", { + description = S("Wallmounted Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + paramtype2 = "wallmounted", + collision_box = tall_pyr_cbox, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:mesh_colorwallmounted", { + description = S("Color Wallmounted Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes3.png"}, + paramtype = "light", + paramtype2 = "colorwallmounted", + palette = "testnodes_palette_wallmounted.png", + collision_box = tall_pyr_cbox, + + groups = {dig_immediate=3}, +}) + + +minetest.register_node("testnodes:mesh_double", { + description = S("Double-sized Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + visual_scale = 2, + + groups = {dig_immediate=3}, +}) +minetest.register_node("testnodes:mesh_half", { + description = S("Half-sized Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + visual_scale = 0.5, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:mesh_waving1", { + description = S("Plantlike-waving Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0FFB0"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + waving = 1, + + groups = {dig_immediate=3}, +}) +minetest.register_node("testnodes:mesh_waving2", { + description = S("Leaflike-waving Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes4.png^[multiply:#FFFFB0"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + waving = 2, + + groups = {dig_immediate=3}, +}) +minetest.register_node("testnodes:mesh_waving3", { + description = S("Liquidlike-waving Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0B0FF"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + waving = 3, + + groups = {dig_immediate=3}, +}) diff --git a/games/devtest/mods/testnodes/mod.conf b/games/devtest/mods/testnodes/mod.conf new file mode 100644 index 000000000..4824c6ed0 --- /dev/null +++ b/games/devtest/mods/testnodes/mod.conf @@ -0,0 +1,2 @@ +name = testnodes +description = Contains a bunch of basic example nodes for demonstrative purposes, development and testing diff --git a/games/devtest/mods/testnodes/models/testnodes_ocorner.obj b/games/devtest/mods/testnodes/models/testnodes_ocorner.obj new file mode 100644 index 000000000..231d7056b --- /dev/null +++ b/games/devtest/mods/testnodes/models/testnodes_ocorner.obj @@ -0,0 +1,23 @@ +# Blender v2.73 (sub 0) OBJ File: 'slope_test_ocorner_onetexture.blend' +# www.blender.org +o Cube_Cube.002 +v 0.500000 0.500000 0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vn 0.000000 -1.000000 -0.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 -0.000000 1.000000 +vn -0.707100 0.707100 0.000000 +vn 0.000000 0.707100 -0.707100 +s off +f 3/1/1 2/2/1 4/3/1 5/4/1 +f 1/2/2 3/3/2 5/4/2 +f 1/1/3 2/3/3 3/4/3 +f 1/1/4 4/3/4 2/4/4 +f 1/2/5 5/3/5 4/4/5 diff --git a/games/devtest/mods/testnodes/models/testnodes_pyramid.obj b/games/devtest/mods/testnodes/models/testnodes_pyramid.obj new file mode 100644 index 000000000..b305af2f8 --- /dev/null +++ b/games/devtest/mods/testnodes/models/testnodes_pyramid.obj @@ -0,0 +1,24 @@ +# Blender v2.73 (sub 0) OBJ File: 'slope_test_pyramid_onetexture.blend' +# www.blender.org +o Cube +v 0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.000000 0.500000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.500000 1.000000 +vn 0.000000 -1.000000 0.000000 +vn -0.894400 0.447200 -0.000000 +vn 0.000000 0.447200 -0.894400 +vn 0.894400 0.447200 0.000000 +vn -0.000000 0.447200 0.894400 +s off +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 3/4/2 5/5/2 4/3/2 +f 5/5/3 1/3/3 4/4/3 +f 1/4/4 5/5/4 2/3/4 +f 2/4/5 5/5/5 3/3/5 diff --git a/games/devtest/mods/testnodes/nodeboxes.lua b/games/devtest/mods/testnodes/nodeboxes.lua new file mode 100644 index 000000000..ebd858337 --- /dev/null +++ b/games/devtest/mods/testnodes/nodeboxes.lua @@ -0,0 +1,80 @@ +local S = minetest.get_translator("testnodes") + +-- Nodebox examples and tests. + +-- An simple example nodebox with one centered box +minetest.register_node("testnodes:nodebox_fixed", { + description = S("Fixed Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, + }, + + groups = {dig_immediate=3}, +}) + +-- 50% higher than a regular node +minetest.register_node("testnodes:nodebox_overhigh", { + description = S("Overhigh Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5}, + }, + + groups = {dig_immediate=3}, +}) + +-- 100% higher than a regular node +minetest.register_node("testnodes:nodebox_overhigh2", { + description = S("Double-height Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}, + }, + + groups = {dig_immediate=3}, +}) + +-- Height of nodebox changes with its param2 value +minetest.register_node("testnodes:nodebox_leveled", { + description = S("Leveled Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "leveled", + node_box = { + type = "leveled", + fixed = {-0.5, 0.0, -0.5, 0.5, -0.499, 0.5}, + }, + + groups = {dig_immediate=3}, +}) + +-- Wall-like nodebox that connects to neighbors +minetest.register_node("testnodes:nodebox_connected", { + description = S("Connected Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + groups = {connected_nodebox=1, dig_immediate=3}, + drawtype = "nodebox", + paramtype = "light", + connects_to = {"group:connected_nodebox"}, + connect_sides = {"front", "back", "left", "right"}, + node_box = { + type = "connected", + fixed = {-0.125, -0.500, -0.125, 0.125, 0.500, 0.125}, + connect_front = {-0.125, -0.500, -0.500, 0.125, 0.400, -0.125}, + connect_back = {-0.125, -0.500, 0.125, 0.125, 0.400, 0.500}, + connect_left = {-0.500, -0.500, -0.125, -0.125, 0.400, 0.125}, + connect_right = {0.125, -0.500, -0.125, 0.500, 0.400, 0.125}, + }, +}) + diff --git a/games/devtest/mods/testnodes/param2.lua b/games/devtest/mods/testnodes/param2.lua new file mode 100644 index 000000000..5d64376fa --- /dev/null +++ b/games/devtest/mods/testnodes/param2.lua @@ -0,0 +1,168 @@ +-- This file is for misc. param2 tests that aren't covered in drawtypes.lua already. + +local S = minetest.get_translator("testnodes") + +minetest.register_node("testnodes:facedir", { + description = S("Facedir Test Node"), + paramtype2 = "facedir", + tiles = { + "testnodes_1.png", + "testnodes_2.png", + "testnodes_3.png", + "testnodes_4.png", + "testnodes_5.png", + "testnodes_6.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:facedir_nodebox", { + description = S("Facedir Nodebox Test Node"), + tiles = { + "testnodes_1.png", + "testnodes_2.png", + "testnodes_3.png", + "testnodes_4.png", + "testnodes_5.png", + "testnodes_6.png", + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, + }, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:wallmounted", { + description = S("Wallmounted Test Node"), + paramtype2 = "wallmounted", + tiles = { + "testnodes_1w.png", + "testnodes_2w.png", + "testnodes_3w.png", + "testnodes_4w.png", + "testnodes_5w.png", + "testnodes_6w.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:wallmounted_nodebox", { + description = S("Wallmounted Nodebox Test Node"), + paramtype2 = "wallmounted", + paramtype = "light", + tiles = { + "testnodes_1w.png", + "testnodes_2w.png", + "testnodes_3w.png", + "testnodes_4w.png", + "testnodes_5w.png", + "testnodes_6w.png", + }, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, + wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:color", { + description = S("Color Test Node"), + paramtype2 = "color", + palette = "testnodes_palette_full.png", + tiles = { + "testnodes_node.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:colorfacedir", { + description = S("Color Facedir Test Node"), + paramtype2 = "colorfacedir", + palette = "testnodes_palette_facedir.png", + tiles = { + "testnodes_1g.png", + "testnodes_2g.png", + "testnodes_3g.png", + "testnodes_4g.png", + "testnodes_5g.png", + "testnodes_6g.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:colorfacedir_nodebox", { + description = S("Color Facedir Nodebox Test Node"), + tiles = { + "testnodes_1g.png", + "testnodes_2g.png", + "testnodes_3g.png", + "testnodes_4g.png", + "testnodes_5g.png", + "testnodes_6g.png", + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "colorfacedir", + palette = "testnodes_palette_facedir.png", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, + }, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:colorwallmounted", { + description = S("Color Wallmounted Test Node"), + paramtype2 = "colorwallmounted", + paramtype = "light", + palette = "testnodes_palette_wallmounted.png", + tiles = { + "testnodes_1wg.png", + "testnodes_2wg.png", + "testnodes_3wg.png", + "testnodes_4wg.png", + "testnodes_5wg.png", + "testnodes_6wg.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:colorwallmounted_nodebox", { + description = S("Color Wallmounted Nodebox Test Node"), + paramtype2 = "colorwallmounted", + paramtype = "light", + palette = "testnodes_palette_wallmounted.png", + tiles = { + "testnodes_1wg.png", + "testnodes_2wg.png", + "testnodes_3wg.png", + "testnodes_4wg.png", + "testnodes_5wg.png", + "testnodes_6wg.png", + }, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, + wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, + }, + + groups = { dig_immediate = 3 }, +}) + diff --git a/games/devtest/mods/testnodes/properties.lua b/games/devtest/mods/testnodes/properties.lua new file mode 100644 index 000000000..e169d4b08 --- /dev/null +++ b/games/devtest/mods/testnodes/properties.lua @@ -0,0 +1,270 @@ +-- Test Nodes: Node property tests + +local S = minetest.get_translator("testnodes") + +-- Is supposed to fall when it doesn't rest on solid ground +minetest.register_node("testnodes:falling", { + description = S("Falling Node"), + tiles = { + "testnodes_node.png", + "testnodes_node.png", + "testnodes_node_falling.png", + }, + groups = { falling_node = 1, dig_immediate = 3 }, +}) + +-- Same as falling node, but will stop falling on top of liquids +minetest.register_node("testnodes:falling_float", { + description = S("Falling+Floating Node"), + groups = { falling_node = 1, float = 1, dig_immediate = 3 }, + + + tiles = { + "testnodes_node.png", + "testnodes_node.png", + "testnodes_node_falling.png", + }, + color = "cyan", +}) + +-- This node attaches to the floor and drops as item +-- when the floor is gone. +minetest.register_node("testnodes:attached", { + description = S("Floor-Attached Node"), + tiles = { + "testnodes_attached_top.png", + "testnodes_attached_bottom.png", + "testnodes_attached_side.png", + }, + groups = { attached_node = 1, dig_immediate = 3 }, +}) + +-- This node attaches to the side of a node and drops as item +-- when the node it attaches to is gone. +minetest.register_node("testnodes:attached_wallmounted", { + description = S("Wallmounted Attached Node"), + paramtype2 = "wallmounted", + tiles = { + "testnodes_attachedw_top.png", + "testnodes_attachedw_bottom.png", + "testnodes_attachedw_side.png", + }, + groups = { attached_node = 1, dig_immediate = 3 }, +}) + +-- Jump disabled +minetest.register_node("testnodes:nojump", { + description = S("Non-jumping Node"), + groups = {disable_jump=1, dig_immediate=3}, + + + tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"}, +}) + +-- Climbable up and down with jump and sneak keys +minetest.register_node("testnodes:climbable", { + description = S("Climbable Node"), + climbable = true, + walkable = false, + + + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + tiles ={"testnodes_climbable_side.png"}, + drawtype = "glasslike", + groups = {dig_immediate=3}, +}) + +-- Climbable only downwards with sneak key +minetest.register_node("testnodes:climbable_nojump", { + description = S("Downwards-climbable Node"), + climbable = true, + walkable = false, + + groups = {disable_jump=1, dig_immediate=3}, + drawtype = "glasslike", + tiles ={"testnodes_climbable_nojump_side.png"}, + paramtype = "light", + sunlight_propagates = true, +}) + +-- A liquid in which you can't rise +minetest.register_node("testnodes:liquid_nojump", { + description = S("Non-jumping Liquid Source Node"), + liquidtype = "source", + liquid_range = 1, + liquid_viscosity = 0, + liquid_alternative_flowing = "testnodes:liquidflowing_nojump", + liquid_alternative_source = "testnodes:liquid_nojump", + liquid_renewable = false, + groups = {disable_jump=1, dig_immediate=3}, + walkable = false, + + drawtype = "liquid", + tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"}, + special_tiles = { + {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false}, + {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true}, + }, + use_texture_alpha = true, + paramtype = "light", + pointable = false, + liquids_pointable = true, + diggable = false, + buildable_to = true, + is_ground_content = false, + post_effect_color = {a = 70, r = 255, g = 0, b = 200}, +}) + +-- A liquid in which you can't rise (flowing variant) +minetest.register_node("testnodes:liquidflowing_nojump", { + description = S("Non-jumping Flowing Liquid Node"), + liquidtype = "flowing", + liquid_range = 1, + liquid_viscosity = 0, + liquid_alternative_flowing = "testnodes:liquidflowing_nojump", + liquid_alternative_source = "testnodes:liquid_nojump", + liquid_renewable = false, + groups = {disable_jump=1, dig_immediate=3}, + walkable = false, + + + drawtype = "flowingliquid", + tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"}, + special_tiles = { + {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, + {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, + }, + use_texture_alpha = true, + paramtype = "light", + paramtype2 = "flowingliquid", + pointable = false, + liquids_pointable = true, + diggable = false, + buildable_to = true, + is_ground_content = false, + post_effect_color = {a = 70, r = 255, g = 0, b = 200}, +}) + +-- Nodes that modify fall damage (various damage modifiers) +for i=-100, 100, 25 do + if i ~= 0 then + local subname, descnum + if i < 0 then + subname = "m"..math.abs(i) + descnum = tostring(i) + else + subname = tostring(i) + descnum = S("+@1", i) + end + local tex, color, desc + if i > 0 then + local val = math.floor((i/100)*255) + tex = "testnodes_fall_damage_plus.png" + color = { b=0, g=255-val, r=255, a=255 } + desc = S("Fall Damage Node (+@1%)", i) + else + tex = "testnodes_fall_damage_minus.png" + if i == -100 then + color = { r=0, b=0, g=255, a=255 } + else + local val = math.floor((math.abs(i)/100)*255) + color = { r=0, b=255, g=255-val, a=255 } + end + desc = S("Fall Damage Node (-@1%)", math.abs(i)) + end + minetest.register_node("testnodes:damage"..subname, { + description = desc, + groups = {fall_damage_add_percent=i, dig_immediate=3}, + + + tiles = { tex }, + is_ground_content = false, + color = color, + }) + end +end + +-- Bouncy nodes (various bounce levels) +for i=20, 180, 20 do + local val = math.floor(((i-20)/200)*255) + minetest.register_node("testnodes:bouncy"..i, { + description = S("Bouncy Node (@1%)", i), + groups = {bouncy=i, dig_immediate=3}, + + + tiles ={"testnodes_bouncy.png"}, + is_ground_content = false, + color = { r=255, g=255-val, b=val, a=255 }, + }) +end + +-- Slippery nodes (various slippery levels) +for i=1, 5 do + minetest.register_node("testnodes:slippery"..i, { + description = S("Slippery Node (@1)", i), + tiles ={"testnodes_slippery.png"}, + is_ground_content = false, + groups = {slippery=i, dig_immediate=3}, + color = { r=0, g=255, b=math.floor((i/5)*255), a=255 }, + }) +end + +-- By placing something on the node, the node itself will be replaced +minetest.register_node("testnodes:buildable_to", { + description = S("Replacable Node"), + buildable_to = true, + tiles = {"testnodes_buildable_to.png"}, + is_ground_content = false, + groups = {dig_immediate=3}, +}) + +-- Nodes that deal damage to players that are inside them. +-- Negative damage nodes should heal. +for d=-3,3 do + if d ~= 0 then + local sub, tile + if d > 0 then + sub = tostring(d) + tile = "testnodes_damage.png" + else + sub = "m" .. tostring(math.abs(d)) + tile = "testnodes_damage_neg.png" + end + if math.abs(d) == 2 then + tile = tile .. "^[colorize:#000000:70" + elseif math.abs(d) == 3 then + tile = tile .. "^[colorize:#000000:140" + end + minetest.register_node("testnodes:damage_"..sub, { + description = S("Damage Node (@1 damage per second)", d), + damage_per_second = d, + + + walkable = false, + is_ground_content = false, + drawtype = "allfaces", + paramtype = "light", + sunlight_propagates = true, + tiles = { tile }, + groups = {dig_immediate=3}, + }) + end +end + +-- Causes drowning damage +minetest.register_node("testnodes:drowning_1", { + description = S("Drowning Node (@1 damage)", 1), + drowning = 1, + + + walkable = false, + is_ground_content = false, + drawtype = "allfaces", + paramtype = "light", + sunlight_propagates = true, + tiles = { "testnodes_drowning.png" }, + groups = {dig_immediate=3}, +}) + diff --git a/games/devtest/mods/testnodes/settingtypes.txt b/games/devtest/mods/testnodes/settingtypes.txt new file mode 100644 index 000000000..7f753bf3e --- /dev/null +++ b/games/devtest/mods/testnodes/settingtypes.txt @@ -0,0 +1,4 @@ +# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. +# This is due to . +# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. +testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/games/devtest/mods/testnodes/textures.lua b/games/devtest/mods/testnodes/textures.lua new file mode 100644 index 000000000..f5db9ccbf --- /dev/null +++ b/games/devtest/mods/testnodes/textures.lua @@ -0,0 +1,67 @@ +-- Node texture tests + +local S = minetest.get_translator("testnodes") + +minetest.register_node("testnodes:6sides", { + description = S("Six Textures Test Node"), + tiles = { + "testnodes_normal1.png", + "testnodes_normal2.png", + "testnodes_normal3.png", + "testnodes_normal4.png", + "testnodes_normal5.png", + "testnodes_normal6.png", + }, + + groups = { dig_immediate = 2 }, +}) + +minetest.register_node("testnodes:anim", { + description = S("Animated Test Node"), + tiles = { + { name = "testnodes_anim.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 4.0, + }, }, + }, + + groups = { dig_immediate = 2 }, +}) + +-- Node texture transparency test + +local alphas = { 64, 128, 191 } + +for a=1,#alphas do + local alpha = alphas[a] + + -- Transparency taken from texture + minetest.register_node("testnodes:alpha_texture_"..alpha, { + description = S("Texture Alpha Test Node (@1)", alpha), + drawtype = "glasslike", + paramtype = "light", + tiles = { + "testnodes_alpha"..alpha..".png", + }, + use_texture_alpha = true, + + groups = { dig_immediate = 3 }, + }) + + -- Transparency set via "alpha" parameter + minetest.register_node("testnodes:alpha_"..alpha, { + description = S("Alpha Test Node (@1)", alpha), + -- It seems that only the liquid drawtype supports the alpha parameter + drawtype = "liquid", + paramtype = "light", + tiles = { + "testnodes_alpha.png", + }, + alpha = alpha, + + groups = { dig_immediate = 3 }, + }) +end diff --git a/games/devtest/mods/testnodes/textures/testnodes_1.png b/games/devtest/mods/testnodes/textures/testnodes_1.png new file mode 100644 index 000000000..6730997e2 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_1g.png b/games/devtest/mods/testnodes/textures/testnodes_1g.png new file mode 100644 index 000000000..529298ece Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_1w.png b/games/devtest/mods/testnodes/textures/testnodes_1w.png new file mode 100644 index 000000000..d24e571cc Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_1wg.png b/games/devtest/mods/testnodes/textures/testnodes_1wg.png new file mode 100644 index 000000000..b2eba0e9a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2.png b/games/devtest/mods/testnodes/textures/testnodes_2.png new file mode 100644 index 000000000..6c87c868d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2g.png b/games/devtest/mods/testnodes/textures/testnodes_2g.png new file mode 100644 index 000000000..cb9060f7b Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2w.png b/games/devtest/mods/testnodes/textures/testnodes_2w.png new file mode 100644 index 000000000..b56874ee1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2wg.png b/games/devtest/mods/testnodes/textures/testnodes_2wg.png new file mode 100644 index 000000000..108dc87bb Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3.png b/games/devtest/mods/testnodes/textures/testnodes_3.png new file mode 100644 index 000000000..05b45629a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3g.png b/games/devtest/mods/testnodes/textures/testnodes_3g.png new file mode 100644 index 000000000..5c84f5882 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3w.png b/games/devtest/mods/testnodes/textures/testnodes_3w.png new file mode 100644 index 000000000..8b435cf01 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3wg.png b/games/devtest/mods/testnodes/textures/testnodes_3wg.png new file mode 100644 index 000000000..9ee900667 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4.png b/games/devtest/mods/testnodes/textures/testnodes_4.png new file mode 100644 index 000000000..15e6ffec7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4g.png b/games/devtest/mods/testnodes/textures/testnodes_4g.png new file mode 100644 index 000000000..8f144fae0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4w.png b/games/devtest/mods/testnodes/textures/testnodes_4w.png new file mode 100644 index 000000000..214e0df9d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4wg.png b/games/devtest/mods/testnodes/textures/testnodes_4wg.png new file mode 100644 index 000000000..888b3d482 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5.png b/games/devtest/mods/testnodes/textures/testnodes_5.png new file mode 100644 index 000000000..1ef1c728c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5g.png b/games/devtest/mods/testnodes/textures/testnodes_5g.png new file mode 100644 index 000000000..30da4793a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5w.png b/games/devtest/mods/testnodes/textures/testnodes_5w.png new file mode 100644 index 000000000..b4cb42426 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5wg.png b/games/devtest/mods/testnodes/textures/testnodes_5wg.png new file mode 100644 index 000000000..fac9db28e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6.png b/games/devtest/mods/testnodes/textures/testnodes_6.png new file mode 100644 index 000000000..805813e57 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6g.png b/games/devtest/mods/testnodes/textures/testnodes_6g.png new file mode 100644 index 000000000..a88f4c9f8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6w.png b/games/devtest/mods/testnodes/textures/testnodes_6w.png new file mode 100644 index 000000000..e6bbf97d9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6wg.png b/games/devtest/mods/testnodes/textures/testnodes_6wg.png new file mode 100644 index 000000000..29ca933e0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_airlike.png b/games/devtest/mods/testnodes/textures/testnodes_airlike.png new file mode 100644 index 000000000..5a5664a2a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_airlike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_allfaces.png b/games/devtest/mods/testnodes/textures/testnodes_allfaces.png new file mode 100644 index 000000000..c0a7dc550 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_allfaces.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png b/games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png new file mode 100644 index 000000000..1f6a17313 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha.png b/games/devtest/mods/testnodes/textures/testnodes_alpha.png new file mode 100644 index 000000000..157fa7386 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha128.png b/games/devtest/mods/testnodes/textures/testnodes_alpha128.png new file mode 100644 index 000000000..16babf6c7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha128.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha191.png b/games/devtest/mods/testnodes/textures/testnodes_alpha191.png new file mode 100644 index 000000000..f165d2887 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha191.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha64.png b/games/devtest/mods/testnodes/textures/testnodes_alpha64.png new file mode 100644 index 000000000..c343c32c3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha64.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_anim.png b/games/devtest/mods/testnodes/textures/testnodes_anim.png new file mode 100644 index 000000000..d321fe857 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_anim.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png b/games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png new file mode 100644 index 000000000..e01ae576f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attached_side.png b/games/devtest/mods/testnodes/textures/testnodes_attached_side.png new file mode 100644 index 000000000..9459cbb05 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attached_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attached_top.png b/games/devtest/mods/testnodes/textures/testnodes_attached_top.png new file mode 100644 index 000000000..0148b41e0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attached_top.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png b/games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png new file mode 100644 index 000000000..488ad23a9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png b/games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png new file mode 100644 index 000000000..a02facbc7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png b/games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png new file mode 100644 index 000000000..1f4fc7b85 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_bouncy.png b/games/devtest/mods/testnodes/textures/testnodes_bouncy.png new file mode 100644 index 000000000..eabbbdfe4 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_bouncy.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_buildable_to.png b/games/devtest/mods/testnodes/textures/testnodes_buildable_to.png new file mode 100644 index 000000000..23b5e54d2 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_buildable_to.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png b/games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png new file mode 100644 index 000000000..d5ca13033 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_climbable_side.png b/games/devtest/mods/testnodes/textures/testnodes_climbable_side.png new file mode 100644 index 000000000..c56ea90d7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_climbable_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_damage.png b/games/devtest/mods/testnodes/textures/testnodes_damage.png new file mode 100644 index 000000000..9de2ab5e8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_damage.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_damage_neg.png b/games/devtest/mods/testnodes/textures/testnodes_damage_neg.png new file mode 100644 index 000000000..85811bc8e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_damage_neg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_drowning.png b/games/devtest/mods/testnodes/textures/testnodes_drowning.png new file mode 100644 index 000000000..57ffc8fcf Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_drowning.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png new file mode 100644 index 000000000..88d3bdf58 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png new file mode 100644 index 000000000..61fdec2e3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_fencelike.png b/games/devtest/mods/testnodes/textures/testnodes_fencelike.png new file mode 100644 index 000000000..84dea1b7c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_fencelike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_firelike.png b/games/devtest/mods/testnodes/textures/testnodes_firelike.png new file mode 100644 index 000000000..ee59b0db1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_firelike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike.png new file mode 100644 index 000000000..cf3e35414 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png new file mode 100644 index 000000000..30c9586e8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png new file mode 100644 index 000000000..8a513f21c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png new file mode 100644 index 000000000..4ea839c8b Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png new file mode 100644 index 000000000..37de77dd1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png b/games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png new file mode 100644 index 000000000..e1e96ffb9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light.png b/games/devtest/mods/testnodes/textures/testnodes_light.png new file mode 100644 index 000000000..4ba0081c3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_1.png b/games/devtest/mods/testnodes/textures/testnodes_light_1.png new file mode 100644 index 000000000..57adf5a4a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_10.png b/games/devtest/mods/testnodes/textures/testnodes_light_10.png new file mode 100644 index 000000000..483834770 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_10.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_11.png b/games/devtest/mods/testnodes/textures/testnodes_light_11.png new file mode 100644 index 000000000..4c423d9b4 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_11.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_12.png b/games/devtest/mods/testnodes/textures/testnodes_light_12.png new file mode 100644 index 000000000..bc7946d09 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_12.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_13.png b/games/devtest/mods/testnodes/textures/testnodes_light_13.png new file mode 100644 index 000000000..0b63c84a6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_13.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_14.png b/games/devtest/mods/testnodes/textures/testnodes_light_14.png new file mode 100644 index 000000000..a817bd394 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_14.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_2.png b/games/devtest/mods/testnodes/textures/testnodes_light_2.png new file mode 100644 index 000000000..852eaeff1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_3.png b/games/devtest/mods/testnodes/textures/testnodes_light_3.png new file mode 100644 index 000000000..79fc834cc Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_4.png b/games/devtest/mods/testnodes/textures/testnodes_light_4.png new file mode 100644 index 000000000..75f8c6136 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_5.png b/games/devtest/mods/testnodes/textures/testnodes_light_5.png new file mode 100644 index 000000000..b6eede0ae Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_6.png b/games/devtest/mods/testnodes/textures/testnodes_light_6.png new file mode 100644 index 000000000..ef54addec Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_7.png b/games/devtest/mods/testnodes/textures/testnodes_light_7.png new file mode 100644 index 000000000..4a885b0f6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_7.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_8.png b/games/devtest/mods/testnodes/textures/testnodes_light_8.png new file mode 100644 index 000000000..b283301e3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_8.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_9.png b/games/devtest/mods/testnodes/textures/testnodes_light_9.png new file mode 100644 index 000000000..2aa902358 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_9.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_line_crossing.png new file mode 100644 index 000000000..e566f2793 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_curved.png b/games/devtest/mods/testnodes/textures/testnodes_line_curved.png new file mode 100644 index 000000000..ab9f8e720 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_straight.png b/games/devtest/mods/testnodes/textures/testnodes_line_straight.png new file mode 100644 index 000000000..4f33d9c6d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png new file mode 100644 index 000000000..5668f6ea3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquid.png b/games/devtest/mods/testnodes/textures/testnodes_liquid.png new file mode 100644 index 000000000..98ab270c2 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquid.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png new file mode 100644 index 000000000..1736b89ba Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png new file mode 100644 index 000000000..e8a61039d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png new file mode 100644 index 000000000..b4e45b42f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png new file mode 100644 index 000000000..e064b8f2d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png new file mode 100644 index 000000000..bef773968 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png new file mode 100644 index 000000000..de1001b2d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png new file mode 100644 index 000000000..97b422e9a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png new file mode 100644 index 000000000..4cd8e4e8e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png new file mode 100644 index 000000000..711dd961c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png new file mode 100644 index 000000000..9cf22b8ca Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource.png new file mode 100644 index 000000000..b3f29b702 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png new file mode 100644 index 000000000..da0a99623 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png new file mode 100644 index 000000000..66bf2be8f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png new file mode 100644 index 000000000..fc5f65cb6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png new file mode 100644 index 000000000..0f46e291e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png new file mode 100644 index 000000000..0693a04d7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png new file mode 100644 index 000000000..cc9d03992 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png new file mode 100644 index 000000000..e276a07ae Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png new file mode 100644 index 000000000..3534a4b15 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png new file mode 100644 index 000000000..ee1a8b169 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png new file mode 100644 index 000000000..51b8e0025 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png new file mode 100644 index 000000000..9ea65c1ec Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png new file mode 100644 index 000000000..96bc55ac5 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png new file mode 100644 index 000000000..fca33727d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_node.png b/games/devtest/mods/testnodes/textures/testnodes_node.png new file mode 100644 index 000000000..145099b3a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_node.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_node_falling.png b/games/devtest/mods/testnodes/textures/testnodes_node_falling.png new file mode 100644 index 000000000..44153185c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_node_falling.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_nodebox.png b/games/devtest/mods/testnodes/textures/testnodes_nodebox.png new file mode 100644 index 000000000..66e8dd663 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_nodebox.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_nojump_side.png b/games/devtest/mods/testnodes/textures/testnodes_nojump_side.png new file mode 100644 index 000000000..6a64cfff0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_nojump_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_nojump_top.png b/games/devtest/mods/testnodes/textures/testnodes_nojump_top.png new file mode 100644 index 000000000..fe770838f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_nojump_top.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal.png b/games/devtest/mods/testnodes/textures/testnodes_normal.png new file mode 100644 index 000000000..a1acfd9fd Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal1.png b/games/devtest/mods/testnodes/textures/testnodes_normal1.png new file mode 100644 index 000000000..edaba77e4 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal2.png b/games/devtest/mods/testnodes/textures/testnodes_normal2.png new file mode 100644 index 000000000..0080a9ee7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal3.png b/games/devtest/mods/testnodes/textures/testnodes_normal3.png new file mode 100644 index 000000000..0426ab216 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal4.png b/games/devtest/mods/testnodes/textures/testnodes_normal4.png new file mode 100644 index 000000000..0d1922eb6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal5.png b/games/devtest/mods/testnodes/textures/testnodes_normal5.png new file mode 100644 index 000000000..0b7dcd2da Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal6.png b/games/devtest/mods/testnodes/textures/testnodes_normal6.png new file mode 100644 index 000000000..f34a67d71 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png b/games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png new file mode 100644 index 000000000..8cf47bbbe Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_palette_full.png b/games/devtest/mods/testnodes/textures/testnodes_palette_full.png new file mode 100644 index 000000000..e0a5f8b34 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_palette_full.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png b/games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png new file mode 100644 index 000000000..682f3ac84 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike.png new file mode 100644 index 000000000..cc464444d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png new file mode 100644 index 000000000..01c81da8e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png new file mode 100644 index 000000000..53504dbcd Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png new file mode 100644 index 000000000..d504d459f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png new file mode 100644 index 000000000..79cf2125e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png new file mode 100644 index 000000000..b9ee9e5be Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png new file mode 100644 index 000000000..85311cb2c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png new file mode 100644 index 000000000..bc602bafe Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png new file mode 100644 index 000000000..d10002375 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png new file mode 100644 index 000000000..527817bc1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png new file mode 100644 index 000000000..45e75bdd3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png new file mode 100644 index 000000000..8954b2c34 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png new file mode 100644 index 000000000..a782d4874 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png new file mode 100644 index 000000000..112a0540f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png new file mode 100644 index 000000000..b584a8dc9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png new file mode 100644 index 000000000..530bbba7a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png new file mode 100644 index 000000000..4ed1ca00f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png new file mode 100644 index 000000000..8749330d8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png new file mode 100644 index 000000000..0517f6570 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png new file mode 100644 index 000000000..3916ce1ef Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_curved.png b/games/devtest/mods/testnodes/textures/testnodes_rail_curved.png new file mode 100644 index 000000000..e44419848 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_straight.png b/games/devtest/mods/testnodes/textures/testnodes_rail_straight.png new file mode 100644 index 000000000..872d04fb9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png new file mode 100644 index 000000000..7e4af5182 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_signlike.png b/games/devtest/mods/testnodes/textures/testnodes_signlike.png new file mode 100644 index 000000000..33ffcba6c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_signlike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_slippery.png b/games/devtest/mods/testnodes/textures/testnodes_slippery.png new file mode 100644 index 000000000..b990468a1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_slippery.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_street_crossing.png new file mode 100644 index 000000000..d6e35ad7a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_curved.png b/games/devtest/mods/testnodes/textures/testnodes_street_curved.png new file mode 100644 index 000000000..251b7fb71 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_straight.png b/games/devtest/mods/testnodes/textures/testnodes_street_straight.png new file mode 100644 index 000000000..639e24b93 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png new file mode 100644 index 000000000..713621e06 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png b/games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png new file mode 100644 index 000000000..b38ea4072 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png b/games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png new file mode 100644 index 000000000..5d9862cc9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png b/games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png new file mode 100644 index 000000000..adf1e002d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png b/games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png new file mode 100644 index 000000000..cb442b22d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png differ diff --git a/games/devtest/mods/testpathfinder/README.md b/games/devtest/mods/testpathfinder/README.md new file mode 100644 index 000000000..2b9d46e70 --- /dev/null +++ b/games/devtest/mods/testpathfinder/README.md @@ -0,0 +1,15 @@ +# Pathfinder Tester + +Usage: + +Use the Pathfinder Tester tool (`testpathfinder:testpathfinder`). +Here's how it works: + +* Place on node: Set destination position +* Punch: Find path +* Sneak+punch: Select pathfinding algorithm + +Information will be shown in chat. If a path was found, all waypoints +will be shown for a few seconds. + +See `init.lua` for config variables. diff --git a/games/devtest/mods/testpathfinder/init.lua b/games/devtest/mods/testpathfinder/init.lua new file mode 100644 index 000000000..f94848236 --- /dev/null +++ b/games/devtest/mods/testpathfinder/init.lua @@ -0,0 +1,132 @@ +local S = minetest.get_translator("testpathfinder") + +-- Config parameters + +-- Maximum direct distance between start and end +local MAX_DIRECT_DISTANCE = 64 +-- Maximum search distance +local MAX_SEARCH_DISTANCE = 32 +-- Maximum permitted jump height +local MAX_JUMP = 1 +-- Maximum permitted drop height +local MAX_DROP = 5 +-- If true, mod won't refuse to run pathfinder even at long distances +local IGNORE_MAX_DISTANCE_SAFEGUARD = false + +-- End of config parameters + +local timer = 0 +local algorithms = { + "A*_noprefetch", + "A*", + "Dijkstra", +} + +local function find_path_for_player(player, itemstack) + local meta = itemstack:get_meta() + if not meta then + return + end + local x = meta:get_int("pos_x") + local y = meta:get_int("pos_y") + local z = meta:get_int("pos_z") + local algo = meta:get_int("algorithm") + if x and y and z then + local pos2 = {x=x, y=y, z=z} + algo = algorithms[algo+1] + local pos1 = vector.round(player:get_pos()) + -- Don't bother calling pathfinder for high distance to avoid freezing + if (not IGNORE_MAX_DISTANCE_SAFEGUARD) and (vector.distance(pos1, pos2) > MAX_DIRECT_DISTANCE) then + minetest.chat_send_player(player:get_player_name(), S("Destination too far away! Set a destination (via placing) within a distance of @1 and try again!", MAX_DIRECT_DISTANCE)) + return + end + local str = S("Path from @1 to @2:", + minetest.pos_to_string(pos1), + minetest.pos_to_string(pos2)) + + minetest.chat_send_player(player:get_player_name(), str) + local time_start = minetest.get_us_time() + local path = minetest.find_path(pos1, pos2, MAX_SEARCH_DISTANCE, MAX_JUMP, MAX_DROP, algo) + local time_end = minetest.get_us_time() + local time_diff = time_end - time_start + str = "" + if not path then + minetest.chat_send_player(player:get_player_name(), S("No path!")) + minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) + return + end + for s=1, #path do + str = str .. minetest.pos_to_string(path[s]) .. "\n" + local t + if s == #path then + t = "testpathfinder_waypoint_end.png" + elseif s == 1 then + t = "testpathfinder_waypoint_start.png" + else + local c = math.floor(((#path-s)/#path)*255) + t = string.format("testpathfinder_waypoint.png^[multiply:#%02x%02x00", 0xFF-c, c) + end + minetest.add_particle({ + pos = path[s], + expirationtime = 5 + 0.2 * s, + playername = player:get_player_name(), + glow = minetest.LIGHT_MAX, + texture = t, + size = 3, + }) + end + minetest.chat_send_player(player:get_player_name(), str) + minetest.chat_send_player(player:get_player_name(), S("Path length: @1", #path)) + minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) + end +end + +local function set_destination(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + local name = user:get_player_name() + local obj + local meta = itemstack:get_meta() + if pointed_thing.type == "node" then + local pos = pointed_thing.above + meta:set_int("pos_x", pos.x) + meta:set_int("pos_y", pos.y) + meta:set_int("pos_z", pos.z) + minetest.chat_send_player(user:get_player_name(), S("Destination set to @1", minetest.pos_to_string(pos))) + return itemstack + end +end + +local function find_path_or_set_algorithm(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + local ctrl = user:get_player_control() + -- No sneak: Find path + if not ctrl.sneak then + find_path_for_player(user, itemstack) + else + -- Sneak: Set algorithm + local meta = itemstack:get_meta() + local algo = meta:get_int("algorithm") + algo = (algo + 1) % #algorithms + meta:set_int("algorithm", algo) + minetest.chat_send_player(user:get_player_name(), S("Algorithm: @1", algorithms[algo+1])) + return itemstack + end +end + +-- Punch: Find path +-- Sneak+punch: Select pathfinding algorithm +-- Place: Select destination node +minetest.register_tool("testpathfinder:testpathfinder", { + description = S("Pathfinder Tester"), + inventory_image = "testpathfinder_testpathfinder.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = find_path_or_set_algorithm, + on_secondary_use = set_destination, + on_place = set_destination, +}) + + diff --git a/games/devtest/mods/testpathfinder/mod.conf b/games/devtest/mods/testpathfinder/mod.conf new file mode 100644 index 000000000..e6034ae8c --- /dev/null +++ b/games/devtest/mods/testpathfinder/mod.conf @@ -0,0 +1,2 @@ +name = testpathfinder +description = Tool to test Minetest's pathfinder function diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png new file mode 100644 index 000000000..37eef0565 Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png differ diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png new file mode 100644 index 000000000..661dcf906 Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png differ diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png new file mode 100644 index 000000000..41a1cc549 Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png differ diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png new file mode 100644 index 000000000..a22e31c3b Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png differ diff --git a/games/devtest/mods/testtools/README.md b/games/devtest/mods/testtools/README.md new file mode 100644 index 000000000..9cfe29ea4 --- /dev/null +++ b/games/devtest/mods/testtools/README.md @@ -0,0 +1,99 @@ +# Test Tools readme + +Test Tools is a mod for developers that adds a bunch of tools to directly manipulate nodes and entities. This is great for quickly testing out stuff. + +Here's the list of tools: + +## Remover +Removes nodes and non-player entities that you punch. + +## Node Setter +Replace a node with another one. + +First, punch a node you want to remember. +Then rightclick any other node to replace it with the node you remembered. + +If you rightclick while pointing nothing, you can manually enter the node and param2. + +## Param2 Tool +Change the value param2 of nodes. + +* Punch: Add 1 to param2 +* Sneak+Punch: Add 8 to param2 +* Place: Subtract 1 from param2 +* Sneak+Place: Subtract 8 from param2 + +Note: Use the debug screen (F5) to see the param2 of the pointed node. + +## Falling Node Tool +Turns nodes into falling nodes. + +Usage: + +* Punch node: Make it fall +* Place: Try to teleport up to 2 units upwards, then make it fall + +## Entity Rotator +Changes the entity rotation (with `set_rotation`). + +Usage: + +* Punch entity: Rotate yaw +* Punch entity while holding down “Sneak” key: Rotate pitch +* Punch entity while holding down “Special” key (aka “Aux”): Rotate roll + +Each usage rotates the entity by 22.5°. + +## Entity Spawner +Spawns entities. + +Usage: + +* Punch to select entity or spawn one directly +* Place to place selected entity + +## Object Property Editor +Edits properties of objects. + +Usage: + +* Punch object to open a formspec that allows you to view and edit properties +* Punch air to edit properties of your own player object + +To edit a property, select it in the list, enter a new value (in Lua syntax) +and hit “Submit”. + +## Object Attacher +Allows you to attach an object to another one. + +Basic usage: +* First select the parent object, then the child object that should be attached +* Selecting an object is done by punching it +* Sneak+punch to detach selected object +* If you punch air, you select yourself + +Configuration: +* Place: Increase attachment Y position +* Sneak+place: decrease attachment Y position +* Aux+place: Increase attachment X rotation +* Aux+Sneak+Rightclick: Decrease attachment X rotation + +Hint: To detach all objects nearby you (including on yourself), use the +`/detach` server command. + +## Object Mover +Move an object by a given distance. + +Usage: +* Punch object into the direction you want to move it +* Sneak+punch: Move object towards you +* Place: Increase move distance +* Sneak+place: Decrease move distance + +## Entity Visual Scaler +Change visual size of entities + +Usage: + +* Punch entity to increase visual size +* Sneak+punch entity to decrease visual size diff --git a/games/devtest/mods/testtools/init.lua b/games/devtest/mods/testtools/init.lua new file mode 100644 index 000000000..a63c98377 --- /dev/null +++ b/games/devtest/mods/testtools/init.lua @@ -0,0 +1,691 @@ +local S = minetest.get_translator("testtools") +local F = minetest.formspec_escape + +-- TODO: Add a Node Metadata tool + +-- Param 2 Tool: Set param2 value of tools +-- Punch: +1 +-- Punch+Shift: +8 +-- Place: -1 +-- Place+Shift: -8 +minetest.register_tool("testtools:param2tool", { + description = S("Param2 Tool"), + inventory_image = "testtools_param2tool.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local add = 1 + if user then + local ctrl = user:get_player_control() + if ctrl.sneak then + add = 8 + end + end + local node = minetest.get_node(pos) + node.param2 = node.param2 + add + minetest.swap_node(pos, node) + end, + on_place = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local add = -1 + if user then + local ctrl = user:get_player_control() + if ctrl.sneak then + add = -8 + end + end + local node = minetest.get_node(pos) + node.param2 = node.param2 + add + minetest.swap_node(pos, node) + end, +}) + +minetest.register_tool("testtools:node_setter", { + description = S("Node Setter"), + inventory_image = "testtools_node_setter.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type == "nothing" then + local meta = itemstack:get_meta() + meta:set_string("node", "air") + meta:set_int("node_param2", 0) + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", "air", 0)) + end + return itemstack + elseif pointed_thing.type ~= "node" or (not pos) then + return + end + local node = minetest.get_node(pos) + local meta = itemstack:get_meta() + meta:set_string("node", node.name) + meta:set_int("node_param2", node.param2) + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", node.name, node.param2)) + end + return itemstack + end, + on_secondary_use = function(itemstack, user, pointed_thing) + local meta = itemstack:get_meta() + local nodename = meta:get_string("node") or "" + local param2 = meta:get_int("node_param2") or 0 + + minetest.show_formspec(user:get_player_name(), "testtools:node_setter", + "size[4,4]".. + "field[0.5,1;3,1;nodename;"..F(S("Node name (itemstring):"))..";"..F(nodename).."]".. + "field[0.5,2;3,1;param2;"..F(S("param2:"))..";"..F(tostring(param2)).."]".. + "button_exit[0.5,3;3,1;submit;"..F(S("Submit")).."]" + ) + end, + on_place = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + local meta = itemstack:get_meta() + local nodename = meta:get_string("node") + if nodename == "" and user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Punch a node first!")) + return + end + local param2 = meta:get_int("node_param2") + if not param2 then + param2 = 0 + end + local node = { name = nodename, param2 = param2 } + if not minetest.registered_nodes[nodename] then + minetest.chat_send_player(user:get_player_name(), S("Cannot set unknown node: @1", nodename)) + return + end + minetest.set_node(pos, node) + end, +}) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname == "testtools:node_setter" then + local playername = player:get_player_name() + local witem = player:get_wielded_item() + if witem:get_name() == "testtools:node_setter" then + if fields.nodename and fields.param2 then + local param2 = tonumber(fields.param2) + if not param2 then + return + end + local meta = witem:get_meta() + meta:set_string("node", fields.nodename) + meta:set_int("node_param2", param2) + player:set_wielded_item(witem) + end + end + end +end) + +minetest.register_tool("testtools:remover", { + description = S("Remover"), + inventory_image = "testtools_remover.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type == "node" and pos ~= nil then + minetest.remove_node(pos) + elseif pointed_thing.type == "object" then + local obj = pointed_thing.ref + if not obj:is_player() then + obj:remove() + end + end + end, +}) + +minetest.register_tool("testtools:falling_node_tool", { + description = S("Falling Node Tool"), + inventory_image = "testtools_falling_node_tool.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = function(itemstack, user, pointed_thing) + -- Teleport node 1-2 units upwards (if possible) and make it fall + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local ok = false + local highest + for i=1,2 do + local above = {x=pos.x,y=pos.y+i,z=pos.z} + local n2 = minetest.get_node(above) + local def2 = minetest.registered_nodes[n2.name] + if def2 and (not def2.walkable) then + highest = above + else + break + end + end + if highest then + local node = minetest.get_node(pos) + local metatable = minetest.get_meta(pos):to_table() + minetest.remove_node(pos) + minetest.set_node(highest, node) + local meta_highest = minetest.get_meta(highest) + meta_highest:from_table(metatable) + ok = minetest.spawn_falling_node(highest) + else + ok = minetest.spawn_falling_node(pos) + end + if not ok and user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) + end + end, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local ok = minetest.spawn_falling_node(pos) + if not ok and user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) + end + end, +}) + +minetest.register_tool("testtools:rotator", { + description = S("Entity Rotator"), + inventory_image = "testtools_entity_rotator.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "object" then + return + end + local obj = pointed_thing.ref + if obj:is_player() then + -- No player rotation + return + else + local axis = "y" + if user and user:is_player() then + local ctrl = user:get_player_control() + if ctrl.sneak then + axis = "x" + elseif ctrl.aux1 then + axis = "z" + end + end + local rot = obj:get_rotation() + rot[axis] = rot[axis] + math.pi/8 + if rot[axis] > math.pi*2 then + rot[axis] = rot[axis] - math.pi*2 + end + obj:set_rotation(rot) + end + end, +}) + +local mover_config = function(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + local name = user:get_player_name() + local ctrl = user:get_player_control() + local meta = itemstack:get_meta() + local dist = 1.0 + if meta:contains("distance") then + dist = meta:get_int("distance") + end + if ctrl.sneak then + dist = dist - 1 + else + dist = dist + 1 + end + meta:set_int("distance", dist) + minetest.chat_send_player(user:get_player_name(), S("distance=@1/10", dist*2)) + return itemstack +end + +minetest.register_tool("testtools:object_mover", { + description = S("Object Mover"), + inventory_image = "testtools_object_mover.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = mover_config, + on_secondary_use = mover_config, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "object" then + return + end + local obj = pointed_thing.ref + if not (user and user:is_player()) then + return + end + local yaw = user:get_look_horizontal() + local dir = minetest.yaw_to_dir(yaw) + local pos = obj:get_pos() + local pitch = user:get_look_vertical() + if pitch > 0.25 * math.pi then + dir.y = -1 + dir.x = 0 + dir.z = 0 + elseif pitch < -0.25 * math.pi then + dir.y = 1 + dir.x = 0 + dir.z = 0 + end + local ctrl = user:get_player_control() + if ctrl.sneak then + dir = vector.multiply(dir, -1) + end + local meta = itemstack:get_meta() + if meta:contains("distance") then + local dist = meta:get_int("distance") + dir = vector.multiply(dir, dist*0.2) + end + pos = vector.add(pos, dir) + obj:set_pos(pos) + end, +}) + + + +minetest.register_tool("testtools:entity_scaler", { + description = S("Entity Visual Scaler"), + inventory_image = "testtools_entity_scaler.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "object" then + return + end + local obj = pointed_thing.ref + if obj:is_player() then + -- No player scaling + return + else + local diff = 0.1 + if user and user:is_player() then + local ctrl = user:get_player_control() + if ctrl.sneak then + diff = -0.1 + end + end + local prop = obj:get_properties() + if not prop.visual_size then + prop.visual_size = { x=1, y=1, z=1 } + else + prop.visual_size = { x=prop.visual_size.x+diff, y=prop.visual_size.y+diff, z=prop.visual_size.z+diff } + if prop.visual_size.x <= 0.1 then + prop.visual_size.x = 0.1 + end + if prop.visual_size.y <= 0.1 then + prop.visual_size.y = 0.1 + end + if prop.visual_size.z <= 0.1 then + prop.visual_size.z = 0.1 + end + end + obj:set_properties(prop) + end + end, +}) + +local selections = {} +local entity_list +local function get_entity_list() + if entity_list then + return entity_list + end + local ents = minetest.registered_entities + local list = {} + for k,_ in pairs(ents) do + table.insert(list, k) + end + table.sort(list) + entity_list = list + return entity_list +end +minetest.register_tool("testtools:entity_spawner", { + description = S("Entity Spawner"), + inventory_image = "testtools_entity_spawner.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + if selections[name] and pointed_thing.type == "node" then + local pos = pointed_thing.above + minetest.add_entity(pos, get_entity_list()[selections[name]]) + end + end, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type == "object" then + return + end + if user and user:is_player() then + local list = table.concat(get_entity_list(), ",") + local name = user:get_player_name() + local sel = selections[name] or "" + minetest.show_formspec(name, "testtools:entity_list", + "size[9,9]".. + "textlist[0,0;9,8;entity_list;"..list..";"..sel..";false]".. + "button[0,8;4,1;spawn;Spawn entity]" + ) + end + end, +}) + +local function prop_to_string(property) + if type(property) == "string" then + return "\"" .. property .. "\"" + elseif type(property) == "table" then + return tostring(dump(property)):gsub("\n", "") + else + return tostring(property) + end +end + +local property_formspec_data = {} +local property_formspec_index = {} +local selected_objects = {} +local function get_object_properties_form(obj, playername) + if not playername then return "" end + local props = obj:get_properties() + local str = "" + property_formspec_data[playername] = {} + local proplist = {} + for k,_ in pairs(props) do + table.insert(proplist, k) + end + table.sort(proplist) + for p=1, #proplist do + local k = proplist[p] + local v = props[k] + local newline = "" + newline = k .. " = " + newline = newline .. prop_to_string(v) + str = str .. F(newline) + if p < #proplist then + str = str .. "," + end + table.insert(property_formspec_data[playername], k) + end + return str +end + +local editor_formspec_selindex = {} + +local editor_formspec = function(playername, obj, value, sel) + if not value then + value = "" + end + if not sel then + sel = "" + end + local list = get_object_properties_form(obj, playername) + local title + if obj:is_player() then + title = S("Object properties of player “@1”", obj:get_player_name()) + else + local ent = obj:get_luaentity() + title = S("Object properties of @1", ent.name) + end + minetest.show_formspec(playername, "testtools:object_editor", + "size[9,9]".. + "label[0,0;"..F(title).."]".. + "textlist[0,0.5;9,7.5;object_props;"..list..";"..sel..";false]".. + "field[0.2,8.75;8,1;value;"..F(S("Value"))..";"..F(value).."]".. + "button[8,8.5;1,1;submit;"..F(S("Submit")).."]" + ) +end + +minetest.register_tool("testtools:object_editor", { + description = S("Object Property Editor"), + inventory_image = "testtools_object_editor.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if user and user:is_player() then + local name = user:get_player_name() + + if pointed_thing.type == "object" then + selected_objects[name] = pointed_thing.ref + elseif pointed_thing.type == "nothing" then + -- Use on yourself if pointing nothing + selected_objects[name] = user + else + -- Unsupported pointed thing + return + end + + local sel = editor_formspec_selindex[name] + local val + if selected_objects[name] and selected_objects[name]:get_properties() then + local props = selected_objects[name]:get_properties() + local keys = property_formspec_data[name] + if property_formspec_index[name] and props then + local key = keys[property_formspec_index[name]] + val = prop_to_string(props[key]) + end + end + + editor_formspec(name, selected_objects[name], val, sel) + end + end, +}) + +local ent_parent = {} +local ent_child = {} +local DEFAULT_ATTACH_OFFSET_Y = 11 + +local attacher_config = function(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + if pointed_thing.type == "object" then + return + end + local name = user:get_player_name() + local ctrl = user:get_player_control() + local meta = itemstack:get_meta() + if ctrl.aux1 then + local rot_x = meta:get_float("rot_x") + if ctrl.sneak then + rot_x = rot_x - math.pi/8 + else + rot_x = rot_x + math.pi/8 + end + if rot_x > 6.2 then + rot_x = 0 + elseif rot_x < 0 then + rot_x = math.pi * (15/8) + end + minetest.chat_send_player(name, S("rotation=@1", minetest.pos_to_string({x=rot_x,y=0,z=0}))) + meta:set_float("rot_x", rot_x) + else + local pos_y + if meta:contains("pos_y") then + pos_y = meta:get_int("pos_y") + else + pos_y = DEFAULT_ATTACH_OFFSET_Y + end + if ctrl.sneak then + pos_y = pos_y - 1 + else + pos_y = pos_y + 1 + end + minetest.chat_send_player(name, S("position=@1", minetest.pos_to_string({x=0,y=pos_y,z=0}))) + meta:set_int("pos_y", pos_y) + end + return itemstack +end + +minetest.register_tool("testtools:object_attacher", { + description = S("Object Attacher"), + inventory_image = "testtools_object_attacher.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = attacher_config, + on_secondary_use = attacher_config, + on_use = function(itemstack, user, pointed_thing) + if user and user:is_player() then + local name = user:get_player_name() + local selected_object + if pointed_thing.type == "object" then + selected_object = pointed_thing.ref + elseif pointed_thing.type == "nothing" then + selected_object = user + else + return + end + local ctrl = user:get_player_control() + if ctrl.sneak then + if selected_object:get_attach() then + selected_object:set_detach() + minetest.chat_send_player(name, S("Object detached!")) + else + minetest.chat_send_player(name, S("Object is not attached!")) + end + return + end + local parent = ent_parent[name] + local child = ent_child[name] + local ename = S("") + if not parent then + parent = selected_object + ent_parent[name] = parent + elseif not child then + child = selected_object + ent_child[name] = child + end + local entity = selected_object:get_luaentity() + if entity then + ename = entity.name + elseif selected_object:is_player() then + ename = selected_object:get_player_name() + end + if selected_object == parent then + minetest.chat_send_player(name, S("Parent object selected: @1", ename)) + elseif selected_object == child then + minetest.chat_send_player(name, S("Child object selected: @1", ename)) + end + if parent and child then + if parent == child then + minetest.chat_send_player(name, S("Can't attach an object to itself!")) + ent_parent[name] = nil + ent_child[name] = nil + return + end + local meta = itemstack:get_meta() + local y + if meta:contains("pos_y") then + y = meta:get_int("pos_y") + else + y = DEFAULT_ATTACH_OFFSET_Y + end + local rx = meta:get_float("rot_x") or 0 + local offset = {x=0,y=y,z=0} + local angle = {x=rx,y=0,z=0} + child:set_attach(parent, "", offset, angle) + local check_parent = child:get_attach() + if check_parent then + minetest.chat_send_player(name, S("Object attached! position=@1, rotation=@2", + minetest.pos_to_string(offset), minetest.pos_to_string(angle))) + else + minetest.chat_send_player(name, S("Attachment failed!")) + end + ent_parent[name] = nil + ent_child[name] = nil + end + end + end, +}) + +-- Use loadstring to parse param as a Lua value +local function use_loadstring(param, player) + -- For security reasons, require 'server' priv, just in case + -- someone is actually crazy enough to run this on a public server. + local privs = minetest.get_player_privs(player:get_player_name()) + if not privs.server then + return false, "You need 'server' privilege to change object properties!" + end + if not param then + return false, "Failed: parameter is nil" + end + --[[ DANGER ZONE ]] + -- Interpret string as Lua value + local func, errormsg = loadstring("return (" .. param .. ")") + if not func then + return false, "Failed: " .. errormsg + end + + -- Apply sandbox here using setfenv + setfenv(func, {}) + + -- Run it + local good, errOrResult = pcall(func) + if not good then + -- A Lua error was thrown + return false, "Failed: " .. errOrResult + end + + -- errOrResult will be the value + return true, errOrResult +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if not (player and player:is_player()) then + return + end + if formname == "testtools:entity_list" then + local name = player:get_player_name() + if fields.entity_list then + local expl = minetest.explode_textlist_event(fields.entity_list) + if expl.type == "DCL" then + local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) + selections[name] = expl.index + minetest.add_entity(pos, get_entity_list()[expl.index]) + return + elseif expl.type == "CHG" then + selections[name] = expl.index + return + end + elseif fields.spawn and selections[name] then + local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) + minetest.add_entity(pos, get_entity_list()[selections[name]]) + return + end + elseif formname == "testtools:object_editor" then + local name = player:get_player_name() + if fields.object_props then + local expl = minetest.explode_textlist_event(fields.object_props) + if expl.type == "DCL" or expl.type == "CHG" then + property_formspec_index[name] = expl.index + + local props = selected_objects[name]:get_properties() + local keys = property_formspec_data[name] + if (not property_formspec_index[name]) or (not props) then + return + end + local key = keys[property_formspec_index[name]] + editor_formspec_selindex[name] = expl.index + editor_formspec(name, selected_objects[name], prop_to_string(props[key]), expl.index) + return + end + end + if fields.submit then + local props = selected_objects[name]:get_properties() + local keys = property_formspec_data[name] + if (not property_formspec_index[name]) or (not props) then + return + end + local key = keys[property_formspec_index[name]] + if not key then + return + end + local success, str = use_loadstring(fields.value, player) + if success then + props[key] = str + else + minetest.chat_send_player(name, str) + return + end + selected_objects[name]:set_properties(props) + local sel = editor_formspec_selindex[name] + editor_formspec(name, selected_objects[name], prop_to_string(props[key]), sel) + return + end + end +end) diff --git a/games/devtest/mods/testtools/mod.conf b/games/devtest/mods/testtools/mod.conf new file mode 100644 index 000000000..cde1b2685 --- /dev/null +++ b/games/devtest/mods/testtools/mod.conf @@ -0,0 +1,2 @@ +name = testtools +description = Some tools to directly manipulate nodes and entities. Great for development and testing diff --git a/games/devtest/mods/testtools/textures/testtools_entity_rotator.png b/games/devtest/mods/testtools/textures/testtools_entity_rotator.png new file mode 100644 index 000000000..17ebb2d35 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_entity_rotator.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_entity_scaler.png b/games/devtest/mods/testtools/textures/testtools_entity_scaler.png new file mode 100644 index 000000000..4909c25b0 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_entity_scaler.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_entity_spawner.png b/games/devtest/mods/testtools/textures/testtools_entity_spawner.png new file mode 100644 index 000000000..6199e0145 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_entity_spawner.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_falling_node_tool.png b/games/devtest/mods/testtools/textures/testtools_falling_node_tool.png new file mode 100644 index 000000000..30099a7ef Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_falling_node_tool.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_node_setter.png b/games/devtest/mods/testtools/textures/testtools_node_setter.png new file mode 100644 index 000000000..8599438de Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_node_setter.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_object_attacher.png b/games/devtest/mods/testtools/textures/testtools_object_attacher.png new file mode 100644 index 000000000..4d9bf6fd1 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_object_attacher.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_object_editor.png b/games/devtest/mods/testtools/textures/testtools_object_editor.png new file mode 100644 index 000000000..d1ce9cecd Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_object_editor.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_object_mover.png b/games/devtest/mods/testtools/textures/testtools_object_mover.png new file mode 100644 index 000000000..8b14e9fb2 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_object_mover.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_param2tool.png b/games/devtest/mods/testtools/textures/testtools_param2tool.png new file mode 100644 index 000000000..dbc663575 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_param2tool.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_remover.png b/games/devtest/mods/testtools/textures/testtools_remover.png new file mode 100644 index 000000000..73f14cd54 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_remover.png differ diff --git a/games/devtest/mods/tiled/init.lua b/games/devtest/mods/tiled/init.lua new file mode 100644 index 000000000..68ead8e3a --- /dev/null +++ b/games/devtest/mods/tiled/init.lua @@ -0,0 +1,33 @@ +minetest.register_node("tiled:tiled", { + description = "Tiled Node (world-aligned)", + tiles = {{ + name = "tiled_tiled.png", + align_style = "world", + scale = 8, + }}, + groups = {cracky=3}, +}) + +minetest.register_node("tiled:tiled_n", { + description = "Tiled Node (node-aligned)", + tiles = {{ + name = "tiled_tiled.png", + align_style = "node", + scale = 8, + }}, + groups = {cracky=3}, +}) + +stairs.register_stair_and_slab("tiled_n", "tiled:tiled", + {cracky=3}, + {{name="tiled_tiled.png", align_style="node", scale=8}}, + "Tiled Stair (node-aligned)", + "Tiled Slab (node-aligned)") + +stairs.register_stair_and_slab("tiled", "tiled:tiled", + {cracky=3}, + {{name="tiled_tiled.png", align_style="world", scale=8}}, + "Tiled Stair (world-aligned)", + "Tiled Slab (world-aligned)") + + diff --git a/games/devtest/mods/tiled/mod.conf b/games/devtest/mods/tiled/mod.conf new file mode 100644 index 000000000..78b19f93b --- /dev/null +++ b/games/devtest/mods/tiled/mod.conf @@ -0,0 +1,3 @@ +name = tiled +description = Add nodes with a special texture that spans multiple nodes (aka "world-aligned") +depends = stairs diff --git a/games/devtest/mods/tiled/textures/tiled_tiled.png b/games/devtest/mods/tiled/textures/tiled_tiled.png new file mode 100644 index 000000000..363a26487 Binary files /dev/null and b/games/devtest/mods/tiled/textures/tiled_tiled.png differ diff --git a/games/devtest/mods/unittests/crafting.lua b/games/devtest/mods/unittests/crafting.lua new file mode 100644 index 000000000..eff13ce09 --- /dev/null +++ b/games/devtest/mods/unittests/crafting.lua @@ -0,0 +1,120 @@ +-- Test minetest.clear_craft function +local function test_clear_craft() + minetest.log("info", "[unittests] Testing minetest.clear_craft") + -- Clearing by output + minetest.register_craft({ + output = "foo", + recipe = {{"bar"}} + }) + minetest.register_craft({ + output = "foo 4", + recipe = {{"foo", "bar"}} + }) + assert(#minetest.get_all_craft_recipes("foo") == 2) + minetest.clear_craft({output="foo"}) + assert(minetest.get_all_craft_recipes("foo") == nil) + -- Clearing by input + minetest.register_craft({ + output = "foo 4", + recipe = {{"foo", "bar"}} + }) + assert(#minetest.get_all_craft_recipes("foo") == 1) + minetest.clear_craft({recipe={{"foo", "bar"}}}) + assert(minetest.get_all_craft_recipes("foo") == nil) +end + +-- Test minetest.get_craft_result function +local function test_get_craft_result() + minetest.log("info", "[unittests] Testing minetest.get_craft_result") + + -- normal + local input = { + method = "normal", + width = 2, + items = {"", "unittests:coal_lump", "", "unittests:stick"} + } + minetest.log("info", "[unittests] torch crafting input: "..dump(input)) + local output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] torch crafting output: "..dump(output)) + minetest.log("info", "[unittests] torch crafting decremented input: "..dump(decremented_input)) + assert(output.item) + minetest.log("info", "[unittests] torch crafting output.item:to_table(): "..dump(output.item:to_table())) + assert(output.item:get_name() == "unittests:torch") + assert(output.item:get_count() == 4) + + -- fuel + input = { + method = "fuel", + width = 1, + items = {"unittests:coal_lump"} + } + minetest.log("info", "[unittests] coal fuel input: "..dump(input)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] coal fuel output: "..dump(output)) + minetest.log("info", "[unittests] coal fuel decremented input: "..dump(decremented_input)) + assert(output.time) + assert(output.time > 0) + + -- cooking + input = { + method = "cooking", + width = 1, + items = {"unittests:iron_lump"} + } + minetest.log("info", "[unittests] iron lump cooking input: "..dump(output)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] iron lump cooking output: "..dump(output)) + minetest.log("info", "[unittests] iron lump cooking decremented input: "..dump(decremented_input)) + assert(output.time) + assert(output.time > 0) + assert(output.item) + minetest.log("info", "[unittests] iron lump cooking output.item:to_table(): "..dump(output.item:to_table())) + assert(output.item:get_name() == "unittests:steel_ingot") + assert(output.item:get_count() == 1) + + -- tool repair (repairable) + input = { + method = "normal", + width = 2, + -- Using a wear of 60000 + items = {"unittests:repairable_tool 1 60000", "unittests:repairable_tool 1 60000"} + } + minetest.log("info", "[unittests] repairable tool crafting input: "..dump(input)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] repairable tool crafting output: "..dump(output)) + minetest.log("info", "[unittests] repairable tool crafting decremented input: "..dump(decremented_input)) + assert(output.item) + minetest.log("info", "[unittests] repairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) + assert(output.item:get_name() == "unittests:repairable_tool") + -- Test the wear value. + -- See src/craftdef.cpp in Minetest source code for the formula. The formula to calculate + -- the value 51187 is: + -- 65536 - ((65536-60000)+(65536-60000)) + floor(additonal_wear * 65536 + 0.5) = 51187 + -- where additional_wear = 0.05 + assert(output.item:get_wear() == 51187) + assert(output.item:get_count() == 1) + + -- failing tool repair (unrepairable) + input = { + method = "normal", + width = 2, + items = {"unittests:unrepairable_tool 1 60000", "unittests:unrepairable_tool 1 60000"} + } + minetest.log("info", "[unittests] unrepairable tool crafting input: "..dump(input)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] unrepairable tool crafting output: "..dump(output)) + minetest.log("info", "[unittests] unrepairable tool crafting decremented input: "..dump(decremented_input)) + assert(output.item) + minetest.log("info", "[unittests] unrepairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) + -- unrepairable tool must not yield any output + assert(output.item:get_name() == "") + +end + +function unittests.test_crafting() + test_clear_craft() + test_get_craft_result() + minetest.log("action", "[unittests] Crafting tests passed!") + return true +end + diff --git a/games/devtest/mods/unittests/crafting_prepare.lua b/games/devtest/mods/unittests/crafting_prepare.lua new file mode 100644 index 000000000..a09734827 --- /dev/null +++ b/games/devtest/mods/unittests/crafting_prepare.lua @@ -0,0 +1,88 @@ +-- Registering some dummy items and recipes for the crafting tests + +minetest.register_craftitem("unittests:torch", { + description = "Crafting Test Item: Torch", + inventory_image = "unittests_torch.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:coal_lump", { + description = "Crafting Test Item: Coal Lump", + inventory_image = "unittests_coal_lump.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:stick", { + description = "Crafting Test Item: Stick", + inventory_image = "unittests_stick.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:iron_lump", { + description = "Crafting Test Item: Iron Lump", + inventory_image = "unittests_iron_lump.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:steel_ingot", { + description = "Crafting Test Item: Steel Ingot", + inventory_image = "unittests_steel_ingot.png", + + groups = { dummy = 1 }, +}) + +-- Recipes for tests: Normal crafting, cooking and fuel + +minetest.register_craft({ + output = 'unittests:torch 4', + recipe = { + {'unittests:coal_lump'}, + {'unittests:stick'}, + } +}) + +minetest.register_craft({ + type = "cooking", + output = "unittests:steel_ingot", + recipe = "unittests:iron_lump", +}) + +minetest.register_craft({ + type = "fuel", + recipe = "unittests:coal_lump", + burntime = 40, +}) + +-- Test tool repair +minetest.register_craft({ + type = "toolrepair", + additional_wear = -0.05, +}) + +-- Test the disable_repair=1 group +minetest.register_tool("unittests:unrepairable_tool", { + description = "Crafting Test Item: Unrepairable Tool", + inventory_image = "unittests_unrepairable_tool.png", + tool_capabilities = { + groupcaps = { + cracky = { + times = {3, 2, 1}, + } + } + }, + groups = { disable_repair = 1, dummy = 1 } +}) + +minetest.register_tool("unittests:repairable_tool", { + description = "Crafting Test Item: Repairable Tool", + inventory_image = "unittests_repairable_tool.png", + tool_capabilities = { + groupcaps = { + cracky = { + times = {3, 2, 1}, + } + } + }, + + groups = { dummy = 1 }, +}) diff --git a/games/devtest/mods/unittests/init.lua b/games/devtest/mods/unittests/init.lua new file mode 100644 index 000000000..6c1728420 --- /dev/null +++ b/games/devtest/mods/unittests/init.lua @@ -0,0 +1,16 @@ +unittests = {} + +local modpath = minetest.get_modpath("unittests") +dofile(modpath .. "/random.lua") +dofile(modpath .. "/player.lua") +dofile(modpath .. "/crafting_prepare.lua") +dofile(modpath .. "/crafting.lua") + +if minetest.settings:get_bool("devtest_unittests_autostart", false) then + unittests.test_random() + unittests.test_crafting() + minetest.register_on_joinplayer(function(player) + unittests.test_player(player) + end) +end + diff --git a/games/devtest/mods/unittests/mod.conf b/games/devtest/mods/unittests/mod.conf new file mode 100644 index 000000000..0d5e3c959 --- /dev/null +++ b/games/devtest/mods/unittests/mod.conf @@ -0,0 +1,2 @@ +name = unittests +description = Adds automated unit tests for the engine diff --git a/games/devtest/mods/unittests/player.lua b/games/devtest/mods/unittests/player.lua new file mode 100644 index 000000000..10781a95f --- /dev/null +++ b/games/devtest/mods/unittests/player.lua @@ -0,0 +1,73 @@ +-- +-- HP Change Reasons +-- +local expect = nil +local function run_hpchangereason_tests(player) + expect = { type = "set_hp", from = "mod" } + player:set_hp(3) + assert(expect == nil) + + expect = { a = 234, type = "set_hp", from = "mod" } + player:set_hp(7, { a= 234 }) + assert(expect == nil) + + expect = { df = 3458973454, type = "fall", from = "mod" } + player:set_hp(10, { type = "fall", df = 3458973454 }) + assert(expect == nil) + + player:set_hp(20) +end + +local function run_player_meta_tests(player) + local meta = player:get_meta() + meta:set_string("foo", "bar") + assert(meta:contains("foo")) + assert(meta:get_string("foo") == "bar") + assert(meta:get("foo") == "bar") + + local meta2 = player:get_meta() + assert(meta2:get_string("foo") == "bar") + assert(meta2:get("foo") == "bar") + assert(meta:equals(meta2)) + + meta:set_string("bob", "dillan") + assert(meta:get_string("foo") == "bar") + assert(meta:get_string("bob") == "dillan") + assert(meta:get("bob") == "dillan") + assert(meta2:get_string("foo") == "bar") + assert(meta2:get_string("bob") == "dillan") + assert(meta2:get("bob") == "dillan") + assert(meta:equals(meta2)) + + meta:set_string("foo", "") + assert(not meta:contains("foo")) + assert(meta:get("foo") == nil) + assert(meta:get_string("foo") == "") + assert(meta:equals(meta2)) +end + +function unittests.test_player(player) + minetest.register_on_player_hpchange(function(player, hp, reason) + if not expect then + return + end + + for key, value in pairs(reason) do + assert(expect[key] == value) + end + + for key, value in pairs(expect) do + assert(reason[key] == value) + end + + expect = nil + end) + + run_hpchangereason_tests(player) + run_player_meta_tests(player) + local msg = "Player tests passed for player '"..player:get_player_name().."'!" + minetest.chat_send_all(msg) + minetest.log("action", "[unittests] "..msg) + return true +end + diff --git a/games/devtest/mods/unittests/random.lua b/games/devtest/mods/unittests/random.lua new file mode 100644 index 000000000..f94f0a88e --- /dev/null +++ b/games/devtest/mods/unittests/random.lua @@ -0,0 +1,10 @@ +function unittests.test_random() + -- Try out PseudoRandom + minetest.log("action", "[unittests] Testing PseudoRandom ...") + local pseudo = PseudoRandom(13) + assert(pseudo:next() == 22290) + assert(pseudo:next() == 13854) + minetest.log("action", "[unittests] PseudoRandom test passed!") + return true +end + diff --git a/games/devtest/mods/unittests/textures/unittests_coal_lump.png b/games/devtest/mods/unittests/textures/unittests_coal_lump.png new file mode 100644 index 000000000..f460d909e Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_coal_lump.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_iron_lump.png b/games/devtest/mods/unittests/textures/unittests_iron_lump.png new file mode 100644 index 000000000..22f43e9cc Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_iron_lump.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_repairable_tool.png b/games/devtest/mods/unittests/textures/unittests_repairable_tool.png new file mode 100644 index 000000000..46fbbaa74 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_repairable_tool.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_steel_ingot.png b/games/devtest/mods/unittests/textures/unittests_steel_ingot.png new file mode 100644 index 000000000..6977696a2 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_steel_ingot.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_stick.png b/games/devtest/mods/unittests/textures/unittests_stick.png new file mode 100644 index 000000000..ffdce70d4 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_stick.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_torch.png b/games/devtest/mods/unittests/textures/unittests_torch.png new file mode 100644 index 000000000..ba5eebef0 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_torch.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png b/games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png new file mode 100644 index 000000000..c676213a5 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png differ diff --git a/games/devtest/mods/util_commands/init.lua b/games/devtest/mods/util_commands/init.lua new file mode 100644 index 000000000..ad8d3f9ba --- /dev/null +++ b/games/devtest/mods/util_commands/init.lua @@ -0,0 +1,137 @@ +minetest.register_chatcommand("hotbar", { + params = "", + description = "Set hotbar size", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local size = tonumber(param) + if not size then + return false, "Missing or incorrect size parameter!" + end + local ok = player:hud_set_hotbar_itemcount(size) + if ok then + return true + else + return false, "Invalid item count!" + end + end, +}) + +minetest.register_chatcommand("hp", { + params = "", + description = "Set your health", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local hp = tonumber(param) + if not hp then + return false, "Missing or incorrect hp parameter!" + end + player:set_hp(hp) + return true + end, +}) + +minetest.register_chatcommand("zoom", { + params = "[]", + description = "Set or display your zoom_fov", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + if param == "" then + local fov = player:get_properties().zoom_fov + return true, "zoom_fov = "..tostring(fov) + end + local fov = tonumber(param) + if not fov then + return false, "Missing or incorrect zoom_fov parameter!" + end + player:set_properties({zoom_fov = fov}) + fov = player:get_properties().zoom_fov + return true, "zoom_fov = "..tostring(fov) + end, +}) + + + +local s_infplace = minetest.settings:get("devtest_infplace") +if s_infplace == "true" then + infplace = true +elseif s_infplace == "false" then + infplace = false +else + infplace = minetest.settings:get_bool("creative_mode", false) +end + +minetest.register_chatcommand("infplace", { + params = "", + description = "Toggle infinite node placement", + func = function(name, param) + infplace = not infplace + if infplace then + minetest.chat_send_all("Infinite node placement enabled!") + minetest.log("action", "Infinite node placement enabled") + else + minetest.chat_send_all("Infinite node placement disabled!") + minetest.log("action", "Infinite node placement disabled") + end + return true + end, +}) + +minetest.register_chatcommand("detach", { + params = "[]", + description = "Detach all objects nearby", + func = function(name, param) + local radius = tonumber(param) + if type(radius) ~= "number" then + radius = 8 + end + if radius < 1 then + radius = 1 + end + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local objs = minetest.get_objects_inside_radius(player:get_pos(), radius) + local num = 0 + for o=1, #objs do + if objs[o]:get_attach() then + objs[o]:set_detach() + num = num + 1 + end + end + return true, string.format("%d object(s) detached.", num) + end, +}) + + +-- Unlimited node placement +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + if placer and placer:is_player() then + return infplace + end +end) + +-- Don't pick up if the item is already in the inventory +local old_handle_node_drops = minetest.handle_node_drops +function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() or not infplace then + return old_handle_node_drops(pos, drops, digger) + end + local inv = digger:get_inventory() + if inv then + for _, item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) + end + end + end +end diff --git a/games/devtest/mods/util_commands/mod.conf b/games/devtest/mods/util_commands/mod.conf new file mode 100644 index 000000000..fea6dd3e9 --- /dev/null +++ b/games/devtest/mods/util_commands/mod.conf @@ -0,0 +1,2 @@ +name = util_commands +description = Random server commands to make testing easier and more convenient diff --git a/games/devtest/screenshot.png b/games/devtest/screenshot.png new file mode 100644 index 000000000..7324883f6 Binary files /dev/null and b/games/devtest/screenshot.png differ diff --git a/games/devtest/settingtypes.txt b/games/devtest/settingtypes.txt new file mode 100644 index 000000000..40ee5845b --- /dev/null +++ b/games/devtest/settingtypes.txt @@ -0,0 +1,37 @@ +# If enabled, nodes won't be used up when placed. +# Note: This behavior can also be toggled in-game with the /infplace command. +# +# - true: enabled +# - false: disabled +# - auto: only enabled when Creative Mode is enabled (default) +devtest_infplace (Infinite node placement) enum auto true,false,auto + +# If enabled, new players receive some initial items when joining for the first time. +give_initial_stuff (Give initial stuff) bool true + +# If enabled, automated tests of the Lua API such as player health, crafting and PseudoRandom will be performed on startup. +devtest_unittests_autostart (Perform unit tests) bool false + +# If enabled, the game will use all mapgen aliases for the v6 mapgen. +# If disabled, it will only use a minimal set of mapgen aliases. +# If enabled, there should be biome-specific tree, leaves and ground nodes. If disabled, stuff should use fallback nodes (like stone instead of desert stone). +# +# Many mapgen aliases have fallback values when no value is provided. Having this setting disabled can be useful to test whether those fallback values are functional. +devtest_v6_mapgen_aliases (Use all v6 mapgen aliases) bool false + +# If enabled, the game will use dungeon stairs by enabling the corresponding mapgen aliases. +# +# Disabling this setting can be useful to test whether dungeons still work when stairs are not defined. +devtest_dungeon_stairs (Generate dungeon stairs) bool false + +# If enabled, the mapgen alias 'mapgen_mossycobble' will be used. This should enable random mossy cobblestone in dungeons. +# If disabled, it won't be used. The engine should fall back to cobble instead. +devtest_dungeon_mossycobble (Generate mossy cobblestone) bool false + +# If enabled, some very basic biomes will be registered. +devtest_register_biomes (Register biomes) bool true + +# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. +# This is due to . +# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. +testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/games/minimal/LICENSE.txt b/games/minimal/LICENSE.txt deleted file mode 100644 index 108c66abf..000000000 --- a/games/minimal/LICENSE.txt +++ /dev/null @@ -1,4 +0,0 @@ -License information for Developer Test --------------------------------------- - -The same license as for Minetest applies. diff --git a/games/minimal/README.md b/games/minimal/README.md deleted file mode 100644 index a94530498..000000000 --- a/games/minimal/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Minimal development test - -This is a basic testing environment that contains a bunch of things to test the engine, but it could also be used as a minimal testbed for testing out mods. - -## Features - -* Basic nodes for mapgen -* Basic, minimal map generator -* Lots of example nodes for testing drawtypes, param2, light level, and many other node properties -* Example entities -* Other example items -* Formspec test (via `/test_formspec` command) -* Automated unit tests (disabled by default) -* Tools for manipulating nodes and entities, like the "Param2 Tool" - -## Getting started - -Basically, just create a world and start. A few important things to note: - -* Items are gotten from the “Chest of Everything” (`chest_of_everything:chest`) -* When you lost your initial items, type in `/stuff` command to get them back -* By default, Creative Mode activates infinite node placement. This behavior can be changed with the `devtest_infplace` setting -* Use the `/infplace` command to toggle infinite node placement in-game -* Use the Param2 Tool to change the param2 of nodes; it's useful to experiment with the various drawtype test nodes -* Check out the game settings and server commands for additional tests and features -* Creative Mode does nothing (apart from default engine behavior) - -Confused by a certain node or item? Check out for inline code comments. - -### Example tests - -* You can use this to test what happens if a player is simultaneously in 2 nodes with `damage_per_second` but with a different value. -* Or use the Falling Node Tool on various test nodes to see how they behave when falling. -* You could also use this as a testbed for dependency-free mods, e.g. to test out how your formspecs behave without theming. - -## Random notes - -* Experimental/strange/unstructured tests can be found in the `experimental` mod -* Textures of drawtype test nodes have a red dot at the top left corner. This is to see whether the textures are oriented properly - -## Design philosophy - -This should loosely follow the following principles: - -* Engine testing: The main focus of this is to aid testing of *engine* features, such as mapgen or node drawtypes -* Mod testing: The secondary focus is to help modders as well, either as a minimal testbed for mods or even as a code example -* Minimal interference: Under default settings, it shall not interfere with APIs except on explicit user wish. Non-trivial tests and features need to be enabled by a setting first -* Convenience: Have various tools to make usage easier and more convenient -* Reproducing engine bugs: When an engine bug was found, consider creating a test case -* Clarity: Textures and names need to be designed to keep different things clearly visually apart at a glance -* Low loading time: It must load blazing-fast so stuff can be tested quickly - diff --git a/games/minimal/game.conf b/games/minimal/game.conf deleted file mode 100644 index ae76cf7ad..000000000 --- a/games/minimal/game.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = Minimal development test -description = Testing environment to help with testing the engine features of Minetest. It can also be helpful in mod development. diff --git a/games/minimal/menu/background.png b/games/minimal/menu/background.png deleted file mode 100644 index 415bb3d14..000000000 Binary files a/games/minimal/menu/background.png and /dev/null differ diff --git a/games/minimal/menu/header.png b/games/minimal/menu/header.png deleted file mode 100644 index db864d6b7..000000000 Binary files a/games/minimal/menu/header.png and /dev/null differ diff --git a/games/minimal/menu/icon.png b/games/minimal/menu/icon.png deleted file mode 100644 index f854b9c31..000000000 Binary files a/games/minimal/menu/icon.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/init.lua b/games/minimal/mods/basenodes/init.lua deleted file mode 100644 index 8156c4bec..000000000 --- a/games/minimal/mods/basenodes/init.lua +++ /dev/null @@ -1,334 +0,0 @@ -local WATER_ALPHA = 160 -local WATER_VISC = 1 -local LAVA_VISC = 7 - --- --- Node definitions --- - --- Register nodes - -minetest.register_node("basenodes:stone", { - description = "Stone", - tiles = {"default_stone.png"}, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:desert_stone", { - description = "Desert Stone", - tiles = {"default_desert_stone.png"}, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:dirt_with_grass", { - description = "Dirt with Grass", - tiles ={"default_grass.png", - -- a little dot on the bottom to distinguish it from dirt - "default_dirt.png^basenodes_dirt_with_grass_bottom.png", - {name = "default_dirt.png^default_grass_side.png", - tileable_vertical = false}}, - groups = {crumbly=3, soil=1}, -}) - -minetest.register_node("basenodes:dirt_with_snow", { - description = "Dirt with Snow", - tiles ={"basenodes_dirt_with_snow.png", - -- a little dot on the bottom to distinguish it from dirt - "default_dirt.png^basenodes_dirt_with_snow_bottom.png", - {name = "default_dirt.png^default_snow_side.png", - tileable_vertical = false}}, - groups = {crumbly=3, soil=1}, -}) - -minetest.register_node("basenodes:dirt", { - description = "Dirt", - tiles ={"default_dirt.png"}, - groups = {crumbly=3, soil=1}, -}) - -minetest.register_node("basenodes:sand", { - description = "Sand", - tiles ={"default_sand.png"}, - groups = {crumbly=3}, -}) - -minetest.register_node("basenodes:desert_sand", { - description = "Desert Sand", - tiles ={"default_desert_sand.png"}, - groups = {crumbly=3}, -}) - -minetest.register_node("basenodes:gravel", { - description = "Gravel", - tiles ={"default_gravel.png"}, - groups = {crumbly=2}, -}) - -minetest.register_node("basenodes:junglegrass", { - description = "Jungle Grass", - drawtype = "plantlike", - tiles ={"default_junglegrass.png"}, - inventory_image = "default_junglegrass.png", - wield_image = "default_junglegrass.png", - paramtype = "light", - walkable = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:tree", { - description = "Normal Tree Trunk", - tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, - is_ground_content = false, - groups = {choppy=2,oddly_breakable_by_hand=1}, -}) - -minetest.register_node("basenodes:leaves", { - description = "Normal Leaves", - drawtype = "allfaces_optional", - tiles = {"default_leaves.png"}, - paramtype = "light", - is_ground_content = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:jungletree", { - description = "Jungle Tree Trunk", - tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, - is_ground_content = false, - groups = {choppy=2,oddly_breakable_by_hand=1}, -}) - -minetest.register_node("basenodes:jungleleaves", { - description = "Jungle Leaves", - drawtype = "allfaces_optional", - tiles = {"default_jungleleaves.png"}, - paramtype = "light", - is_ground_content = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:pine_tree", { - description = "Pine Tree Trunk", - tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", "default_pine_tree.png"}, - is_ground_content = false, - groups = {choppy=2,oddly_breakable_by_hand=1}, -}) - -minetest.register_node("basenodes:pine_needles", { - description = "Pine Needles", - drawtype = "allfaces_optional", - tiles = {"default_pine_needles.png"}, - paramtype = "light", - is_ground_content = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:water_source", { - description = "Water Source", - drawtype = "liquid", - tiles = {"default_water.png"}, - special_tiles = { - {name = "default_water.png", backface_culling = false}, - {name = "default_water.png", backface_culling = true}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "source", - liquid_alternative_flowing = "basenodes:water_flowing", - liquid_alternative_source = "basenodes:water_source", - liquid_viscosity = WATER_VISC, - post_effect_color = {a = 64, r = 100, g = 100, b = 200}, - groups = {water = 3, liquid = 3}, -}) - -minetest.register_node("basenodes:water_flowing", { - description = "Flowing Water", - drawtype = "flowingliquid", - tiles = {"default_water_flowing.png"}, - special_tiles = { - {name = "default_water_flowing.png", backface_culling = false}, - {name = "default_water_flowing.png", backface_culling = false}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "basenodes:water_flowing", - liquid_alternative_source = "basenodes:water_source", - liquid_viscosity = WATER_VISC, - post_effect_color = {a = 64, r = 100, g = 100, b = 200}, - groups = {water = 3, liquid = 3}, -}) - -minetest.register_node("basenodes:river_water_source", { - description = "River Water Source", - drawtype = "liquid", - tiles = { "default_river_water.png" }, - special_tiles = { - {name = "default_river_water.png", backface_culling = false}, - {name = "default_river_water.png", backface_culling = true}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "source", - liquid_alternative_flowing = "basenodes:river_water_flowing", - liquid_alternative_source = "basenodes:river_water_source", - liquid_viscosity = 1, - liquid_renewable = false, - liquid_range = 2, - post_effect_color = {a = 103, r = 30, g = 76, b = 90}, - groups = {water = 3, liquid = 3, }, -}) - -minetest.register_node("basenodes:river_water_flowing", { - description = "Flowing River Water", - drawtype = "flowingliquid", - tiles = {"default_river_water_flowing.png"}, - special_tiles = { - {name = "default_river_water_flowing.png", backface_culling = false}, - {name = "default_river_water_flowing.png", backface_culling = false}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "basenodes:river_water_flowing", - liquid_alternative_source = "basenodes:river_water_source", - liquid_viscosity = 1, - liquid_renewable = false, - liquid_range = 2, - post_effect_color = {a = 103, r = 30, g = 76, b = 90}, - groups = {water = 3, liquid = 3, }, -}) - -minetest.register_node("basenodes:lava_flowing", { - description = "Flowing Lava", - drawtype = "flowingliquid", - tiles = {"default_lava_flowing.png"}, - special_tiles = { - {name="default_lava_flowing.png", backface_culling = false}, - {name="default_lava_flowing.png", backface_culling = false}, - }, - paramtype = "light", - light_source = minetest.LIGHT_MAX, - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - damage_per_second = 4, - liquidtype = "flowing", - liquid_alternative_flowing = "basenodes:lava_flowing", - liquid_alternative_source = "basenodes:lava_source", - liquid_viscosity = LAVA_VISC, - post_effect_color = {a=192, r=255, g=64, b=0}, - groups = {lava=3, liquid=1}, -}) - -minetest.register_node("basenodes:lava_source", { - description = "Lava Source", - drawtype = "liquid", - tiles = { "default_lava.png" }, - special_tiles = { - {name = "default_lava.png", backface_culling = false}, - {name = "default_lava.png", backface_culling = true}, - }, - paramtype = "light", - light_source = minetest.LIGHT_MAX, - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - damage_per_second = 4, - liquidtype = "source", - liquid_alternative_flowing = "basenodes:lava_flowing", - liquid_alternative_source = "basenodes:lava_source", - liquid_viscosity = LAVA_VISC, - post_effect_color = {a=192, r=255, g=64, b=0}, - groups = {lava=3, liquid=1}, -}) - -minetest.register_node("basenodes:cobble", { - description = "Cobblestone", - tiles ={"default_cobble.png"}, - is_ground_content = false, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:mossycobble", { - description = "Mossy Cobblestone", - tiles ={"default_mossycobble.png"}, - is_ground_content = false, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:apple", { - description = "Apple", - drawtype = "plantlike", - tiles ={"default_apple.png"}, - inventory_image = "default_apple.png", - paramtype = "light", - is_ground_content = false, - sunlight_propagates = true, - walkable = false, - groups = {dig_immediate=3}, - - -- Make eatable because why not? - on_use = minetest.item_eat(2), -}) - -minetest.register_node("basenodes:ice", { - description = "Ice", - tiles ={"default_ice.png"}, - groups = {cracky=3}, -}) - --- The snow nodes intentionally have different tints to make them more --- distinguishable -minetest.register_node("basenodes:snow", { - description = "Snow Sheet", - tiles = {"basenodes_snow_sheet.png"}, - groups = {crumbly=3}, - walkable = false, - paramtype = "light", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - }, -}) - -minetest.register_node("basenodes:snowblock", { - description = "Snow Block", - tiles ={"default_snow.png"}, - groups = {crumbly=3}, -}) - - diff --git a/games/minimal/mods/basenodes/mod.conf b/games/minimal/mods/basenodes/mod.conf deleted file mode 100644 index 25024dc63..000000000 --- a/games/minimal/mods/basenodes/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = basenodes -description = Contains basic nodes for mapgen diff --git a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png b/games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png deleted file mode 100644 index 5e8fc41a9..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png b/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png deleted file mode 100644 index 7ea2d8d31..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png b/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png deleted file mode 100644 index 447c94e98..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png b/games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png deleted file mode 100644 index 455332093..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_apple.png b/games/minimal/mods/basenodes/textures/default_apple.png deleted file mode 100644 index 9c115dae4..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_apple.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_cobble.png b/games/minimal/mods/basenodes/textures/default_cobble.png deleted file mode 100644 index 5b859e9c2..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_cobble.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_desert_sand.png b/games/minimal/mods/basenodes/textures/default_desert_sand.png deleted file mode 100644 index 19ec87dc0..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_desert_sand.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_desert_stone.png b/games/minimal/mods/basenodes/textures/default_desert_stone.png deleted file mode 100644 index 5126fb61c..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_desert_stone.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_dirt.png b/games/minimal/mods/basenodes/textures/default_dirt.png deleted file mode 100644 index 58670305d..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_dirt.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_grass.png b/games/minimal/mods/basenodes/textures/default_grass.png deleted file mode 100644 index 3d6397186..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_grass.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_grass_side.png b/games/minimal/mods/basenodes/textures/default_grass_side.png deleted file mode 100644 index 04770b6f6..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_grass_side.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_gravel.png b/games/minimal/mods/basenodes/textures/default_gravel.png deleted file mode 100644 index 7e5ff616f..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_gravel.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_ice.png b/games/minimal/mods/basenodes/textures/default_ice.png deleted file mode 100644 index c4bddd223..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_ice.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_junglegrass.png b/games/minimal/mods/basenodes/textures/default_junglegrass.png deleted file mode 100644 index d64e33abc..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_junglegrass.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_jungleleaves.png b/games/minimal/mods/basenodes/textures/default_jungleleaves.png deleted file mode 100644 index 1fa67e83a..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_jungleleaves.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_jungletree.png b/games/minimal/mods/basenodes/textures/default_jungletree.png deleted file mode 100644 index 053850fa7..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_jungletree.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_jungletree_top.png b/games/minimal/mods/basenodes/textures/default_jungletree_top.png deleted file mode 100644 index e80de8a69..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_jungletree_top.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_lava.png b/games/minimal/mods/basenodes/textures/default_lava.png deleted file mode 100644 index a4cf649f1..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_lava.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_lava_flowing.png b/games/minimal/mods/basenodes/textures/default_lava_flowing.png deleted file mode 100644 index 07066a6e3..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_lava_flowing.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_leaves.png b/games/minimal/mods/basenodes/textures/default_leaves.png deleted file mode 100644 index c0475d4d2..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_leaves.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_mossycobble.png b/games/minimal/mods/basenodes/textures/default_mossycobble.png deleted file mode 100644 index 69585e37b..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_mossycobble.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_pine_needles.png b/games/minimal/mods/basenodes/textures/default_pine_needles.png deleted file mode 100644 index 137caa2a3..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_pine_needles.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_pine_tree.png b/games/minimal/mods/basenodes/textures/default_pine_tree.png deleted file mode 100644 index 5743183c0..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_pine_tree.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_pine_tree_top.png b/games/minimal/mods/basenodes/textures/default_pine_tree_top.png deleted file mode 100644 index cc18f3462..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_pine_tree_top.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_river_water.png b/games/minimal/mods/basenodes/textures/default_river_water.png deleted file mode 100644 index e1074d2ef..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_river_water.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_river_water_flowing.png b/games/minimal/mods/basenodes/textures/default_river_water_flowing.png deleted file mode 100644 index 4a756b2bd..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_river_water_flowing.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_sand.png b/games/minimal/mods/basenodes/textures/default_sand.png deleted file mode 100644 index 0ed0e4ceb..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_sand.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_snow.png b/games/minimal/mods/basenodes/textures/default_snow.png deleted file mode 100644 index c42e0eecb..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_snow.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_snow_side.png b/games/minimal/mods/basenodes/textures/default_snow_side.png deleted file mode 100644 index f34d10991..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_snow_side.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_stone.png b/games/minimal/mods/basenodes/textures/default_stone.png deleted file mode 100644 index 763b4396a..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_stone.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_tree.png b/games/minimal/mods/basenodes/textures/default_tree.png deleted file mode 100644 index 189ec1593..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_tree.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_tree_top.png b/games/minimal/mods/basenodes/textures/default_tree_top.png deleted file mode 100644 index d1a4fa704..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_tree_top.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_water.png b/games/minimal/mods/basenodes/textures/default_water.png deleted file mode 100644 index 3e385ae8b..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_water.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_water_flowing.png b/games/minimal/mods/basenodes/textures/default_water_flowing.png deleted file mode 100644 index 7cdafd51d..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_water_flowing.png and /dev/null differ diff --git a/games/minimal/mods/basetools/init.lua b/games/minimal/mods/basetools/init.lua deleted file mode 100644 index d9d9afb07..000000000 --- a/games/minimal/mods/basetools/init.lua +++ /dev/null @@ -1,295 +0,0 @@ --- --- Tool definitions --- - ---[[ TOOLS SUMMARY: - -Tool types: - -* Hand: basic tool/weapon (just for convenience, not optimized for testing) -* Pickaxe: dig cracky -* Axe: dig choppy -* Shovel: dig crumbly -* Shears: dig snappy -* Sword: deal damage -* Dagger: deal damage, but faster - -Tool materials: - -* Dirt: dig nodes of rating 3, one use only -* Wood: dig nodes of rating 3 -* Stone: dig nodes of rating 3 or 2 -* Steel: dig nodes of rating 3, 2 or 1 -* Mese: dig "everything" instantly -]] - --- The hand -minetest.register_item(":", { - type = "none", - wield_image = "wieldhand.png", - wield_scale = {x=1,y=1,z=2.5}, - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level = 0, - groupcaps = { - crumbly = {times={[3]=1.50}, uses=0, maxlevel=0}, - snappy = {times={[3]=1.50}, uses=0, maxlevel=0}, - oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=2.00}, uses=0, maxlevel=0}, - }, - damage_groups = {fleshy=1}, - } -}) - --- Mese Pickaxe: special tool that digs "everything" instantly -minetest.register_tool("basetools:pick_mese", { - description = "Mese Pickaxe", - inventory_image = "basetools_mesepick.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - }, - }, -}) - - --- --- Pickaxes: Dig cracky --- - --- This should break after only 1 use -minetest.register_tool("basetools:pick_dirt", { - description = "Dirt Pickaxe", - inventory_image = "basetools_dirtpick.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[3]=2.00}, uses=1, maxlevel=0} - }, - }, -}) - -minetest.register_tool("basetools:pick_wood", { - description = "Wooden Pickaxe", - inventory_image = "basetools_woodpick.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[3]=2.00}, uses=30, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:pick_stone", { - description = "Stone Pickaxe", - inventory_image = "basetools_stonepick.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:pick_steel", { - description = "Steel Pickaxe", - inventory_image = "basetools_steelpick.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:pick_steel_l1", { - description = "Steel Pickaxe Level 1", - inventory_image = "basetools_steelpick_l1.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1} - }, - }, -}) -minetest.register_tool("basetools:pick_steel_l2", { - description = "Steel Pickaxe Level 2", - inventory_image = "basetools_steelpick_l2.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2} - }, - }, -}) - --- --- Shovels (dig crumbly) --- - -minetest.register_tool("basetools:shovel_wood", { - description = "Wooden Shovel", - inventory_image = "basetools_woodshovel.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - crumbly={times={[3]=0.50}, uses=30, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:shovel_stone", { - description = "Stone Shovel", - inventory_image = "basetools_stoneshovel.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - crumbly={times={[2]=0.50, [3]=0.30}, uses=60, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:shovel_steel", { - description = "Steel Shovel", - inventory_image = "basetools_steelshovel.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=90, maxlevel=0} - }, - }, -}) - --- --- Axes (dig choppy) --- - -minetest.register_tool("basetools:axe_wood", { - description = "Wooden Axe", - inventory_image = "basetools_woodaxe.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - choppy={times={[3]=0.80}, uses=30, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:axe_stone", { - description = "Stone Axe", - inventory_image = "basetools_stoneaxe.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:axe_steel", { - description = "Steel Axe", - inventory_image = "basetools_steelaxe.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0}, - }, - }, -}) - --- --- Shears (dig snappy) --- - -minetest.register_tool("basetools:shears_wood", { - description = "Wooden Shears", - inventory_image = "basetools_woodshears.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - snappy={times={[3]=1.00}, uses=30, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:shears_stone", { - description = "Stone Shears", - inventory_image = "basetools_stoneshears.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:shears_steel", { - description = "Steel Shears", - inventory_image = "basetools_steelshears.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0}, - }, - }, -}) - --- --- Swords (deal damage) --- - -minetest.register_tool("basetools:sword_wood", { - description = "Wooden Sword", - inventory_image = "basetools_woodsword.png", - tool_capabilities = { - full_punch_interval = 1.0, - damage_groups = {fleshy=2}, - } -}) -minetest.register_tool("basetools:sword_stone", { - description = "Stone Sword", - inventory_image = "basetools_stonesword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=0, - damage_groups = {fleshy=4}, - } -}) -minetest.register_tool("basetools:sword_steel", { - description = "Steel Sword", - inventory_image = "basetools_steelsword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - damage_groups = {fleshy=6}, - } -}) - --- Fire/Ice sword: Deal damage to non-fleshy damage groups -minetest.register_tool("basetools:sword_fire", { - description = "Fire Sword", - inventory_image = "basetools_firesword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=0, - damage_groups = {icy=6}, - } -}) -minetest.register_tool("basetools:sword_ice", { - description = "Ice Sword", - inventory_image = "basetools_icesword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=0, - damage_groups = {firy=6}, - } -}) - --- --- Dagger: Low damage, fast punch interval --- -minetest.register_tool("basetools:dagger_steel", { - description = "Steel Dagger", - inventory_image = "basetools_steeldagger.png", - tool_capabilities = { - full_punch_interval = 0.5, - max_drop_level=0, - damage_groups = {fleshy=2}, - } -}) diff --git a/games/minimal/mods/basetools/mod.conf b/games/minimal/mods/basetools/mod.conf deleted file mode 100644 index f0d9f657d..000000000 --- a/games/minimal/mods/basetools/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = basetools -description = Contains basic digging tools diff --git a/games/minimal/mods/basetools/textures/basetools_dirtpick.png b/games/minimal/mods/basetools/textures/basetools_dirtpick.png deleted file mode 100644 index 20a021d72..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_dirtpick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_firesword.png b/games/minimal/mods/basetools/textures/basetools_firesword.png deleted file mode 100644 index ee2809ab7..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_firesword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_icesword.png b/games/minimal/mods/basetools/textures/basetools_icesword.png deleted file mode 100644 index 35ba8214b..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_icesword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_mesepick.png b/games/minimal/mods/basetools/textures/basetools_mesepick.png deleted file mode 100644 index 2b5e12cdb..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_mesepick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelaxe.png b/games/minimal/mods/basetools/textures/basetools_steelaxe.png deleted file mode 100644 index aac594d84..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelaxe.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steeldagger.png b/games/minimal/mods/basetools/textures/basetools_steeldagger.png deleted file mode 100644 index 4c9173094..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steeldagger.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelpick.png b/games/minimal/mods/basetools/textures/basetools_steelpick.png deleted file mode 100644 index bc02aac3e..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelpick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelpick_l1.png b/games/minimal/mods/basetools/textures/basetools_steelpick_l1.png deleted file mode 100644 index dc03f3f65..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelpick_l1.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelpick_l2.png b/games/minimal/mods/basetools/textures/basetools_steelpick_l2.png deleted file mode 100644 index 011df4584..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelpick_l2.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelshears.png b/games/minimal/mods/basetools/textures/basetools_steelshears.png deleted file mode 100644 index 04c86c370..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelshears.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelshovel.png b/games/minimal/mods/basetools/textures/basetools_steelshovel.png deleted file mode 100644 index 8cab60784..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelshovel.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelsword.png b/games/minimal/mods/basetools/textures/basetools_steelsword.png deleted file mode 100644 index 9909365c3..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelsword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stoneaxe.png b/games/minimal/mods/basetools/textures/basetools_stoneaxe.png deleted file mode 100644 index a374c547d..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stoneaxe.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stonepick.png b/games/minimal/mods/basetools/textures/basetools_stonepick.png deleted file mode 100644 index d9156ee3a..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stonepick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stoneshears.png b/games/minimal/mods/basetools/textures/basetools_stoneshears.png deleted file mode 100644 index 0b4bd3b74..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stoneshears.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stoneshovel.png b/games/minimal/mods/basetools/textures/basetools_stoneshovel.png deleted file mode 100644 index 3c1bb48cb..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stoneshovel.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stonesword.png b/games/minimal/mods/basetools/textures/basetools_stonesword.png deleted file mode 100644 index 6f3e94cda..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stonesword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodaxe.png b/games/minimal/mods/basetools/textures/basetools_woodaxe.png deleted file mode 100644 index 4015e910f..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodaxe.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodpick.png b/games/minimal/mods/basetools/textures/basetools_woodpick.png deleted file mode 100644 index 15c61f408..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodpick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodshears.png b/games/minimal/mods/basetools/textures/basetools_woodshears.png deleted file mode 100644 index 4ff92fd7c..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodshears.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodshovel.png b/games/minimal/mods/basetools/textures/basetools_woodshovel.png deleted file mode 100644 index 6cc52f8a1..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodshovel.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodsword.png b/games/minimal/mods/basetools/textures/basetools_woodsword.png deleted file mode 100644 index 364016ed6..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodsword.png and /dev/null differ diff --git a/games/minimal/mods/bucket/init.lua b/games/minimal/mods/bucket/init.lua deleted file mode 100644 index 3189d4aa6..000000000 --- a/games/minimal/mods/bucket/init.lua +++ /dev/null @@ -1,26 +0,0 @@ --- Bucket: Punch liquid source or flowing liquid to collect it - -minetest.register_tool("bucket:bucket", { - description = "Bucket", - inventory_image = "bucket.png", - stack_max = 1, - liquids_pointable = true, - groups = { disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - -- Must be pointing to node - if pointed_thing.type ~= "node" then - return - end - -- Check if pointing to a liquid - local n = minetest.get_node(pointed_thing.under) - local def = minetest.registered_nodes[n.name] - if def ~= nil and (def.liquidtype == "source" or def.liquidtype == "flowing") then - minetest.add_node(pointed_thing.under, {name="air"}) - local inv = user:get_inventory() - if inv then - inv:add_item("main", ItemStack(n.name)) - end - end - end, -}) - diff --git a/games/minimal/mods/bucket/mod.conf b/games/minimal/mods/bucket/mod.conf deleted file mode 100644 index d14deb4ea..000000000 --- a/games/minimal/mods/bucket/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = bucket -description = Minimal bucket to pick up liquids diff --git a/games/minimal/mods/bucket/textures/bucket.png b/games/minimal/mods/bucket/textures/bucket.png deleted file mode 100644 index 677952875..000000000 Binary files a/games/minimal/mods/bucket/textures/bucket.png and /dev/null differ diff --git a/games/minimal/mods/bucket/textures/bucket_lava.png b/games/minimal/mods/bucket/textures/bucket_lava.png deleted file mode 100644 index dfcae65fb..000000000 Binary files a/games/minimal/mods/bucket/textures/bucket_lava.png and /dev/null differ diff --git a/games/minimal/mods/bucket/textures/bucket_water.png b/games/minimal/mods/bucket/textures/bucket_water.png deleted file mode 100644 index e164b0a50..000000000 Binary files a/games/minimal/mods/bucket/textures/bucket_water.png and /dev/null differ diff --git a/games/minimal/mods/chest/init.lua b/games/minimal/mods/chest/init.lua deleted file mode 100644 index c44522cb9..000000000 --- a/games/minimal/mods/chest/init.lua +++ /dev/null @@ -1,27 +0,0 @@ -minetest.register_node("chest:chest", { - description = "Chest", - tiles ={"chest_chest.png^[sheet:2x2:0,0", "chest_chest.png^[sheet:2x2:0,0", - "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:1,0", - "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:0,1"}, - paramtype2 = "facedir", - groups = {dig_immediate=2,choppy=3}, - is_ground_content = false, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[8,9]".. - "list[current_name;main;0,0;8,4;]".. - "list[current_player;main;0,5;8,4;]" .. - "listring[]") - meta:set_string("infotext", "Chest") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") - end, -}) - - diff --git a/games/minimal/mods/chest/mod.conf b/games/minimal/mods/chest/mod.conf deleted file mode 100644 index 0d7500164..000000000 --- a/games/minimal/mods/chest/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = chest -description = A simple chest to store items diff --git a/games/minimal/mods/chest/textures/chest_chest.png b/games/minimal/mods/chest/textures/chest_chest.png deleted file mode 100644 index 824b4d502..000000000 Binary files a/games/minimal/mods/chest/textures/chest_chest.png and /dev/null differ diff --git a/games/minimal/mods/chest_of_everything/init.lua b/games/minimal/mods/chest_of_everything/init.lua deleted file mode 100644 index 7d61abebf..000000000 --- a/games/minimal/mods/chest_of_everything/init.lua +++ /dev/null @@ -1,135 +0,0 @@ -local F = minetest.formspec_escape - --- Create a detached inventory -local inv_everything = minetest.create_detached_inventory("everything", { - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - return 0 - end, - allow_put = function(inv, listname, index, stack, player) - return 0 - end, - allow_take = function(inv, listname, index, stack, player) - return -1 - end, -}) -local inv_trash = minetest.create_detached_inventory("trash", { - allow_take = function(inv, listname, index, stack, player) - return 0 - end, - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - return 0 - end, - on_put = function(inv, listname, index, stack, player) - inv:set_list("main", {}) - end, -}) -inv_trash:set_size("main", 1) - -local max_page = 1 - -local function get_chest_formspec(page) - local start = 0 + (page-1)*32 - return "size[8,9]".. - "list[detached:everything;main;0,0;8,4;"..start.."]".. - "list[current_player;main;0,5;8,4;]" .. - "label[6,4;Trash:]" .. - "list[detached:trash;main;7,4;1,1]" .. - "button[0,4;1,1;chest_of_everything_prev;"..F("<").."]".. - "button[1,4;1,1;chest_of_everything_next;"..F(">").."]".. - "label[2,4;"..F("Page: "..page).."]".. - "listring[detached:everything;main]".. - "listring[current_player;main]".. - "listring[detached:trash;main]" -end - -minetest.register_node("chest_of_everything:chest", { - description = "Chest of Everything", - tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0", - "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:1,0", - "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:0,1"}, - paramtype2 = "facedir", - groups = {dig_immediate=2,choppy=3}, - is_ground_content = false, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Chest of Everything") - meta:set_int("page", 1) - meta:set_string("formspec", get_chest_formspec(1)) - end, - on_receive_fields = function(pos, formname, fields, sender) - if formname == "" then - local meta = minetest.get_meta(pos) - local page = meta:get_int("page") - if fields.chest_of_everything_prev then - page = page - 1 - elseif fields.chest_of_everything_next then - page = page + 1 - end - if page < 1 then - page = 1 - end - if page > max_page then - page = max_page - end - meta:set_int("page", page) - meta:set_string("formspec", get_chest_formspec(page)) - end - end, -}) - -minetest.register_on_mods_loaded(function() - local items = {} - for itemstring,_ in pairs(minetest.registered_items) do - if itemstring ~= "" and itemstring ~= "unknown" and itemstring ~= "ignore" then - table.insert(items, itemstring) - end - end - --[[ Sort items in this order: - * Chest of Everything - * Test tools - * Other tools - * Craftitems - * Other items - * Dummy items ]] - local function compare(item1, item2) - local def1 = minetest.registered_items[item1] - local def2 = minetest.registered_items[item2] - local tool1 = def1.type == "tool" - local tool2 = def2.type == "tool" - local testtool1 = minetest.get_item_group(item1, "testtool") == 1 - local testtool2 = minetest.get_item_group(item2, "testtool") == 1 - local dummy1 = minetest.get_item_group(item1, "dummy") == 1 - local dummy2 = minetest.get_item_group(item2, "dummy") == 1 - local craftitem1 = def1.type == "craft" - local craftitem2 = def2.type == "craft" - if item1 == "chest_of_everything:chest" then - return true - elseif item2 == "chest_of_everything:chest" then - return false - elseif dummy1 and not dummy2 then - return false - elseif not dummy1 and dummy2 then - return true - elseif testtool1 and not testtool2 then - return true - elseif not testtool1 and testtool2 then - return false - elseif tool1 and not tool2 then - return true - elseif not tool1 and tool2 then - return false - elseif craftitem1 and not craftitem2 then - return true - elseif not craftitem1 and craftitem2 then - return false - else - return item1 < item2 - end - end - table.sort(items, compare) - inv_everything:set_size("main", #items) - max_page = math.ceil(#items / 32) - for i=1, #items do - inv_everything:add_item("main", items[i]) - end -end) diff --git a/games/minimal/mods/chest_of_everything/mod.conf b/games/minimal/mods/chest_of_everything/mod.conf deleted file mode 100644 index 4a4425e05..000000000 --- a/games/minimal/mods/chest_of_everything/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = chest_of_everything -description = Adds the chest of everything from which you can take all items diff --git a/games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png b/games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png deleted file mode 100644 index 6b2fd58d5..000000000 Binary files a/games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/init.lua b/games/minimal/mods/dignodes/init.lua deleted file mode 100644 index 833150873..000000000 --- a/games/minimal/mods/dignodes/init.lua +++ /dev/null @@ -1,37 +0,0 @@ -local groups = { - "cracky", "dig_immediate" -} - --- Register dig nodes with 1 digging group, a rating between 1-3 and a level between 0-2 -for g=1, #groups do - local gr = groups[g] - for r=1, 3 do - for l=0, 2 do - if not (gr=="dig_immediate" and (l>0 or r==1)) then - local d - if l > 0 then - d = string.format("Dig Test Node: %s=%d, level=%d", gr, r, l) - else - d = string.format("Dig Test Node: %s=%d", gr, r) - end - local tile = "dignodes_"..gr..".png^dignodes_rating"..r..".png" - if l==1 then - tile = tile .. "^[colorize:#FFFF00:127" - elseif l==2 then - tile = tile .. "^[colorize:#FF0000:127" - end - minetest.register_node("dignodes:"..gr.."_"..r.."_"..l, { - description = d, - tiles = { tile }, - groups = { [gr] = r, level = l }, - }) - end - end - end -end - --- Node without any digging groups -minetest.register_node("dignodes:none", { - description = "Dig Test Node: groupless", - tiles = {"dignodes_none.png"}, -}) diff --git a/games/minimal/mods/dignodes/mod.conf b/games/minimal/mods/dignodes/mod.conf deleted file mode 100644 index 52a80d66e..000000000 --- a/games/minimal/mods/dignodes/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = dignodes -description = Nodes with different digging groups diff --git a/games/minimal/mods/dignodes/textures/dignodes_choppy.png b/games/minimal/mods/dignodes/textures/dignodes_choppy.png deleted file mode 100644 index a73fc2424..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_choppy.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_cracky.png b/games/minimal/mods/dignodes/textures/dignodes_cracky.png deleted file mode 100644 index eb84e3079..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_cracky.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_crumbly.png b/games/minimal/mods/dignodes/textures/dignodes_crumbly.png deleted file mode 100644 index 23f2f7c71..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_crumbly.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png b/games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png deleted file mode 100644 index a532ad90b..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_none.png b/games/minimal/mods/dignodes/textures/dignodes_none.png deleted file mode 100644 index 60f13650b..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_none.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_rating1.png b/games/minimal/mods/dignodes/textures/dignodes_rating1.png deleted file mode 100644 index d2fee3a23..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_rating1.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_rating2.png b/games/minimal/mods/dignodes/textures/dignodes_rating2.png deleted file mode 100644 index 15329b93f..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_rating2.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_rating3.png b/games/minimal/mods/dignodes/textures/dignodes_rating3.png deleted file mode 100644 index 37216bfd1..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_rating3.png and /dev/null differ diff --git a/games/minimal/mods/experimental/commands.lua b/games/minimal/mods/experimental/commands.lua deleted file mode 100644 index 96f8cbe39..000000000 --- a/games/minimal/mods/experimental/commands.lua +++ /dev/null @@ -1,215 +0,0 @@ -minetest.register_chatcommand("test_inv", { - params = "", - description = "Test: Modify player's inventory formspec", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - player:set_inventory_formspec( - "size[13,7.5]".. - "image[6,0.6;1,2;player.png]".. - "list[current_player;main;5,3.5;8,4;]".. - "list[current_player;craft;8,0;3,3;]".. - "list[current_player;craftpreview;12,1;1,1;]".. - "list[detached:test_inventory;main;0,0;4,6;0]".. - "button[0.5,7;2,1;button1;Button 1]".. - "button_exit[2.5,7;2,1;button2;Exit Button]") - return true, "Done." - end, -}) - -minetest.register_chatcommand("test_bulk_set_node", { - params = "", - description = "Test: Bulk-set 9×9×9 stone nodes", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local pos_list = {} - local ppos = player:get_pos() - local i = 1 - for x=2,10 do - for y=2,10 do - for z=2,10 do - pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} - i = i + 1 - end - end - end - minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) - return true, "Done." - end, -}) - -minetest.register_chatcommand("bench_bulk_set_node", { - params = "", - description = "Benchmark: Bulk-set 99×99×99 stone nodes", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local pos_list = {} - local ppos = player:get_pos() - local i = 1 - for x=2,100 do - for y=2,100 do - for z=2,100 do - pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} - i = i + 1 - end - end - end - - minetest.chat_send_player(name, "Benchmarking minetest.bulk_set_node. Warming up ..."); - - -- warm up with stone to prevent having different callbacks - -- due to different node topology - minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) - - minetest.chat_send_player(name, "Warming up finished, now benchmarking ..."); - - local start_time = minetest.get_us_time() - for i=1,#pos_list do - minetest.set_node(pos_list[i], {name = "mapgen_stone"}) - end - local middle_time = minetest.get_us_time() - minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) - local end_time = minetest.get_us_time() - local msg = string.format("Benchmark results: minetest.set_node loop: %.2f ms; minetest.bulk_set_node: %.2f ms", - ((middle_time - start_time)) / 1000, - ((end_time - middle_time)) / 1000 - ) - return true, msg - end, -}) - -local function advance_pos(pos, start_pos, advance_z) - if advance_z then - pos.z = pos.z + 2 - pos.x = start_pos.x - else - pos.x = pos.x + 2 - end - if pos.x > 30900 or pos.x - start_pos.x > 46 then - pos.x = start_pos.x - pos.z = pos.z + 2 - end - if pos.z > 30900 then - -- We ran out of space! Aborting - aborted = true - return false - end - return pos -end - -local function place_nodes(param) - local nodes = param.nodes - local name = param.name - local pos = param.pos - local start_pos = param.start_pos - table.sort(nodes) - minetest.chat_send_player(name, "Placing nodes …") - local nodes_placed = 0 - for n=1, #nodes do - local itemstring = nodes[n] - local def = minetest.registered_nodes[itemstring] - local p2_max = 0 - if param.param ~= "no_param2" then - -- Also test the param2 values of the nodes - -- ... but we only use permissible param2 values - if def.paramtype2 == "wallmounted" then - p2_max = 5 - elseif def.paramtype2 == "facedir" then - p2_max = 23 - elseif def.paramtype2 == "glasslikeliquidlevel" then - p2_max = 63 - elseif def.paramtype2 == "meshoptions" and def.drawtype == "plantlike" then - p2_max = 63 - elseif def.paramtype2 == "leveled" then - p2_max = 127 - elseif def.paramtype2 == "degrotate" and def.drawtype == "plantlike" then - p2_max = 179 - elseif def.paramtype2 == "colorfacedir" or - def.paramtype2 == "colorwallmounted" or - def.paramtype2 == "color" then - p2_max = 255 - end - end - for p2 = 0, p2_max do - -- Skip undefined param2 values - if not ((def.paramtype2 == "meshoptions" and p2 % 8 > 4) or - (def.paramtype2 == "colorwallmounted" and p2 % 8 > 5) or - (def.paramtype2 == "colorfacedir" and p2 % 32 > 23)) then - - minetest.set_node(pos, { name = itemstring, param2 = p2 }) - nodes_placed = nodes_placed + 1 - pos = advance_pos(pos, start_pos) - if not pos then - aborted = true - break - end - end - end - if aborted then - break - end - end - if aborted then - minetest.chat_send_player(name, "Not all nodes could be placed, please move further away from the world boundary. Nodes placed: "..nodes_placed) - end - minetest.chat_send_player(name, "Nodes placed: "..nodes_placed..".") -end - -local function after_emerge(blockpos, action, calls_remaining, param) - if calls_remaining == 0 then - place_nodes(param) - end -end - -minetest.register_chatcommand("test_place_nodes", { - params = "[ no_param2 ]", - description = "Test: Place all non-experimental nodes and optionally their permissible param2 variants", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local pos = vector.floor(player:get_pos()) - pos.x = math.ceil(pos.x + 3) - pos.z = math.ceil(pos.z + 3) - pos.y = math.ceil(pos.y + 1) - local start_pos = table.copy(pos) - if pos.x > 30800 then - return false, "Too close to world boundary (+X). Please move to X < 30800." - end - if pos.z > 30800 then - return false, "Too close to world boundary (+Z). Please move to Z < 30800." - end - - local aborted = false - local nodes = {} - local emerge_estimate = 0 - for itemstring, def in pairs(minetest.registered_nodes) do - if itemstring ~= "ignore" and string.sub(itemstring, 1, 13) ~= "experimental:" then - table.insert(nodes, itemstring) - if def.paramtype2 == 0 then - emerge_estimate = emerge_estimate + 1 - else - emerge_estimate = emerge_estimate + 255 - end - end - end - -- Emerge area to make sure that all nodes are being placed. - -- Note we will emerge much more than we need to (overestimation), - -- the estimation code could be improved performance-wise … - local length = 16 + math.ceil(emerge_estimate / 24) * 2 - minetest.emerge_area(start_pos, - { x = start_pos.x + 46, y = start_pos.y, z = start_pos.z + length }, - after_emerge, { nodes = nodes, name = name, pos = pos, start_pos = start_pos, param = param }) - return true, "Emerging area …" - end, -}) - diff --git a/games/minimal/mods/experimental/detached.lua b/games/minimal/mods/experimental/detached.lua deleted file mode 100644 index 673adfdd4..000000000 --- a/games/minimal/mods/experimental/detached.lua +++ /dev/null @@ -1,29 +0,0 @@ --- Create a detached inventory -local inv = minetest.create_detached_inventory("test_inventory", { - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - experimental.print_to_everything("allow move asked") - return count -- Allow all - end, - allow_put = function(inv, listname, index, stack, player) - experimental.print_to_everything("allow put asked") - return 1 -- Allow only 1 - end, - allow_take = function(inv, listname, index, stack, player) - experimental.print_to_everything("allow take asked") - return 4 -- Allow 4 at max - end, - on_move = function(inv, from_list, from_index, to_list, to_index, count, player) - experimental.print_to_everything(player:get_player_name().." moved items") - end, - on_put = function(inv, listname, index, stack, player) - experimental.print_to_everything(player:get_player_name().." put items") - end, - on_take = function(inv, listname, index, stack, player) - experimental.print_to_everything(player:get_player_name().." took items") - end, -}) -inv:set_size("main", 4*6) -inv:add_item("main", "experimental:callback_node") -inv:add_item("main", "experimental:particle_spawner") - - diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua deleted file mode 100644 index b292f792e..000000000 --- a/games/minimal/mods/experimental/init.lua +++ /dev/null @@ -1,23 +0,0 @@ --- --- Experimental things --- - -experimental = {} - -dofile(minetest.get_modpath("experimental").."/detached.lua") -dofile(minetest.get_modpath("experimental").."/items.lua") -dofile(minetest.get_modpath("experimental").."/commands.lua") - -function experimental.print_to_everything(msg) - minetest.log("action", msg) - minetest.chat_send_all(msg) -end - -minetest.log("info", "[experimental] modname="..dump(minetest.get_current_modname())) -minetest.log("info", "[experimental] modpath="..dump(minetest.get_modpath("experimental"))) -minetest.log("info", "[experimental] worldpath="..dump(minetest.get_worldpath())) - - -minetest.register_on_mods_loaded(function() - minetest.log("action", "[experimental] on_mods_loaded()") -end) diff --git a/games/minimal/mods/experimental/items.lua b/games/minimal/mods/experimental/items.lua deleted file mode 100644 index 51b063ba2..000000000 --- a/games/minimal/mods/experimental/items.lua +++ /dev/null @@ -1,103 +0,0 @@ -minetest.register_node("experimental:callback_node", { - description = "Callback Test Node (construct/destruct/timer)", - tiles = {"experimental_callback_node.png"}, - groups = {dig_immediate=3}, - -- This was known to cause a bug in minetest.item_place_node() when used - -- via minetest.place_node(), causing a placer with no position - paramtype2 = "facedir", - drop = "", - - on_construct = function(pos) - experimental.print_to_everything("experimental:callback_node:on_construct("..minetest.pos_to_string(pos)..")") - local meta = minetest.get_meta(pos) - meta:set_string("mine", "test") - local timer = minetest.get_node_timer(pos) - timer:start(4, 3) - end, - - after_place_node = function(pos, placer) - experimental.print_to_everything("experimental:callback_node:after_place_node("..minetest.pos_to_string(pos)..")") - local meta = minetest.get_meta(pos) - if meta:get_string("mine") == "test" then - experimental.print_to_everything("correct metadata found") - else - experimental.print_to_everything("incorrect metadata found") - end - end, - - on_destruct = function(pos) - experimental.print_to_everything("experimental:callback_node:on_destruct("..minetest.pos_to_string(pos)..")") - end, - - after_destruct = function(pos) - experimental.print_to_everything("experimental:callback_node:after_destruct("..minetest.pos_to_string(pos)..")") - end, - - after_dig_node = function(pos, oldnode, oldmetadata, digger) - experimental.print_to_everything("experimental:callback_node:after_dig_node("..minetest.pos_to_string(pos)..")") - end, - - on_timer = function(pos, elapsed) - experimental.print_to_everything("on_timer(): elapsed="..dump(elapsed)) - return true - end, -}) - -minetest.register_tool("experimental:privatizer", { - description = "Node Meta Privatizer", - inventory_image = "experimental_tester_tool_1.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type == "node" then - local node = minetest.get_node(pointed_thing.under) - if node.name == "chest:chest" then - local p = pointed_thing.under - minetest.log("action", "Privatizer used at "..minetest.pos_to_string(p)) - minetest.get_meta(p):mark_as_private({"infotext", "formspec"}) - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), "Chest metadata (infotext, formspec) set private!") - end - return - end - end - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), "Privatizer can only be used on chest!") - end - end, -}) - -minetest.register_tool("experimental:particle_spawner", { - description = "Particle Spawner", - inventory_image = "experimental_tester_tool_1.png^[invert:g", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing, true) - if pos == nil then - if user then - pos = user:get_pos() - end - end - pos = vector.add(pos, {x=0, y=0.5, z=0}) - local tex, anim - if math.random(0, 1) == 0 then - tex = "experimental_particle_sheet.png" - anim = {type="sheet_2d", frames_w=3, frames_h=2, frame_length=0.5} - else - tex = "experimental_particle_vertical.png" - anim = {type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3} - end - - minetest.add_particle({ - pos = pos, - velocity = {x=0, y=0, z=0}, - acceleration = {x=0, y=0.04, z=0}, - expirationtime = 6, - collisiondetection = true, - texture = tex, - animation = anim, - size = 4, - glow = math.random(0, 5), - }) - end, -}) - diff --git a/games/minimal/mods/experimental/mod.conf b/games/minimal/mods/experimental/mod.conf deleted file mode 100644 index cf0f9cb42..000000000 --- a/games/minimal/mods/experimental/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = experimental -description = Chaotic mod containing unstructured tests for testing out engine features. The features in this mod should be moved to other mods. diff --git a/games/minimal/mods/experimental/textures/experimental_callback_node.png b/games/minimal/mods/experimental/textures/experimental_callback_node.png deleted file mode 100644 index e9d87434c..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_callback_node.png and /dev/null differ diff --git a/games/minimal/mods/experimental/textures/experimental_particle_sheet.png b/games/minimal/mods/experimental/textures/experimental_particle_sheet.png deleted file mode 100644 index 6d70394e4..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_particle_sheet.png and /dev/null differ diff --git a/games/minimal/mods/experimental/textures/experimental_particle_vertical.png b/games/minimal/mods/experimental/textures/experimental_particle_vertical.png deleted file mode 100644 index 0320b7545..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_particle_vertical.png and /dev/null differ diff --git a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png b/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png deleted file mode 100644 index 5df416a58..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png and /dev/null differ diff --git a/games/minimal/mods/give_initial_stuff/init.lua b/games/minimal/mods/give_initial_stuff/init.lua deleted file mode 100644 index 491a531e4..000000000 --- a/games/minimal/mods/give_initial_stuff/init.lua +++ /dev/null @@ -1,37 +0,0 @@ -local give_if_not_gotten_already = function(inv, list, item) - if not inv:contains_item(list, item) then - inv:add_item(list, item) - end -end - -local give_initial_stuff = function(player) - local inv = player:get_inventory() - give_if_not_gotten_already(inv, "main", "basetools:pick_mese") - give_if_not_gotten_already(inv, "main", "basetools:axe_steel") - give_if_not_gotten_already(inv, "main", "basetools:shovel_steel") - give_if_not_gotten_already(inv, "main", "bucket:bucket") - give_if_not_gotten_already(inv, "main", "testnodes:light14") - give_if_not_gotten_already(inv, "main", "chest_of_everything:chest") - minetest.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name()) -end - -minetest.register_on_newplayer(function(player) - if minetest.settings:get_bool("give_initial_stuff", true) then - give_initial_stuff(player) - end -end) - -minetest.register_chatcommand("stuff", { - params = "", - privs = { give = true }, - description = "Give yourself initial items", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player or not player:is_player() then - return false, "No player." - end - give_initial_stuff(player) - return true - end, -}) - diff --git a/games/minimal/mods/give_initial_stuff/mod.conf b/games/minimal/mods/give_initial_stuff/mod.conf deleted file mode 100644 index 1ba49f52a..000000000 --- a/games/minimal/mods/give_initial_stuff/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = give_initial_stuff -description = Gives items to players on join -depends = basetools, bucket, chest_of_everything, testnodes diff --git a/games/minimal/mods/initial_message/init.lua b/games/minimal/mods/initial_message/init.lua deleted file mode 100644 index f92f4d3cf..000000000 --- a/games/minimal/mods/initial_message/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -minetest.register_on_joinplayer(function(player) - local cb = function(player) - if not player or not player:is_player() then - return - end - minetest.chat_send_player(player:get_player_name(), "This is the \"Minimal development Test\" [minimal], meant only for testing and development. Use Minetest Game for the real thing.") - end - minetest.after(2.0, cb, player) -end) diff --git a/games/minimal/mods/initial_message/mod.conf b/games/minimal/mods/initial_message/mod.conf deleted file mode 100644 index 32aa2ac4e..000000000 --- a/games/minimal/mods/initial_message/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = initial_message -description = Show message to joining players explaining what this testing game is about diff --git a/games/minimal/mods/mapgen/init.lua b/games/minimal/mods/mapgen/init.lua deleted file mode 100644 index 13a186a50..000000000 --- a/games/minimal/mods/mapgen/init.lua +++ /dev/null @@ -1,81 +0,0 @@ --- --- Aliases for map generator outputs --- - --- ESSENTIAL node aliases --- Basic nodes -minetest.register_alias("mapgen_stone", "basenodes:stone") -minetest.register_alias("mapgen_water_source", "basenodes:water_source") -minetest.register_alias("mapgen_river_water_source", "basenodes:river_water_source") - --- Additional essential aliases for v6 -minetest.register_alias("mapgen_lava_source", "basenodes:lava_source") -minetest.register_alias("mapgen_dirt", "basenodes:dirt") -minetest.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass") -minetest.register_alias("mapgen_sand", "basenodes:sand") -minetest.register_alias("mapgen_tree", "basenodes:tree") -minetest.register_alias("mapgen_leaves", "basenodes:leaves") -minetest.register_alias("mapgen_apple", "basenodes:apple") - --- Essential alias for dungeons -minetest.register_alias("mapgen_cobble", "basenodes:cobble") - --- Optional aliases for v6 (they all have fallback values in the engine) -if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then - minetest.register_alias("mapgen_gravel", "basenodes:gravel") - minetest.register_alias("mapgen_desert_stone", "basenodes:desert_stone") - minetest.register_alias("mapgen_desert_sand", "basenodes:desert_sand") - minetest.register_alias("mapgen_dirt_with_snow", "basenodes:dirt_with_snow") - minetest.register_alias("mapgen_snowblock", "basenodes:snowblock") - minetest.register_alias("mapgen_snow", "basenodes:snow") - minetest.register_alias("mapgen_ice", "basenodes:ice") - minetest.register_alias("mapgen_junglegrass", "basenodes:junglegrass") - minetest.register_alias("mapgen_jungletree", "basenodes:jungletree") - minetest.register_alias("mapgen_jungleleaves", "basenodes:jungleleaves") - minetest.register_alias("mapgen_pine_tree", "basenodes:pine_tree") - minetest.register_alias("mapgen_pine_needles", "basenodes:pine_needles") -end --- Optional alias for mossycobble (should fall back to cobble) -if minetest.settings:get_bool("devtest_dungeon_mossycobble", false) then - minetest.register_alias("mapgen_mossycobble", "basenodes:mossycobble") -end --- Optional aliases for dungeon stairs (should fall back to full nodes) -if minetest.settings:get_bool("devtest_dungeon_stairs", false) then - minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") - if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then - minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone") - end -end - --- --- Register biomes for biome API --- - -minetest.clear_registered_biomes() -minetest.clear_registered_decorations() - -if minetest.settings:get_bool("devtest_register_biomes", true) then - minetest.register_biome({ - name = "mapgen:grassland", - node_top = "basenodes:dirt_with_grass", - depth_top = 1, - node_filler = "basenodes:dirt", - depth_filler = 1, - y_min = 5, - y_max = 31000, - heat_point = 50, - humidity_point = 50, - }) - - minetest.register_biome({ - name = "mapgen:grassland_ocean", - node_top = "basenodes:sand", - depth_top = 1, - node_filler = "basenodes:sand", - depth_filler = 2, - y_min = -31000, - y_max = 4, - heat_point = 50, - humidity_point = 50, - }) -end diff --git a/games/minimal/mods/mapgen/mod.conf b/games/minimal/mods/mapgen/mod.conf deleted file mode 100644 index 15750ccbe..000000000 --- a/games/minimal/mods/mapgen/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = mapgen -description = Minimal map generator -depends = basenodes diff --git a/games/minimal/mods/modchannels/init.lua b/games/minimal/mods/modchannels/init.lua deleted file mode 100644 index ee925f09b..000000000 --- a/games/minimal/mods/modchannels/init.lua +++ /dev/null @@ -1,14 +0,0 @@ --- --- Mod channels experimental handlers --- -local mod_channel = minetest.mod_channel_join("experimental_preview") - -minetest.register_on_modchannel_message(function(channel, sender, message) - minetest.log("action", "[modchannels] Server received message `" .. message - .. "` on channel `" .. channel .. "` from sender `" .. sender .. "`") - - if mod_channel:is_writeable() then - mod_channel:send_all("experimental answers to preview") - mod_channel:leave() - end -end) diff --git a/games/minimal/mods/modchannels/mod.conf b/games/minimal/mods/modchannels/mod.conf deleted file mode 100644 index 7c13aadfb..000000000 --- a/games/minimal/mods/modchannels/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = modchannels -description = Add experimental mod channel handlers diff --git a/games/minimal/mods/soundstuff/init.lua b/games/minimal/mods/soundstuff/init.lua deleted file mode 100644 index 22012ba14..000000000 --- a/games/minimal/mods/soundstuff/init.lua +++ /dev/null @@ -1,170 +0,0 @@ -local simple_nodes = { - footstep = { "Footstep Sound Node", "soundstuff_node_footstep.png" }, - dig = { "Dig Sound Node", "soundstuff_node_dig.png" }, - dug = { "Dug Sound Node", "soundstuff_node_dug.png" }, - place = { "Place Sound Node", "soundstuff_node_place.png" }, - place_failed = { "Place Failed Sound Node", "soundstuff_node_place_failed.png" }, -} - -for k,v in pairs(simple_nodes) do - minetest.register_node("soundstuff:"..k, { - description = v[1], - tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]}, - groups = {dig_immediate=2}, - sounds = { - [k] = { name = "soundstuff_mono", gain = 1.0 }, - } - }) -end - -minetest.register_node("soundstuff:place_failed_attached", { - description = "Attached Place Failed Sound Node", - tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"}, - groups = {dig_immediate=2, attached_node=1}, - drawtype = "nodebox", - paramtype = "light", - node_box = { type = "fixed", fixed = { - { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, - { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, - }}, - sounds = { - place_failed = { name = "soundstuff_mono", gain = 1.0 }, - }, -}) - -minetest.register_node("soundstuff:fall", { - description = "Fall Sound Node", - tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, - groups = {dig_immediate=2, falling_node=1}, - sounds = { - fall = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_node("soundstuff:fall_attached", { - description = "Attached Fall Sound Node", - tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, - groups = {dig_immediate=2, attached_node=1}, - drawtype = "nodebox", - paramtype = "light", - node_box = { type = "fixed", fixed = { - { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, - { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, - }}, - sounds = { - fall = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_node("soundstuff:footstep_liquid", { - description = "Liquid Footstep Sound Node", - drawtype = "liquid", - tiles = { - "soundstuff_node_sound.png^[colorize:#0000FF:127", - }, - special_tiles = { - {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = false}, - {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = true}, - }, - liquids_pointable = true, - liquidtype = "source", - liquid_alternative_flowing = "soundstuff:footstep_liquid", - liquid_alternative_source = "soundstuff:footstep_liquid", - liquid_renewable = false, - liquid_range = 0, - liquid_viscosity = 0, - alpha = 190, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - post_effect_color = {a = 64, r = 0, g = 0, b = 200}, - sounds = { - footstep = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_node("soundstuff:footstep_climbable", { - description = "Climbable Footstep Sound Node", - drawtype = "allfaces", - tiles = { - "soundstuff_node_climbable.png", - }, - alpha = 120, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - climbable = true, - is_ground_content = false, - groups = { dig_immediate = 2 }, - sounds = { - footstep = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - - - -minetest.register_craftitem("soundstuff:eat", { - description = "Eat Sound Item", - inventory_image = "soundstuff_eat.png", - on_use = minetest.item_eat(0), - sound = { - eat = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_tool("soundstuff:breaks", { - description = "Break Sound Tool", - inventory_image = "soundstuff_node_dug.png", - sound = { - breaks = { name = "soundstuff_mono", gain = 1.0 }, - }, - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - choppy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - snappy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - crumbly={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - }, - }, -}) - --- Plays sound repeatedly -minetest.register_node("soundstuff:positional", { - description = "Positional Sound Node", - on_construct = function(pos) - local timer = minetest.get_node_timer(pos) - timer:start(0) - end, - on_timer = function(pos, elapsed) - local node = minetest.get_node(pos) - local dist = node.param2 - if dist == 0 then - dist = nil - end - minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist }) - local timer = minetest.get_node_timer(pos) - timer:start(0.7) - end, - on_rightclick = function(pos, node, clicker) - node.param2 = (node.param2 + 1) % 64 - minetest.set_node(pos, node) - if clicker and clicker:is_player() then - local dist = node.param2 - local diststr - if dist == 0 then - diststr = "" - else - diststr = tostring(dist) - end - minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr) - end - end, - - groups = { dig_immediate = 2 }, - tiles = { "soundstuff_node_sound.png" }, -}) - diff --git a/games/minimal/mods/soundstuff/mod.conf b/games/minimal/mods/soundstuff/mod.conf deleted file mode 100644 index 2c631e2da..000000000 --- a/games/minimal/mods/soundstuff/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = soundstuff -description = Example items and nodes for testing sound effects diff --git a/games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg b/games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg deleted file mode 100644 index 43428d566..000000000 Binary files a/games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_eat.png b/games/minimal/mods/soundstuff/textures/soundstuff_eat.png deleted file mode 100644 index aed205422..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_eat.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png deleted file mode 100644 index 4dffacc4c..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png deleted file mode 100644 index 3888f793c..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png deleted file mode 100644 index 67ba111d8..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png deleted file mode 100644 index bab5fbe51..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png deleted file mode 100644 index 17b14f1e4..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png deleted file mode 100644 index 6367ae909..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_place.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_place.png deleted file mode 100644 index d159ad533..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_place.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png deleted file mode 100644 index 780ba946d..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png deleted file mode 100644 index 0592a0299..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png and /dev/null differ diff --git a/games/minimal/mods/stairs/init.lua b/games/minimal/mods/stairs/init.lua deleted file mode 100644 index 2701cabab..000000000 --- a/games/minimal/mods/stairs/init.lua +++ /dev/null @@ -1,65 +0,0 @@ -stairs = {} - --- Node will be called stairs:stair_ -function stairs.register_stair(subname, recipeitem, groups, images, description) - minetest.register_node(":stairs:stair_" .. subname, { - description = description, - drawtype = "nodebox", - tiles = images, - paramtype = "light", - paramtype2 = "facedir", - is_ground_content = true, - groups = groups, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - }, - }, - }) -end - --- Node will be called stairs:slab_ -function stairs.register_slab(subname, recipeitem, groups, images, description) - minetest.register_node(":stairs:slab_" .. subname, { - description = description, - drawtype = "nodebox", - tiles = images, - paramtype = "light", - is_ground_content = true, - groups = groups, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - }) -end - --- Nodes will be called stairs:{stair,slab}_ -function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab) - stairs.register_stair(subname, recipeitem, groups, images, desc_stair) - stairs.register_slab(subname, recipeitem, groups, images, desc_slab) -end - -stairs.register_stair_and_slab("stone", "basenodes:stone", - {cracky=3}, - {"default_stone.png"}, - "Stone Stair", - "Stone Slab") - -stairs.register_stair_and_slab("desert_stone", "basenodes:desert_stone", - {cracky=3}, - {"default_desert_stone.png"}, - "Desert Stone Stair", - "Desert Stone Slab") - -stairs.register_stair_and_slab("cobble", "basenodes:cobble", - {cracky=3}, - {"default_cobble.png"}, - "Cobblestone Stair", - "Cobblestone Slab") diff --git a/games/minimal/mods/stairs/mod.conf b/games/minimal/mods/stairs/mod.conf deleted file mode 100644 index 724bff881..000000000 --- a/games/minimal/mods/stairs/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = stairs -description = Adds stairs and slabs -depends = basenodes diff --git a/games/minimal/mods/testentities/armor.lua b/games/minimal/mods/testentities/armor.lua deleted file mode 100644 index 4c30cec8d..000000000 --- a/games/minimal/mods/testentities/armor.lua +++ /dev/null @@ -1,41 +0,0 @@ --- Armorball: Test entity for testing armor groups --- Rightclick to change armor group - -local phasearmor = { - [0]={icy=100}, - [1]={firy=100}, - [2]={fleshy=100}, - [3]={immortal=1}, - [4]={punch_operable=1}, -} - -minetest.register_entity("testentities:armorball", { - initial_properties = { - hp_max = 20, - physical = false, - collisionbox = {-0.4,-0.4,-0.4, 0.4,0.4,0.4}, - visual = "sprite", - visual_size = {x=1, y=1}, - textures = {"testentities_armorball.png"}, - spritediv = {x=1, y=5}, - initial_sprite_basepos = {x=0, y=0}, - }, - - _phase = 2, - - on_activate = function(self, staticdata) - minetest.log("action", "[testentities] armorball.on_activate") - self.object:set_armor_groups(phasearmor[self._phase]) - self.object:set_sprite({x=0, y=self._phase}) - end, - - on_rightclick = function(self, clicker) - -- Change armor group and sprite - self._phase = self._phase + 1 - if self._phase >= 5 then - self._phase = 0 - end - self.object:set_sprite({x=0, y=self._phase}) - self.object:set_armor_groups(phasearmor[self._phase]) - end, -}) diff --git a/games/minimal/mods/testentities/callbacks.lua b/games/minimal/mods/testentities/callbacks.lua deleted file mode 100644 index 711079f87..000000000 --- a/games/minimal/mods/testentities/callbacks.lua +++ /dev/null @@ -1,75 +0,0 @@ --- Entities that test their callbacks - -local message = function(msg) - minetest.log("action", msg) - minetest.chat_send_all(msg) -end - -local get_object_name = function(obj) - local name = "" - if obj then - if obj:is_player() then - name = obj:get_player_name() - else - name = "" - end - end - return name -end - -local spos = function(self) - return minetest.pos_to_string(vector.round(self.object:get_pos())) -end - --- Callback test entity (all callbacks except on_step) -minetest.register_entity("testentities:callback", { - initial_properties = { - visual = "upright_sprite", - textures = { "testentities_callback.png" }, - }, - - on_activate = function(self, staticdata, dtime_s) - message("Callback entity: on_activate! pos="..spos(self).."; dtime_s="..dtime_s) - end, - on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) - local name = get_object_name(puncher) - message( - "Callback entity: on_punch! ".. - "pos="..spos(self).."; puncher="..name.."; ".. - "time_from_last_punch="..time_from_last_punch.."; ".. - "tool_capabilities="..tostring(dump(tool_capabilities)).."; ".. - "dir="..tostring(dump(dir)).."; damage="..damage) - end, - on_rightclick = function(self, clicker) - local name = get_object_name(clicker) - message("Callback entity: on_rightclick! pos="..spos(self).."; clicker="..name) - end, - on_death = function(self, killer) - local name = get_object_name(killer) - message("Callback entity: on_death! pos="..spos(self).."; killer="..name) - end, - on_attach_child = function(self, child) - local name = get_object_name(child) - message("Callback entity: on_attach_child! pos="..spos(self).."; child="..name) - end, - on_detach_child = function(self, child) - local name = get_object_name(child) - message("Callback entity: on_detach_child! pos="..spos(self).."; child="..name) - end, - on_detach = function(self, parent) - local name = get_object_name(parent) - message("Callback entity: on_detach! pos="..spos(self).."; parent="..name) - end, - get_staticdata = function(self) - message("Callback entity: get_staticdata! pos="..spos(self)) - end, -}) - --- Only test on_step callback -minetest.register_entity("testentities:callback_step", { - visual = "upright_sprite", - textures = { "testentities_callback_step.png" }, - on_step = function(self, dtime) - message("on_step callback entity: on_step! pos="..spos(self).."; dtime="..dtime) - end, -}) diff --git a/games/minimal/mods/testentities/init.lua b/games/minimal/mods/testentities/init.lua deleted file mode 100644 index df8c72ea7..000000000 --- a/games/minimal/mods/testentities/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -dofile(minetest.get_modpath("testentities").."/visuals.lua") -dofile(minetest.get_modpath("testentities").."/armor.lua") -dofile(minetest.get_modpath("testentities").."/callbacks.lua") diff --git a/games/minimal/mods/testentities/mod.conf b/games/minimal/mods/testentities/mod.conf deleted file mode 100644 index 7a8cb5a3e..000000000 --- a/games/minimal/mods/testentities/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testentities -description = Example entities for testing diff --git a/games/minimal/mods/testentities/textures/testentities_armorball.png b/games/minimal/mods/testentities/textures/testentities_armorball.png deleted file mode 100644 index 88147bd1f..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_armorball.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_callback.png b/games/minimal/mods/testentities/textures/testentities_callback.png deleted file mode 100644 index c4c9066d1..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_callback.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_callback_step.png b/games/minimal/mods/testentities/textures/testentities_callback_step.png deleted file mode 100644 index b67506a97..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_callback_step.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube1.png b/games/minimal/mods/testentities/textures/testentities_cube1.png deleted file mode 100644 index c667e425f..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube1.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube2.png b/games/minimal/mods/testentities/textures/testentities_cube2.png deleted file mode 100644 index 481823420..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube2.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube3.png b/games/minimal/mods/testentities/textures/testentities_cube3.png deleted file mode 100644 index 03b5daa15..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube3.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube4.png b/games/minimal/mods/testentities/textures/testentities_cube4.png deleted file mode 100644 index 639204896..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube4.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube5.png b/games/minimal/mods/testentities/textures/testentities_cube5.png deleted file mode 100644 index d8acdf0b6..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube5.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube6.png b/games/minimal/mods/testentities/textures/testentities_cube6.png deleted file mode 100644 index 5f81a64d9..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube6.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_dungeon_master.png b/games/minimal/mods/testentities/textures/testentities_dungeon_master.png deleted file mode 100644 index 1e3107746..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_dungeon_master.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_sprite.png b/games/minimal/mods/testentities/textures/testentities_sprite.png deleted file mode 100644 index a4b019699..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_sprite.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_upright_sprite1.png b/games/minimal/mods/testentities/textures/testentities_upright_sprite1.png deleted file mode 100644 index 6242511df..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_upright_sprite1.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_upright_sprite2.png b/games/minimal/mods/testentities/textures/testentities_upright_sprite2.png deleted file mode 100644 index a79a760e3..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_upright_sprite2.png and /dev/null differ diff --git a/games/minimal/mods/testentities/visuals.lua b/games/minimal/mods/testentities/visuals.lua deleted file mode 100644 index de346fd68..000000000 --- a/games/minimal/mods/testentities/visuals.lua +++ /dev/null @@ -1,74 +0,0 @@ --- Minimal test entities to test visuals - -minetest.register_entity("testentities:sprite", { - initial_properties = { - visual = "sprite", - textures = { "testentities_sprite.png" }, - }, -}) - -minetest.register_entity("testentities:upright_sprite", { - initial_properties = { - visual = "upright_sprite", - textures = { - "testentities_upright_sprite1.png", - "testentities_upright_sprite2.png", - }, - }, -}) - -minetest.register_entity("testentities:cube", { - initial_properties = { - visual = "cube", - textures = { - "testentities_cube1.png", - "testentities_cube2.png", - "testentities_cube3.png", - "testentities_cube4.png", - "testentities_cube5.png", - "testentities_cube6.png", - }, - }, -}) - -minetest.register_entity("testentities:item", { - initial_properties = { - visual = "item", - wield_item = "testnodes:normal", - }, -}) - -minetest.register_entity("testentities:wielditem", { - initial_properties = { - visual = "wielditem", - wield_item = "testnodes:normal", - }, -}) - -minetest.register_entity("testentities:mesh", { - initial_properties = { - visual = "mesh", - mesh = "testnodes_pyramid.obj", - textures = { - "testnodes_mesh_stripes2.png" - }, - }, -}) - --- Advanced visual tests - --- A test entity for testing animated and yaw-modulated sprites -minetest.register_entity("testentities:yawsprite", { - initial_properties = { - selectionbox = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}, - visual = "sprite", - visual_size = {x=0.6666, y=1}, - textures = {"testentities_dungeon_master.png^[makealpha:128,0,0^[makealpha:128,128,0"}, - spritediv = {x=6, y=5}, - initial_sprite_basepos = {x=0, y=0}, - on_activate = function(self, staticdata) - self.object:set_sprite({x=0, y=0}, 1, 0, true) - end, - }, -}) - diff --git a/games/minimal/mods/testfood/init.lua b/games/minimal/mods/testfood/init.lua deleted file mode 100644 index a6236ff68..000000000 --- a/games/minimal/mods/testfood/init.lua +++ /dev/null @@ -1,24 +0,0 @@ -local S = minetest.get_translator("testfood") - -minetest.register_craftitem("testfood:good1", { - description = S("Good Food (+1)"), - inventory_image = "testfood_good.png", - on_use = minetest.item_eat(1), -}) -minetest.register_craftitem("testfood:good5", { - description = S("Good Food (+5)"), - inventory_image = "testfood_good2.png", - on_use = minetest.item_eat(5), -}) - -minetest.register_craftitem("testfood:bad1", { - description = S("Bad Food (-1)"), - inventory_image = "testfood_bad.png", - on_use = minetest.item_eat(-1), -}) -minetest.register_craftitem("testfood:bad5", { - description = S("Bad Food (-5)"), - inventory_image = "testfood_bad2.png", - on_use = minetest.item_eat(-5), -}) - diff --git a/games/minimal/mods/testfood/mod.conf b/games/minimal/mods/testfood/mod.conf deleted file mode 100644 index 7bff21b6e..000000000 --- a/games/minimal/mods/testfood/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testfood -description = For testing food items diff --git a/games/minimal/mods/testfood/textures/testfood_bad.png b/games/minimal/mods/testfood/textures/testfood_bad.png deleted file mode 100644 index 6e9251440..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_bad.png and /dev/null differ diff --git a/games/minimal/mods/testfood/textures/testfood_bad2.png b/games/minimal/mods/testfood/textures/testfood_bad2.png deleted file mode 100644 index 22b567890..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_bad2.png and /dev/null differ diff --git a/games/minimal/mods/testfood/textures/testfood_good.png b/games/minimal/mods/testfood/textures/testfood_good.png deleted file mode 100644 index 31df7f5dd..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_good.png and /dev/null differ diff --git a/games/minimal/mods/testfood/textures/testfood_good2.png b/games/minimal/mods/testfood/textures/testfood_good2.png deleted file mode 100644 index e43dda209..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_good2.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/callbacks.lua b/games/minimal/mods/testformspec/callbacks.lua deleted file mode 100644 index 559380580..000000000 --- a/games/minimal/mods/testformspec/callbacks.lua +++ /dev/null @@ -1,51 +0,0 @@ -local callback_test = 0 - -local out = function(player, formname, fields, number) - local snum = "" - if number then - snum = " "..number - end - local msg = "Formspec callback"..snum..": player="..player:get_player_name()..", formname=\""..tostring(formname).."\", fields="..dump(fields) - minetest.chat_send_player(player:get_player_name(), msg) - minetest.log("action", msg) -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if callback_test == 1 then - out(player, formname, fields) - elseif callback_test == 2 then - out(player, formname, fields, 1) - end -end) -minetest.register_on_player_receive_fields(function(player, formname, fields) - if callback_test == 2 then - out(player, formname, fields, 2) - return true -- Disable the first callback - end -end) -minetest.register_on_player_receive_fields(function(player, formname, fields) - if callback_test == 2 then - out(player, formname, fields, 3) - end -end) - -minetest.register_chatcommand("test_formspec_callbacks", { - params = "[ 0 | 1 | 2 ]", - description = "Test: Change formspec callbacks testing mode", - func = function(name, param) - local mode = tonumber(param) - if not mode then - callback_test = (callback_test + 1 % 3) - else - callback_test = mode - end - if callback_test == 1 then - minetest.chat_send_player(name, "Formspec callback test mode 1 enabled: Logging only") - elseif callback_test == 2 then - minetest.chat_send_player(name, "Formspec callback test mode 2 enabled: Three callbacks, disable pre-registered callbacks") - else - callback_test = 0 - minetest.chat_send_player(name, "Formspec callback test disabled!") - end - end -}) diff --git a/games/minimal/mods/testformspec/dummy_items.lua b/games/minimal/mods/testformspec/dummy_items.lua deleted file mode 100644 index 2037ae9cf..000000000 --- a/games/minimal/mods/testformspec/dummy_items.lua +++ /dev/null @@ -1,14 +0,0 @@ --- This code adds dummy items that are supposed to be used in formspecs --- for testing item_image formspec elements. - -minetest.register_node("testformspec:node", { - description = "Formspec Test Node", - tiles = { "testformspec_node.png" }, - groups = { dig_immediate = 3, dummy = 1 }, -}) - -minetest.register_craftitem("testformspec:item", { - description = "Formspec Test Item", - inventory_image = "testformspec_item.png", - groups = { dummy = 1 }, -}) diff --git a/games/minimal/mods/testformspec/formspec.lua b/games/minimal/mods/testformspec/formspec.lua deleted file mode 100644 index 08c1b6dc0..000000000 --- a/games/minimal/mods/testformspec/formspec.lua +++ /dev/null @@ -1,381 +0,0 @@ -local color = minetest.colorize - -local clip_fs = [[ - style_type[label,button,image_button,item_image_button, - tabheader,scrollbar,table,animated_image - ,field,textarea,checkbox,dropdown;noclip=%c] - - label[0,0;A clipping test] - button[0,1;3,0.8;clip_button;A clipping test] - image_button[0,2;3,0.8;testformspec_button_image.png;clip_image_button;A clipping test] - item_image_button[0,3;3,0.8;testformspec:item;clip_item_image_button;A clipping test] - tabheader[0,4.7;3,0.63;clip_tabheader;Clip,Test,Text,Tabs;1;false;false] - field[0,5;3,0.8;clip_field;Title;] - textarea[0,6;3,1;clip_textarea;Title;] - checkbox[0,7.5;clip_checkbox;This is a test;true] - dropdown[0,8;3,0.8;clip_dropdown;Select An Item,One,Two,Three,Four,Five;1] - scrollbar[0,9;3,0.8;horizontal;clip_scrollbar;3] - tablecolumns[text;text] - table[0,10;3,1;clip_table;one,two,three,four;1] - animated_image[-0.5,11;4.5,1;clip_animated_image;testformspec_animation.png;4;100] -]] - -local tabheaders_fs = [[ - tabheader[0,0;10,0.63;tabs_opaque;Opaque,Without,Border;1;false;false] - tabheader[0,1;10,0.63;tabs_opaque_border;Opaque,With,Border;1;false;true] - tabheader[0,2;10,0.63;tabs_transparent;Transparent,Without,Border;1;true;false] - tabheader[0,3;10,0.63;tabs_transparent_border;Transparent,With,Border;1;true;true] - tabheader[0,4;tabs_default;Default,Tabs;1] - tabheader[0,6;10,0.5;tabs_size1;Height=0.5;1;false;false] - tabheader[2,6;10,0.75;tabs_size1;Height=0.75;1;false;false] - tabheader[4,6;10,1;tabs_size2;Height=1;1;false;false] - tabheader[6,6;10,1.25;tabs_size2;Height=1.25;1;false;false] - tabheader[8,6;10,1.5;tabs_size2;Height=1.5;1;false;false] -]] - -local hypertext_basic = [[ -Normal test -This is a normal text. - -style test - - . - - -Tag test -normal -mono -bold -italic -underlined -big -bigger -left -
center
-right -justify. Here comes a blind text: Lorem testum dolor sit amet consecutor celeron fiftifahivus e shadoninia e smalus jokus anrus relsocutoti rubenwardus. Erasputinus hara holisti dominus wusi. Grumarinsti erltusmuate ol fortitusti fla flo, blani burki e sfani fahif. Ultae ratii, e megus gigae don anonimus. Grinus dimondus krockus e nore. Endus finalus nowus comus endus o blindus tekstus. - -Custom tag test - - - - - -color=green -Action: color=green -Action: hovercolor=yellow -size=24 -font=mono -color=green font=mono size=24 - -action test -action - -img test -Normal: - -width=48 height=48: - -float=left: - -float=right: - - -item test -Normal: - -width=48 height=48 - -angle=30,0,0: - -angle=0,30,0: - -angle=0,0,30: - -rotate=yes: - -rotate=100,0,0: - -rotate=0,100,0: - -rotate=0,0,100: - -rotate=50,75,100: - -angle=-30,-45,90 rotate=100,150,-50: -]] - -local hypertext_global = [[ - -This is a test of the global tag. The parameters are: -background=gray margin=20 valign=bottom halign=right color=pink hovercolor=purple size=12 font=mono -action]] - -local hypertext_fs = "hypertext[0,0;11,9;hypertext;"..minetest.formspec_escape(hypertext_basic).."]".. - "hypertext[0,9.5;11,2.5;hypertext;"..minetest.formspec_escape(hypertext_global).."]" - -local style_fs = [[ - style[one_btn1;bgcolor=red;textcolor=yellow;bgcolor_hovered=orange; - bgcolor_pressed=purple] - button[0,0;2.5,0.8;one_btn1;Button] - - style[one_btn2;border=false;textcolor=cyan] ]].. - "button[0,1.05;2.5,0.8;one_btn2;Text " .. color("#FF0", "Yellow") .. [[] - - style[one_btn3;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; - bgimg_pressed=testformspec_pressed.png] - button[0,2.1;1,1;one_btn3;Border] - - style[one_btn4;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; - bgimg_pressed=testformspec_pressed.png;border=false] - button[1.25,2.1;1,1;one_btn4;NoBor] - - style[one_btn5;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; - bgimg_pressed=testformspec_pressed.png;border=false;alpha=false] - button[0,3.35;1,1;one_btn5;Alph] - - style[one_btn6;border=true] - image_button[0,4.6;1,1;testformspec_button_image.png;one_btn6;Border] - - style[one_btn7;border=false] - image_button[1.25,4.6;1,1;testformspec_button_image.png;one_btn7;NoBor] - - style[one_btn8;border=false] - image_button[0,5.85;1,1;testformspec_button_image.png;one_btn8;Border;false;true;testformspec_pressed.png] - - style[one_btn9;border=true] - image_button[1.25,5.85;1,1;testformspec_button_image.png;one_btn9;NoBor;false;false;testformspec_pressed.png] - - style[one_btn10;alpha=false] - image_button[0,7.1;1,1;testformspec_button_image.png;one_btn10;NoAlpha] - - style[one_btn11;alpha=true] - image_button[1.25,7.1;1,1;testformspec_button_image.png;one_btn11;Alpha] - - style[one_btn12;border=true] - item_image_button[0,8.35;1,1;testformspec:item;one_btn12;Border] - - style[one_btn13;border=false] - item_image_button[1.25,8.35;1,1;testformspec:item;one_btn13;NoBor] - - style[one_btn14;border=false;bgimg=testformspec_bg.png;fgimg=testformspec_button_image.png] - style[one_btn14:hovered;bgimg=testformspec_bg_hovered.png;fgimg=testformspec_hovered.png;textcolor=yellow] - style[one_btn14:pressed;bgimg=testformspec_bg_pressed.png;fgimg=testformspec_pressed.png;textcolor=blue] - style[one_btn14:hovered+pressed;textcolor=purple] - image_button[0,9.6;1,1;testformspec_button_image.png;one_btn14;Bg] - - style[one_btn15;border=false;bgimg=testformspec_bg.png;bgimg_hovered=testformspec_bg_hovered.png;bgimg_pressed=testformspec_bg_pressed.png] - item_image_button[1.25,9.6;1,1;testformspec:item;one_btn15;Bg] - - style[one_btn16;border=false;bgimg=testformspec_bg_9slice.png;bgimg_hovered=testformspec_bg_9slice_hovered.png;bgimg_pressed=testformspec_bg_9slice_pressed.png;bgimg_middle=4,6] - button[2.5,9.6;2,1;one_btn16;9-Slice Bg] - - - - container[2.75,0] - - style[one_tb1;textcolor=Yellow] - tabheader[0,3;2.5,0.63;one_tb1;Yellow,Text,Tabs;1;false;false] - - style[one_f1;textcolor=yellow] - field[0,4.25;2.5,0.8;one_f1;Field One;Yellow Text] - - style[one_f2;border=false;textcolor=cyan] - field[0,5.75;2.5,0.8;one_f2;Field Two;Borderless Cyan Text] - - style[one_f3;textcolor=yellow] - textarea[0,7.025;2.5,0.8;one_f3;Label;]] .. - minetest.formspec_escape("Yellow Text\nLine two") .. [[ ] - - style[one_f4;border=false;textcolor=cyan] - textarea[0,8.324999999999999;2.5,0.8;one_f4;Label;]] .. - minetest.formspec_escape("Borderless Cyan Text\nLine two") .. [[ ] - - container_end[] -]] - -local scroll_fs = - "button[8.5,1;4,1;outside;Outside of container]".. - "box[1,1;8,6;#00aa]".. - "scroll_container[1,1;8,6;scrbar;vertical]".. - "button[0,1;1,1;lorem;Lorem]".. - "button[0,10;1,1;ipsum;Ipsum]".. - "pwdfield[2,2;1,1;lorem2;Lorem]".. - "list[current_player;main;4,4;1,5;]".. - "box[2,5;3,2;#ffff00]".. - "image[1,10;3,2;testformspec_item.png]".. - "image[3,1;testformspec_item.png]".. - "item_image[2,6;3,2;testformspec:node]".. - "label[2,15;bla Bli\nfoo bar]".. - "item_image_button[2,3;1,1;testformspec:node;itemimagebutton;ItemImageButton]".. - "tooltip[0,11;3,2;Buz;#f00;#000]".. - "box[0,11;3,2;#00ff00]".. - "hypertext[3,13;3,3;;" .. hypertext_basic .. "]" .. - "container[0,18]".. - "box[1,2;3,2;#0a0a]".. - "scroll_container[1,2;3,2;scrbar2;horizontal;0.06]".. - "button[0,0;6,1;butnest;Nest]".. - "label[10,0.5;nest]".. - "scroll_container_end[]".. - "scrollbar[1,0;3.5,0.3;horizontal;scrbar2;0]".. - "container_end[]".. - "dropdown[0,6;2;hmdrpdwn;apple,bulb;1]".. - "image_button[0,4;2,2;testformspec_button_image.png;imagebutton;bbbbtt;false;true;testformspec_pressed.png]".. - "box[1,22.5;4,1;#a00a]".. - "scroll_container_end[]".. - "scrollbaroptions[max=170]".. -- lowest seen pos is: 0.1*170+6=23 (factor*max+height) - "scrollbar[7.5,0;0.3,4;vertical;scrbar;0]".. - "scrollbar[8,0;0.3,4;vertical;scrbarhmmm;0]".. - "dropdown[0,6;2;hmdrpdwnnn;Outside,of,container;1]" - ---style_type[label;textcolor=green] ---label[0,0;Green] ---style_type[label;textcolor=blue] ---label[0,1;Blue] ---style_type[label;textcolor=;border=true] ---label[1.2,0;Border] ---style_type[label;border=true;bgcolor=red] ---label[1.2,1;Background] ---style_type[label;border=;bgcolor=] ---label[0.75,2;Reset] - - -local pages = { - -- Real Coordinates - [[ - formspec_version[3] - size[12,13] - image_button[0,0;1,1;logo.png;rc_image_button_1x1;1x1] - image_button[1,0;2,2;logo.png;rc_image_button_2x2;2x2] - button[0,2;1,1;rc_button_1x1;1x1] - button[1,2;2,2;rc_button_2x2;2x2] - item_image[0,4;1,1;air] - item_image[1,4;2,2;air] - item_image_button[0,6;1,1;testformspec:node;rc_item_image_button_1x1;1x1] - item_image_button[1,6;2,2;testformspec:node;rc_item_image_button_2x2;2x2] - field[3,.5;3,.5;rc_field;Field;text] - pwdfield[6,.5;3,1;rc_pwdfield;Password Field] - field[3,1;3,1;;Read-Only Field;text] - textarea[3,2;3,.5;rc_textarea_small;Textarea;text] - textarea[6,2;3,2;rc_textarea_big;Textarea;text\nmore text] - textarea[3,3;3,1;;Read-Only Textarea;text\nmore text] - textlist[3,4;3,2;rc_textlist;Textlist,Perfect Coordinates;1;false] - tableoptions[highlight=#ABCDEF75;background=#00000055;border=false] - table[6,4;3,2;rc_table;Table,Cool Stuff,Foo,Bar;2] - dropdown[3,6;3,1;rc_dropdown_small;This,is,a,dropdown;1] - dropdown[6,6;3,2;rc_dropdown_big;I,am,a,bigger,dropdown;5] - image[0,8;3,2;ignore.png] - box[3,7;3,1;#00A3FF] - checkbox[3,8;rc_checkbox_1;Check me!;false] - checkbox[3,9;rc_checkbox_2;Uncheck me now!;true] - scrollbar[0,11.5;11.5,.5;horizontal;rc_scrollbar_horizontal;500] - scrollbar[11.5,0;.5,11.5;vertical;rc_scrollbar_vertical;0] - list[current_player;main;6,8;3,2;1] - button[9,0;2.5,1;rc_empty_button_1;] - button[9,1;2.5,1;rc_empty_button_2;] - button[9,2;2.5,1;rc_empty_button_3;] ]].. - "label[9,0.5;This is a label.\nLine\nLine\nLine\nEnd]".. - [[button[9,3;1,1;rc_empty_button_4;] - vertlabel[9,4;VERT] - label[10,3;HORIZ] - tabheader[8,0;6,0.65;rc_tabheader;Tab 1,Tab 2,Tab 3,Secrets;1;false;false] - ]], - -- Style - - "formspec_version[3]size[12,13]" .. - ("label[0.375,0.375;Styled - %s %s]"):format( - color("#F00", "red text"), - color("#77FF00CC", "green text")) .. - "label[6.375,0.375;Unstyled]" .. - "box[0,0.75;12,0.1;#999]" .. - "box[6,0.85;0.1,11.15;#999]" .. - "container[0.375,1.225]" .. - style_fs .. - "container_end[]container[6.375,1.225]" .. - style_fs:gsub("one_", "two_"):gsub("style%[[^%]]+%]", ""):gsub("style_type%[[^%]]+%]", "") .. - "container_end[]", - - -- Noclip - "formspec_version[3]size[12,13]" .. - "label[0.1,0.5;Clip]" .. - "container[-2.5,1]" .. clip_fs:gsub("%%c", "false") .. "container_end[]" .. - "label[11,0.5;Noclip]" .. - "container[11.5,1]" .. clip_fs:gsub("%%c", "true") .. "container_end[]", - - -- Hypertext - "size[12,13]real_coordinates[true]" .. - "container[0.5,0.5]" .. hypertext_fs .. "container_end[]", - - -- Tabheaders - "size[12,13]real_coordinates[true]" .. - "container[0.5,1.5]" .. tabheaders_fs .. "container_end[]", - - -- Animation - [[ - formspec_version[3] - size[12,13] - animated_image[0.5,0.5;1,1;;testformspec_animation.png;4;100] - animated_image[0.5,1.75;1,1;;testformspec_animation.jpg;4;100] - animated_image[1.75,0.5;1,1;;testformspec_animation.png;100;100] - animated_image[3,0.5;1,1;ani_img_1;testformspec_animation.png;4;1000] - button[4.25,0.5;1,1;ani_btn_1;Current -Number] - animated_image[3,1.75;1,1;ani_img_2;testformspec_animation.png;4;1000;2] - button[4.25,1.75;1,1;ani_btn_2;Current -Number] - animated_image[3,3;1,1;;testformspec_animation.png;4;0] - animated_image[3,4.25;1,1;;testformspec_animation.png;4;0;3] - animated_image[5.5,0.5;5,2;;testformspec_animation.png;4;100] - animated_image[5.5,2.75;5,2;;testformspec_animation.jpg;4;100] - ]], - - -- Scroll containers - "formspec_version[3]size[12,13]" .. - scroll_fs, -} - -local function show_test_formspec(pname, page_id) - page_id = page_id or 2 - - local fs = pages[page_id] .. "tabheader[0,0;8,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Anim,ScrollC;" .. page_id .. ";false;false]" - - minetest.show_formspec(pname, "testformspec:formspec", fs) -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "testformspec:formspec" then - return false - end - - - if fields.maintabs then - show_test_formspec(player:get_player_name(), tonumber(fields.maintabs)) - return true - end - - if fields.ani_img_1 and fields.ani_btn_1 then - minetest.chat_send_player(player:get_player_name(), "ani_img_1 = " .. tostring(fields.ani_img_1)) - return true - elseif fields.ani_img_2 and fields.ani_btn_2 then - minetest.chat_send_player(player:get_player_name(), "ani_img_2 = " .. tostring(fields.ani_img_2)) - return true - end - - if fields.hypertext then - minetest.chat_send_player(player:get_player_name(), "Hypertext action received: " .. tostring(fields.hypertext)) - return true - end -end) - -minetest.register_chatcommand("test_formspec", { - params = "", - description = "Open the test formspec", - func = function(name) - if not minetest.get_player_by_name(name) then - return false, "You need to be online!" - end - - show_test_formspec(name) - return true - end, -}) diff --git a/games/minimal/mods/testformspec/init.lua b/games/minimal/mods/testformspec/init.lua deleted file mode 100644 index 23b565f08..000000000 --- a/games/minimal/mods/testformspec/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -dofile(minetest.get_modpath("testformspec").."/dummy_items.lua") -dofile(minetest.get_modpath("testformspec").."/formspec.lua") -dofile(minetest.get_modpath("testformspec").."/callbacks.lua") diff --git a/games/minimal/mods/testformspec/mod.conf b/games/minimal/mods/testformspec/mod.conf deleted file mode 100644 index 00eac307a..000000000 --- a/games/minimal/mods/testformspec/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testformspec -description = Contains an example formspec to test all the features of formspecs diff --git a/games/minimal/mods/testformspec/textures/testformspec_animation.jpg b/games/minimal/mods/testformspec/textures/testformspec_animation.jpg deleted file mode 100644 index b98ca2677..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_animation.jpg and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_animation.png b/games/minimal/mods/testformspec/textures/testformspec_animation.png deleted file mode 100644 index b972e5dbb..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_animation.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg.png b/games/minimal/mods/testformspec/textures/testformspec_bg.png deleted file mode 100644 index cd1e50900..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png b/games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png deleted file mode 100644 index 34433ac82..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png b/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png deleted file mode 100644 index 01c2dc777..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png b/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png deleted file mode 100644 index 0cbac7536..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png b/games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png deleted file mode 100644 index 3ebbb988c..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png b/games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png deleted file mode 100644 index 2fb5fc21e..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_button_image.png b/games/minimal/mods/testformspec/textures/testformspec_button_image.png deleted file mode 100644 index 75c438a9a..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_button_image.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_hovered.png b/games/minimal/mods/testformspec/textures/testformspec_hovered.png deleted file mode 100644 index 3ccad30a2..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_hovered.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_item.png b/games/minimal/mods/testformspec/textures/testformspec_item.png deleted file mode 100644 index 4fd823b55..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_item.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_node.png b/games/minimal/mods/testformspec/textures/testformspec_node.png deleted file mode 100644 index c107f28a3..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_node.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_pressed.png b/games/minimal/mods/testformspec/textures/testformspec_pressed.png deleted file mode 100644 index 45c504f27..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_pressed.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/README.md b/games/minimal/mods/testnodes/README.md deleted file mode 100644 index 13ed972c0..000000000 --- a/games/minimal/mods/testnodes/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Test Nodes - -This mod contains a bunch of basic nodes to test development stuff. -Most nodes are kept as minimal as possible in order to show off one particular feature of the engine, to make testing stuff easier. - -This mod includes tests for: - -* drawtypes -* paramtype2's -* node properties such as damage, drowning, falling, etc. -* other random stuff diff --git a/games/minimal/mods/testnodes/drawtypes.lua b/games/minimal/mods/testnodes/drawtypes.lua deleted file mode 100644 index 35fda960f..000000000 --- a/games/minimal/mods/testnodes/drawtypes.lua +++ /dev/null @@ -1,517 +0,0 @@ ---[[ Drawtype Test: This file tests out and provides examples for -all drawtypes in Minetest. It is attempted to keep the node -definitions as simple and minimal as possible to keep -side-effects to a minimum. - -How to read the node definitions: -There are two parts which are separated by 2 newlines: -The first part contains the things that are more or less essential -for defining the drawtype (except description, which is -at the top for readability). -The second part (after the 2 newlines) contains stuff that are -unrelated to the drawtype, stuff that is mostly there to make -testing this node easier and more convenient. -]] - -local S = minetest.get_translator("testnodes") - --- If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. --- This is due to . --- This is only added to make the items more visible to avoid confusion, but you will no longer see --- the default inventory images for these items. When you want to test the default inventory image of drawtypes, --- this should be turned off. --- TODO: Remove support for fallback inventory image as soon #9209 is fixed. -local SHOW_FALLBACK_IMAGE = minetest.settings:get_bool("testnodes_show_fallback_image", false) - -local fallback_image = function(img) - if SHOW_FALLBACK_IMAGE then - return img - else - return nil - end -end - --- A regular cube -minetest.register_node("testnodes:normal", { - description = S("Normal Drawtype Test Node"), - drawtype = "normal", - tiles = { "testnodes_normal.png" }, - - groups = { dig_immediate = 3 }, -}) - --- Standard glasslike node -minetest.register_node("testnodes:glasslike", { - description = S("Glasslike Drawtype Test Node"), - drawtype = "glasslike", - paramtype = "light", - tiles = { "testnodes_glasslike.png" }, - - groups = { dig_immediate = 3 }, -}) - --- Glasslike framed with the two textures (normal and "detail") -minetest.register_node("testnodes:glasslike_framed", { - description = S("Glasslike Framed Drawtype Test Node"), - drawtype = "glasslike_framed", - paramtype = "light", - tiles = { - "testnodes_glasslike_framed.png", - "testnodes_glasslike_detail.png", - }, - - - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - --- Like the one above, but without the "detail" texture (texture 2). --- This node was added to see how the engine behaves when the "detail" texture --- is missing. -minetest.register_node("testnodes:glasslike_framed_no_detail", { - description = S("Glasslike Framed without Detail Drawtype Test Node"), - drawtype = "glasslike_framed", - paramtype = "light", - tiles = { "testnodes_glasslike_framed2.png" }, - - - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - - -minetest.register_node("testnodes:glasslike_framed_optional", { - description = S("Glasslike Framed Optional Drawtype Test Node"), - drawtype = "glasslike_framed_optional", - paramtype = "light", - tiles = { - "testnodes_glasslike_framed_optional.png", - "testnodes_glasslike_detail.png", - }, - - - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - - - -minetest.register_node("testnodes:allfaces", { - description = S("Allfaces Drawtype Test Node"), - drawtype = "allfaces", - paramtype = "light", - tiles = { "testnodes_allfaces.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:allfaces_optional", { - description = S("Allfaces Optional Drawtype Test Node"), - drawtype = "allfaces_optional", - paramtype = "light", - tiles = { "testnodes_allfaces_optional.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:allfaces_optional_waving", { - description = S("Waving Allfaces Optional Drawtype Test Node"), - drawtype = "allfaces_optional", - paramtype = "light", - tiles = { "testnodes_allfaces_optional.png^[brighten" }, - waving = 2, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:firelike", { - description = S("Firelike Drawtype Test Node"), - drawtype = "firelike", - paramtype = "light", - tiles = { "testnodes_firelike.png" }, - - - walkable = false, - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:fencelike", { - description = S("Fencelike Drawtype Test Node"), - drawtype = "fencelike", - paramtype = "light", - tiles = { "testnodes_fencelike.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:torchlike", { - description = S("Wallmounted Torchlike Drawtype Test Node"), - drawtype = "torchlike", - paramtype = "light", - paramtype2 = "wallmounted", - tiles = { - "testnodes_torchlike_floor.png", - "testnodes_torchlike_ceiling.png", - "testnodes_torchlike_wall.png", - }, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, - inventory_image = fallback_image("testnodes_torchlike_floor.png"), -}) - -minetest.register_node("testnodes:signlike", { - description = S("Wallmounted Signlike Drawtype Test Node"), - drawtype = "signlike", - paramtype = "light", - paramtype2 = "wallmounted", - tiles = { "testnodes_signlike.png" }, - - - walkable = false, - groups = { dig_immediate = 3 }, - sunlight_propagates = true, - inventory_image = fallback_image("testnodes_signlike.png"), -}) - -minetest.register_node("testnodes:plantlike", { - description = S("Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - tiles = { "testnodes_plantlike.png" }, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:plantlike_waving", { - description = S("Waving Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - tiles = { "testnodes_plantlike_waving.png" }, - waving = 1, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - - - --- param2 will rotate -minetest.register_node("testnodes:plantlike_degrotate", { - description = S("Degrotate Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - paramtype2 = "degrotate", - tiles = { "testnodes_plantlike_degrotate.png" }, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - --- param2 will change height -minetest.register_node("testnodes:plantlike_leveled", { - description = S("Leveled Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - paramtype2 = "leveled", - tiles = { - { name = "testnodes_plantlike_leveled.png", tileable_vertical = true }, - }, - - - -- We set a default param2 here only for convenience, to make the "plant" visible after placement - place_param2 = 8, - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - --- param2 changes shape -minetest.register_node("testnodes:plantlike_meshoptions", { - description = S("Meshoptions Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - paramtype2 = "meshoptions", - tiles = { "testnodes_plantlike_meshoptions.png" }, - - - walkable = false, - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:plantlike_rooted", { - description = S("Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - tiles = { "testnodes_plantlike_rooted_base.png" }, - special_tiles = { "testnodes_plantlike_rooted.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:plantlike_rooted_waving", { - description = S("Waving Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_waving.png", - }, - special_tiles = { "testnodes_plantlike_rooted_waving.png" }, - waving = 1, - - groups = { dig_immediate = 3 }, -}) - --- param2 changes height -minetest.register_node("testnodes:plantlike_rooted_leveled", { - description = S("Leveled Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - paramtype2 = "leveled", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_leveled.png", - }, - special_tiles = { - { name = "testnodes_plantlike_rooted_leveled.png", tileable_vertical = true }, - }, - - - -- We set a default param2 here only for convenience, to make the "plant" visible after placement - place_param2 = 8, - groups = { dig_immediate = 3 }, -}) - --- param2 changes shape -minetest.register_node("testnodes:plantlike_rooted_meshoptions", { - description = S("Meshoptions Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - paramtype2 = "meshoptions", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_meshoptions.png", - }, - special_tiles = { - "testnodes_plantlike_rooted_meshoptions.png", - }, - - groups = { dig_immediate = 3 }, -}) - --- param2 changes rotation -minetest.register_node("testnodes:plantlike_rooted_degrotate", { - description = S("Degrotate Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - paramtype2 = "degrotate", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_degrotate.png", - }, - special_tiles = { - "testnodes_plantlike_rooted_degrotate.png", - }, - - groups = { dig_immediate = 3 }, -}) - --- Demonstrative liquid nodes, source and flowing form. This is only the --- drawtype, no physical liquid properties are used -minetest.register_node("testnodes:liquid", { - description = S("Source Liquid Drawtype Test Node"), - drawtype = "liquid", - paramtype = "light", - tiles = { - "testnodes_liquidsource.png", - }, - special_tiles = { - {name="testnodes_liquidsource.png", backface_culling=false}, - {name="testnodes_liquidsource.png", backface_culling=true}, - }, - use_texture_alpha = true, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) -minetest.register_node("testnodes:liquid_flowing", { - description = S("Flowing Liquid Drawtype Test Node"), - drawtype = "flowingliquid", - paramtype = "light", - paramtype2 = "flowingliquid", - tiles = { - "testnodes_liquidflowing.png", - }, - special_tiles = { - {name="testnodes_liquidflowing.png", backface_culling=false}, - {name="testnodes_liquidflowing.png", backface_culling=false}, - }, - use_texture_alpha = true, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) -minetest.register_node("testnodes:liquid_waving", { - description = S("Waving Source Liquid Drawtype Test Node"), - drawtype = "liquid", - paramtype = "light", - tiles = { - "testnodes_liquidsource.png^[brighten", - }, - special_tiles = { - {name="testnodes_liquidsource.png^[brighten", backface_culling=false}, - {name="testnodes_liquidsource.png^[brighten", backface_culling=true}, - }, - use_texture_alpha = true, - waving = 3, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) -minetest.register_node("testnodes:liquid_flowing_waving", { - description = S("Waving Flowing Liquid Drawtype Test Node"), - drawtype = "flowingliquid", - paramtype = "light", - paramtype2 = "flowingliquid", - tiles = { - "testnodes_liquidflowing.png^[brighten", - }, - special_tiles = { - {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, - {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, - }, - use_texture_alpha = true, - waving = 3, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) - - - --- Invisible node -minetest.register_node("testnodes:airlike", { - description = S("Airlike Drawtype Test Node"), - drawtype = "airlike", - paramtype = "light", - - - walkable = false, - groups = { dig_immediate = 3 }, - sunlight_propagates = true, - inventory_image = fallback_image("testnodes_airlike.png"), -}) - --- param2 changes liquid height -minetest.register_node("testnodes:glassliquid", { - description = S("Glasslike Liquid Level Drawtype Test Node"), - drawtype = "glasslike_framed", - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - tiles = { - "testnodes_glasslikeliquid.png", - }, - special_tiles = { - "testnodes_liquid.png", - }, - - groups = { dig_immediate = 3 }, -}) - --- Adding many raillike examples, primarily to demonstrate the behavior of --- "raillike groups". Nodes of the same type (rail, groupless, line, street) --- should connect to nodes of the same "rail type" (=same shape, different --- color) only. -local rails = { - { "rail", {"testnodes_rail_straight.png", "testnodes_rail_curved.png", "testnodes_rail_t_junction.png", "testnodes_rail_crossing.png"} }, - { "line", {"testnodes_line_straight.png", "testnodes_line_curved.png", "testnodes_line_t_junction.png", "testnodes_line_crossing.png"}, }, - { "street", {"testnodes_street_straight.png", "testnodes_street_curved.png", "testnodes_street_t_junction.png", "testnodes_street_crossing.png"}, }, - -- the "groupless" nodes are nodes in which the "connect_to_raillike" group is not set - { "groupless", {"testnodes_rail2_straight.png", "testnodes_rail2_curved.png", "testnodes_rail2_t_junction.png", "testnodes_rail2_crossing.png"} }, -} -local colors = { "", "cyan", "red" } - -for r=1, #rails do - local id = rails[r][1] - local tiles = rails[r][2] - local raillike_group - if id ~= "groupless" then - raillike_group = minetest.raillike_group(id) - end - for c=1, #colors do - local color - if colors[c] ~= "" then - color = colors[c] - end - minetest.register_node("testnodes:raillike_"..id..c, { - description = S("Raillike Drawtype Test Node: @1 @2", id, c), - drawtype = "raillike", - paramtype = "light", - tiles = tiles, - groups = { connect_to_raillike = raillike_group, dig_immediate = 3 }, - - - color = color, - selection_box = { - type = "fixed", - fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}}, - }, - sunlight_propagates = true, - walkable = false, - }) - end -end - - - --- Add visual_scale variants of previous nodes for half and double size -local scale = function(subname, desc_double, desc_half) - local original = "testnodes:"..subname - local def = table.copy(minetest.registered_items[original]) - def.visual_scale = 2.0 - def.description = desc_double - minetest.register_node("testnodes:"..subname.."_double", def) - def = table.copy(minetest.registered_items[original]) - def.visual_scale = 0.5 - def.description = desc_half - minetest.register_node("testnodes:"..subname.."_half", def) -end - -scale("plantlike", - S("Double-sized Plantlike Drawtype Test Node"), - S("Half-sized Plantlike Drawtype Test Node")) -scale("torchlike", - S("Double-sized Wallmounted Torchlike Drawtype Test Node"), - S("Half-sized Wallmounted Torchlike Drawtype Test Node")) -scale("signlike", - S("Double-sized Wallmounted Signlike Drawtype Test Node"), - S("Half-sized Wallmounted Signlike Drawtype Test Node")) -scale("firelike", - S("Double-sized Firelike Drawtype Test Node"), - S("Half-sized Firelike Drawtype Test Node")) diff --git a/games/minimal/mods/testnodes/init.lua b/games/minimal/mods/testnodes/init.lua deleted file mode 100644 index 92e2c5630..000000000 --- a/games/minimal/mods/testnodes/init.lua +++ /dev/null @@ -1,10 +0,0 @@ -local path = minetest.get_modpath(minetest.get_current_modname()) - -dofile(path.."/drawtypes.lua") -dofile(path.."/meshes.lua") -dofile(path.."/nodeboxes.lua") -dofile(path.."/param2.lua") -dofile(path.."/properties.lua") -dofile(path.."/liquids.lua") -dofile(path.."/light.lua") -dofile(path.."/textures.lua") diff --git a/games/minimal/mods/testnodes/light.lua b/games/minimal/mods/testnodes/light.lua deleted file mode 100644 index 94409e83f..000000000 --- a/games/minimal/mods/testnodes/light.lua +++ /dev/null @@ -1,48 +0,0 @@ --- Test Nodes: Light test - -local S = minetest.get_translator("testnodes") - --- All possible light levels -for i=1, minetest.LIGHT_MAX do - minetest.register_node("testnodes:light"..i, { - description = S("Light Source (@1)", i), - paramtype = "light", - light_source = i, - - - tiles ={"testnodes_light_"..i..".png"}, - drawtype = "glasslike", - walkable = false, - sunlight_propagates = true, - is_ground_content = false, - groups = {dig_immediate=3}, - }) -end - --- Lets light through, but not sunlight, leading to a --- reduction in light level when light passes through -minetest.register_node("testnodes:sunlight_filter", { - description = S("Sunlight Filter"), - paramtype = "light", - - - drawtype = "glasslike", - tiles = { - "testnodes_sunlight_filter.png", - }, - groups = { dig_immediate = 3 }, -}) - --- Lets light and sunlight through without obstruction -minetest.register_node("testnodes:sunlight_propagator", { - description = S("Sunlight Propagator"), - paramtype = "light", - sunlight_propagates = true, - - - drawtype = "glasslike", - tiles = { - "testnodes_sunlight_filter.png^[brighten", - }, - groups = { dig_immediate = 3 }, -}) diff --git a/games/minimal/mods/testnodes/liquids.lua b/games/minimal/mods/testnodes/liquids.lua deleted file mode 100644 index e316782ad..000000000 --- a/games/minimal/mods/testnodes/liquids.lua +++ /dev/null @@ -1,91 +0,0 @@ --- Add liquids for ranges and viscosity levels 0-8 - -for d=0, 8 do - minetest.register_node("testnodes:rliquid_"..d, { - description = "Test Liquid Source, Range "..d, - drawtype = "liquid", - tiles = {"testnodes_liquidsource_r"..d..".png"}, - special_tiles = { - {name = "testnodes_liquidsource_r"..d..".png", backface_culling = false}, - {name = "testnodes_liquidsource_r"..d..".png", backface_culling = true}, - }, - alpha = 192, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "source", - liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, - liquid_alternative_source = "testnodes:rliquid_"..d, - liquid_range = d, - }) - - minetest.register_node("testnodes:rliquid_flowing_"..d, { - description = "Flowing Test Liquid, Range "..d, - drawtype = "flowingliquid", - tiles = {"testnodes_liquidflowing_r"..d..".png"}, - special_tiles = { - {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, - {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, - }, - alpha = 192, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "flowing", - liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, - liquid_alternative_source = "testnodes:rliquid_"..d, - liquid_range = d, - }) - - local mod = "^[colorize:#000000:127" - minetest.register_node("testnodes:vliquid_"..d, { - description = "Test Liquid Source, Viscosity "..d, - drawtype = "liquid", - tiles = {"testnodes_liquidsource_r"..d..".png"..mod}, - special_tiles = { - {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false}, - {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true}, - }, - alpha = 192, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "source", - liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, - liquid_alternative_source = "testnodes:vliquid_"..d, - liquid_viscosity = d, - }) - - minetest.register_node("testnodes:vliquid_flowing_"..d, { - description = "Flowing Test Liquid, Viscosity "..d, - drawtype = "flowingliquid", - tiles = {"testnodes_liquidflowing_r"..d..".png"..mod}, - special_tiles = { - {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, - {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, - }, - alpha = 192, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "flowing", - liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, - liquid_alternative_source = "testnodes:vliquid_"..d, - liquid_viscosity = d, - }) - -end diff --git a/games/minimal/mods/testnodes/meshes.lua b/games/minimal/mods/testnodes/meshes.lua deleted file mode 100644 index 900abc180..000000000 --- a/games/minimal/mods/testnodes/meshes.lua +++ /dev/null @@ -1,145 +0,0 @@ --- Meshes - -local S = minetest.get_translator("testnodes") - -local ocorner_cbox = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - {-0.5, -0.25, -0.25, 0.25, 0, 0.5}, - {-0.5, 0, 0, 0, 0.25, 0.5}, - {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5} - } -} - -local tall_pyr_cbox = { - type = "fixed", - fixed = { - { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, - { -0.375, -0.25, -0.375, 0.375, 0, 0.375}, - { -0.25, 0, -0.25, 0.25, 0.25, 0.25}, - { -0.125, 0.25, -0.125, 0.125, 0.5, 0.125} - } -} - --- Normal mesh -minetest.register_node("testnodes:mesh", { - description = S("Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - - groups = {dig_immediate=3}, -}) - --- Facedir mesh: outer corner slope -minetest.register_node("testnodes:mesh_facedir", { - description = S("Facedir Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_ocorner.obj", - tiles = {"testnodes_mesh_stripes.png"}, - paramtype = "light", - paramtype2 = "facedir", - collision_box = ocorner_cbox, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:mesh_colorfacedir", { - description = S("Color Facedir Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_ocorner.obj", - tiles = {"testnodes_mesh_stripes3.png"}, - paramtype = "light", - paramtype2 = "colorfacedir", - palette = "testnodes_palette_facedir.png", - collision_box = ocorner_cbox, - - groups = {dig_immediate=3}, -}) - --- Wallmounted mesh: pyramid -minetest.register_node("testnodes:mesh_wallmounted", { - description = S("Wallmounted Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - paramtype2 = "wallmounted", - collision_box = tall_pyr_cbox, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:mesh_colorwallmounted", { - description = S("Color Wallmounted Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes3.png"}, - paramtype = "light", - paramtype2 = "colorwallmounted", - palette = "testnodes_palette_wallmounted.png", - collision_box = tall_pyr_cbox, - - groups = {dig_immediate=3}, -}) - - -minetest.register_node("testnodes:mesh_double", { - description = S("Double-sized Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - visual_scale = 2, - - groups = {dig_immediate=3}, -}) -minetest.register_node("testnodes:mesh_half", { - description = S("Half-sized Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - visual_scale = 0.5, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:mesh_waving1", { - description = S("Plantlike-waving Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0FFB0"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - waving = 1, - - groups = {dig_immediate=3}, -}) -minetest.register_node("testnodes:mesh_waving2", { - description = S("Leaflike-waving Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes4.png^[multiply:#FFFFB0"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - waving = 2, - - groups = {dig_immediate=3}, -}) -minetest.register_node("testnodes:mesh_waving3", { - description = S("Liquidlike-waving Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0B0FF"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - waving = 3, - - groups = {dig_immediate=3}, -}) diff --git a/games/minimal/mods/testnodes/mod.conf b/games/minimal/mods/testnodes/mod.conf deleted file mode 100644 index 4824c6ed0..000000000 --- a/games/minimal/mods/testnodes/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testnodes -description = Contains a bunch of basic example nodes for demonstrative purposes, development and testing diff --git a/games/minimal/mods/testnodes/models/testnodes_ocorner.obj b/games/minimal/mods/testnodes/models/testnodes_ocorner.obj deleted file mode 100644 index 231d7056b..000000000 --- a/games/minimal/mods/testnodes/models/testnodes_ocorner.obj +++ /dev/null @@ -1,23 +0,0 @@ -# Blender v2.73 (sub 0) OBJ File: 'slope_test_ocorner_onetexture.blend' -# www.blender.org -o Cube_Cube.002 -v 0.500000 0.500000 0.500000 -v -0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 -0.500000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.000000 -vt 1.000000 0.000000 -vn 0.000000 -1.000000 -0.000000 -vn 1.000000 0.000000 0.000000 -vn 0.000000 -0.000000 1.000000 -vn -0.707100 0.707100 0.000000 -vn 0.000000 0.707100 -0.707100 -s off -f 3/1/1 2/2/1 4/3/1 5/4/1 -f 1/2/2 3/3/2 5/4/2 -f 1/1/3 2/3/3 3/4/3 -f 1/1/4 4/3/4 2/4/4 -f 1/2/5 5/3/5 4/4/5 diff --git a/games/minimal/mods/testnodes/models/testnodes_pyramid.obj b/games/minimal/mods/testnodes/models/testnodes_pyramid.obj deleted file mode 100644 index b305af2f8..000000000 --- a/games/minimal/mods/testnodes/models/testnodes_pyramid.obj +++ /dev/null @@ -1,24 +0,0 @@ -# Blender v2.73 (sub 0) OBJ File: 'slope_test_pyramid_onetexture.blend' -# www.blender.org -o Cube -v 0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v -0.000000 0.500000 -0.000000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.000000 -vt 1.000000 0.000000 -vt 0.500000 1.000000 -vn 0.000000 -1.000000 0.000000 -vn -0.894400 0.447200 -0.000000 -vn 0.000000 0.447200 -0.894400 -vn 0.894400 0.447200 0.000000 -vn -0.000000 0.447200 0.894400 -s off -f 1/1/1 2/2/1 3/3/1 4/4/1 -f 3/4/2 5/5/2 4/3/2 -f 5/5/3 1/3/3 4/4/3 -f 1/4/4 5/5/4 2/3/4 -f 2/4/5 5/5/5 3/3/5 diff --git a/games/minimal/mods/testnodes/nodeboxes.lua b/games/minimal/mods/testnodes/nodeboxes.lua deleted file mode 100644 index ebd858337..000000000 --- a/games/minimal/mods/testnodes/nodeboxes.lua +++ /dev/null @@ -1,80 +0,0 @@ -local S = minetest.get_translator("testnodes") - --- Nodebox examples and tests. - --- An simple example nodebox with one centered box -minetest.register_node("testnodes:nodebox_fixed", { - description = S("Fixed Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - node_box = { - type = "fixed", - fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, - }, - - groups = {dig_immediate=3}, -}) - --- 50% higher than a regular node -minetest.register_node("testnodes:nodebox_overhigh", { - description = S("Overhigh Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5}, - }, - - groups = {dig_immediate=3}, -}) - --- 100% higher than a regular node -minetest.register_node("testnodes:nodebox_overhigh2", { - description = S("Double-height Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}, - }, - - groups = {dig_immediate=3}, -}) - --- Height of nodebox changes with its param2 value -minetest.register_node("testnodes:nodebox_leveled", { - description = S("Leveled Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "leveled", - node_box = { - type = "leveled", - fixed = {-0.5, 0.0, -0.5, 0.5, -0.499, 0.5}, - }, - - groups = {dig_immediate=3}, -}) - --- Wall-like nodebox that connects to neighbors -minetest.register_node("testnodes:nodebox_connected", { - description = S("Connected Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - groups = {connected_nodebox=1, dig_immediate=3}, - drawtype = "nodebox", - paramtype = "light", - connects_to = {"group:connected_nodebox"}, - connect_sides = {"front", "back", "left", "right"}, - node_box = { - type = "connected", - fixed = {-0.125, -0.500, -0.125, 0.125, 0.500, 0.125}, - connect_front = {-0.125, -0.500, -0.500, 0.125, 0.400, -0.125}, - connect_back = {-0.125, -0.500, 0.125, 0.125, 0.400, 0.500}, - connect_left = {-0.500, -0.500, -0.125, -0.125, 0.400, 0.125}, - connect_right = {0.125, -0.500, -0.125, 0.500, 0.400, 0.125}, - }, -}) - diff --git a/games/minimal/mods/testnodes/param2.lua b/games/minimal/mods/testnodes/param2.lua deleted file mode 100644 index 5d64376fa..000000000 --- a/games/minimal/mods/testnodes/param2.lua +++ /dev/null @@ -1,168 +0,0 @@ --- This file is for misc. param2 tests that aren't covered in drawtypes.lua already. - -local S = minetest.get_translator("testnodes") - -minetest.register_node("testnodes:facedir", { - description = S("Facedir Test Node"), - paramtype2 = "facedir", - tiles = { - "testnodes_1.png", - "testnodes_2.png", - "testnodes_3.png", - "testnodes_4.png", - "testnodes_5.png", - "testnodes_6.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:facedir_nodebox", { - description = S("Facedir Nodebox Test Node"), - tiles = { - "testnodes_1.png", - "testnodes_2.png", - "testnodes_3.png", - "testnodes_4.png", - "testnodes_5.png", - "testnodes_6.png", - }, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, - }, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:wallmounted", { - description = S("Wallmounted Test Node"), - paramtype2 = "wallmounted", - tiles = { - "testnodes_1w.png", - "testnodes_2w.png", - "testnodes_3w.png", - "testnodes_4w.png", - "testnodes_5w.png", - "testnodes_6w.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:wallmounted_nodebox", { - description = S("Wallmounted Nodebox Test Node"), - paramtype2 = "wallmounted", - paramtype = "light", - tiles = { - "testnodes_1w.png", - "testnodes_2w.png", - "testnodes_3w.png", - "testnodes_4w.png", - "testnodes_5w.png", - "testnodes_6w.png", - }, - drawtype = "nodebox", - node_box = { - type = "wallmounted", - wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, - wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, - wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:color", { - description = S("Color Test Node"), - paramtype2 = "color", - palette = "testnodes_palette_full.png", - tiles = { - "testnodes_node.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:colorfacedir", { - description = S("Color Facedir Test Node"), - paramtype2 = "colorfacedir", - palette = "testnodes_palette_facedir.png", - tiles = { - "testnodes_1g.png", - "testnodes_2g.png", - "testnodes_3g.png", - "testnodes_4g.png", - "testnodes_5g.png", - "testnodes_6g.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:colorfacedir_nodebox", { - description = S("Color Facedir Nodebox Test Node"), - tiles = { - "testnodes_1g.png", - "testnodes_2g.png", - "testnodes_3g.png", - "testnodes_4g.png", - "testnodes_5g.png", - "testnodes_6g.png", - }, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "colorfacedir", - palette = "testnodes_palette_facedir.png", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, - }, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:colorwallmounted", { - description = S("Color Wallmounted Test Node"), - paramtype2 = "colorwallmounted", - paramtype = "light", - palette = "testnodes_palette_wallmounted.png", - tiles = { - "testnodes_1wg.png", - "testnodes_2wg.png", - "testnodes_3wg.png", - "testnodes_4wg.png", - "testnodes_5wg.png", - "testnodes_6wg.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:colorwallmounted_nodebox", { - description = S("Color Wallmounted Nodebox Test Node"), - paramtype2 = "colorwallmounted", - paramtype = "light", - palette = "testnodes_palette_wallmounted.png", - tiles = { - "testnodes_1wg.png", - "testnodes_2wg.png", - "testnodes_3wg.png", - "testnodes_4wg.png", - "testnodes_5wg.png", - "testnodes_6wg.png", - }, - drawtype = "nodebox", - node_box = { - type = "wallmounted", - wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, - wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, - wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, - }, - - groups = { dig_immediate = 3 }, -}) - diff --git a/games/minimal/mods/testnodes/properties.lua b/games/minimal/mods/testnodes/properties.lua deleted file mode 100644 index e169d4b08..000000000 --- a/games/minimal/mods/testnodes/properties.lua +++ /dev/null @@ -1,270 +0,0 @@ --- Test Nodes: Node property tests - -local S = minetest.get_translator("testnodes") - --- Is supposed to fall when it doesn't rest on solid ground -minetest.register_node("testnodes:falling", { - description = S("Falling Node"), - tiles = { - "testnodes_node.png", - "testnodes_node.png", - "testnodes_node_falling.png", - }, - groups = { falling_node = 1, dig_immediate = 3 }, -}) - --- Same as falling node, but will stop falling on top of liquids -minetest.register_node("testnodes:falling_float", { - description = S("Falling+Floating Node"), - groups = { falling_node = 1, float = 1, dig_immediate = 3 }, - - - tiles = { - "testnodes_node.png", - "testnodes_node.png", - "testnodes_node_falling.png", - }, - color = "cyan", -}) - --- This node attaches to the floor and drops as item --- when the floor is gone. -minetest.register_node("testnodes:attached", { - description = S("Floor-Attached Node"), - tiles = { - "testnodes_attached_top.png", - "testnodes_attached_bottom.png", - "testnodes_attached_side.png", - }, - groups = { attached_node = 1, dig_immediate = 3 }, -}) - --- This node attaches to the side of a node and drops as item --- when the node it attaches to is gone. -minetest.register_node("testnodes:attached_wallmounted", { - description = S("Wallmounted Attached Node"), - paramtype2 = "wallmounted", - tiles = { - "testnodes_attachedw_top.png", - "testnodes_attachedw_bottom.png", - "testnodes_attachedw_side.png", - }, - groups = { attached_node = 1, dig_immediate = 3 }, -}) - --- Jump disabled -minetest.register_node("testnodes:nojump", { - description = S("Non-jumping Node"), - groups = {disable_jump=1, dig_immediate=3}, - - - tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"}, -}) - --- Climbable up and down with jump and sneak keys -minetest.register_node("testnodes:climbable", { - description = S("Climbable Node"), - climbable = true, - walkable = false, - - - paramtype = "light", - sunlight_propagates = true, - is_ground_content = false, - tiles ={"testnodes_climbable_side.png"}, - drawtype = "glasslike", - groups = {dig_immediate=3}, -}) - --- Climbable only downwards with sneak key -minetest.register_node("testnodes:climbable_nojump", { - description = S("Downwards-climbable Node"), - climbable = true, - walkable = false, - - groups = {disable_jump=1, dig_immediate=3}, - drawtype = "glasslike", - tiles ={"testnodes_climbable_nojump_side.png"}, - paramtype = "light", - sunlight_propagates = true, -}) - --- A liquid in which you can't rise -minetest.register_node("testnodes:liquid_nojump", { - description = S("Non-jumping Liquid Source Node"), - liquidtype = "source", - liquid_range = 1, - liquid_viscosity = 0, - liquid_alternative_flowing = "testnodes:liquidflowing_nojump", - liquid_alternative_source = "testnodes:liquid_nojump", - liquid_renewable = false, - groups = {disable_jump=1, dig_immediate=3}, - walkable = false, - - drawtype = "liquid", - tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"}, - special_tiles = { - {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false}, - {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true}, - }, - use_texture_alpha = true, - paramtype = "light", - pointable = false, - liquids_pointable = true, - diggable = false, - buildable_to = true, - is_ground_content = false, - post_effect_color = {a = 70, r = 255, g = 0, b = 200}, -}) - --- A liquid in which you can't rise (flowing variant) -minetest.register_node("testnodes:liquidflowing_nojump", { - description = S("Non-jumping Flowing Liquid Node"), - liquidtype = "flowing", - liquid_range = 1, - liquid_viscosity = 0, - liquid_alternative_flowing = "testnodes:liquidflowing_nojump", - liquid_alternative_source = "testnodes:liquid_nojump", - liquid_renewable = false, - groups = {disable_jump=1, dig_immediate=3}, - walkable = false, - - - drawtype = "flowingliquid", - tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"}, - special_tiles = { - {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, - {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, - }, - use_texture_alpha = true, - paramtype = "light", - paramtype2 = "flowingliquid", - pointable = false, - liquids_pointable = true, - diggable = false, - buildable_to = true, - is_ground_content = false, - post_effect_color = {a = 70, r = 255, g = 0, b = 200}, -}) - --- Nodes that modify fall damage (various damage modifiers) -for i=-100, 100, 25 do - if i ~= 0 then - local subname, descnum - if i < 0 then - subname = "m"..math.abs(i) - descnum = tostring(i) - else - subname = tostring(i) - descnum = S("+@1", i) - end - local tex, color, desc - if i > 0 then - local val = math.floor((i/100)*255) - tex = "testnodes_fall_damage_plus.png" - color = { b=0, g=255-val, r=255, a=255 } - desc = S("Fall Damage Node (+@1%)", i) - else - tex = "testnodes_fall_damage_minus.png" - if i == -100 then - color = { r=0, b=0, g=255, a=255 } - else - local val = math.floor((math.abs(i)/100)*255) - color = { r=0, b=255, g=255-val, a=255 } - end - desc = S("Fall Damage Node (-@1%)", math.abs(i)) - end - minetest.register_node("testnodes:damage"..subname, { - description = desc, - groups = {fall_damage_add_percent=i, dig_immediate=3}, - - - tiles = { tex }, - is_ground_content = false, - color = color, - }) - end -end - --- Bouncy nodes (various bounce levels) -for i=20, 180, 20 do - local val = math.floor(((i-20)/200)*255) - minetest.register_node("testnodes:bouncy"..i, { - description = S("Bouncy Node (@1%)", i), - groups = {bouncy=i, dig_immediate=3}, - - - tiles ={"testnodes_bouncy.png"}, - is_ground_content = false, - color = { r=255, g=255-val, b=val, a=255 }, - }) -end - --- Slippery nodes (various slippery levels) -for i=1, 5 do - minetest.register_node("testnodes:slippery"..i, { - description = S("Slippery Node (@1)", i), - tiles ={"testnodes_slippery.png"}, - is_ground_content = false, - groups = {slippery=i, dig_immediate=3}, - color = { r=0, g=255, b=math.floor((i/5)*255), a=255 }, - }) -end - --- By placing something on the node, the node itself will be replaced -minetest.register_node("testnodes:buildable_to", { - description = S("Replacable Node"), - buildable_to = true, - tiles = {"testnodes_buildable_to.png"}, - is_ground_content = false, - groups = {dig_immediate=3}, -}) - --- Nodes that deal damage to players that are inside them. --- Negative damage nodes should heal. -for d=-3,3 do - if d ~= 0 then - local sub, tile - if d > 0 then - sub = tostring(d) - tile = "testnodes_damage.png" - else - sub = "m" .. tostring(math.abs(d)) - tile = "testnodes_damage_neg.png" - end - if math.abs(d) == 2 then - tile = tile .. "^[colorize:#000000:70" - elseif math.abs(d) == 3 then - tile = tile .. "^[colorize:#000000:140" - end - minetest.register_node("testnodes:damage_"..sub, { - description = S("Damage Node (@1 damage per second)", d), - damage_per_second = d, - - - walkable = false, - is_ground_content = false, - drawtype = "allfaces", - paramtype = "light", - sunlight_propagates = true, - tiles = { tile }, - groups = {dig_immediate=3}, - }) - end -end - --- Causes drowning damage -minetest.register_node("testnodes:drowning_1", { - description = S("Drowning Node (@1 damage)", 1), - drowning = 1, - - - walkable = false, - is_ground_content = false, - drawtype = "allfaces", - paramtype = "light", - sunlight_propagates = true, - tiles = { "testnodes_drowning.png" }, - groups = {dig_immediate=3}, -}) - diff --git a/games/minimal/mods/testnodes/settingtypes.txt b/games/minimal/mods/testnodes/settingtypes.txt deleted file mode 100644 index 7f753bf3e..000000000 --- a/games/minimal/mods/testnodes/settingtypes.txt +++ /dev/null @@ -1,4 +0,0 @@ -# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. -# This is due to . -# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. -testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/games/minimal/mods/testnodes/textures.lua b/games/minimal/mods/testnodes/textures.lua deleted file mode 100644 index f5db9ccbf..000000000 --- a/games/minimal/mods/testnodes/textures.lua +++ /dev/null @@ -1,67 +0,0 @@ --- Node texture tests - -local S = minetest.get_translator("testnodes") - -minetest.register_node("testnodes:6sides", { - description = S("Six Textures Test Node"), - tiles = { - "testnodes_normal1.png", - "testnodes_normal2.png", - "testnodes_normal3.png", - "testnodes_normal4.png", - "testnodes_normal5.png", - "testnodes_normal6.png", - }, - - groups = { dig_immediate = 2 }, -}) - -minetest.register_node("testnodes:anim", { - description = S("Animated Test Node"), - tiles = { - { name = "testnodes_anim.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 4.0, - }, }, - }, - - groups = { dig_immediate = 2 }, -}) - --- Node texture transparency test - -local alphas = { 64, 128, 191 } - -for a=1,#alphas do - local alpha = alphas[a] - - -- Transparency taken from texture - minetest.register_node("testnodes:alpha_texture_"..alpha, { - description = S("Texture Alpha Test Node (@1)", alpha), - drawtype = "glasslike", - paramtype = "light", - tiles = { - "testnodes_alpha"..alpha..".png", - }, - use_texture_alpha = true, - - groups = { dig_immediate = 3 }, - }) - - -- Transparency set via "alpha" parameter - minetest.register_node("testnodes:alpha_"..alpha, { - description = S("Alpha Test Node (@1)", alpha), - -- It seems that only the liquid drawtype supports the alpha parameter - drawtype = "liquid", - paramtype = "light", - tiles = { - "testnodes_alpha.png", - }, - alpha = alpha, - - groups = { dig_immediate = 3 }, - }) -end diff --git a/games/minimal/mods/testnodes/textures/testnodes_1.png b/games/minimal/mods/testnodes/textures/testnodes_1.png deleted file mode 100644 index 6730997e2..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_1g.png b/games/minimal/mods/testnodes/textures/testnodes_1g.png deleted file mode 100644 index 529298ece..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_1w.png b/games/minimal/mods/testnodes/textures/testnodes_1w.png deleted file mode 100644 index d24e571cc..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_1wg.png b/games/minimal/mods/testnodes/textures/testnodes_1wg.png deleted file mode 100644 index b2eba0e9a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2.png b/games/minimal/mods/testnodes/textures/testnodes_2.png deleted file mode 100644 index 6c87c868d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2g.png b/games/minimal/mods/testnodes/textures/testnodes_2g.png deleted file mode 100644 index cb9060f7b..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2w.png b/games/minimal/mods/testnodes/textures/testnodes_2w.png deleted file mode 100644 index b56874ee1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2wg.png b/games/minimal/mods/testnodes/textures/testnodes_2wg.png deleted file mode 100644 index 108dc87bb..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3.png b/games/minimal/mods/testnodes/textures/testnodes_3.png deleted file mode 100644 index 05b45629a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3g.png b/games/minimal/mods/testnodes/textures/testnodes_3g.png deleted file mode 100644 index 5c84f5882..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3w.png b/games/minimal/mods/testnodes/textures/testnodes_3w.png deleted file mode 100644 index 8b435cf01..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3wg.png b/games/minimal/mods/testnodes/textures/testnodes_3wg.png deleted file mode 100644 index 9ee900667..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4.png b/games/minimal/mods/testnodes/textures/testnodes_4.png deleted file mode 100644 index 15e6ffec7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4g.png b/games/minimal/mods/testnodes/textures/testnodes_4g.png deleted file mode 100644 index 8f144fae0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4w.png b/games/minimal/mods/testnodes/textures/testnodes_4w.png deleted file mode 100644 index 214e0df9d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4wg.png b/games/minimal/mods/testnodes/textures/testnodes_4wg.png deleted file mode 100644 index 888b3d482..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5.png b/games/minimal/mods/testnodes/textures/testnodes_5.png deleted file mode 100644 index 1ef1c728c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5g.png b/games/minimal/mods/testnodes/textures/testnodes_5g.png deleted file mode 100644 index 30da4793a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5w.png b/games/minimal/mods/testnodes/textures/testnodes_5w.png deleted file mode 100644 index b4cb42426..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5wg.png b/games/minimal/mods/testnodes/textures/testnodes_5wg.png deleted file mode 100644 index fac9db28e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6.png b/games/minimal/mods/testnodes/textures/testnodes_6.png deleted file mode 100644 index 805813e57..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6g.png b/games/minimal/mods/testnodes/textures/testnodes_6g.png deleted file mode 100644 index a88f4c9f8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6w.png b/games/minimal/mods/testnodes/textures/testnodes_6w.png deleted file mode 100644 index e6bbf97d9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6wg.png b/games/minimal/mods/testnodes/textures/testnodes_6wg.png deleted file mode 100644 index 29ca933e0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_airlike.png b/games/minimal/mods/testnodes/textures/testnodes_airlike.png deleted file mode 100644 index 5a5664a2a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_airlike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_allfaces.png b/games/minimal/mods/testnodes/textures/testnodes_allfaces.png deleted file mode 100644 index c0a7dc550..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_allfaces.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png b/games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png deleted file mode 100644 index 1f6a17313..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha.png b/games/minimal/mods/testnodes/textures/testnodes_alpha.png deleted file mode 100644 index 157fa7386..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha128.png b/games/minimal/mods/testnodes/textures/testnodes_alpha128.png deleted file mode 100644 index 16babf6c7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha128.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha191.png b/games/minimal/mods/testnodes/textures/testnodes_alpha191.png deleted file mode 100644 index f165d2887..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha191.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha64.png b/games/minimal/mods/testnodes/textures/testnodes_alpha64.png deleted file mode 100644 index c343c32c3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha64.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_anim.png b/games/minimal/mods/testnodes/textures/testnodes_anim.png deleted file mode 100644 index d321fe857..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_anim.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png b/games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png deleted file mode 100644 index e01ae576f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attached_side.png b/games/minimal/mods/testnodes/textures/testnodes_attached_side.png deleted file mode 100644 index 9459cbb05..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attached_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attached_top.png b/games/minimal/mods/testnodes/textures/testnodes_attached_top.png deleted file mode 100644 index 0148b41e0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attached_top.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png b/games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png deleted file mode 100644 index 488ad23a9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png b/games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png deleted file mode 100644 index a02facbc7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png b/games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png deleted file mode 100644 index 1f4fc7b85..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_bouncy.png b/games/minimal/mods/testnodes/textures/testnodes_bouncy.png deleted file mode 100644 index eabbbdfe4..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_bouncy.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_buildable_to.png b/games/minimal/mods/testnodes/textures/testnodes_buildable_to.png deleted file mode 100644 index 23b5e54d2..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_buildable_to.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png b/games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png deleted file mode 100644 index d5ca13033..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_climbable_side.png b/games/minimal/mods/testnodes/textures/testnodes_climbable_side.png deleted file mode 100644 index c56ea90d7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_climbable_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_damage.png b/games/minimal/mods/testnodes/textures/testnodes_damage.png deleted file mode 100644 index 9de2ab5e8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_damage.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_damage_neg.png b/games/minimal/mods/testnodes/textures/testnodes_damage_neg.png deleted file mode 100644 index 85811bc8e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_damage_neg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_drowning.png b/games/minimal/mods/testnodes/textures/testnodes_drowning.png deleted file mode 100644 index 57ffc8fcf..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_drowning.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png b/games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png deleted file mode 100644 index 88d3bdf58..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png b/games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png deleted file mode 100644 index 61fdec2e3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_fencelike.png b/games/minimal/mods/testnodes/textures/testnodes_fencelike.png deleted file mode 100644 index 84dea1b7c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_fencelike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_firelike.png b/games/minimal/mods/testnodes/textures/testnodes_firelike.png deleted file mode 100644 index ee59b0db1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_firelike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike.png deleted file mode 100644 index cf3e35414..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png deleted file mode 100644 index 30c9586e8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png deleted file mode 100644 index 8a513f21c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png deleted file mode 100644 index 4ea839c8b..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png deleted file mode 100644 index 37de77dd1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png b/games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png deleted file mode 100644 index e1e96ffb9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light.png b/games/minimal/mods/testnodes/textures/testnodes_light.png deleted file mode 100644 index 4ba0081c3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_1.png b/games/minimal/mods/testnodes/textures/testnodes_light_1.png deleted file mode 100644 index 57adf5a4a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_10.png b/games/minimal/mods/testnodes/textures/testnodes_light_10.png deleted file mode 100644 index 483834770..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_10.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_11.png b/games/minimal/mods/testnodes/textures/testnodes_light_11.png deleted file mode 100644 index 4c423d9b4..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_11.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_12.png b/games/minimal/mods/testnodes/textures/testnodes_light_12.png deleted file mode 100644 index bc7946d09..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_12.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_13.png b/games/minimal/mods/testnodes/textures/testnodes_light_13.png deleted file mode 100644 index 0b63c84a6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_13.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_14.png b/games/minimal/mods/testnodes/textures/testnodes_light_14.png deleted file mode 100644 index a817bd394..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_14.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_2.png b/games/minimal/mods/testnodes/textures/testnodes_light_2.png deleted file mode 100644 index 852eaeff1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_3.png b/games/minimal/mods/testnodes/textures/testnodes_light_3.png deleted file mode 100644 index 79fc834cc..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_4.png b/games/minimal/mods/testnodes/textures/testnodes_light_4.png deleted file mode 100644 index 75f8c6136..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_5.png b/games/minimal/mods/testnodes/textures/testnodes_light_5.png deleted file mode 100644 index b6eede0ae..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_6.png b/games/minimal/mods/testnodes/textures/testnodes_light_6.png deleted file mode 100644 index ef54addec..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_7.png b/games/minimal/mods/testnodes/textures/testnodes_light_7.png deleted file mode 100644 index 4a885b0f6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_7.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_8.png b/games/minimal/mods/testnodes/textures/testnodes_light_8.png deleted file mode 100644 index b283301e3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_8.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_9.png b/games/minimal/mods/testnodes/textures/testnodes_light_9.png deleted file mode 100644 index 2aa902358..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_9.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_line_crossing.png deleted file mode 100644 index e566f2793..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_curved.png b/games/minimal/mods/testnodes/textures/testnodes_line_curved.png deleted file mode 100644 index ab9f8e720..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_straight.png b/games/minimal/mods/testnodes/textures/testnodes_line_straight.png deleted file mode 100644 index 4f33d9c6d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png deleted file mode 100644 index 5668f6ea3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquid.png b/games/minimal/mods/testnodes/textures/testnodes_liquid.png deleted file mode 100644 index 98ab270c2..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquid.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png deleted file mode 100644 index 1736b89ba..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png deleted file mode 100644 index e8a61039d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png deleted file mode 100644 index b4e45b42f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png deleted file mode 100644 index e064b8f2d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png deleted file mode 100644 index bef773968..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png deleted file mode 100644 index de1001b2d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png deleted file mode 100644 index 97b422e9a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png deleted file mode 100644 index 4cd8e4e8e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png deleted file mode 100644 index 711dd961c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png deleted file mode 100644 index 9cf22b8ca..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource.png deleted file mode 100644 index b3f29b702..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png deleted file mode 100644 index da0a99623..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png deleted file mode 100644 index 66bf2be8f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png deleted file mode 100644 index fc5f65cb6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png deleted file mode 100644 index 0f46e291e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png deleted file mode 100644 index 0693a04d7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png deleted file mode 100644 index cc9d03992..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png deleted file mode 100644 index e276a07ae..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png deleted file mode 100644 index 3534a4b15..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png deleted file mode 100644 index ee1a8b169..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png deleted file mode 100644 index 51b8e0025..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png deleted file mode 100644 index 9ea65c1ec..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png deleted file mode 100644 index 96bc55ac5..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png deleted file mode 100644 index fca33727d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_node.png b/games/minimal/mods/testnodes/textures/testnodes_node.png deleted file mode 100644 index 145099b3a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_node.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_node_falling.png b/games/minimal/mods/testnodes/textures/testnodes_node_falling.png deleted file mode 100644 index 44153185c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_node_falling.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_nodebox.png b/games/minimal/mods/testnodes/textures/testnodes_nodebox.png deleted file mode 100644 index 66e8dd663..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_nodebox.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_nojump_side.png b/games/minimal/mods/testnodes/textures/testnodes_nojump_side.png deleted file mode 100644 index 6a64cfff0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_nojump_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_nojump_top.png b/games/minimal/mods/testnodes/textures/testnodes_nojump_top.png deleted file mode 100644 index fe770838f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_nojump_top.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal.png b/games/minimal/mods/testnodes/textures/testnodes_normal.png deleted file mode 100644 index a1acfd9fd..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal1.png b/games/minimal/mods/testnodes/textures/testnodes_normal1.png deleted file mode 100644 index edaba77e4..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal2.png b/games/minimal/mods/testnodes/textures/testnodes_normal2.png deleted file mode 100644 index 0080a9ee7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal3.png b/games/minimal/mods/testnodes/textures/testnodes_normal3.png deleted file mode 100644 index 0426ab216..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal4.png b/games/minimal/mods/testnodes/textures/testnodes_normal4.png deleted file mode 100644 index 0d1922eb6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal5.png b/games/minimal/mods/testnodes/textures/testnodes_normal5.png deleted file mode 100644 index 0b7dcd2da..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal6.png b/games/minimal/mods/testnodes/textures/testnodes_normal6.png deleted file mode 100644 index f34a67d71..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png b/games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png deleted file mode 100644 index 8cf47bbbe..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_palette_full.png b/games/minimal/mods/testnodes/textures/testnodes_palette_full.png deleted file mode 100644 index e0a5f8b34..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_palette_full.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png b/games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png deleted file mode 100644 index 682f3ac84..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike.png deleted file mode 100644 index cc464444d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png deleted file mode 100644 index 01c81da8e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png deleted file mode 100644 index 53504dbcd..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png deleted file mode 100644 index d504d459f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png deleted file mode 100644 index 79cf2125e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png deleted file mode 100644 index b9ee9e5be..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png deleted file mode 100644 index 85311cb2c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png deleted file mode 100644 index bc602bafe..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png deleted file mode 100644 index d10002375..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png deleted file mode 100644 index 527817bc1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png deleted file mode 100644 index 45e75bdd3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png deleted file mode 100644 index 8954b2c34..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png deleted file mode 100644 index a782d4874..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png deleted file mode 100644 index 112a0540f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png deleted file mode 100644 index b584a8dc9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png deleted file mode 100644 index 530bbba7a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png deleted file mode 100644 index 4ed1ca00f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png deleted file mode 100644 index 8749330d8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png deleted file mode 100644 index 0517f6570..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png deleted file mode 100644 index 3916ce1ef..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_curved.png b/games/minimal/mods/testnodes/textures/testnodes_rail_curved.png deleted file mode 100644 index e44419848..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_straight.png b/games/minimal/mods/testnodes/textures/testnodes_rail_straight.png deleted file mode 100644 index 872d04fb9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png deleted file mode 100644 index 7e4af5182..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_signlike.png b/games/minimal/mods/testnodes/textures/testnodes_signlike.png deleted file mode 100644 index 33ffcba6c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_signlike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_slippery.png b/games/minimal/mods/testnodes/textures/testnodes_slippery.png deleted file mode 100644 index b990468a1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_slippery.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_street_crossing.png deleted file mode 100644 index d6e35ad7a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_curved.png b/games/minimal/mods/testnodes/textures/testnodes_street_curved.png deleted file mode 100644 index 251b7fb71..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_straight.png b/games/minimal/mods/testnodes/textures/testnodes_street_straight.png deleted file mode 100644 index 639e24b93..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png deleted file mode 100644 index 713621e06..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png b/games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png deleted file mode 100644 index b38ea4072..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png b/games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png deleted file mode 100644 index 5d9862cc9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png b/games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png deleted file mode 100644 index adf1e002d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png b/games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png deleted file mode 100644 index cb442b22d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/README.md b/games/minimal/mods/testpathfinder/README.md deleted file mode 100644 index 2b9d46e70..000000000 --- a/games/minimal/mods/testpathfinder/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Pathfinder Tester - -Usage: - -Use the Pathfinder Tester tool (`testpathfinder:testpathfinder`). -Here's how it works: - -* Place on node: Set destination position -* Punch: Find path -* Sneak+punch: Select pathfinding algorithm - -Information will be shown in chat. If a path was found, all waypoints -will be shown for a few seconds. - -See `init.lua` for config variables. diff --git a/games/minimal/mods/testpathfinder/init.lua b/games/minimal/mods/testpathfinder/init.lua deleted file mode 100644 index f94848236..000000000 --- a/games/minimal/mods/testpathfinder/init.lua +++ /dev/null @@ -1,132 +0,0 @@ -local S = minetest.get_translator("testpathfinder") - --- Config parameters - --- Maximum direct distance between start and end -local MAX_DIRECT_DISTANCE = 64 --- Maximum search distance -local MAX_SEARCH_DISTANCE = 32 --- Maximum permitted jump height -local MAX_JUMP = 1 --- Maximum permitted drop height -local MAX_DROP = 5 --- If true, mod won't refuse to run pathfinder even at long distances -local IGNORE_MAX_DISTANCE_SAFEGUARD = false - --- End of config parameters - -local timer = 0 -local algorithms = { - "A*_noprefetch", - "A*", - "Dijkstra", -} - -local function find_path_for_player(player, itemstack) - local meta = itemstack:get_meta() - if not meta then - return - end - local x = meta:get_int("pos_x") - local y = meta:get_int("pos_y") - local z = meta:get_int("pos_z") - local algo = meta:get_int("algorithm") - if x and y and z then - local pos2 = {x=x, y=y, z=z} - algo = algorithms[algo+1] - local pos1 = vector.round(player:get_pos()) - -- Don't bother calling pathfinder for high distance to avoid freezing - if (not IGNORE_MAX_DISTANCE_SAFEGUARD) and (vector.distance(pos1, pos2) > MAX_DIRECT_DISTANCE) then - minetest.chat_send_player(player:get_player_name(), S("Destination too far away! Set a destination (via placing) within a distance of @1 and try again!", MAX_DIRECT_DISTANCE)) - return - end - local str = S("Path from @1 to @2:", - minetest.pos_to_string(pos1), - minetest.pos_to_string(pos2)) - - minetest.chat_send_player(player:get_player_name(), str) - local time_start = minetest.get_us_time() - local path = minetest.find_path(pos1, pos2, MAX_SEARCH_DISTANCE, MAX_JUMP, MAX_DROP, algo) - local time_end = minetest.get_us_time() - local time_diff = time_end - time_start - str = "" - if not path then - minetest.chat_send_player(player:get_player_name(), S("No path!")) - minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) - return - end - for s=1, #path do - str = str .. minetest.pos_to_string(path[s]) .. "\n" - local t - if s == #path then - t = "testpathfinder_waypoint_end.png" - elseif s == 1 then - t = "testpathfinder_waypoint_start.png" - else - local c = math.floor(((#path-s)/#path)*255) - t = string.format("testpathfinder_waypoint.png^[multiply:#%02x%02x00", 0xFF-c, c) - end - minetest.add_particle({ - pos = path[s], - expirationtime = 5 + 0.2 * s, - playername = player:get_player_name(), - glow = minetest.LIGHT_MAX, - texture = t, - size = 3, - }) - end - minetest.chat_send_player(player:get_player_name(), str) - minetest.chat_send_player(player:get_player_name(), S("Path length: @1", #path)) - minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) - end -end - -local function set_destination(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - local name = user:get_player_name() - local obj - local meta = itemstack:get_meta() - if pointed_thing.type == "node" then - local pos = pointed_thing.above - meta:set_int("pos_x", pos.x) - meta:set_int("pos_y", pos.y) - meta:set_int("pos_z", pos.z) - minetest.chat_send_player(user:get_player_name(), S("Destination set to @1", minetest.pos_to_string(pos))) - return itemstack - end -end - -local function find_path_or_set_algorithm(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - local ctrl = user:get_player_control() - -- No sneak: Find path - if not ctrl.sneak then - find_path_for_player(user, itemstack) - else - -- Sneak: Set algorithm - local meta = itemstack:get_meta() - local algo = meta:get_int("algorithm") - algo = (algo + 1) % #algorithms - meta:set_int("algorithm", algo) - minetest.chat_send_player(user:get_player_name(), S("Algorithm: @1", algorithms[algo+1])) - return itemstack - end -end - --- Punch: Find path --- Sneak+punch: Select pathfinding algorithm --- Place: Select destination node -minetest.register_tool("testpathfinder:testpathfinder", { - description = S("Pathfinder Tester"), - inventory_image = "testpathfinder_testpathfinder.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = find_path_or_set_algorithm, - on_secondary_use = set_destination, - on_place = set_destination, -}) - - diff --git a/games/minimal/mods/testpathfinder/mod.conf b/games/minimal/mods/testpathfinder/mod.conf deleted file mode 100644 index e6034ae8c..000000000 --- a/games/minimal/mods/testpathfinder/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testpathfinder -description = Tool to test Minetest's pathfinder function diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png deleted file mode 100644 index 37eef0565..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png deleted file mode 100644 index 661dcf906..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png deleted file mode 100644 index 41a1cc549..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png deleted file mode 100644 index a22e31c3b..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png and /dev/null differ diff --git a/games/minimal/mods/testtools/README.md b/games/minimal/mods/testtools/README.md deleted file mode 100644 index 9cfe29ea4..000000000 --- a/games/minimal/mods/testtools/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# Test Tools readme - -Test Tools is a mod for developers that adds a bunch of tools to directly manipulate nodes and entities. This is great for quickly testing out stuff. - -Here's the list of tools: - -## Remover -Removes nodes and non-player entities that you punch. - -## Node Setter -Replace a node with another one. - -First, punch a node you want to remember. -Then rightclick any other node to replace it with the node you remembered. - -If you rightclick while pointing nothing, you can manually enter the node and param2. - -## Param2 Tool -Change the value param2 of nodes. - -* Punch: Add 1 to param2 -* Sneak+Punch: Add 8 to param2 -* Place: Subtract 1 from param2 -* Sneak+Place: Subtract 8 from param2 - -Note: Use the debug screen (F5) to see the param2 of the pointed node. - -## Falling Node Tool -Turns nodes into falling nodes. - -Usage: - -* Punch node: Make it fall -* Place: Try to teleport up to 2 units upwards, then make it fall - -## Entity Rotator -Changes the entity rotation (with `set_rotation`). - -Usage: - -* Punch entity: Rotate yaw -* Punch entity while holding down “Sneak” key: Rotate pitch -* Punch entity while holding down “Special” key (aka “Aux”): Rotate roll - -Each usage rotates the entity by 22.5°. - -## Entity Spawner -Spawns entities. - -Usage: - -* Punch to select entity or spawn one directly -* Place to place selected entity - -## Object Property Editor -Edits properties of objects. - -Usage: - -* Punch object to open a formspec that allows you to view and edit properties -* Punch air to edit properties of your own player object - -To edit a property, select it in the list, enter a new value (in Lua syntax) -and hit “Submit”. - -## Object Attacher -Allows you to attach an object to another one. - -Basic usage: -* First select the parent object, then the child object that should be attached -* Selecting an object is done by punching it -* Sneak+punch to detach selected object -* If you punch air, you select yourself - -Configuration: -* Place: Increase attachment Y position -* Sneak+place: decrease attachment Y position -* Aux+place: Increase attachment X rotation -* Aux+Sneak+Rightclick: Decrease attachment X rotation - -Hint: To detach all objects nearby you (including on yourself), use the -`/detach` server command. - -## Object Mover -Move an object by a given distance. - -Usage: -* Punch object into the direction you want to move it -* Sneak+punch: Move object towards you -* Place: Increase move distance -* Sneak+place: Decrease move distance - -## Entity Visual Scaler -Change visual size of entities - -Usage: - -* Punch entity to increase visual size -* Sneak+punch entity to decrease visual size diff --git a/games/minimal/mods/testtools/init.lua b/games/minimal/mods/testtools/init.lua deleted file mode 100644 index a63c98377..000000000 --- a/games/minimal/mods/testtools/init.lua +++ /dev/null @@ -1,691 +0,0 @@ -local S = minetest.get_translator("testtools") -local F = minetest.formspec_escape - --- TODO: Add a Node Metadata tool - --- Param 2 Tool: Set param2 value of tools --- Punch: +1 --- Punch+Shift: +8 --- Place: -1 --- Place+Shift: -8 -minetest.register_tool("testtools:param2tool", { - description = S("Param2 Tool"), - inventory_image = "testtools_param2tool.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local add = 1 - if user then - local ctrl = user:get_player_control() - if ctrl.sneak then - add = 8 - end - end - local node = minetest.get_node(pos) - node.param2 = node.param2 + add - minetest.swap_node(pos, node) - end, - on_place = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local add = -1 - if user then - local ctrl = user:get_player_control() - if ctrl.sneak then - add = -8 - end - end - local node = minetest.get_node(pos) - node.param2 = node.param2 + add - minetest.swap_node(pos, node) - end, -}) - -minetest.register_tool("testtools:node_setter", { - description = S("Node Setter"), - inventory_image = "testtools_node_setter.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type == "nothing" then - local meta = itemstack:get_meta() - meta:set_string("node", "air") - meta:set_int("node_param2", 0) - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", "air", 0)) - end - return itemstack - elseif pointed_thing.type ~= "node" or (not pos) then - return - end - local node = minetest.get_node(pos) - local meta = itemstack:get_meta() - meta:set_string("node", node.name) - meta:set_int("node_param2", node.param2) - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", node.name, node.param2)) - end - return itemstack - end, - on_secondary_use = function(itemstack, user, pointed_thing) - local meta = itemstack:get_meta() - local nodename = meta:get_string("node") or "" - local param2 = meta:get_int("node_param2") or 0 - - minetest.show_formspec(user:get_player_name(), "testtools:node_setter", - "size[4,4]".. - "field[0.5,1;3,1;nodename;"..F(S("Node name (itemstring):"))..";"..F(nodename).."]".. - "field[0.5,2;3,1;param2;"..F(S("param2:"))..";"..F(tostring(param2)).."]".. - "button_exit[0.5,3;3,1;submit;"..F(S("Submit")).."]" - ) - end, - on_place = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - local meta = itemstack:get_meta() - local nodename = meta:get_string("node") - if nodename == "" and user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Punch a node first!")) - return - end - local param2 = meta:get_int("node_param2") - if not param2 then - param2 = 0 - end - local node = { name = nodename, param2 = param2 } - if not minetest.registered_nodes[nodename] then - minetest.chat_send_player(user:get_player_name(), S("Cannot set unknown node: @1", nodename)) - return - end - minetest.set_node(pos, node) - end, -}) - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname == "testtools:node_setter" then - local playername = player:get_player_name() - local witem = player:get_wielded_item() - if witem:get_name() == "testtools:node_setter" then - if fields.nodename and fields.param2 then - local param2 = tonumber(fields.param2) - if not param2 then - return - end - local meta = witem:get_meta() - meta:set_string("node", fields.nodename) - meta:set_int("node_param2", param2) - player:set_wielded_item(witem) - end - end - end -end) - -minetest.register_tool("testtools:remover", { - description = S("Remover"), - inventory_image = "testtools_remover.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type == "node" and pos ~= nil then - minetest.remove_node(pos) - elseif pointed_thing.type == "object" then - local obj = pointed_thing.ref - if not obj:is_player() then - obj:remove() - end - end - end, -}) - -minetest.register_tool("testtools:falling_node_tool", { - description = S("Falling Node Tool"), - inventory_image = "testtools_falling_node_tool.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = function(itemstack, user, pointed_thing) - -- Teleport node 1-2 units upwards (if possible) and make it fall - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local ok = false - local highest - for i=1,2 do - local above = {x=pos.x,y=pos.y+i,z=pos.z} - local n2 = minetest.get_node(above) - local def2 = minetest.registered_nodes[n2.name] - if def2 and (not def2.walkable) then - highest = above - else - break - end - end - if highest then - local node = minetest.get_node(pos) - local metatable = minetest.get_meta(pos):to_table() - minetest.remove_node(pos) - minetest.set_node(highest, node) - local meta_highest = minetest.get_meta(highest) - meta_highest:from_table(metatable) - ok = minetest.spawn_falling_node(highest) - else - ok = minetest.spawn_falling_node(pos) - end - if not ok and user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) - end - end, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local ok = minetest.spawn_falling_node(pos) - if not ok and user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) - end - end, -}) - -minetest.register_tool("testtools:rotator", { - description = S("Entity Rotator"), - inventory_image = "testtools_entity_rotator.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "object" then - return - end - local obj = pointed_thing.ref - if obj:is_player() then - -- No player rotation - return - else - local axis = "y" - if user and user:is_player() then - local ctrl = user:get_player_control() - if ctrl.sneak then - axis = "x" - elseif ctrl.aux1 then - axis = "z" - end - end - local rot = obj:get_rotation() - rot[axis] = rot[axis] + math.pi/8 - if rot[axis] > math.pi*2 then - rot[axis] = rot[axis] - math.pi*2 - end - obj:set_rotation(rot) - end - end, -}) - -local mover_config = function(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - local name = user:get_player_name() - local ctrl = user:get_player_control() - local meta = itemstack:get_meta() - local dist = 1.0 - if meta:contains("distance") then - dist = meta:get_int("distance") - end - if ctrl.sneak then - dist = dist - 1 - else - dist = dist + 1 - end - meta:set_int("distance", dist) - minetest.chat_send_player(user:get_player_name(), S("distance=@1/10", dist*2)) - return itemstack -end - -minetest.register_tool("testtools:object_mover", { - description = S("Object Mover"), - inventory_image = "testtools_object_mover.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = mover_config, - on_secondary_use = mover_config, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "object" then - return - end - local obj = pointed_thing.ref - if not (user and user:is_player()) then - return - end - local yaw = user:get_look_horizontal() - local dir = minetest.yaw_to_dir(yaw) - local pos = obj:get_pos() - local pitch = user:get_look_vertical() - if pitch > 0.25 * math.pi then - dir.y = -1 - dir.x = 0 - dir.z = 0 - elseif pitch < -0.25 * math.pi then - dir.y = 1 - dir.x = 0 - dir.z = 0 - end - local ctrl = user:get_player_control() - if ctrl.sneak then - dir = vector.multiply(dir, -1) - end - local meta = itemstack:get_meta() - if meta:contains("distance") then - local dist = meta:get_int("distance") - dir = vector.multiply(dir, dist*0.2) - end - pos = vector.add(pos, dir) - obj:set_pos(pos) - end, -}) - - - -minetest.register_tool("testtools:entity_scaler", { - description = S("Entity Visual Scaler"), - inventory_image = "testtools_entity_scaler.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "object" then - return - end - local obj = pointed_thing.ref - if obj:is_player() then - -- No player scaling - return - else - local diff = 0.1 - if user and user:is_player() then - local ctrl = user:get_player_control() - if ctrl.sneak then - diff = -0.1 - end - end - local prop = obj:get_properties() - if not prop.visual_size then - prop.visual_size = { x=1, y=1, z=1 } - else - prop.visual_size = { x=prop.visual_size.x+diff, y=prop.visual_size.y+diff, z=prop.visual_size.z+diff } - if prop.visual_size.x <= 0.1 then - prop.visual_size.x = 0.1 - end - if prop.visual_size.y <= 0.1 then - prop.visual_size.y = 0.1 - end - if prop.visual_size.z <= 0.1 then - prop.visual_size.z = 0.1 - end - end - obj:set_properties(prop) - end - end, -}) - -local selections = {} -local entity_list -local function get_entity_list() - if entity_list then - return entity_list - end - local ents = minetest.registered_entities - local list = {} - for k,_ in pairs(ents) do - table.insert(list, k) - end - table.sort(list) - entity_list = list - return entity_list -end -minetest.register_tool("testtools:entity_spawner", { - description = S("Entity Spawner"), - inventory_image = "testtools_entity_spawner.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - if selections[name] and pointed_thing.type == "node" then - local pos = pointed_thing.above - minetest.add_entity(pos, get_entity_list()[selections[name]]) - end - end, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type == "object" then - return - end - if user and user:is_player() then - local list = table.concat(get_entity_list(), ",") - local name = user:get_player_name() - local sel = selections[name] or "" - minetest.show_formspec(name, "testtools:entity_list", - "size[9,9]".. - "textlist[0,0;9,8;entity_list;"..list..";"..sel..";false]".. - "button[0,8;4,1;spawn;Spawn entity]" - ) - end - end, -}) - -local function prop_to_string(property) - if type(property) == "string" then - return "\"" .. property .. "\"" - elseif type(property) == "table" then - return tostring(dump(property)):gsub("\n", "") - else - return tostring(property) - end -end - -local property_formspec_data = {} -local property_formspec_index = {} -local selected_objects = {} -local function get_object_properties_form(obj, playername) - if not playername then return "" end - local props = obj:get_properties() - local str = "" - property_formspec_data[playername] = {} - local proplist = {} - for k,_ in pairs(props) do - table.insert(proplist, k) - end - table.sort(proplist) - for p=1, #proplist do - local k = proplist[p] - local v = props[k] - local newline = "" - newline = k .. " = " - newline = newline .. prop_to_string(v) - str = str .. F(newline) - if p < #proplist then - str = str .. "," - end - table.insert(property_formspec_data[playername], k) - end - return str -end - -local editor_formspec_selindex = {} - -local editor_formspec = function(playername, obj, value, sel) - if not value then - value = "" - end - if not sel then - sel = "" - end - local list = get_object_properties_form(obj, playername) - local title - if obj:is_player() then - title = S("Object properties of player “@1”", obj:get_player_name()) - else - local ent = obj:get_luaentity() - title = S("Object properties of @1", ent.name) - end - minetest.show_formspec(playername, "testtools:object_editor", - "size[9,9]".. - "label[0,0;"..F(title).."]".. - "textlist[0,0.5;9,7.5;object_props;"..list..";"..sel..";false]".. - "field[0.2,8.75;8,1;value;"..F(S("Value"))..";"..F(value).."]".. - "button[8,8.5;1,1;submit;"..F(S("Submit")).."]" - ) -end - -minetest.register_tool("testtools:object_editor", { - description = S("Object Property Editor"), - inventory_image = "testtools_object_editor.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if user and user:is_player() then - local name = user:get_player_name() - - if pointed_thing.type == "object" then - selected_objects[name] = pointed_thing.ref - elseif pointed_thing.type == "nothing" then - -- Use on yourself if pointing nothing - selected_objects[name] = user - else - -- Unsupported pointed thing - return - end - - local sel = editor_formspec_selindex[name] - local val - if selected_objects[name] and selected_objects[name]:get_properties() then - local props = selected_objects[name]:get_properties() - local keys = property_formspec_data[name] - if property_formspec_index[name] and props then - local key = keys[property_formspec_index[name]] - val = prop_to_string(props[key]) - end - end - - editor_formspec(name, selected_objects[name], val, sel) - end - end, -}) - -local ent_parent = {} -local ent_child = {} -local DEFAULT_ATTACH_OFFSET_Y = 11 - -local attacher_config = function(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - if pointed_thing.type == "object" then - return - end - local name = user:get_player_name() - local ctrl = user:get_player_control() - local meta = itemstack:get_meta() - if ctrl.aux1 then - local rot_x = meta:get_float("rot_x") - if ctrl.sneak then - rot_x = rot_x - math.pi/8 - else - rot_x = rot_x + math.pi/8 - end - if rot_x > 6.2 then - rot_x = 0 - elseif rot_x < 0 then - rot_x = math.pi * (15/8) - end - minetest.chat_send_player(name, S("rotation=@1", minetest.pos_to_string({x=rot_x,y=0,z=0}))) - meta:set_float("rot_x", rot_x) - else - local pos_y - if meta:contains("pos_y") then - pos_y = meta:get_int("pos_y") - else - pos_y = DEFAULT_ATTACH_OFFSET_Y - end - if ctrl.sneak then - pos_y = pos_y - 1 - else - pos_y = pos_y + 1 - end - minetest.chat_send_player(name, S("position=@1", minetest.pos_to_string({x=0,y=pos_y,z=0}))) - meta:set_int("pos_y", pos_y) - end - return itemstack -end - -minetest.register_tool("testtools:object_attacher", { - description = S("Object Attacher"), - inventory_image = "testtools_object_attacher.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = attacher_config, - on_secondary_use = attacher_config, - on_use = function(itemstack, user, pointed_thing) - if user and user:is_player() then - local name = user:get_player_name() - local selected_object - if pointed_thing.type == "object" then - selected_object = pointed_thing.ref - elseif pointed_thing.type == "nothing" then - selected_object = user - else - return - end - local ctrl = user:get_player_control() - if ctrl.sneak then - if selected_object:get_attach() then - selected_object:set_detach() - minetest.chat_send_player(name, S("Object detached!")) - else - minetest.chat_send_player(name, S("Object is not attached!")) - end - return - end - local parent = ent_parent[name] - local child = ent_child[name] - local ename = S("") - if not parent then - parent = selected_object - ent_parent[name] = parent - elseif not child then - child = selected_object - ent_child[name] = child - end - local entity = selected_object:get_luaentity() - if entity then - ename = entity.name - elseif selected_object:is_player() then - ename = selected_object:get_player_name() - end - if selected_object == parent then - minetest.chat_send_player(name, S("Parent object selected: @1", ename)) - elseif selected_object == child then - minetest.chat_send_player(name, S("Child object selected: @1", ename)) - end - if parent and child then - if parent == child then - minetest.chat_send_player(name, S("Can't attach an object to itself!")) - ent_parent[name] = nil - ent_child[name] = nil - return - end - local meta = itemstack:get_meta() - local y - if meta:contains("pos_y") then - y = meta:get_int("pos_y") - else - y = DEFAULT_ATTACH_OFFSET_Y - end - local rx = meta:get_float("rot_x") or 0 - local offset = {x=0,y=y,z=0} - local angle = {x=rx,y=0,z=0} - child:set_attach(parent, "", offset, angle) - local check_parent = child:get_attach() - if check_parent then - minetest.chat_send_player(name, S("Object attached! position=@1, rotation=@2", - minetest.pos_to_string(offset), minetest.pos_to_string(angle))) - else - minetest.chat_send_player(name, S("Attachment failed!")) - end - ent_parent[name] = nil - ent_child[name] = nil - end - end - end, -}) - --- Use loadstring to parse param as a Lua value -local function use_loadstring(param, player) - -- For security reasons, require 'server' priv, just in case - -- someone is actually crazy enough to run this on a public server. - local privs = minetest.get_player_privs(player:get_player_name()) - if not privs.server then - return false, "You need 'server' privilege to change object properties!" - end - if not param then - return false, "Failed: parameter is nil" - end - --[[ DANGER ZONE ]] - -- Interpret string as Lua value - local func, errormsg = loadstring("return (" .. param .. ")") - if not func then - return false, "Failed: " .. errormsg - end - - -- Apply sandbox here using setfenv - setfenv(func, {}) - - -- Run it - local good, errOrResult = pcall(func) - if not good then - -- A Lua error was thrown - return false, "Failed: " .. errOrResult - end - - -- errOrResult will be the value - return true, errOrResult -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if not (player and player:is_player()) then - return - end - if formname == "testtools:entity_list" then - local name = player:get_player_name() - if fields.entity_list then - local expl = minetest.explode_textlist_event(fields.entity_list) - if expl.type == "DCL" then - local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) - selections[name] = expl.index - minetest.add_entity(pos, get_entity_list()[expl.index]) - return - elseif expl.type == "CHG" then - selections[name] = expl.index - return - end - elseif fields.spawn and selections[name] then - local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) - minetest.add_entity(pos, get_entity_list()[selections[name]]) - return - end - elseif formname == "testtools:object_editor" then - local name = player:get_player_name() - if fields.object_props then - local expl = minetest.explode_textlist_event(fields.object_props) - if expl.type == "DCL" or expl.type == "CHG" then - property_formspec_index[name] = expl.index - - local props = selected_objects[name]:get_properties() - local keys = property_formspec_data[name] - if (not property_formspec_index[name]) or (not props) then - return - end - local key = keys[property_formspec_index[name]] - editor_formspec_selindex[name] = expl.index - editor_formspec(name, selected_objects[name], prop_to_string(props[key]), expl.index) - return - end - end - if fields.submit then - local props = selected_objects[name]:get_properties() - local keys = property_formspec_data[name] - if (not property_formspec_index[name]) or (not props) then - return - end - local key = keys[property_formspec_index[name]] - if not key then - return - end - local success, str = use_loadstring(fields.value, player) - if success then - props[key] = str - else - minetest.chat_send_player(name, str) - return - end - selected_objects[name]:set_properties(props) - local sel = editor_formspec_selindex[name] - editor_formspec(name, selected_objects[name], prop_to_string(props[key]), sel) - return - end - end -end) diff --git a/games/minimal/mods/testtools/mod.conf b/games/minimal/mods/testtools/mod.conf deleted file mode 100644 index cde1b2685..000000000 --- a/games/minimal/mods/testtools/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testtools -description = Some tools to directly manipulate nodes and entities. Great for development and testing diff --git a/games/minimal/mods/testtools/textures/testtools_entity_rotator.png b/games/minimal/mods/testtools/textures/testtools_entity_rotator.png deleted file mode 100644 index 17ebb2d35..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_entity_rotator.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_entity_scaler.png b/games/minimal/mods/testtools/textures/testtools_entity_scaler.png deleted file mode 100644 index 4909c25b0..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_entity_scaler.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_entity_spawner.png b/games/minimal/mods/testtools/textures/testtools_entity_spawner.png deleted file mode 100644 index 6199e0145..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_entity_spawner.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_falling_node_tool.png b/games/minimal/mods/testtools/textures/testtools_falling_node_tool.png deleted file mode 100644 index 30099a7ef..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_falling_node_tool.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_node_setter.png b/games/minimal/mods/testtools/textures/testtools_node_setter.png deleted file mode 100644 index 8599438de..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_node_setter.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_object_attacher.png b/games/minimal/mods/testtools/textures/testtools_object_attacher.png deleted file mode 100644 index 4d9bf6fd1..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_object_attacher.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_object_editor.png b/games/minimal/mods/testtools/textures/testtools_object_editor.png deleted file mode 100644 index d1ce9cecd..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_object_editor.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_object_mover.png b/games/minimal/mods/testtools/textures/testtools_object_mover.png deleted file mode 100644 index 8b14e9fb2..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_object_mover.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_param2tool.png b/games/minimal/mods/testtools/textures/testtools_param2tool.png deleted file mode 100644 index dbc663575..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_param2tool.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_remover.png b/games/minimal/mods/testtools/textures/testtools_remover.png deleted file mode 100644 index 73f14cd54..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_remover.png and /dev/null differ diff --git a/games/minimal/mods/tiled/init.lua b/games/minimal/mods/tiled/init.lua deleted file mode 100644 index 68ead8e3a..000000000 --- a/games/minimal/mods/tiled/init.lua +++ /dev/null @@ -1,33 +0,0 @@ -minetest.register_node("tiled:tiled", { - description = "Tiled Node (world-aligned)", - tiles = {{ - name = "tiled_tiled.png", - align_style = "world", - scale = 8, - }}, - groups = {cracky=3}, -}) - -minetest.register_node("tiled:tiled_n", { - description = "Tiled Node (node-aligned)", - tiles = {{ - name = "tiled_tiled.png", - align_style = "node", - scale = 8, - }}, - groups = {cracky=3}, -}) - -stairs.register_stair_and_slab("tiled_n", "tiled:tiled", - {cracky=3}, - {{name="tiled_tiled.png", align_style="node", scale=8}}, - "Tiled Stair (node-aligned)", - "Tiled Slab (node-aligned)") - -stairs.register_stair_and_slab("tiled", "tiled:tiled", - {cracky=3}, - {{name="tiled_tiled.png", align_style="world", scale=8}}, - "Tiled Stair (world-aligned)", - "Tiled Slab (world-aligned)") - - diff --git a/games/minimal/mods/tiled/mod.conf b/games/minimal/mods/tiled/mod.conf deleted file mode 100644 index 78b19f93b..000000000 --- a/games/minimal/mods/tiled/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = tiled -description = Add nodes with a special texture that spans multiple nodes (aka "world-aligned") -depends = stairs diff --git a/games/minimal/mods/tiled/textures/tiled_tiled.png b/games/minimal/mods/tiled/textures/tiled_tiled.png deleted file mode 100644 index 363a26487..000000000 Binary files a/games/minimal/mods/tiled/textures/tiled_tiled.png and /dev/null differ diff --git a/games/minimal/mods/unittests/crafting.lua b/games/minimal/mods/unittests/crafting.lua deleted file mode 100644 index eff13ce09..000000000 --- a/games/minimal/mods/unittests/crafting.lua +++ /dev/null @@ -1,120 +0,0 @@ --- Test minetest.clear_craft function -local function test_clear_craft() - minetest.log("info", "[unittests] Testing minetest.clear_craft") - -- Clearing by output - minetest.register_craft({ - output = "foo", - recipe = {{"bar"}} - }) - minetest.register_craft({ - output = "foo 4", - recipe = {{"foo", "bar"}} - }) - assert(#minetest.get_all_craft_recipes("foo") == 2) - minetest.clear_craft({output="foo"}) - assert(minetest.get_all_craft_recipes("foo") == nil) - -- Clearing by input - minetest.register_craft({ - output = "foo 4", - recipe = {{"foo", "bar"}} - }) - assert(#minetest.get_all_craft_recipes("foo") == 1) - minetest.clear_craft({recipe={{"foo", "bar"}}}) - assert(minetest.get_all_craft_recipes("foo") == nil) -end - --- Test minetest.get_craft_result function -local function test_get_craft_result() - minetest.log("info", "[unittests] Testing minetest.get_craft_result") - - -- normal - local input = { - method = "normal", - width = 2, - items = {"", "unittests:coal_lump", "", "unittests:stick"} - } - minetest.log("info", "[unittests] torch crafting input: "..dump(input)) - local output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] torch crafting output: "..dump(output)) - minetest.log("info", "[unittests] torch crafting decremented input: "..dump(decremented_input)) - assert(output.item) - minetest.log("info", "[unittests] torch crafting output.item:to_table(): "..dump(output.item:to_table())) - assert(output.item:get_name() == "unittests:torch") - assert(output.item:get_count() == 4) - - -- fuel - input = { - method = "fuel", - width = 1, - items = {"unittests:coal_lump"} - } - minetest.log("info", "[unittests] coal fuel input: "..dump(input)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] coal fuel output: "..dump(output)) - minetest.log("info", "[unittests] coal fuel decremented input: "..dump(decremented_input)) - assert(output.time) - assert(output.time > 0) - - -- cooking - input = { - method = "cooking", - width = 1, - items = {"unittests:iron_lump"} - } - minetest.log("info", "[unittests] iron lump cooking input: "..dump(output)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] iron lump cooking output: "..dump(output)) - minetest.log("info", "[unittests] iron lump cooking decremented input: "..dump(decremented_input)) - assert(output.time) - assert(output.time > 0) - assert(output.item) - minetest.log("info", "[unittests] iron lump cooking output.item:to_table(): "..dump(output.item:to_table())) - assert(output.item:get_name() == "unittests:steel_ingot") - assert(output.item:get_count() == 1) - - -- tool repair (repairable) - input = { - method = "normal", - width = 2, - -- Using a wear of 60000 - items = {"unittests:repairable_tool 1 60000", "unittests:repairable_tool 1 60000"} - } - minetest.log("info", "[unittests] repairable tool crafting input: "..dump(input)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] repairable tool crafting output: "..dump(output)) - minetest.log("info", "[unittests] repairable tool crafting decremented input: "..dump(decremented_input)) - assert(output.item) - minetest.log("info", "[unittests] repairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) - assert(output.item:get_name() == "unittests:repairable_tool") - -- Test the wear value. - -- See src/craftdef.cpp in Minetest source code for the formula. The formula to calculate - -- the value 51187 is: - -- 65536 - ((65536-60000)+(65536-60000)) + floor(additonal_wear * 65536 + 0.5) = 51187 - -- where additional_wear = 0.05 - assert(output.item:get_wear() == 51187) - assert(output.item:get_count() == 1) - - -- failing tool repair (unrepairable) - input = { - method = "normal", - width = 2, - items = {"unittests:unrepairable_tool 1 60000", "unittests:unrepairable_tool 1 60000"} - } - minetest.log("info", "[unittests] unrepairable tool crafting input: "..dump(input)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] unrepairable tool crafting output: "..dump(output)) - minetest.log("info", "[unittests] unrepairable tool crafting decremented input: "..dump(decremented_input)) - assert(output.item) - minetest.log("info", "[unittests] unrepairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) - -- unrepairable tool must not yield any output - assert(output.item:get_name() == "") - -end - -function unittests.test_crafting() - test_clear_craft() - test_get_craft_result() - minetest.log("action", "[unittests] Crafting tests passed!") - return true -end - diff --git a/games/minimal/mods/unittests/crafting_prepare.lua b/games/minimal/mods/unittests/crafting_prepare.lua deleted file mode 100644 index a09734827..000000000 --- a/games/minimal/mods/unittests/crafting_prepare.lua +++ /dev/null @@ -1,88 +0,0 @@ --- Registering some dummy items and recipes for the crafting tests - -minetest.register_craftitem("unittests:torch", { - description = "Crafting Test Item: Torch", - inventory_image = "unittests_torch.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:coal_lump", { - description = "Crafting Test Item: Coal Lump", - inventory_image = "unittests_coal_lump.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:stick", { - description = "Crafting Test Item: Stick", - inventory_image = "unittests_stick.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:iron_lump", { - description = "Crafting Test Item: Iron Lump", - inventory_image = "unittests_iron_lump.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:steel_ingot", { - description = "Crafting Test Item: Steel Ingot", - inventory_image = "unittests_steel_ingot.png", - - groups = { dummy = 1 }, -}) - --- Recipes for tests: Normal crafting, cooking and fuel - -minetest.register_craft({ - output = 'unittests:torch 4', - recipe = { - {'unittests:coal_lump'}, - {'unittests:stick'}, - } -}) - -minetest.register_craft({ - type = "cooking", - output = "unittests:steel_ingot", - recipe = "unittests:iron_lump", -}) - -minetest.register_craft({ - type = "fuel", - recipe = "unittests:coal_lump", - burntime = 40, -}) - --- Test tool repair -minetest.register_craft({ - type = "toolrepair", - additional_wear = -0.05, -}) - --- Test the disable_repair=1 group -minetest.register_tool("unittests:unrepairable_tool", { - description = "Crafting Test Item: Unrepairable Tool", - inventory_image = "unittests_unrepairable_tool.png", - tool_capabilities = { - groupcaps = { - cracky = { - times = {3, 2, 1}, - } - } - }, - groups = { disable_repair = 1, dummy = 1 } -}) - -minetest.register_tool("unittests:repairable_tool", { - description = "Crafting Test Item: Repairable Tool", - inventory_image = "unittests_repairable_tool.png", - tool_capabilities = { - groupcaps = { - cracky = { - times = {3, 2, 1}, - } - } - }, - - groups = { dummy = 1 }, -}) diff --git a/games/minimal/mods/unittests/init.lua b/games/minimal/mods/unittests/init.lua deleted file mode 100644 index 6c1728420..000000000 --- a/games/minimal/mods/unittests/init.lua +++ /dev/null @@ -1,16 +0,0 @@ -unittests = {} - -local modpath = minetest.get_modpath("unittests") -dofile(modpath .. "/random.lua") -dofile(modpath .. "/player.lua") -dofile(modpath .. "/crafting_prepare.lua") -dofile(modpath .. "/crafting.lua") - -if minetest.settings:get_bool("devtest_unittests_autostart", false) then - unittests.test_random() - unittests.test_crafting() - minetest.register_on_joinplayer(function(player) - unittests.test_player(player) - end) -end - diff --git a/games/minimal/mods/unittests/mod.conf b/games/minimal/mods/unittests/mod.conf deleted file mode 100644 index 0d5e3c959..000000000 --- a/games/minimal/mods/unittests/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = unittests -description = Adds automated unit tests for the engine diff --git a/games/minimal/mods/unittests/player.lua b/games/minimal/mods/unittests/player.lua deleted file mode 100644 index 10781a95f..000000000 --- a/games/minimal/mods/unittests/player.lua +++ /dev/null @@ -1,73 +0,0 @@ --- --- HP Change Reasons --- -local expect = nil -local function run_hpchangereason_tests(player) - expect = { type = "set_hp", from = "mod" } - player:set_hp(3) - assert(expect == nil) - - expect = { a = 234, type = "set_hp", from = "mod" } - player:set_hp(7, { a= 234 }) - assert(expect == nil) - - expect = { df = 3458973454, type = "fall", from = "mod" } - player:set_hp(10, { type = "fall", df = 3458973454 }) - assert(expect == nil) - - player:set_hp(20) -end - -local function run_player_meta_tests(player) - local meta = player:get_meta() - meta:set_string("foo", "bar") - assert(meta:contains("foo")) - assert(meta:get_string("foo") == "bar") - assert(meta:get("foo") == "bar") - - local meta2 = player:get_meta() - assert(meta2:get_string("foo") == "bar") - assert(meta2:get("foo") == "bar") - assert(meta:equals(meta2)) - - meta:set_string("bob", "dillan") - assert(meta:get_string("foo") == "bar") - assert(meta:get_string("bob") == "dillan") - assert(meta:get("bob") == "dillan") - assert(meta2:get_string("foo") == "bar") - assert(meta2:get_string("bob") == "dillan") - assert(meta2:get("bob") == "dillan") - assert(meta:equals(meta2)) - - meta:set_string("foo", "") - assert(not meta:contains("foo")) - assert(meta:get("foo") == nil) - assert(meta:get_string("foo") == "") - assert(meta:equals(meta2)) -end - -function unittests.test_player(player) - minetest.register_on_player_hpchange(function(player, hp, reason) - if not expect then - return - end - - for key, value in pairs(reason) do - assert(expect[key] == value) - end - - for key, value in pairs(expect) do - assert(reason[key] == value) - end - - expect = nil - end) - - run_hpchangereason_tests(player) - run_player_meta_tests(player) - local msg = "Player tests passed for player '"..player:get_player_name().."'!" - minetest.chat_send_all(msg) - minetest.log("action", "[unittests] "..msg) - return true -end - diff --git a/games/minimal/mods/unittests/random.lua b/games/minimal/mods/unittests/random.lua deleted file mode 100644 index f94f0a88e..000000000 --- a/games/minimal/mods/unittests/random.lua +++ /dev/null @@ -1,10 +0,0 @@ -function unittests.test_random() - -- Try out PseudoRandom - minetest.log("action", "[unittests] Testing PseudoRandom ...") - local pseudo = PseudoRandom(13) - assert(pseudo:next() == 22290) - assert(pseudo:next() == 13854) - minetest.log("action", "[unittests] PseudoRandom test passed!") - return true -end - diff --git a/games/minimal/mods/unittests/textures/unittests_coal_lump.png b/games/minimal/mods/unittests/textures/unittests_coal_lump.png deleted file mode 100644 index f460d909e..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_coal_lump.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_iron_lump.png b/games/minimal/mods/unittests/textures/unittests_iron_lump.png deleted file mode 100644 index 22f43e9cc..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_iron_lump.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_repairable_tool.png b/games/minimal/mods/unittests/textures/unittests_repairable_tool.png deleted file mode 100644 index 46fbbaa74..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_repairable_tool.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_steel_ingot.png b/games/minimal/mods/unittests/textures/unittests_steel_ingot.png deleted file mode 100644 index 6977696a2..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_steel_ingot.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_stick.png b/games/minimal/mods/unittests/textures/unittests_stick.png deleted file mode 100644 index ffdce70d4..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_stick.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_torch.png b/games/minimal/mods/unittests/textures/unittests_torch.png deleted file mode 100644 index ba5eebef0..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_torch.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png b/games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png deleted file mode 100644 index c676213a5..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png and /dev/null differ diff --git a/games/minimal/mods/util_commands/init.lua b/games/minimal/mods/util_commands/init.lua deleted file mode 100644 index ad8d3f9ba..000000000 --- a/games/minimal/mods/util_commands/init.lua +++ /dev/null @@ -1,137 +0,0 @@ -minetest.register_chatcommand("hotbar", { - params = "", - description = "Set hotbar size", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local size = tonumber(param) - if not size then - return false, "Missing or incorrect size parameter!" - end - local ok = player:hud_set_hotbar_itemcount(size) - if ok then - return true - else - return false, "Invalid item count!" - end - end, -}) - -minetest.register_chatcommand("hp", { - params = "", - description = "Set your health", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local hp = tonumber(param) - if not hp then - return false, "Missing or incorrect hp parameter!" - end - player:set_hp(hp) - return true - end, -}) - -minetest.register_chatcommand("zoom", { - params = "[]", - description = "Set or display your zoom_fov", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - if param == "" then - local fov = player:get_properties().zoom_fov - return true, "zoom_fov = "..tostring(fov) - end - local fov = tonumber(param) - if not fov then - return false, "Missing or incorrect zoom_fov parameter!" - end - player:set_properties({zoom_fov = fov}) - fov = player:get_properties().zoom_fov - return true, "zoom_fov = "..tostring(fov) - end, -}) - - - -local s_infplace = minetest.settings:get("devtest_infplace") -if s_infplace == "true" then - infplace = true -elseif s_infplace == "false" then - infplace = false -else - infplace = minetest.settings:get_bool("creative_mode", false) -end - -minetest.register_chatcommand("infplace", { - params = "", - description = "Toggle infinite node placement", - func = function(name, param) - infplace = not infplace - if infplace then - minetest.chat_send_all("Infinite node placement enabled!") - minetest.log("action", "Infinite node placement enabled") - else - minetest.chat_send_all("Infinite node placement disabled!") - minetest.log("action", "Infinite node placement disabled") - end - return true - end, -}) - -minetest.register_chatcommand("detach", { - params = "[]", - description = "Detach all objects nearby", - func = function(name, param) - local radius = tonumber(param) - if type(radius) ~= "number" then - radius = 8 - end - if radius < 1 then - radius = 1 - end - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local objs = minetest.get_objects_inside_radius(player:get_pos(), radius) - local num = 0 - for o=1, #objs do - if objs[o]:get_attach() then - objs[o]:set_detach() - num = num + 1 - end - end - return true, string.format("%d object(s) detached.", num) - end, -}) - - --- Unlimited node placement -minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) - if placer and placer:is_player() then - return infplace - end -end) - --- Don't pick up if the item is already in the inventory -local old_handle_node_drops = minetest.handle_node_drops -function minetest.handle_node_drops(pos, drops, digger) - if not digger or not digger:is_player() or not infplace then - return old_handle_node_drops(pos, drops, digger) - end - local inv = digger:get_inventory() - if inv then - for _, item in ipairs(drops) do - if not inv:contains_item("main", item, true) then - inv:add_item("main", item) - end - end - end -end diff --git a/games/minimal/mods/util_commands/mod.conf b/games/minimal/mods/util_commands/mod.conf deleted file mode 100644 index fea6dd3e9..000000000 --- a/games/minimal/mods/util_commands/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = util_commands -description = Random server commands to make testing easier and more convenient diff --git a/games/minimal/screenshot.png b/games/minimal/screenshot.png deleted file mode 100644 index 7324883f6..000000000 Binary files a/games/minimal/screenshot.png and /dev/null differ diff --git a/games/minimal/settingtypes.txt b/games/minimal/settingtypes.txt deleted file mode 100644 index 40ee5845b..000000000 --- a/games/minimal/settingtypes.txt +++ /dev/null @@ -1,37 +0,0 @@ -# If enabled, nodes won't be used up when placed. -# Note: This behavior can also be toggled in-game with the /infplace command. -# -# - true: enabled -# - false: disabled -# - auto: only enabled when Creative Mode is enabled (default) -devtest_infplace (Infinite node placement) enum auto true,false,auto - -# If enabled, new players receive some initial items when joining for the first time. -give_initial_stuff (Give initial stuff) bool true - -# If enabled, automated tests of the Lua API such as player health, crafting and PseudoRandom will be performed on startup. -devtest_unittests_autostart (Perform unit tests) bool false - -# If enabled, the game will use all mapgen aliases for the v6 mapgen. -# If disabled, it will only use a minimal set of mapgen aliases. -# If enabled, there should be biome-specific tree, leaves and ground nodes. If disabled, stuff should use fallback nodes (like stone instead of desert stone). -# -# Many mapgen aliases have fallback values when no value is provided. Having this setting disabled can be useful to test whether those fallback values are functional. -devtest_v6_mapgen_aliases (Use all v6 mapgen aliases) bool false - -# If enabled, the game will use dungeon stairs by enabling the corresponding mapgen aliases. -# -# Disabling this setting can be useful to test whether dungeons still work when stairs are not defined. -devtest_dungeon_stairs (Generate dungeon stairs) bool false - -# If enabled, the mapgen alias 'mapgen_mossycobble' will be used. This should enable random mossy cobblestone in dungeons. -# If disabled, it won't be used. The engine should fall back to cobble instead. -devtest_dungeon_mossycobble (Generate mossy cobblestone) bool false - -# If enabled, some very basic biomes will be registered. -devtest_register_biomes (Register biomes) bool true - -# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. -# This is due to . -# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. -testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/src/unittest/CMakeLists.txt b/src/unittest/CMakeLists.txt index 82f9a4a13..5703b8906 100644 --- a/src/unittest/CMakeLists.txt +++ b/src/unittest/CMakeLists.txt @@ -43,7 +43,7 @@ set (UNITTEST_CLIENT_SRCS PARENT_SCOPE) set (TEST_WORLDDIR ${CMAKE_CURRENT_SOURCE_DIR}/test_world) -set (TEST_SUBGAME_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../games/minimal) +set (TEST_SUBGAME_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../games/devtest) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/test_config.h.in" diff --git a/src/unittest/test_servermodmanager.cpp b/src/unittest/test_servermodmanager.cpp index 0757323f4..799936757 100644 --- a/src/unittest/test_servermodmanager.cpp +++ b/src/unittest/test_servermodmanager.cpp @@ -88,7 +88,7 @@ void TestServerModManager::testCreation() { std::string path = std::string(TEST_WORLDDIR) + DIR_DELIM + "world.mt"; Settings world_config; - world_config.set("gameid", "minimal"); + world_config.set("gameid", "devtest"); UASSERTEQ(bool, world_config.updateConfigFile(path.c_str()), true); ServerModManager sm(TEST_WORLDDIR); } @@ -118,10 +118,10 @@ void TestServerModManager::testGetMods() const auto &mods = sm.getMods(); UASSERTEQ(bool, mods.empty(), false); - // Ensure we found default mod inside the test folder + // Ensure we found basenodes mod (part of devtest) bool default_found = false; for (const auto &m : mods) { - if (m.name == "default") + if (m.name == "basenodes") default_found = true; // Verify if paths are not empty @@ -135,7 +135,7 @@ void TestServerModManager::testGetModspec() { ServerModManager sm(std::string(TEST_WORLDDIR)); UASSERTEQ(const ModSpec *, sm.getModSpec("wrongmod"), NULL); - UASSERT(sm.getModSpec("default") != NULL); + UASSERT(sm.getModSpec("basenodes") != NULL); } void TestServerModManager::testGetModNamesWrongDir() @@ -152,7 +152,7 @@ void TestServerModManager::testGetModNames() std::vector result; sm.getModNames(result); UASSERTEQ(bool, result.empty(), false); - UASSERT(std::find(result.begin(), result.end(), "default") != result.end()); + UASSERT(std::find(result.begin(), result.end(), "basenodes") != result.end()); } void TestServerModManager::testGetModMediaPathsWrongDir() diff --git a/util/test_multiplayer.sh b/util/test_multiplayer.sh index 9ebfe73be..176cf11d9 100755 --- a/util/test_multiplayer.sh +++ b/util/test_multiplayer.sh @@ -1,6 +1,6 @@ #!/bin/bash dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -gameid=minimal +gameid=devtest minetest=$dir/../bin/minetest testspath=$dir/../tests worldpath=$testspath/testworld_$gameid -- cgit v1.2.3 From f90ca96c7386f7be35850e923bf413a9acc4b04c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 27 May 2020 17:02:09 +0100 Subject: Make ContentDB downloads not block the UI (#9948) --- builtin/mainmenu/dlg_contentstore.lua | 63 ++++++++++++----------------------- 1 file changed, 22 insertions(+), 41 deletions(-) (limited to 'builtin') diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 3f01d4474..9af16ac86 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -46,14 +46,12 @@ local filter_types_type = { local function download_package(param) if core.download_file(param.package.url, param.filename) then return { - package = param.package, filename = param.filename, successful = true, } else core.log("error", "downloading " .. dump(param.package.url) .. " failed") return { - package = param.package, successful = false, } end @@ -67,9 +65,9 @@ local function start_install(calling_dialog, package) local function callback(result) if result.successful then - local path, msg = pkgmgr.install(result.package.type, - result.filename, result.package.name, - result.package.path) + local path, msg = pkgmgr.install(package.type, + result.filename, package.name, + package.path) if not path then gamedata.errormessage = msg else @@ -77,33 +75,33 @@ local function start_install(calling_dialog, package) local conf_path local name_is_title = false - if result.package.type == "mod" then + if package.type == "mod" then local actual_type = pkgmgr.get_folder_type(path) if actual_type.type == "modpack" then conf_path = path .. DIR_DELIM .. "modpack.conf" else conf_path = path .. DIR_DELIM .. "mod.conf" end - elseif result.package.type == "game" then + elseif package.type == "game" then conf_path = path .. DIR_DELIM .. "game.conf" name_is_title = true - elseif result.package.type == "txp" then + elseif package.type == "txp" then conf_path = path .. DIR_DELIM .. "texture_pack.conf" end if conf_path then local conf = Settings(conf_path) if name_is_title then - conf:set("name", result.package.title) + conf:set("name", package.title) else - conf:set("title", result.package.title) - conf:set("name", result.package.name) + conf:set("title", package.title) + conf:set("name", package.name) end if not conf:get("description") then - conf:set("description", result.package.short_description) + conf:set("description", package.short_description) end - conf:set("author", result.package.author) - conf:set("release", result.package.release) + conf:set("author", package.author) + conf:set("release", package.release) conf:write() end end @@ -112,37 +110,17 @@ local function start_install(calling_dialog, package) gamedata.errormessage = fgettext("Failed to download $1", package.name) end - if gamedata.errormessage == nil then - core.button_handler({btn_hidden_close_download=result}) - else - core.button_handler({btn_hidden_close_download={successful=false}}) - end + package.downloading = false + ui.update() end + package.downloading = true + if not core.handle_async(download_package, params, callback) then core.log("error", "ERROR: async event failed") gamedata.errormessage = fgettext("Failed to download $1", package.name) + return end - - local new_dlg = dialog_create("store_downloading", - function(data) - return "size[7,2]label[0.25,0.75;" .. - fgettext("Downloading and installing $1, please wait...", data.title) .. "]" - end, - function(this,fields) - if fields["btn_hidden_close_download"] ~= nil then - this:delete() - return true - end - - return false - end, - nil) - - new_dlg:set_parent(calling_dialog) - new_dlg.data.title = package.title - calling_dialog:hide() - new_dlg:show() end local function get_screenshot(package) @@ -392,9 +370,12 @@ function store.get_formspec(dlgdata) minetest.colorize("#BFBFBF", " by " .. package.author)) formspec[#formspec + 1] = "]" - -- buttons local description_width = 7.5 - if not package.path then + if package.downloading then + formspec[#formspec + 1] = "label[8.4,0.2;" + formspec[#formspec + 1] = fgettext("Downloading...") + formspec[#formspec + 1] = "]" + elseif not package.path then formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" -- cgit v1.2.3 From 03dae5fba6c4211290bf828b8268099415c68986 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 27 May 2020 15:10:47 +0200 Subject: Fix falling entity not falling through players --- builtin/game/falling.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index cdbb13acc..714506a5f 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -323,7 +323,7 @@ core.register_entity(":__builtin:falling_node", { z = vel.z }) self.object:set_pos(vector.add(self.object:get_pos(), - {x = 0, y = -0.2, z = 0})) + {x = 0, y = -0.5, z = 0})) end return elseif bcn.name == "ignore" then -- cgit v1.2.3 From 2fd5f38c45a3b57a9ea2d566aa50f9e5c33794d2 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 27 May 2020 15:41:28 +0200 Subject: Change item entity collisionbox so that they don't sink into the ground --- builtin/game/item_entity.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'builtin') diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index 5d2cd7c76..20dd18044 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -27,8 +27,6 @@ core.register_entity(":__builtin:item", { visual = "wielditem", visual_size = {x = 0.4, y = 0.4}, textures = {""}, - spritediv = {x = 1, y = 1}, - initial_sprite_basepos = {x = 0, y = 0}, is_visible = false, }, @@ -56,7 +54,6 @@ core.register_entity(":__builtin:item", { 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 local def = core.registered_nodes[itemname] local glow = def and math.floor(def.light_source / 2 + 0.5) @@ -65,9 +62,7 @@ core.register_entity(":__builtin:item", { visual = "wielditem", textures = {itemname}, visual_size = {x = size, y = size}, - collisionbox = {-size, -coll_height, -size, - size, coll_height, size}, - selectionbox = {-size, -size, -size, size, size, size}, + collisionbox = {-size, -size, -size, size, size, size}, automatic_rotate = math.pi * 0.5 * 0.2 / size, wield_item = self.itemstring, glow = glow, -- cgit v1.2.3 From 9a64a9fd9427fc3b62d4dc9bf1ca7c15477ebc5a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 29 May 2020 00:52:48 +0100 Subject: Update ContentDB dialog (#9949) --- LICENSE.txt | 6 +++ builtin/mainmenu/dlg_contentstore.lua | 86 +++++++++++++++++++--------------- textures/base/pack/end_icon.png | Bin 0 -> 908 bytes textures/base/pack/next_icon.png | Bin 0 -> 714 bytes textures/base/pack/prev_icon.png | Bin 0 -> 714 bytes textures/base/pack/start_icon.png | Bin 0 -> 912 bytes 6 files changed, 53 insertions(+), 39 deletions(-) create mode 100644 textures/base/pack/end_icon.png create mode 100644 textures/base/pack/next_icon.png create mode 100644 textures/base/pack/prev_icon.png create mode 100644 textures/base/pack/start_icon.png (limited to 'builtin') diff --git a/LICENSE.txt b/LICENSE.txt index 994e024c9..f5c51833b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -21,6 +21,12 @@ ShadowNinja: paramat: textures/base/pack/menu_header.png + textures/base/pack/next_icon.png + textures/base/pack/prev_icon.png + +rubenwardy, paramat: + textures/base/pack/start_icon.png + textures/base/pack/end_icon.png erlehmann: misc/minetest-icon-24x24.png diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 9af16ac86..76c398f5a 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -303,34 +303,35 @@ function store.get_formspec(dlgdata) cur_page = 1 end + local W = 15.75 + local H = 9.5 + local formspec if #store.packages_full > 0 then formspec = { - "size[12,7;true]", + "formspec_version[3]", + "size[15.75,9.5]", "position[0.5,0.55]", - "field[0.2,0.1;7.8,1;search_string;;", - core.formspec_escape(search_string), "]", + "container[0.375,0.375]", + "field[0,0;10.225,0.8;search_string;;", core.formspec_escape(search_string), "]", "field_close_on_enter[search_string;false]", - "button[7.7,-0.2;2,1;search;", - fgettext("Search"), "]", - "dropdown[9.7,-0.1;2.4;type;", - table.concat(filter_types_titles, ","), - ";", filter_type, "]", - -- "textlist[0,1;2.4,5.6;a;", - -- table.concat(taglist, ","), "]", + "button[10.225,0;2,0.8;search;", fgettext("Search"), "]", + "dropdown[12.6,0;2.4,0.8;type;", table.concat(filter_types_titles, ","), ";", filter_type, "]", + "container_end[]", -- Page nav buttons - "container[0,", - num_per_page + 1.5, "]", - "button[-0.1,0;3,1;back;", - fgettext("Back to Main Menu"), "]", - "button[7.1,0;1,1;pstart;<<]", - "button[8.1,0;1,1;pback;<]", - "label[9.2,0.2;", - tonumber(cur_page), " / ", - tonumber(dlgdata.pagemax), "]", - "button[10.1,0;1,1;pnext;>]", - "button[11.1,0;1,1;pend;>>]", + "container[0,", H - 0.8 - 0.375, "]", + "button[0.375,0;4,0.8;back;", fgettext("Back to Main Menu"), "]", + + "container[", W - 0.375 - 0.8*4 - 2, ",0]", + "image_button[0,0;0.8,0.8;", defaulttexturedir, "start_icon.png;pstart;]", + "image_button[0.8,0;0.8,0.8;", defaulttexturedir, "prev_icon.png;pback;]", + "style[pagenum;border=false]", + "button[1.6,0;2,0.8;pagenum;", tonumber(cur_page), " / ", tonumber(dlgdata.pagemax), "]", + "image_button[3.6,0;0.8,0.8;", defaulttexturedir, "next_icon.png;pnext;]", + "image_button[4.4,0;0.8,0.8;", defaulttexturedir, "end_icon.png;pend;]", + "container_end[]", + "container_end[]", } @@ -341,75 +342,82 @@ function store.get_formspec(dlgdata) end else formspec = { - "size[12,7;true]", + "size[12,7]", "position[0.5,0.55]", "label[4,3;", fgettext("No packages could be retrieved"), "]", - "button[-0.1,", - num_per_page + 1.5, - ";3,1;back;", - fgettext("Back to Main Menu"), "]", + "container[0,", H - 0.8 - 0.375, "]", + "button[0,0;4,0.8;back;", fgettext("Back to Main Menu"), "]", + "container_end[]", } end local start_idx = (cur_page - 1) * num_per_page + 1 for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do local package = store.packages[i] - formspec[#formspec + 1] = "container[0.5," - formspec[#formspec + 1] = (i - start_idx) * 1.1 + 1 + formspec[#formspec + 1] = "container[0.375," + formspec[#formspec + 1] = (i - start_idx) * 1.375 + (2*0.375 + 0.8) formspec[#formspec + 1] = "]" -- image - formspec[#formspec + 1] = "image[-0.4,0;1.5,1;" + formspec[#formspec + 1] = "image[0,0;1.5,1;" formspec[#formspec + 1] = core.formspec_escape(get_screenshot(package)) formspec[#formspec + 1] = "]" -- title - formspec[#formspec + 1] = "label[1,-0.1;" + formspec[#formspec + 1] = "label[1.875,0.1;" formspec[#formspec + 1] = core.formspec_escape( minetest.colorize(mt_color_green, package.title) .. minetest.colorize("#BFBFBF", " by " .. package.author)) formspec[#formspec + 1] = "]" - local description_width = 7.5 + -- buttons + local description_width = W - 0.375*5 - 1 - 2*1.5 + formspec[#formspec + 1] = "container[" + formspec[#formspec + 1] = W - 0.375*2 + formspec[#formspec + 1] = ",0.1]" + if package.downloading then - formspec[#formspec + 1] = "label[8.4,0.2;" + formspec[#formspec + 1] = "style[download;border=false]" + + formspec[#formspec + 1] = "button[-3.5,0;2,0.8;download;" formspec[#formspec + 1] = fgettext("Downloading...") formspec[#formspec + 1] = "]" elseif not package.path then - formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_" + formspec[#formspec + 1] = "button[-3,0;1.5,0.8;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Install") formspec[#formspec + 1] = "]" else if package.installed_release < package.release then - description_width = 6 + description_width = description_width - 1.5 -- The install_ action also handles updating - formspec[#formspec + 1] = "button[6.9,0;1.5,1;install_" + formspec[#formspec + 1] = "button[-4.5,0;1.5,0.8;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Update") formspec[#formspec + 1] = "]" end - formspec[#formspec + 1] = "button[8.4,0;1.5,1;uninstall_" + formspec[#formspec + 1] = "button[-3,0;1.5,0.8;uninstall_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Uninstall") formspec[#formspec + 1] = "]" end - formspec[#formspec + 1] = "button[9.9,0;1.5,1;view_" + formspec[#formspec + 1] = "button[-1.5,0;1.5,0.8;view_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("View") formspec[#formspec + 1] = "]" + formspec[#formspec + 1] = "container_end[]" -- description - formspec[#formspec + 1] = "textarea[1.25,0.3;" + formspec[#formspec + 1] = "textarea[1.855,0.3;" formspec[#formspec + 1] = tostring(description_width) - formspec[#formspec + 1] = ",1;;;" + formspec[#formspec + 1] = ",0.8;;;" formspec[#formspec + 1] = core.formspec_escape(package.short_description) formspec[#formspec + 1] = "]" diff --git a/textures/base/pack/end_icon.png b/textures/base/pack/end_icon.png new file mode 100644 index 000000000..4fb4d52a0 Binary files /dev/null and b/textures/base/pack/end_icon.png differ diff --git a/textures/base/pack/next_icon.png b/textures/base/pack/next_icon.png new file mode 100644 index 000000000..03f960917 Binary files /dev/null and b/textures/base/pack/next_icon.png differ diff --git a/textures/base/pack/prev_icon.png b/textures/base/pack/prev_icon.png new file mode 100644 index 000000000..71509e71a Binary files /dev/null and b/textures/base/pack/prev_icon.png differ diff --git a/textures/base/pack/start_icon.png b/textures/base/pack/start_icon.png new file mode 100644 index 000000000..3830fb3ae Binary files /dev/null and b/textures/base/pack/start_icon.png differ -- cgit v1.2.3 From 65a6a316d081d3951438bbbcfce74c9c65db407a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 26 May 2020 02:11:19 +0200 Subject: Add minetest.is_creative_enabled --- builtin/common/misc_helpers.lua | 10 ++-------- builtin/game/item.lua | 2 +- builtin/game/misc.lua | 6 ++++++ doc/lua_api.txt | 7 +++++++ games/devtest/mods/util_commands/init.lua | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) (limited to 'builtin') diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index 1a0c71efd..a88adf96d 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -345,18 +345,12 @@ if INIT == "game" then --Wrapper for rotate_and_place() to check for sneak and assume Creative mode --implies infinite stacks when performing a 6d rotation. -------------------------------------------------------------------------------- - local creative_mode_cache = core.settings:get_bool("creative_mode") - local function is_creative(name) - return creative_mode_cache or - core.check_player_privs(name, {creative = true}) - end - core.rotate_node = function(itemstack, placer, pointed_thing) local name = placer and placer:get_player_name() or "" local invert_wall = placer and placer:get_player_control().sneak or false return core.rotate_and_place(itemstack, placer, pointed_thing, - is_creative(name), - {invert_wall = invert_wall}, true) + core.is_creative_enabled(name), + {invert_wall = invert_wall}, true) end end diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 3aaa71ef2..f680ce0d4 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -582,7 +582,7 @@ function core.node_dig(pos, node, digger) wielded = wdef.after_use(wielded, digger, node, dp) or wielded else -- Wear out tool - if not core.settings:get_bool("creative_mode") then + if not core.is_creative_enabled(diggername) then wielded:add_wear(dp.wear) if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then core.sound_play(wdef.sound.breaks, { diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index 0ed11ada0..341e613c2 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -164,6 +164,12 @@ function core.record_protection_violation(pos, name) end end +-- To be overridden by Creative mods + +local creative_mode_cache = core.settings:get_bool("creative_mode") +function core.is_creative_enabled(name) + return creative_mode_cache +end -- Checks if specified volume intersects a protected volume diff --git a/doc/lua_api.txt b/doc/lua_api.txt index c4310aa5b..bb9df5373 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -5475,6 +5475,13 @@ Misc. * `minetest.record_protection_violation(pos, name)` * This function calls functions registered with `minetest.register_on_protection_violation`. +* `minetest.is_creative_enabled(name)`: returns boolean + * Returning `true` means that Creative Mode is enabled for player `name`. + * `name` will be `""` for non-players or if the player is unknown. + * This function should be overridden by Creative Mode-related mods to + implement a per-player Creative Mode. + * By default, this function returns `true` if the setting + `creative_mode` is `true` and `false` otherwise. * `minetest.is_area_protected(pos1, pos2, player_name, interval)` * Returns the position of the first node that `player_name` may not modify in the specified cuboid between `pos1` and `pos2`. diff --git a/games/devtest/mods/util_commands/init.lua b/games/devtest/mods/util_commands/init.lua index ad8d3f9ba..3a0e91a41 100644 --- a/games/devtest/mods/util_commands/init.lua +++ b/games/devtest/mods/util_commands/init.lua @@ -66,7 +66,7 @@ if s_infplace == "true" then elseif s_infplace == "false" then infplace = false else - infplace = minetest.settings:get_bool("creative_mode", false) + infplace = minetest.is_creative_enabled("") end minetest.register_chatcommand("infplace", { -- cgit v1.2.3 From 850af80089b3415265c4b4b744448509f776a52d Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 4 Jun 2020 21:53:26 +0100 Subject: Add buttons to ContentDB in game bar and configure world (#9944) --- builtin/mainmenu/dlg_config_world.lua | 95 ++++++++++++++++++++-------------- builtin/mainmenu/dlg_contentstore.lua | 11 ++++ builtin/mainmenu/tab_local.lua | 12 +++++ textures/base/pack/plus.png | Bin 0 -> 763 bytes 4 files changed, 79 insertions(+), 39 deletions(-) create mode 100644 textures/base/pack/plus.png (limited to 'builtin') diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua index 97218df9c..2cf70c9c9 100644 --- a/builtin/mainmenu/dlg_config_world.lua +++ b/builtin/mainmenu/dlg_config_world.lua @@ -23,7 +23,49 @@ local function modname_valid(name) return not name:find("[^a-z0-9_]") end +local function init_data(data) + data.list = filterlist.create( + pkgmgr.preparemodlist, + pkgmgr.comparemod, + function(element, uid) + if element.name == uid then + return true + end + end, + function(element, criteria) + if criteria.hide_game and + element.is_game_content then + return false + end + + if criteria.hide_modpackcontents and + element.modpack ~= nil then + return false + end + return true + end, + { + worldpath = data.worldspec.path, + gameid = data.worldspec.gameid + }) + + if data.selected_mod > data.list:size() then + data.selected_mod = 0 + end + + data.list:set_filtercriteria({ + hide_game = data.hide_gamemods, + hide_modpackcontents = data.hide_modpackcontents + }) + data.list:add_sort_mechanism("alphabetic", sort_mod_list) + data.list:set_sortmode("alphabetic") +end + local function get_formspec(data) + if not data.list then + init_data(data) + end + local mod = data.list:get_list()[data.selected_mod] or {name = ""} local retval = @@ -85,11 +127,14 @@ local function get_formspec(data) end end end + retval = retval .. "button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" .. "button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. - fgettext("Cancel") .. "]" + fgettext("Cancel") .. "]" .. + "button[9,7;2.5,0.5;btn_config_world_cdb;" .. + fgettext("Find More Mods") .. "]" if mod.name ~= "" and not mod.is_game_content then if mod.is_modpack then @@ -198,6 +243,16 @@ local function handle_buttons(this, fields) return true end + if fields.btn_config_world_cdb then + this.data.list = nil + + local dlg = create_store_dlg("mod") + dlg:set_parent(this) + this:hide() + dlg:show() + return true + end + if fields.btn_enable_all_mods then local list = this.data.list:get_raw_list() @@ -247,43 +302,5 @@ function create_configure_world_dlg(worldidx) return end - dlg.data.list = filterlist.create( - pkgmgr.preparemodlist, - pkgmgr.comparemod, - function(element, uid) - if element.name == uid then - return true - end - end, - function(element, criteria) - if criteria.hide_game and - element.is_game_content then - return false - end - - if criteria.hide_modpackcontents and - element.modpack ~= nil then - return false - end - return true - end, - { - worldpath = dlg.data.worldspec.path, - gameid = dlg.data.worldspec.gameid - } - ) - - - if dlg.data.selected_mod > dlg.data.list:size() then - dlg.data.selected_mod = 0 - end - - dlg.data.list:set_filtercriteria({ - hide_game = dlg.data.hide_gamemods, - hide_modpackcontents = dlg.data.hide_modpackcontents - }) - dlg.data.list:add_sort_mechanism("alphabetic", sort_mod_list) - dlg.data.list:set_sortmode("alphabetic") - return dlg end diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 76c398f5a..8ac4dba68 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -513,6 +513,17 @@ function create_store_dlg(type) search_string = "" cur_page = 1 + + if type then + -- table.indexof does not work on tables that contain `nil` + for i, v in pairs(filter_types_type) do + if v == type then + filter_type = i + break + end + end + end + store.filter_packages(search_string) return dialog_create("store", diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua index cd6cbea46..a21cf12b1 100644 --- a/builtin/mainmenu/tab_local.lua +++ b/builtin/mainmenu/tab_local.lua @@ -35,6 +35,15 @@ if enable_gamebar then end local function game_buttonbar_button_handler(fields) + if fields.game_open_cdb then + local maintab = ui.find_by_name("maintab") + local dlg = create_store_dlg("game") + dlg:set_parent(maintab) + maintab:hide() + dlg:show() + return true + end + for key,value in pairs(fields) do for j=1,#pkgmgr.games,1 do if ("game_btnbar_" .. pkgmgr.games[j].id == key) then @@ -87,6 +96,9 @@ if enable_gamebar then end btnbar:add_button(btn_name, text, image, tooltip) end + + local plus_image = core.formspec_escape(defaulttexturedir .. "plus.png") + btnbar:add_button("game_open_cdb", "", plus_image, fgettext("Install games from ContentDB")) end else function current_game() diff --git a/textures/base/pack/plus.png b/textures/base/pack/plus.png new file mode 100644 index 000000000..64680b569 Binary files /dev/null and b/textures/base/pack/plus.png differ -- cgit v1.2.3 From 60bab8b2d7b61383188c10f5d931dc7b5522d042 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 6 Jun 2020 17:17:08 +0100 Subject: Add HTTP API to main menu (#9998) --- builtin/fstk/dialog.lua | 19 +++ builtin/fstk/ui.lua | 2 +- builtin/init.lua | 1 + builtin/mainmenu/dlg_contentstore.lua | 49 +++--- doc/fst_api.txt | 7 +- doc/menu_lua_api.txt | 273 +++++++++++++++++++++++----------- src/script/lua_api/l_http.cpp | 44 +++++- src/script/lua_api/l_http.h | 6 + src/script/scripting_mainmenu.cpp | 2 + 9 files changed, 290 insertions(+), 113 deletions(-) (limited to 'builtin') diff --git a/builtin/fstk/dialog.lua b/builtin/fstk/dialog.lua index df887f413..ea57df1d2 100644 --- a/builtin/fstk/dialog.lua +++ b/builtin/fstk/dialog.lua @@ -67,3 +67,22 @@ function dialog_create(name,get_formspec,buttonhandler,eventhandler) ui.add(self) return self end + +function messagebox(name, message) + return dialog_create(name, + function() + return ([[ + formspec_version[3] + size[8,3] + textarea[0.375,0.375;7.25,1.2;;;%s] + button[3,1.825;2,0.8;ok;%s] + ]]):format(message, fgettext("OK")) + end, + function(this, fields) + if fields.ok then + this:delete() + return true + end + end, + nil) +end diff --git a/builtin/fstk/ui.lua b/builtin/fstk/ui.lua index 884100543..6d26aabf0 100644 --- a/builtin/fstk/ui.lua +++ b/builtin/fstk/ui.lua @@ -85,7 +85,7 @@ function ui.update() "box[0.5,1.2;13,5;#000]", ("textarea[0.5,1.2;13,5;;%s;%s]"):format( error_title, error_message), - "button[5,6.6;4,1;btn_error_confirm;" .. fgettext("Ok") .. "]" + "button[5,6.6;4,1;btn_error_confirm;" .. fgettext("OK") .. "]" } else local active_toplevel_ui_elements = 0 diff --git a/builtin/init.lua b/builtin/init.lua index f76174be7..75bb3db85 100644 --- a/builtin/init.lua +++ b/builtin/init.lua @@ -36,6 +36,7 @@ dofile(commonpath .. "misc_helpers.lua") if INIT == "game" then dofile(gamepath .. "init.lua") + assert(not core.get_http_api) elseif INIT == "mainmenu" then local mm_script = core.settings:get("main_menu_script") if mm_script and mm_script ~= "" then diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 8ac4dba68..ae119f48f 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -1,5 +1,5 @@ --Minetest ---Copyright (C) 2018 rubenwardy +--Copyright (C) 2018-20 rubenwardy -- --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 @@ -15,8 +15,18 @@ --with this program; if not, write to the Free Software Foundation, Inc., --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +if not minetest.get_http_api then + function create_store_dlg() + return messagebox("store", + fgettext("ContentDB is not available when Minetest was compiled without cURL")) + end + return +end + local store = { packages = {}, packages_full = {} } +local http = minetest.get_http_api() + -- Screenshot local screenshot_dir = core.get_cache_path() .. DIR_DELIM .. "cdb" assert(core.create_dir(screenshot_dir)) @@ -171,11 +181,6 @@ local function get_screenshot(package) end function store.load() - local tmpdir = os.tempfolder() - local target = tmpdir .. DIR_DELIM .. "packages.json" - - assert(core.create_dir(tmpdir)) - local version = core.get_version() local base_url = core.settings:get("contentdb_url") local url = base_url .. @@ -189,31 +194,29 @@ function store.load() end end - core.download_file(url, target) + local timeout = tonumber(minetest.settings:get("curl_file_download_timeout")) + local response = http.fetch_sync({ url = url, timeout = timeout }) + if not response.succeeded then + return + end - local file = io.open(target, "r") - if file then - store.packages_full = core.parse_json(file:read("*all")) or {} - file:close() + store.packages_full = core.parse_json(response.data) or {} - for _, package in pairs(store.packages_full) do - package.url = base_url .. "/packages/" .. + for _, package in pairs(store.packages_full) do + package.url = base_url .. "/packages/" .. package.author .. "/" .. package.name .. "/releases/" .. package.release .. "/download/" - local name_len = #package.name - if package.type == "game" and name_len > 5 and package.name:sub(name_len - 4) == "_game" then - package.id = package.author:lower() .. "/" .. package.name:sub(1, name_len - 5) - else - package.id = package.author:lower() .. "/" .. package.name - end + local name_len = #package.name + if package.type == "game" and name_len > 5 and package.name:sub(name_len - 4) == "_game" then + package.id = package.author:lower() .. "/" .. package.name:sub(1, name_len - 5) + else + package.id = package.author:lower() .. "/" .. package.name end - - store.packages = store.packages_full - store.loaded = true end - core.delete_dir(tmpdir) + store.packages = store.packages_full + store.loaded = true end function store.update_paths() diff --git a/doc/fst_api.txt b/doc/fst_api.txt index c8bcb1e91..6f9aa14b3 100644 --- a/doc/fst_api.txt +++ b/doc/fst_api.txt @@ -101,6 +101,9 @@ dialog_create(name, cbf_formspec, cbf_button_handler, cbf_events) ^ cbf_events: function to handle events function(dialog, event) +messagebox(name, message) +^ creates a message dialog + Class reference dialog: methods: @@ -113,13 +116,13 @@ methods: ^ hide dialog - delete() ^ delete dialog from ui - + members: - data ^ variable data attached to this dialog - parent ^ parent component to return to on exit - + File: fst/buttonbar.lua ----------------------- diff --git a/doc/menu_lua_api.txt b/doc/menu_lua_api.txt index 485c50110..4eccf5d10 100644 --- a/doc/menu_lua_api.txt +++ b/doc/menu_lua_api.txt @@ -3,34 +3,53 @@ Minetest Lua Mainmenu API Reference 5.3.0 Introduction ------------- + The main menu is defined as a formspec by Lua in builtin/mainmenu/ Description of formspec language to show your menu is in lua_api.txt + Callbacks --------- + core.buttonhandler(fields): called when a button is pressed. ^ fields = {name1 = value1, name2 = value2, ...} core.event_handler(event) ^ event: "MenuQuit", "KeyEnter", "ExitButton" or "EditBoxEnter" + Gamedata -------- + The "gamedata" table is read when calling core.start(). It should contain: { - playername = , - password = , - address = , - port = , - selected_world = , -- 0 for client mode - singleplayer = , + playername = , + password = , + address = , + port = , + selected_world = , -- 0 for client mode + singleplayer = , } + Functions --------- + core.start() core.close() +core.get_min_supp_proto() +^ returns the minimum supported network protocol version +core.get_max_supp_proto() +^ returns the maximum supported network protocol version +core.open_url(url) +^ opens the URL in a web browser, returns false on failure. +^ Must begin with http:// or https:// +core.get_version() (possible in async calls) +^ returns current core version + + +Filesystem +---------- -Filesystem: core.get_builtin_path() ^ returns path to builtin root core.create_dir(absolute_path) (possible in async calls) @@ -48,12 +67,6 @@ core.extract_zip(zipfile,destination) [unzip within path required] ^ zipfile to extract ^ destination folder to extract to ^ returns true/false -core.download_file(url,target) (possible in async calls) -^ url to download -^ target to store to -^ returns true/false -core.get_version() (possible in async calls) -^ returns current core version core.sound_play(spec, looped) -> handle ^ spec = SimpleSoundSpec (see lua-api.txt) ^ looped = bool @@ -67,7 +80,82 @@ core.get_mapgen_names([include_hidden=false]) -> table of map generator algorith registered in the core (possible in async calls) core.get_cache_path() -> path of cache -Formspec: + +HTTP Requests +------------- + +* core.download_file(url, target) (possible in async calls) + * url to download, and target to store to + * returns true/false +* `minetest.get_http_api()` (possible in async calls) + * returns `HTTPApiTable` containing http functions. + * The returned table contains the functions `fetch_sync`, `fetch_async` and + `fetch_async_get` described below. + * Function only exists if minetest server was built with cURL support. +* `HTTPApiTable.fetch_sync(HTTPRequest req)`: returns HTTPRequestResult + * Performs given request synchronously +* `HTTPApiTable.fetch_async(HTTPRequest req)`: returns handle + * Performs given request asynchronously and returns handle for + `HTTPApiTable.fetch_async_get` +* `HTTPApiTable.fetch_async_get(handle)`: returns HTTPRequestResult + * Return response data for given asynchronous HTTP request + +### `HTTPRequest` definition + +Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`. + + { + url = "http://example.org", + + timeout = 10, + -- Timeout for connection in seconds. Default is 3 seconds. + + post_data = "Raw POST request data string" OR {field1 = "data1", field2 = "data2"}, + -- Optional, if specified a POST request with post_data is performed. + -- Accepts both a string and a table. If a table is specified, encodes + -- table as x-www-form-urlencoded key-value pairs. + -- If post_data is not specified, a GET request is performed instead. + + user_agent = "ExampleUserAgent", + -- Optional, if specified replaces the default minetest user agent with + -- given string + + extra_headers = { "Accept-Language: en-us", "Accept-Charset: utf-8" }, + -- Optional, if specified adds additional headers to the HTTP request. + -- You must make sure that the header strings follow HTTP specification + -- ("Key: Value"). + + multipart = boolean + -- Optional, if true performs a multipart HTTP request. + -- Default is false. + } + +### `HTTPRequestResult` definition + +Passed to `HTTPApiTable.fetch` callback. Returned by +`HTTPApiTable.fetch_async_get`. + + { + completed = true, + -- If true, the request has finished (either succeeded, failed or timed + -- out) + + succeeded = true, + -- If true, the request was successful + + timeout = false, + -- If true, the request timed out + + code = 200, + -- HTTP status code + + data = "response" + } + + +Formspec +-------- + core.update_formspec(formspec) core.get_table_index(tablename) -> index ^ can also handle textlists @@ -82,7 +170,10 @@ core.explode_textlist_event(string) -> table core.set_formspec_prepend(formspec) ^ string to be added to every mainmenu formspec, to be used for theming. -GUI: + +GUI +--- + core.set_background(type, texturepath,[tile],[minsize]) ^ type: "background", "overlay", "header" or "footer" ^ tile: tile the image instead of scaling (background only) @@ -102,86 +193,96 @@ core.show_path_select_dialog(formname, caption, is_file_select) ^ returns nil or selected file/folder core.get_screen_info() ^ returns { - density = , - display_width = , - display_height = , - window_width = , - window_height = - } + density = , + display_width = , + display_height = , + window_width = , + window_height = + } -### Content and Packages + +Content and Packages +-------------------- Content - an installed mod, modpack, game, or texture pack (txt) Package - content which is downloadable from the content db, may or may not be installed. * core.get_modpath() (possible in async calls) - * returns path to global modpath + * returns path to global modpath * core.get_clientmodpath() (possible in async calls) - * returns path to global client-side modpath + * returns path to global client-side modpath * core.get_gamepath() (possible in async calls) - * returns path to global gamepath + * returns path to global gamepath * core.get_texturepath() (possible in async calls) - * returns path to default textures + * returns path to default textures * core.get_game(index) - * returns: - - { - id = , - path = , - gamemods_path = , - name = , - menuicon_path = , - author = "author", - DEPRECATED: - addon_mods_paths = {[1] = ,}, - } + * returns: + + { + id = , + path = , + gamemods_path = , + name = , + menuicon_path = , + author = "author", + DEPRECATED: + addon_mods_paths = {[1] = ,}, + } * core.get_games() -> table of all games in upper format (possible in async calls) * core.get_content_info(path) - * returns + * returns - { - name = "name of content", - type = "mod" or "modpack" or "game" or "txp", - description = "description", - author = "author", - path = "path/to/content", - depends = {"mod", "names"}, -- mods only - optional_depends = {"mod", "names"}, -- mods only - } + { + name = "name of content", + type = "mod" or "modpack" or "game" or "txp", + description = "description", + author = "author", + path = "path/to/content", + depends = {"mod", "names"}, -- mods only + optional_depends = {"mod", "names"}, -- mods only + } -Favorites: +Favorites +--------- + core.get_favorites(location) -> list of favorites (possible in async calls) ^ location: "local" or "online" ^ returns { - [1] = { - clients = , - clients_max = , - version = , - password = , - creative = , - damage = , - pvp = , - description = , - name = , - address =
, - port = - clients_list = - mods = - }, - ... + [1] = { + clients = , + clients_max = , + version = , + password = , + creative = , + damage = , + pvp = , + description = , + name = , + address =
, + port = + clients_list = + mods = + }, + ... } core.delete_favorite(id, location) -> success -Logging: + +Logging +------- + core.debug(line) (possible in async calls) ^ Always printed to stderr and logfile (print() is redirected here) core.log(line) (possible in async calls) core.log(loglevel, line) (possible in async calls) ^ loglevel one of "error", "action", "info", "verbose" -Settings: + +Settings +-------- + core.settings:set(name, value) core.settings:get(name) -> string or nil (possible in async calls) core.settings:set_bool(name, value) @@ -191,19 +292,25 @@ core.settings:save() -> nil, save all settings to config file For a complete list of methods of the Settings object see [lua_api.txt](https://github.com/minetest/minetest/blob/master/doc/lua_api.txt) -Worlds: + +Worlds +------ + core.get_worlds() -> list of worlds (possible in async calls) ^ returns { - [1] = { - path = , - name = , - gameid = , - }, + [1] = { + path = , + name = , + gameid = , + }, } core.create_world(worldname, gameid) core.delete_world(index) -Helpers: + +Helpers +------- + core.get_us_time() ^ returns time with microsecond precision core.gettext(string) -> string @@ -228,18 +335,10 @@ minetest.encode_base64(string) (possible in async calls) minetest.decode_base64(string) (possible in async calls) ^ Decodes a string encoded in base64. -Version compat: -core.get_min_supp_proto() -^ returns the minimum supported network protocol version -core.get_max_supp_proto() -^ returns the maximum supported network protocol version -Other: -core.open_url(url) -^ opens the URL in a web browser, returns false on failure. -^ Must begin with http:// or https:// +Async +----- -Async: core.handle_async(async_job,parameters,finished) ^ execute a function asynchronously ^ async_job is a function receiving one parameter and returning one parameter @@ -250,11 +349,13 @@ core.handle_async(async_job,parameters,finished) Limitations of Async operations -No access to global lua variables, don't even try -Limited set of available functions - e.g. No access to functions modifying menu like core.start,core.close, - core.show_path_select_dialog + e.g. No access to functions modifying menu like core.start,core.close, + core.show_path_select_dialog + Background music ---------------- + The main menu supports background music. It looks for a `main_menu` sound in `$USER_PATH/sounds`. The same naming conventions as for normal sounds apply. diff --git a/src/script/lua_api/l_http.cpp b/src/script/lua_api/l_http.cpp index 2ff651cb5..73b4586e0 100644 --- a/src/script/lua_api/l_http.cpp +++ b/src/script/lua_api/l_http.cpp @@ -83,6 +83,24 @@ void ModApiHttp::push_http_fetch_result(lua_State *L, HTTPFetchResult &res, bool setstringfield(L, -1, "data", res.data); } +// http_api.fetch_sync(HTTPRequest definition) +int ModApiHttp::l_http_fetch_sync(lua_State *L) +{ + NO_MAP_LOCK_REQUIRED; + + HTTPFetchRequest req; + read_http_fetch_request(L, req); + + infostream << "Mod performs HTTP request with URL " << req.url << std::endl; + + HTTPFetchResult res; + httpfetch_sync(req, res); + + push_http_fetch_result(L, res, true); + + return 1; +} + // http_api.fetch_async(HTTPRequest definition) int ModApiHttp::l_http_fetch_async(lua_State *L) { @@ -180,11 +198,35 @@ int ModApiHttp::l_request_http_api(lua_State *L) return 1; } + +int ModApiHttp::l_get_http_api(lua_State *L) +{ + NO_MAP_LOCK_REQUIRED; + + lua_newtable(L); + HTTP_API(fetch_async); + HTTP_API(fetch_async_get); + HTTP_API(fetch_sync); + + return 1; +} + #endif void ModApiHttp::Initialize(lua_State *L, int top) { #if USE_CURL - API_FCT(request_http_api); + + bool isMainmenu = false; +#ifndef SERVER + isMainmenu = ModApiBase::getGuiEngine(L) != nullptr; +#endif + + if (isMainmenu) { + API_FCT(get_http_api); + } else { + API_FCT(request_http_api); + } + #endif } diff --git a/src/script/lua_api/l_http.h b/src/script/lua_api/l_http.h index 3d9cdad29..c665235a9 100644 --- a/src/script/lua_api/l_http.h +++ b/src/script/lua_api/l_http.h @@ -32,6 +32,9 @@ private: static void read_http_fetch_request(lua_State *L, HTTPFetchRequest &req); static void push_http_fetch_result(lua_State *L, HTTPFetchResult &res, bool completed = true); + // http_fetch_sync({url=, timeout=, post_data=}) + static int l_http_fetch_sync(lua_State *L); + // http_fetch_async({url=, timeout=, post_data=}) static int l_http_fetch_async(lua_State *L); @@ -40,6 +43,9 @@ private: // request_http_api() static int l_request_http_api(lua_State *L); + + // get_http_api() + static int l_get_http_api(lua_State *L); #endif public: diff --git a/src/script/scripting_mainmenu.cpp b/src/script/scripting_mainmenu.cpp index b6068439a..08858b1a5 100644 --- a/src/script/scripting_mainmenu.cpp +++ b/src/script/scripting_mainmenu.cpp @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "content/mods.h" #include "cpp_api/s_internal.h" #include "lua_api/l_base.h" +#include "lua_api/l_http.h" #include "lua_api/l_mainmenu.h" #include "lua_api/l_sound.h" #include "lua_api/l_util.h" @@ -67,6 +68,7 @@ void MainMenuScripting::initializeModApi(lua_State *L, int top) ModApiMainMenu::Initialize(L, top); ModApiUtil::Initialize(L, top); ModApiSound::Initialize(L, top); + ModApiHttp::Initialize(L, top); asyncEngine.registerStateInitializer(registerLuaClasses); asyncEngine.registerStateInitializer(ModApiMainMenu::InitializeAsync); -- cgit v1.2.3 From 36099ba947e6a54429c9fdd45ef1fc6dcc86389b Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 6 Jun 2020 17:59:39 +0100 Subject: Fix incorrect extension used for ContentDB thumbnails --- builtin/mainmenu/dlg_contentstore.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index ae119f48f..b5c330f8f 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -133,6 +133,11 @@ local function start_install(calling_dialog, package) end end +local function get_file_extension(path) + local parts = path:split(".") + return parts[#parts] +end + local function get_screenshot(package) if not package.thumbnail then return defaulttexturedir .. "no_screenshot.png" @@ -141,8 +146,9 @@ local function get_screenshot(package) end -- Get tmp screenshot path + local ext = get_file_extension(package.thumbnail) local filepath = screenshot_dir .. DIR_DELIM .. - package.type .. "-" .. package.author .. "-" .. package.name .. ".png" + ("%s-%s-%s.%s"):format(package.type, package.author, package.name, ext) -- Return if already downloaded local file = io.open(filepath, "r") -- cgit v1.2.3 From b16f841756ef86e83710ad2fddf2cd5bafdf4bcc Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Tue, 9 Jun 2020 13:37:25 -0400 Subject: LuaItemStack: Add __tostring metamethod (#8785) * LuaItemStack: Add __tostring metamethod * Clean up LuaItemStack::checkobject --- builtin/common/misc_helpers.lua | 2 ++ src/inventory.cpp | 29 ++++++++++++++++------------- src/inventory.h | 4 ++-- src/script/lua_api/l_item.cpp | 25 ++++++++++++++++++------- src/script/lua_api/l_item.h | 3 +++ 5 files changed, 41 insertions(+), 22 deletions(-) (limited to 'builtin') diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index a88adf96d..e29a9f422 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -20,6 +20,8 @@ local function basic_dump(o) -- dump's output is intended for humans. --elseif tp == "function" then -- return string.format("loadstring(%q)", string.dump(o)) + elseif tp == "userdata" then + return tostring(o) else return string.format("<%s>", tp) end diff --git a/src/inventory.cpp b/src/inventory.cpp index 77ecf5876..349ee503d 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -56,28 +56,31 @@ ItemStack::ItemStack(const std::string &name_, u16 count_, count = 1; } -void ItemStack::serialize(std::ostream &os) const +void ItemStack::serialize(std::ostream &os, bool serialize_meta) const { if (empty()) return; // Check how many parts of the itemstring are needed int parts = 1; - if(count != 1) - parts = 2; - if(wear != 0) - parts = 3; if (!metadata.empty()) parts = 4; + else if (wear != 0) + parts = 3; + else if (count != 1) + parts = 2; - os<= 2) - os<<" "<= 3) - os<<" "<= 2) + os << " " << count; + if (parts >= 3) + os << " " << wear; if (parts >= 4) { os << " "; - metadata.serialize(os); + if (serialize_meta) + metadata.serialize(os); + else + os << ""; } } @@ -240,10 +243,10 @@ void ItemStack::deSerialize(const std::string &str, IItemDefManager *itemdef) deSerialize(is, itemdef); } -std::string ItemStack::getItemString() const +std::string ItemStack::getItemString(bool include_meta) const { std::ostringstream os(std::ios::binary); - serialize(os); + serialize(os, include_meta); return os.str(); } diff --git a/src/inventory.h b/src/inventory.h index 2828d3e5a..67a7859ed 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -40,13 +40,13 @@ struct ItemStack ~ItemStack() = default; // Serialization - void serialize(std::ostream &os) const; + void serialize(std::ostream &os, bool serialize_meta = true) const; // Deserialization. Pass itemdef unless you don't want aliases resolved. void deSerialize(std::istream &is, IItemDefManager *itemdef = NULL); void deSerialize(const std::string &s, IItemDefManager *itemdef = NULL); // Returns the string used for inventory - std::string getItemString() const; + std::string getItemString(bool include_meta = true) const; // Returns the tooltip std::string getDescription(IItemDefManager *itemdef) const; diff --git a/src/script/lua_api/l_item.cpp b/src/script/lua_api/l_item.cpp index 0a403acbd..d67cab76f 100644 --- a/src/script/lua_api/l_item.cpp +++ b/src/script/lua_api/l_item.cpp @@ -37,6 +37,15 @@ int LuaItemStack::gc_object(lua_State *L) return 0; } +// __tostring metamethod +int LuaItemStack::mt_tostring(lua_State *L) +{ + LuaItemStack *o = checkobject(L, 1); + std::string itemstring = o->m_stack.getItemString(false); + lua_pushfstring(L, "ItemStack(\"%s\")", itemstring.c_str()); + return 1; +} + // is_empty(self) -> true/false int LuaItemStack::l_is_empty(lua_State *L) { @@ -433,12 +442,9 @@ int LuaItemStack::create(lua_State *L, const ItemStack &item) return 1; } -LuaItemStack* LuaItemStack::checkobject(lua_State *L, int narg) +LuaItemStack *LuaItemStack::checkobject(lua_State *L, int narg) { - luaL_checktype(L, narg, LUA_TUSERDATA); - void *ud = luaL_checkudata(L, narg, className); - if(!ud) luaL_typerror(L, narg, className); - return *(LuaItemStack**)ud; // unbox pointer + return *(LuaItemStack **)luaL_checkudata(L, narg, className); } void LuaItemStack::Register(lua_State *L) @@ -448,9 +454,10 @@ void LuaItemStack::Register(lua_State *L) luaL_newmetatable(L, className); int metatable = lua_gettop(L); + // hide metatable from Lua getmetatable() lua_pushliteral(L, "__metatable"); lua_pushvalue(L, methodtable); - lua_settable(L, metatable); // hide metatable from Lua getmetatable() + lua_settable(L, metatable); lua_pushliteral(L, "__index"); lua_pushvalue(L, methodtable); @@ -460,12 +467,16 @@ void LuaItemStack::Register(lua_State *L) lua_pushcfunction(L, gc_object); lua_settable(L, metatable); + lua_pushliteral(L, "__tostring"); + lua_pushcfunction(L, mt_tostring); + lua_settable(L, metatable); + lua_pop(L, 1); // drop metatable luaL_openlib(L, 0, methods, 0); // fill methodtable lua_pop(L, 1); // drop methodtable - // Can be created from Lua (LuaItemStack(itemstack or itemstring or table or nil)) + // Can be created from Lua (ItemStack(itemstack or itemstring or table or nil)) lua_register(L, className, create_object); } diff --git a/src/script/lua_api/l_item.h b/src/script/lua_api/l_item.h index 6fab58045..98744c071 100644 --- a/src/script/lua_api/l_item.h +++ b/src/script/lua_api/l_item.h @@ -34,6 +34,9 @@ private: // garbage collector static int gc_object(lua_State *L); + // __tostring metamethod + static int mt_tostring(lua_State *L); + // is_empty(self) -> true/false static int l_is_empty(lua_State *L); -- cgit v1.2.3 From 7148834440d10bc211628aa2652e31166bdd58a0 Mon Sep 17 00:00:00 2001 From: NetherEran <55532075+NetherEran@users.noreply.github.com> Date: Tue, 9 Jun 2020 17:38:39 +0000 Subject: Some vector functions useful for working with rotations (#9572) * added vector.rotate * added vector.forward_from_rotation and vector.up_from_rotation * added vector.forward_up_to_rotatiton * fixed some bugs and formatting with vector functions * shortened name of some new vector functions and added documentation * made vector.rotate not require a unit vector as axis * fixed crash with vector.forward_up_to_rot * renamed new vector functions, made vector.rotate apply a rotation matrix, old vector.rotate is now called vector.rotate_around_axis * documented vector function changes * removed some whitespace to appease luacheck * implemented and fixed optimization of vector.rotate_around_axis by SmallJoker * added some unit tests for rotation vector functions * clarified that rotation vectors are in radians and according to the left hand rule * hopefully appeased luacheck * renamed rotation_to_horizontal to forward_at_rotation, rotation_to_vertical to up_at_rotation * handled cases where sin or cos are 0 in rotation vector functions * added more comments * clarified documentation of rotation vector functions * added more unit tests * changed way in which vector.rotate_around_axis is adjusted for left handed coordinate systems * made vector.rotate_around_axis actually left handed * unrolled matrix multiplication * removed vector.forward_at_rotation and vector.up_at_rotation * prettified vector.rotate_around_axis, made previous commits not break anything * removed references to removed vector.forward_at_rotation and vector.up_at_rotation * removed documentation of removed vector functions * clarified documentation and fixed styling of rotation vector functions * restyled comments minorly * spelling fixes and some hopefully better comments * allowed 'up' to be missing from vector.directions_to_rotation and removed requirement for unit vectors as arguments * made vector.rotate_around_axis() right handed again for consistency * documented previous changes * made matrix multiplication actually multiply * renamed vector.directions_to_rotation() to vector.dir_to_rotation() * optimized a distance comparison * Fixed potential false positive in unit tests. Co-authored-by: NetherEran --- builtin/common/tests/vector_spec.lua | 142 +++++++++++++++++++++++++++++++++++ builtin/common/vector.lua | 93 +++++++++++++++++++++++ doc/lua_api.txt | 18 +++++ 3 files changed, 253 insertions(+) (limited to 'builtin') diff --git a/builtin/common/tests/vector_spec.lua b/builtin/common/tests/vector_spec.lua index 79f032f28..6f308a4a8 100644 --- a/builtin/common/tests/vector_spec.lua +++ b/builtin/common/tests/vector_spec.lua @@ -43,4 +43,146 @@ describe("vector", function() it("add()", function() assert.same({ x = 2, y = 4, z = 6 }, vector.add(vector.new(1, 2, 3), { x = 1, y = 2, z = 3 })) end) + + -- This function is needed because of floating point imprecision. + local function almost_equal(a, b) + if type(a) == "number" then + return math.abs(a - b) < 0.00000000001 + end + return vector.distance(a, b) < 0.000000000001 + end + + describe("rotate_around_axis()", function() + it("rotates", function() + assert.True(almost_equal({x = -1, y = 0, z = 0}, + vector.rotate_around_axis({x = 1, y = 0, z = 0}, {x = 0, y = 1, z = 0}, math.pi))) + assert.True(almost_equal({x = 0, y = 1, z = 0}, + vector.rotate_around_axis({x = 0, y = 0, z = 1}, {x = 1, y = 0, z = 0}, math.pi / 2))) + assert.True(almost_equal({x = 4, y = 1, z = 1}, + vector.rotate_around_axis({x = 4, y = 1, z = 1}, {x = 4, y = 1, z = 1}, math.pi / 6))) + end) + it("keeps distance to axis", function() + local rotate1 = {x = 1, y = 3, z = 1} + local axis1 = {x = 1, y = 3, z = 2} + local rotated1 = vector.rotate_around_axis(rotate1, axis1, math.pi / 13) + assert.True(almost_equal(vector.distance(axis1, rotate1), vector.distance(axis1, rotated1))) + local rotate2 = {x = 1, y = 1, z = 3} + local axis2 = {x = 2, y = 6, z = 100} + local rotated2 = vector.rotate_around_axis(rotate2, axis2, math.pi / 23) + assert.True(almost_equal(vector.distance(axis2, rotate2), vector.distance(axis2, rotated2))) + local rotate3 = {x = 1, y = -1, z = 3} + local axis3 = {x = 2, y = 6, z = 100} + local rotated3 = vector.rotate_around_axis(rotate3, axis3, math.pi / 2) + assert.True(almost_equal(vector.distance(axis3, rotate3), vector.distance(axis3, rotated3))) + end) + it("rotates back", function() + local rotate1 = {x = 1, y = 3, z = 1} + local axis1 = {x = 1, y = 3, z = 2} + local rotated1 = vector.rotate_around_axis(rotate1, axis1, math.pi / 13) + rotated1 = vector.rotate_around_axis(rotated1, axis1, -math.pi / 13) + assert.True(almost_equal(rotate1, rotated1)) + local rotate2 = {x = 1, y = 1, z = 3} + local axis2 = {x = 2, y = 6, z = 100} + local rotated2 = vector.rotate_around_axis(rotate2, axis2, math.pi / 23) + rotated2 = vector.rotate_around_axis(rotated2, axis2, -math.pi / 23) + assert.True(almost_equal(rotate2, rotated2)) + local rotate3 = {x = 1, y = -1, z = 3} + local axis3 = {x = 2, y = 6, z = 100} + local rotated3 = vector.rotate_around_axis(rotate3, axis3, math.pi / 2) + rotated3 = vector.rotate_around_axis(rotated3, axis3, -math.pi / 2) + assert.True(almost_equal(rotate3, rotated3)) + end) + it("is right handed", function() + local v_before1 = {x = 0, y = 1, z = -1} + local v_after1 = vector.rotate_around_axis(v_before1, {x = 1, y = 0, z = 0}, math.pi / 4) + assert.True(almost_equal(vector.normalize(vector.cross(v_after1, v_before1)), {x = 1, y = 0, z = 0})) + + local v_before2 = {x = 0, y = 3, z = 4} + local v_after2 = vector.rotate_around_axis(v_before2, {x = 1, y = 0, z = 0}, 2 * math.pi / 5) + assert.True(almost_equal(vector.normalize(vector.cross(v_after2, v_before2)), {x = 1, y = 0, z = 0})) + + local v_before3 = {x = 1, y = 0, z = -1} + local v_after3 = vector.rotate_around_axis(v_before3, {x = 0, y = 1, z = 0}, math.pi / 4) + assert.True(almost_equal(vector.normalize(vector.cross(v_after3, v_before3)), {x = 0, y = 1, z = 0})) + + local v_before4 = {x = 3, y = 0, z = 4} + local v_after4 = vector.rotate_around_axis(v_before4, {x = 0, y = 1, z = 0}, 2 * math.pi / 5) + assert.True(almost_equal(vector.normalize(vector.cross(v_after4, v_before4)), {x = 0, y = 1, z = 0})) + + local v_before5 = {x = 1, y = -1, z = 0} + local v_after5 = vector.rotate_around_axis(v_before5, {x = 0, y = 0, z = 1}, math.pi / 4) + assert.True(almost_equal(vector.normalize(vector.cross(v_after5, v_before5)), {x = 0, y = 0, z = 1})) + + local v_before6 = {x = 3, y = 4, z = 0} + local v_after6 = vector.rotate_around_axis(v_before6, {x = 0, y = 0, z = 1}, 2 * math.pi / 5) + assert.True(almost_equal(vector.normalize(vector.cross(v_after6, v_before6)), {x = 0, y = 0, z = 1})) + end) + end) + + describe("rotate()", function() + it("rotates", function() + assert.True(almost_equal({x = -1, y = 0, z = 0}, + vector.rotate({x = 1, y = 0, z = 0}, {x = 0, y = math.pi, z = 0}))) + assert.True(almost_equal({x = 0, y = -1, z = 0}, + vector.rotate({x = 1, y = 0, z = 0}, {x = 0, y = 0, z = math.pi / 2}))) + assert.True(almost_equal({x = 1, y = 0, z = 0}, + vector.rotate({x = 1, y = 0, z = 0}, {x = math.pi / 123, y = 0, z = 0}))) + end) + it("is counterclockwise", function() + local v_before1 = {x = 0, y = 1, z = -1} + local v_after1 = vector.rotate(v_before1, {x = math.pi / 4, y = 0, z = 0}) + assert.True(almost_equal(vector.normalize(vector.cross(v_after1, v_before1)), {x = 1, y = 0, z = 0})) + + local v_before2 = {x = 0, y = 3, z = 4} + local v_after2 = vector.rotate(v_before2, {x = 2 * math.pi / 5, y = 0, z = 0}) + assert.True(almost_equal(vector.normalize(vector.cross(v_after2, v_before2)), {x = 1, y = 0, z = 0})) + + local v_before3 = {x = 1, y = 0, z = -1} + local v_after3 = vector.rotate(v_before3, {x = 0, y = math.pi / 4, z = 0}) + assert.True(almost_equal(vector.normalize(vector.cross(v_after3, v_before3)), {x = 0, y = 1, z = 0})) + + local v_before4 = {x = 3, y = 0, z = 4} + local v_after4 = vector.rotate(v_before4, {x = 0, y = 2 * math.pi / 5, z = 0}) + assert.True(almost_equal(vector.normalize(vector.cross(v_after4, v_before4)), {x = 0, y = 1, z = 0})) + + local v_before5 = {x = 1, y = -1, z = 0} + local v_after5 = vector.rotate(v_before5, {x = 0, y = 0, z = math.pi / 4}) + assert.True(almost_equal(vector.normalize(vector.cross(v_after5, v_before5)), {x = 0, y = 0, z = 1})) + + local v_before6 = {x = 3, y = 4, z = 0} + local v_after6 = vector.rotate(v_before6, {x = 0, y = 0, z = 2 * math.pi / 5}) + assert.True(almost_equal(vector.normalize(vector.cross(v_after6, v_before6)), {x = 0, y = 0, z = 1})) + end) + end) + + it("dir_to_rotation()", function() + -- Comparing rotations (pitch, yaw, roll) is hard because of certain ambiguities, + -- e.g. (pi, 0, pi) looks exactly the same as (0, pi, 0) + -- So instead we convert the rotation back to vectors and compare these. + local function forward_at_rot(rot) + return vector.rotate(vector.new(0, 0, 1), rot) + end + local function up_at_rot(rot) + return vector.rotate(vector.new(0, 1, 0), rot) + end + local rot1 = vector.dir_to_rotation({x = 1, y = 0, z = 0}, {x = 0, y = 1, z = 0}) + assert.True(almost_equal({x = 1, y = 0, z = 0}, forward_at_rot(rot1))) + assert.True(almost_equal({x = 0, y = 1, z = 0}, up_at_rot(rot1))) + local rot2 = vector.dir_to_rotation({x = 1, y = 1, z = 0}, {x = 0, y = 0, z = 1}) + assert.True(almost_equal({x = 1/math.sqrt(2), y = 1/math.sqrt(2), z = 0}, forward_at_rot(rot2))) + assert.True(almost_equal({x = 0, y = 0, z = 1}, up_at_rot(rot2))) + for i = 1, 1000 do + local rand_vec = vector.new(math.random(), math.random(), math.random()) + if vector.length(rand_vec) ~= 0 then + local rot_1 = vector.dir_to_rotation(rand_vec) + local rot_2 = { + x = math.atan2(rand_vec.y, math.sqrt(rand_vec.z * rand_vec.z + rand_vec.x * rand_vec.x)), + y = -math.atan2(rand_vec.x, rand_vec.z), + z = 0 + } + assert.True(almost_equal(rot_1, rot_2)) + end + end + + end) end) diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua index ca6541eb4..1fd784ce2 100644 --- a/builtin/common/vector.lua +++ b/builtin/common/vector.lua @@ -141,3 +141,96 @@ function vector.sort(a, b) return {x = math.min(a.x, b.x), y = math.min(a.y, b.y), z = math.min(a.z, b.z)}, {x = math.max(a.x, b.x), y = math.max(a.y, b.y), z = math.max(a.z, b.z)} end + +local function sin(x) + if x % math.pi == 0 then + return 0 + else + return math.sin(x) + end +end + +local function cos(x) + if x % math.pi == math.pi / 2 then + return 0 + else + return math.cos(x) + end +end + +function vector.rotate_around_axis(v, axis, angle) + local cosangle = cos(angle) + local sinangle = sin(angle) + axis = vector.normalize(axis) + -- https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula + local dot_axis = vector.multiply(axis, vector.dot(axis, v)) + local cross = vector.cross(v, axis) + return vector.new( + cross.x * sinangle + (v.x - dot_axis.x) * cosangle + dot_axis.x, + cross.y * sinangle + (v.y - dot_axis.y) * cosangle + dot_axis.y, + cross.z * sinangle + (v.z - dot_axis.z) * cosangle + dot_axis.z + ) +end + +function vector.rotate(v, rot) + local sinpitch = sin(-rot.x) + local sinyaw = sin(-rot.y) + local sinroll = sin(-rot.z) + local cospitch = cos(rot.x) + local cosyaw = cos(rot.y) + local cosroll = math.cos(rot.z) + -- Rotation matrix that applies yaw, pitch and roll + local matrix = { + { + sinyaw * sinpitch * sinroll + cosyaw * cosroll, + sinyaw * sinpitch * cosroll - cosyaw * sinroll, + sinyaw * cospitch, + }, + { + cospitch * sinroll, + cospitch * cosroll, + -sinpitch, + }, + { + cosyaw * sinpitch * sinroll - sinyaw * cosroll, + cosyaw * sinpitch * cosroll + sinyaw * sinroll, + cosyaw * cospitch, + }, + } + -- Compute matrix multiplication: `matrix` * `v` + return vector.new( + matrix[1][1] * v.x + matrix[1][2] * v.y + matrix[1][3] * v.z, + matrix[2][1] * v.x + matrix[2][2] * v.y + matrix[2][3] * v.z, + matrix[3][1] * v.x + matrix[3][2] * v.y + matrix[3][3] * v.z + ) +end + +function vector.dir_to_rotation(forward, up) + forward = vector.normalize(forward) + local rot = {x = math.asin(forward.y), y = -math.atan2(forward.x, forward.z), z = 0} + if not up then + return rot + end + assert(vector.dot(forward, up) < 0.000001, + "Invalid vectors passed to vector.dir_to_rotation().") + up = vector.normalize(up) + -- Calculate vector pointing up with roll = 0, just based on forward vector. + local forwup = vector.rotate({x = 0, y = 1, z = 0}, rot) + -- 'forwup' and 'up' are now in a plane with 'forward' as normal. + -- The angle between them is the absolute of the roll value we're looking for. + rot.z = vector.angle(forwup, up) + + -- Since vector.angle never returns a negative value or a value greater + -- than math.pi, rot.z has to be inverted sometimes. + -- To determine wether this is the case, we rotate the up vector back around + -- the forward vector and check if it worked out. + local back = vector.rotate_around_axis(up, forward, -rot.z) + + -- We don't use vector.equals for this because of floating point imprecision. + if (back.x - forwup.x) * (back.x - forwup.x) + + (back.y - forwup.y) * (back.y - forwup.y) + + (back.z - forwup.z) * (back.z - forwup.z) > 0.0000001 then + rot.z = -rot.z + end + return rot +end diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 898531880..ed060c4ad 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3007,6 +3007,24 @@ For the following functions `x` can be either a vector or a number: * `vector.divide(v, x)`: * Returns a scaled vector or Schur quotient. +For the following functions `a` is an angle in radians and `r` is a rotation +vector ({x = , y = , z = }) where pitch, yaw and roll are +angles in radians. + +* `vector.rotate(v, r)`: + * Applies the rotation `r` to `v` and returns the result. + * `vector.rotate({x = 0, y = 0, z = 1}, r)` and + `vector.rotate({x = 0, y = 1, z = 0}, r)` return vectors pointing + forward and up relative to an entity's rotation `r`. +* `vector.rotate_around_axis(v1, v2, a)`: + * Returns `v1` rotated around axis `v2` by `a` radians according to + the right hand rule. +* `vector.dir_to_rotation(direction[, up])`: + * Returns a rotation vector for `direction` pointing forward using `up` + as the up vector. + * If `up` is omitted, the roll of the returned vector defaults to zero. + * Otherwise `direction` and `up` need to be vectors in a 90 degree angle to each other. + -- cgit v1.2.3 From 21de17e3b695f3fcb0462f4aeb2a6ff733d0d282 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 8 Jul 2020 23:37:14 +0200 Subject: Fix ContentDB menu icons not appearing on Windows --- builtin/mainmenu/dlg_contentstore.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'builtin') diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index b5c330f8f..01c42be0b 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -333,12 +333,12 @@ function store.get_formspec(dlgdata) "button[0.375,0;4,0.8;back;", fgettext("Back to Main Menu"), "]", "container[", W - 0.375 - 0.8*4 - 2, ",0]", - "image_button[0,0;0.8,0.8;", defaulttexturedir, "start_icon.png;pstart;]", - "image_button[0.8,0;0.8,0.8;", defaulttexturedir, "prev_icon.png;pback;]", + "image_button[0,0;0.8,0.8;", core.formspec_escape(defaulttexturedir), "start_icon.png;pstart;]", + "image_button[0.8,0;0.8,0.8;", core.formspec_escape(defaulttexturedir), "prev_icon.png;pback;]", "style[pagenum;border=false]", "button[1.6,0;2,0.8;pagenum;", tonumber(cur_page), " / ", tonumber(dlgdata.pagemax), "]", - "image_button[3.6,0;0.8,0.8;", defaulttexturedir, "next_icon.png;pnext;]", - "image_button[4.4,0;0.8,0.8;", defaulttexturedir, "end_icon.png;pend;]", + "image_button[3.6,0;0.8,0.8;", core.formspec_escape(defaulttexturedir), "next_icon.png;pnext;]", + "image_button[4.4,0;0.8,0.8;", core.formspec_escape(defaulttexturedir), "end_icon.png;pend;]", "container_end[]", "container_end[]", -- cgit v1.2.3 From 88ffd641243ead70d82623d54822421c72893240 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Tue, 14 Jul 2020 10:12:17 -0700 Subject: Add object crosshair, disable entity selectionboxes by default (#9523) Adds new object crosshair base pack texture --- builtin/settingtypes.txt | 5 ++++- doc/texture_packs.txt | 7 ++++++- minetest.conf.example | 4 ++-- src/client/game.cpp | 3 +++ src/client/hud.cpp | 39 ++++++++++++++++++++++++++++++++++----- src/client/hud.h | 4 ++++ src/client/render/core.cpp | 1 + src/defaultsettings.cpp | 2 +- 8 files changed, 55 insertions(+), 10 deletions(-) (limited to 'builtin') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index c787aea2c..c0620542d 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -741,9 +741,11 @@ selectionbox_color (Selection box color) string (0,0,0) selectionbox_width (Selection box width) int 2 1 5 # Crosshair color (R,G,B). +# Also controls the object crosshair color crosshair_color (Crosshair color) string (255,255,255) # Crosshair alpha (opaqueness, between 0 and 255). +# Also controls the object crosshair color crosshair_alpha (Crosshair alpha) int 255 0 255 # Maximum number of recent chat messages to show @@ -817,7 +819,8 @@ world_aligned_mode (World-aligned textures mode) enum enable disable,enable,forc autoscale_mode (Autoscaling mode) enum disable disable,enable,force # Show entity selection boxes -show_entity_selectionbox (Show entity selection boxes) bool true +# A restart is required after changing this. +show_entity_selectionbox (Show entity selection boxes) bool false [*Menus] diff --git a/doc/texture_packs.txt b/doc/texture_packs.txt index 94151f1a4..e7a7dfd3c 100644 --- a/doc/texture_packs.txt +++ b/doc/texture_packs.txt @@ -72,7 +72,12 @@ by texture packs. All existing fallback textures can be found in the directory * `crosshair.png` * the crosshair texture in the center of the screen. The settings `crosshair_color` and `crosshair_alpha` are used to create a cross - when no texture was found + when no texture is found. + +* `object_crosshair.png` + * the crosshair seen when pointing at an object. The settings + `crosshair_color` and `crosshair_alpha` are used to create a cross + when no texture is found. * `halo.png`: used for the node highlighting mesh diff --git a/minetest.conf.example b/minetest.conf.example index a5f98ee5e..520125713 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -955,8 +955,9 @@ # autoscale_mode = disable # Show entity selection boxes +# A restart is required after changing this. # type: bool -# show_entity_selectionbox = true +# show_entity_selectionbox = false ## Menus @@ -3374,4 +3375,3 @@ # so see a full list at https://content.minetest.net/help/content_flags/ # type: string # contentdb_flag_blacklist = nonfree, desktop_default - diff --git a/src/client/game.cpp b/src/client/game.cpp index 5f3ff5649..42d60b21c 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -3176,11 +3176,14 @@ PointedThing Game::updatePointedThing( const NodeDefManager *nodedef = map.getNodeDefManager(); runData.selected_object = NULL; + hud->pointing_at_object = false; RaycastState s(shootline, look_for_object, liquids_pointable); PointedThing result; env.continueRaycast(&s, &result); if (result.type == POINTEDTHING_OBJECT) { + hud->pointing_at_object = true; + runData.selected_object = client->getEnv().getActiveObject(result.object_id); aabb3f selection_box; if (show_entity_selectionbox && runData.selected_object->doShowSelectionBox() && diff --git a/src/client/hud.cpp b/src/client/hud.cpp index 31e633bc2..2b347c1e0 100644 --- a/src/client/hud.cpp +++ b/src/client/hud.cpp @@ -41,6 +41,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gui/touchscreengui.h" #endif +#define OBJECT_CROSSHAIR_LINE_SIZE 8 +#define CROSSHAIR_LINE_SIZE 10 + Hud::Hud(gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player, Inventory *inventory) { @@ -76,6 +79,7 @@ Hud::Hud(gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player, selectionbox_argb = video::SColor(255, sbox_r, sbox_g, sbox_b); use_crosshair_image = tsrc->isKnownSourceImage("crosshair.png"); + use_object_crosshair_image = tsrc->isKnownSourceImage("object_crosshair.png"); m_selection_boxes.clear(); m_halo_boxes.clear(); @@ -601,6 +605,31 @@ void Hud::drawHotbar(u16 playeritem) { void Hud::drawCrosshair() { + if (pointing_at_object) { + if (use_object_crosshair_image) { + video::ITexture *object_crosshair = tsrc->getTexture("object_crosshair.png"); + v2u32 size = object_crosshair->getOriginalSize(); + v2s32 lsize = v2s32(m_displaycenter.X - (size.X / 2), + m_displaycenter.Y - (size.Y / 2)); + driver->draw2DImage(object_crosshair, lsize, + core::rect(0, 0, size.X, size.Y), + nullptr, crosshair_argb, true); + } else { + driver->draw2DLine( + m_displaycenter - v2s32(OBJECT_CROSSHAIR_LINE_SIZE, + OBJECT_CROSSHAIR_LINE_SIZE), + m_displaycenter + v2s32(OBJECT_CROSSHAIR_LINE_SIZE, + OBJECT_CROSSHAIR_LINE_SIZE), crosshair_argb); + driver->draw2DLine( + m_displaycenter + v2s32(OBJECT_CROSSHAIR_LINE_SIZE, + -OBJECT_CROSSHAIR_LINE_SIZE), + m_displaycenter + v2s32(-OBJECT_CROSSHAIR_LINE_SIZE, + OBJECT_CROSSHAIR_LINE_SIZE), crosshair_argb); + } + + return; + } + if (use_crosshair_image) { video::ITexture *crosshair = tsrc->getTexture("crosshair.png"); v2u32 size = crosshair->getOriginalSize(); @@ -608,12 +637,12 @@ void Hud::drawCrosshair() m_displaycenter.Y - (size.Y / 2)); driver->draw2DImage(crosshair, lsize, core::rect(0, 0, size.X, size.Y), - 0, crosshair_argb, true); + nullptr, crosshair_argb, true); } else { - driver->draw2DLine(m_displaycenter - v2s32(10, 0), - m_displaycenter + v2s32(10, 0), crosshair_argb); - driver->draw2DLine(m_displaycenter - v2s32(0, 10), - m_displaycenter + v2s32(0, 10), crosshair_argb); + driver->draw2DLine(m_displaycenter - v2s32(CROSSHAIR_LINE_SIZE, 0), + m_displaycenter + v2s32(CROSSHAIR_LINE_SIZE, 0), crosshair_argb); + driver->draw2DLine(m_displaycenter - v2s32(0, CROSSHAIR_LINE_SIZE), + m_displaycenter + v2s32(0, CROSSHAIR_LINE_SIZE), crosshair_argb); } } diff --git a/src/client/hud.h b/src/client/hud.h index 6f4c54626..ba34d479d 100644 --- a/src/client/hud.h +++ b/src/client/hud.h @@ -45,12 +45,16 @@ public: video::SColor crosshair_argb; video::SColor selectionbox_argb; + bool use_crosshair_image = false; + bool use_object_crosshair_image = false; std::string hotbar_image = ""; bool use_hotbar_image = false; std::string hotbar_selected_image = ""; bool use_hotbar_selected_image = false; + bool pointing_at_object = false; + Hud(gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player, Inventory *inventory); ~Hud(); diff --git a/src/client/render/core.cpp b/src/client/render/core.cpp index bf5aa6c2c..92a7137ea 100644 --- a/src/client/render/core.cpp +++ b/src/client/render/core.cpp @@ -86,6 +86,7 @@ void RenderingCore::drawHUD() if (show_hud) { if (draw_crosshair) hud->drawCrosshair(); + hud->drawHotbar(client->getEnv().getLocalPlayer()->getWieldIndex()); hud->drawLuaElements(camera->getOffset()); camera->drawNametags(); diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index abb6593b7..07bf0ebb8 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -225,7 +225,7 @@ void set_default_settings(Settings *settings) settings->setDefault("desynchronize_mapblock_texture_animation", "true"); settings->setDefault("hud_hotbar_max_width", "1.0"); settings->setDefault("enable_local_map_saving", "false"); - settings->setDefault("show_entity_selectionbox", "true"); + settings->setDefault("show_entity_selectionbox", "false"); settings->setDefault("texture_clean_transparent", "false"); settings->setDefault("texture_min_size", "64"); settings->setDefault("ambient_occlusion_gamma", "2.2"); -- cgit v1.2.3