summaryrefslogtreecommitdiff
path: root/moreblocks
diff options
context:
space:
mode:
Diffstat (limited to 'moreblocks')
-rw-r--r--moreblocks/.travis.yml15
-rw-r--r--moreblocks/CHANGELOG.md13
-rw-r--r--moreblocks/README.md13
-rw-r--r--moreblocks/circular_saw.lua2
-rw-r--r--moreblocks/init.lua16
-rw-r--r--moreblocks/intllib.lua44
-rw-r--r--moreblocks/nodes.lua2
-rw-r--r--moreblocks/ownership.lua2
-rw-r--r--moreblocks/stairsplus/common.lua2
-rw-r--r--moreblocks/stairsplus/custom.lua3
-rw-r--r--moreblocks/stairsplus/init.lua3
-rw-r--r--moreblocks/stairsplus/microblocks.lua3
-rw-r--r--moreblocks/stairsplus/panels.lua3
-rw-r--r--moreblocks/stairsplus/slabs.lua6
-rw-r--r--moreblocks/stairsplus/slopes.lua3
-rw-r--r--moreblocks/stairsplus/stairs.lua3
16 files changed, 97 insertions, 36 deletions
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 <http://unlicense.org>.
+
+-- 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 <modname>:micro_<subname>
-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 <modname>:panel_<subname>
-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 <modname>:slab_<subname>
-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 <modname>:slope_<subname>
-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 <modname>:stair_<subname>
-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,