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 --- moreblocks/.travis.yml | 15 ++++++++++++ moreblocks/CHANGELOG.md | 13 +++++++---- moreblocks/README.md | 13 ++++++----- moreblocks/circular_saw.lua | 2 +- moreblocks/init.lua | 16 ++++--------- moreblocks/intllib.lua | 44 +++++++++++++++++++++++++++++++++++ moreblocks/nodes.lua | 2 +- moreblocks/ownership.lua | 2 +- moreblocks/stairsplus/common.lua | 2 +- moreblocks/stairsplus/custom.lua | 3 ++- moreblocks/stairsplus/init.lua | 3 ++- moreblocks/stairsplus/microblocks.lua | 3 ++- moreblocks/stairsplus/panels.lua | 3 ++- moreblocks/stairsplus/slabs.lua | 6 ++--- moreblocks/stairsplus/slopes.lua | 3 ++- moreblocks/stairsplus/stairs.lua | 3 ++- 16 files changed, 97 insertions(+), 36 deletions(-) create mode 100644 moreblocks/.travis.yml create mode 100644 moreblocks/intllib.lua (limited to 'moreblocks') diff --git a/moreblocks/.travis.yml b/moreblocks/.travis.yml new file mode 100644 index 0000000..1c4c0d8 --- /dev/null +++ b/moreblocks/.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/moreblocks/CHANGELOG.md b/moreblocks/CHANGELOG.md index 0d949aa..aa9942c 100644 --- a/moreblocks/CHANGELOG.md +++ b/moreblocks/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +- Updated intllib support to avoid using deprecated functions. + ### Fixed - Node rotation now works correctly when placing Stairs+ nodes. @@ -32,12 +36,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed -- New craft for: +- New crafting recipes for: - Stone Tile - Circle Stone Bricks - Stairs+: - - Move definitions to `stairsplus.defs` table in a separate file - - Move recipe definitions to `stairsplus.register_recipes` function in a separate file + - Moved definitions to `stairsplus.defs` table into a separate file. + - Moved recipe definitions to `stairsplus.register_recipes` function + into a separate file. ## [1.1.0] - 2017-10-04 @@ -57,7 +62,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Straw - Tin Block - Wool (all colors) -- Other mods can now get a list of all the defined Stairs+ shapes +- Other mods can now get a list of all the defined Stairs+ shapes. ## 1.0.0 - 2017-02-19 diff --git a/moreblocks/README.md b/moreblocks/README.md index 739164b..4e58814 100644 --- a/moreblocks/README.md +++ b/moreblocks/README.md @@ -12,15 +12,15 @@ world block sandbox game. To install More Blocks, clone this Git repository into your Minetest's `mods/` directory: -``` +```bash git clone https://github.com/minetest-mods/moreblocks.git ``` You can also [download a ZIP archive](https://github.com/minetest-mods/moreblocks/archive/master.zip) -of More Blocks. If you do so, you will need to extract the archive, then rename +of More Blocks. If you do so, you will need to extract the archive then rename the resulting folder from `moreblocks-master` to `moreblocks` – 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 More Blocks 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_moreblocks = 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 More Blocks on. 5. More Blocks should now be running on your world. diff --git a/moreblocks/circular_saw.lua b/moreblocks/circular_saw.lua index 4d1a3d9..1dce479 100644 --- a/moreblocks/circular_saw.lua +++ b/moreblocks/circular_saw.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio, Sokomine and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib +local S = moreblocks.S circular_saw = {} diff --git a/moreblocks/init.lua b/moreblocks/init.lua index ad5ad25..7627f7d 100644 --- a/moreblocks/init.lua +++ b/moreblocks/init.lua @@ -10,20 +10,12 @@ Licensed under the zlib license. See LICENSE.md for more information. moreblocks = {} -local S -if minetest.global_exists("intllib") then - if intllib.make_gettext_pair then - S = intllib.make_gettext_pair() - else - S = intllib.Getter() - end -else - S = function(s) return s end -end -moreblocks.intllib = S - local modpath = minetest.get_modpath("moreblocks") +local S, NS = dofile(modpath .. "/intllib.lua") +moreblocks.S = S +moreblocks.NS = NS + dofile(modpath .. "/config.lua") dofile(modpath .. "/circular_saw.lua") dofile(modpath .. "/stairsplus/init.lua") diff --git a/moreblocks/intllib.lua b/moreblocks/intllib.lua new file mode 100644 index 0000000..c7af2c2 --- /dev/null +++ b/moreblocks/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/moreblocks/nodes.lua b/moreblocks/nodes.lua index 5bcab6c..047f59e 100644 --- a/moreblocks/nodes.lua +++ b/moreblocks/nodes.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib +local S = moreblocks.S local sound_dirt = default.node_sound_dirt_defaults() local sound_wood = default.node_sound_wood_defaults() diff --git a/moreblocks/ownership.lua b/moreblocks/ownership.lua index 34bcffa..20f0fe1 100644 --- a/moreblocks/ownership.lua +++ b/moreblocks/ownership.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.gettext +local S = moreblocks.S function moreblocks.node_is_owned(pos, placer) local ownername = false diff --git a/moreblocks/stairsplus/common.lua b/moreblocks/stairsplus/common.lua index 6ec5101..7b86fad 100644 --- a/moreblocks/stairsplus/common.lua +++ b/moreblocks/stairsplus/common.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib +local S = moreblocks.S stairsplus.register_single = function(category, alternate, info, modname, subname, recipeitem, fields) diff --git a/moreblocks/stairsplus/custom.lua b/moreblocks/stairsplus/custom.lua index ad67009..4004c6c 100644 --- a/moreblocks/stairsplus/custom.lua +++ b/moreblocks/stairsplus/custom.lua @@ -61,7 +61,8 @@ local subset = { } --]] -function register_custom_subset(subset, modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_custom_subset(subset, modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_custom_subset(subset, modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua index 0d99a14..a3f3399 100644 --- a/moreblocks/stairsplus/init.lua +++ b/moreblocks/stairsplus/init.lua @@ -58,7 +58,8 @@ function stairsplus:register_alias_force_all(modname_old, subname_old, modname_n self:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new) end -function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_all(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua index a08ec7c..e477664 100644 --- a/moreblocks/stairsplus/microblocks.lua +++ b/moreblocks/stairsplus/microblocks.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called :micro_ -function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_micro(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/panels.lua b/moreblocks/stairsplus/panels.lua index c017af6..095c4c2 100644 --- a/moreblocks/stairsplus/panels.lua +++ b/moreblocks/stairsplus/panels.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called :panel_ -function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_panel(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua index c41b2e3..ee9ce89 100644 --- a/moreblocks/stairsplus/slabs.lua +++ b/moreblocks/stairsplus/slabs.lua @@ -5,11 +5,10 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :slab_ -function register_slab(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_slab(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_slab(modname, subname, recipeitem, { groups = groups, tiles = images, @@ -36,7 +35,6 @@ end function stairsplus:register_slab(modname, subname, recipeitem, fields) local defs = table.copy(stairsplus.defs["slab"]) - local desc_base = S("%s Slab"):format(fields.description) for alternate, shape in pairs(defs) do stairsplus.register_single("slab", alternate, shape, modname, subname, recipeitem, fields) end diff --git a/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua index 0652a51..6e516d5 100644 --- a/moreblocks/stairsplus/slopes.lua +++ b/moreblocks/stairsplus/slopes.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called :slope_ -function register_slope(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_slope(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_slope(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/stairs.lua b/moreblocks/stairsplus/stairs.lua index c72b268..8c77498 100644 --- a/moreblocks/stairsplus/stairs.lua +++ b/moreblocks/stairsplus/stairs.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called :stair_ -function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_stair(modname, subname, recipeitem, { groups = groups, tiles = images, -- cgit v1.2.3