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 --- moreores/.travis.yml | 15 +++++++++++++++ moreores/CHANGELOG.md | 1 + moreores/README.md | 13 +++++++------ moreores/init.lua | 11 ++++------- moreores/intllib.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 moreores/.travis.yml create mode 100644 moreores/intllib.lua (limited to 'moreores') diff --git a/moreores/.travis.yml b/moreores/.travis.yml new file mode 100644 index 0000000..1c4c0d8 --- /dev/null +++ b/moreores/.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/moreores/CHANGELOG.md b/moreores/CHANGELOG.md index 6ec2e51..cd7bd33 100644 --- a/moreores/CHANGELOG.md +++ b/moreores/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Ores are now slower to mine and cannot be mined using wooden tools anymore. +- Updated intllib support to avoid using deprecated functions. ### Deprecated diff --git a/moreores/README.md b/moreores/README.md index 5b4877e..601001b 100644 --- a/moreores/README.md +++ b/moreores/README.md @@ -12,15 +12,15 @@ world block sandbox game. To install More Ores, clone this Git repository into your Minetest's `mods/` directory: -``` +```bash git clone https://github.com/minetest-mods/moreores.git ``` You can also [download a ZIP archive](https://github.com/minetest-mods/moreores/archive/master.zip) -of More Ores. If you do so, you will need to extract the archive, then rename +of More Ores. If you do so, you will need to extract the archive then rename the resulting folder from `moreores-master` to `moreores` – 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 Ores 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_moreores = 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 Ores on. 5. More Ores should now be running on your world. diff --git a/moreores/init.lua b/moreores/init.lua index 08bc0a6..e389778 100644 --- a/moreores/init.lua +++ b/moreores/init.lua @@ -10,15 +10,12 @@ Licensed under the zlib license. See LICENSE.md for more information. moreores = {} -local S -if minetest.get_modpath("intllib") then - S = intllib.Getter() -else - S = function(s) return s end -end - local modpath = minetest.get_modpath("moreores") +local S, NS = dofile(modpath .. "/intllib.lua") +moreores.S = S +moreores.NS = NS + dofile(modpath .. "/_config.txt") -- `mg` mapgen support diff --git a/moreores/intllib.lua b/moreores/intllib.lua new file mode 100644 index 0000000..c7af2c2 --- /dev/null +++ b/moreores/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 -- cgit v1.2.3