From 18fc18b5aece7aae1caafd38a2c742af7974348c Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sun, 10 Mar 2019 19:44:56 -0400 Subject: update cottages, digilines, locks, maptools, moreblocks, technic, and travelnet --- maptools/.travis.yml | 15 ++++++++++++ maptools/CHANGELOG.md | 5 ++++ maptools/README.md | 13 +++++----- maptools/craftitems.lua | 2 +- maptools/default_nodes.lua | 2 +- maptools/init.lua | 20 +++++++--------- maptools/intllib.lua | 44 ++++++++++++++++++++++++++++++++++ maptools/nodes.lua | 51 ++++++++++++++++++++------------------- maptools/tools.lua | 59 +++++++++++++++++++--------------------------- 9 files changed, 130 insertions(+), 81 deletions(-) create mode 100644 maptools/.travis.yml create mode 100644 maptools/intllib.lua (limited to 'maptools') diff --git a/maptools/.travis.yml b/maptools/.travis.yml new file mode 100644 index 0000000..1c4c0d8 --- /dev/null +++ b/maptools/.travis.yml @@ -0,0 +1,15 @@ +language: generic + +addons: + apt: + packages: + - luarocks + +install: + - pyenv global 3.6.3 + - pip3 install --user pre-commit + - luarocks install --local luacheck + +script: + - $HOME/.local/bin/pre-commit run --all-files + - $HOME/.luarocks/bin/luacheck . diff --git a/maptools/CHANGELOG.md b/maptools/CHANGELOG.md index 0830e62..6e022a4 100644 --- a/maptools/CHANGELOG.md +++ b/maptools/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +- Increased the range of the Admin Pickaxe from 12 to 20 nodes. +- Updated intllib support to avoid using deprecated functions. + ## 1.0.0 - 2017-02-19 - Initial versioned release. diff --git a/maptools/README.md b/maptools/README.md index 7a14122..9474ce5 100644 --- a/maptools/README.md +++ b/maptools/README.md @@ -12,15 +12,15 @@ world block sandbox game. To install Map Tools, clone this Git repository into your Minetest's `mods/` directory: -``` +```bash git clone https://github.com/minetest-mods/maptools.git ``` You can also [download a ZIP archive](https://github.com/minetest-mods/maptools/archive/master.zip) -of Map Tools. If you do so, you will need to extract the archive, then rename +of Map Tools. If you do so, you will need to extract the archive then rename the resulting folder from `maptools-master` to `maptools` – this is -**absolutely** necessary to do, else, it won't work! +**absolutely** required, as the mod won't work otherwise. ### Enable the mod @@ -43,16 +43,17 @@ This is the easiest way to enable Map Tools when playing in singleplayer This is the recommended way to enable the mod on a server without using a GUI. -1. Make sure Minetest is not currently running (else, it will overwrite +1. Make sure Minetest is not currently running (otherwise, it will overwrite the changes when exiting). 2. Open the world's `world.mt` file using a text editor. 3. Add the following line at the end of the file: -``` +```text load_mod_maptools = true ``` -If the line is already present in the file, then replace `false` with `true` on that line. +If the line is already present in the file, then replace `false` with `true` +on that line. 4. Save the file, then start a game on the world you enabled Map Tools on. 5. Map Tools should now be running on your world. diff --git a/maptools/craftitems.lua b/maptools/craftitems.lua index aa2330b..00f09f2 100644 --- a/maptools/craftitems.lua +++ b/maptools/craftitems.lua @@ -5,7 +5,7 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] diff --git a/maptools/default_nodes.lua b/maptools/default_nodes.lua index 89409f0..15ce925 100644 --- a/maptools/default_nodes.lua +++ b/maptools/default_nodes.lua @@ -5,7 +5,7 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] diff --git a/maptools/init.lua b/maptools/init.lua index a329f62..a7ae4a5 100644 --- a/maptools/init.lua +++ b/maptools/init.lua @@ -10,20 +10,11 @@ Licensed under the zlib license. See LICENSE.md for more information. maptools = {} -local S -if minetest.get_modpath("intllib") then - S = intllib.Getter() -else - S = function(s) return s end -end -maptools.intllib = S - local modpath = minetest.get_modpath("maptools") -maptools.drop_msg = function(itemstack, player) - local name = player:get_player_name() - minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!")) -end +local S, NS = dofile(modpath .. "/intllib.lua") +maptools.S = S +maptools.NS = NS dofile(modpath .. "/config.lua") dofile(modpath .. "/aliases.lua") @@ -32,6 +23,11 @@ dofile(modpath .. "/default_nodes.lua") dofile(modpath .. "/nodes.lua") dofile(modpath .. "/tools.lua") +maptools.drop_msg = function(itemstack, player) + local name = player:get_player_name() + minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!")) +end + if minetest.setting_getbool("log_mods") then minetest.log("action", S("[maptools] loaded.")) end diff --git a/maptools/intllib.lua b/maptools/intllib.lua new file mode 100644 index 0000000..c7af2c2 --- /dev/null +++ b/maptools/intllib.lua @@ -0,0 +1,44 @@ +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/maptools/nodes.lua b/maptools/nodes.lua index 3a2ebf5..200107f 100644 --- a/maptools/nodes.lua +++ b/maptools/nodes.lua @@ -5,11 +5,11 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] --- Redefine cloud so that the admin pickaxe can mine it: +-- Redefine cloud so that the admin pickaxe can mine it minetest.register_node(":default:cloud", { description = S("Cloud"), tiles = {"default_cloud.png"}, @@ -20,7 +20,6 @@ minetest.register_node(":default:cloud", { }) -- Nodes --- ===== minetest.register_node("maptools:black", { description = S("Black"), @@ -239,29 +238,29 @@ minetest.register_node("maptools:playerclip_top", { }) for pusher_num=1,10,1 do -minetest.register_node("maptools:pusher_" .. pusher_num, { - description = S("Pusher (%s)"):format(pusher_num), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^default_apple.png", - drawtype = "nodebox", - tiles = {"invisible.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, - }, - drop = "", - groups = { - unbreakable = 1, - not_in_creative_inventory = maptools.creative, - fall_damage_add_percent = -100, - bouncy = pusher_num * 100, - }, - on_drop = maptools.drop_msg -}) + minetest.register_node("maptools:pusher_" .. pusher_num, { + description = S("Pusher (%s)"):format(pusher_num), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^default_apple.png", + drawtype = "nodebox", + tiles = {"invisible.png"}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, + }, + drop = "", + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + fall_damage_add_percent = -100, + bouncy = pusher_num * 100, + }, + on_drop = maptools.drop_msg + }) end minetest.register_node("maptools:lightbulb", { diff --git a/maptools/tools.lua b/maptools/tools.lua index 9e784ae..550ab6b 100644 --- a/maptools/tools.lua +++ b/maptools/tools.lua @@ -5,52 +5,41 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] +local pick_admin_toolcaps = { + full_punch_interval = 0.1, + max_drop_level = 3, + groupcaps = { + unbreakable = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + fleshy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + choppy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + bendy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + cracky = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + crumbly = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + snappy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + }, + damage_groups = {fleshy = 1000}, +} + minetest.register_tool("maptools:pick_admin", { description = S("Admin Pickaxe"), - range = 12, + range = 20, inventory_image = "maptools_adminpick.png", groups = {not_in_creative_inventory = maptools.creative}, - tool_capabilities = { - full_punch_interval = 0.1, - max_drop_level = 3, - groupcaps= { - unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - }, - damage_groups = {fleshy = 1000}, - }, - on_drop = maptools.drop_msg + tool_capabilities = pick_admin_toolcaps, + on_drop = maptools.drop_msg, }) minetest.register_tool("maptools:pick_admin_with_drops", { description = S("Admin Pickaxe with Drops"), - range = 12, + range = 20, inventory_image = "maptools_adminpick_with_drops.png", groups = {not_in_creative_inventory = maptools.creative}, - tool_capabilities = { - full_punch_interval = 0.35, - max_drop_level = 3, - groupcaps = { - unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - }, - damage_groups = {fleshy = 1000}, - }, - on_drop = maptools.drop_msg + tool_capabilities = pick_admin_toolcaps, + on_drop = maptools.drop_msg, }) minetest.register_on_punchnode(function(pos, node, puncher) @@ -66,9 +55,9 @@ minetest.register_on_punchnode(function(pos, node, puncher) " using an Admin Pickaxe." ) -- The node is removed directly, which means it even works - -- on non-empty containers and group-less nodes. + -- on non-empty containers and group-less nodes minetest.remove_node(pos) - -- Run node update actions like falling nodes. + -- Run node update actions like falling nodes minetest.check_for_falling(pos) end end) -- cgit v1.2.3