diff --git a/.luacheckrc b/.luacheckrc index b1eb1c9..fb340e5 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -25,7 +25,9 @@ stds.minetest = { } read_globals = { + "carts", "farming", + "frame", "intllib", "mg", } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 22f1dbe..04507b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.1.0 + rev: v2.3.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace diff --git a/.travis.yml b/.travis.yml index a032acb..32a776a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,16 @@ -language: generic +dist: bionic +language: python -addons: - apt: - packages: - - luarocks +python: + - 3.7.1 install: - - pyenv global 3.6.3 - - pip3 install --user pre-commit + - sudo apt-get update -qq + - sudo apt-get install -qqq luarocks + - pip3 install pre-commit - luarocks install --local luacheck script: # All linters are run with pre-commit hooks - export PATH="$HOME/.luarocks/bin:$PATH" - - $HOME/.local/bin/pre-commit run --all-files + - pre-commit run --all-files diff --git a/CHANGELOG.md b/CHANGELOG.md index 1363aba..aaffdc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,13 +7,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [2.0.0] - 2019-11-25 + ### Added +- More Ores nodes/items/tools can now be placed in item frames + from the [`frame`](https://github.com/minetest-mods/frame) mod. - Polish translation. ### Changed - The minimum supported Minetest version is now 5.0.0. +- Copper rails are now registered using functions from the `carts` mod, + making them interoperate seamlessly with default rails. + - Copper rails can no longer be placed in the air. ## [1.1.0] - 2019-03-23 @@ -44,5 +51,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Initial versioned release. -[Unreleased]: https://github.com/minetest-mods/moreores/compare/v1.1.0...HEAD +[Unreleased]: https://github.com/minetest-mods/moreores/compare/v2.0.0...HEAD +[2.0.0]: https://github.com/minetest-mods/moreores/compare/v1.1.0...v2.0.0 [1.1.0]: https://github.com/minetest-mods/moreores/compare/v1.0.0...v1.1.0 diff --git a/README.md b/README.md index 255ca60..540ca56 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,9 @@ on that line. ## Version compatibility -More Ores is currently primarily tested with Minetest 0.4.17. +More Ores is currently primarily tested with Minetest 5.1.0. It may or may not work with newer or older versions. Issues arising in older -versions than 0.4.17 will generally not be fixed. +versions than 5.0.0 will generally not be fixed. ## License diff --git a/init.lua b/init.lua index 8b4bcfb..8cc771a 100644 --- a/init.lua +++ b/init.lua @@ -23,6 +23,9 @@ if minetest.get_modpath("mg") then dofile(modpath .. "/mg.lua") end +-- `frame` support +local use_frame = minetest.get_modpath("frame") + local default_stone_sounds = default.node_sound_stone_defaults() local default_metal_sounds = default.node_sound_metal_defaults() @@ -89,6 +92,10 @@ local function add_ore(modname, description, mineral_name, oredef) sounds = default_stone_sounds, drop = lump_item, }) + + if use_frame then + frame.register(modname .. ":mineral_" .. mineral_name) + end end if oredef.makes.block then @@ -112,6 +119,9 @@ local function add_ore(modname, description, mineral_name, oredef) } }) end + if use_frame then + frame.register(block_item) + end end if oredef.makes.lump then @@ -127,6 +137,9 @@ local function add_ore(modname, description, mineral_name, oredef) recipe = lump_item, }) end + if use_frame then + frame.register(lump_item) + end end if oredef.makes.ingot then @@ -135,6 +148,9 @@ local function add_ore(modname, description, mineral_name, oredef) inventory_image = img_base .. "_ingot.png", }) minetest.register_alias(mineral_name .. "_ingot", ingot) + if use_frame then + frame.register(ingot) + end end if oredef.makes.chest then @@ -205,6 +221,9 @@ local function add_ore(modname, description, mineral_name, oredef) end minetest.register_alias(tool_name .. tool_post, fulltool_name) + if use_frame then + frame.register(fulltool_name) + end end end @@ -311,45 +330,20 @@ else end -- Copper rail (unique node) -minetest.register_node("moreores:copper_rail", { - description = S("Copper Rail"), - drawtype = "raillike", - tiles = { - "moreores_copper_rail.png", - "moreores_copper_rail_curved.png", - "moreores_copper_rail_t_junction.png", - "moreores_copper_rail_crossing.png", - }, - inventory_image = "moreores_copper_rail.png", - wield_image = "moreores_copper_rail.png", - paramtype = "light", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { - -1/2, - -1/2, - -1/2, - 1/2, - -1/2 + 1/16, - 1/2, +if minetest.get_modpath("carts") then + carts:register_rail("moreores:copper_rail", { + description = S("Copper Rail"), + tiles = { + "moreores_copper_rail.png", + "moreores_copper_rail_curved.png", + "moreores_copper_rail_t_junction.png", + "moreores_copper_rail_crossing.png", }, - }, - sounds = default_metal_sounds, - groups = {bendy = 2, snappy = 1, dig_immediate = 2, rail = 1, connect_to_raillike = 1}, - mesecons = { - effector = { - action_on = function(pos, node) - minetest.get_meta(pos):set_string("cart_acceleration", "0.5") - end, - - action_off = function(pos, node) - minetest.get_meta(pos):set_string("cart_acceleration", "0") - end, - }, - }, -}) + inventory_image = "moreores_copper_rail.png", + wield_image = "moreores_copper_rail.png", + groups = carts:get_rail_groups(), + }, {}) +end minetest.register_craft({ output = "moreores:copper_rail 24", diff --git a/locale/pl.txt b/locale/pl.txt index fb65804..e6c585e 100644 --- a/locale/pl.txt +++ b/locale/pl.txt @@ -2,14 +2,14 @@ [moreores] loaded. = [moreores] załadowano. -%s Ore = %Ruda -%s Lump = %Bryłka -%s Ingot = %Sztabka -%s Block = %sBlok -%s Pickaxe = %sKilof -%s Shovel = %sŁopatka -%s Axe = %sSiekiera -%s Sword = %sMiecz +%s Ore = %s Ruda +%s Lump = %s Bryłka +%s Ingot = %s Sztabka +%s Block = %s Blok +%s Pickaxe = %s Kilof +%s Shovel = %s Łopatka +%s Axe = %s Siekiera +%s Sword = %s Miecz Copper = Miedź Tin = Cyna diff --git a/mod.conf b/mod.conf index 1262b58..9b71bfb 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = moreores description = Adds new ore types. depends = default -optional_depends = intllib,mg +optional_depends = carts,farming,frame,intllib,mg diff --git a/textures/moreores_copper_rail.png b/textures/moreores_copper_rail.png index 31f2999..da7f5cf 100644 Binary files a/textures/moreores_copper_rail.png and b/textures/moreores_copper_rail.png differ diff --git a/textures/moreores_copper_rail_crossing.png b/textures/moreores_copper_rail_crossing.png index cf80320..ca68539 100644 Binary files a/textures/moreores_copper_rail_crossing.png and b/textures/moreores_copper_rail_crossing.png differ diff --git a/textures/moreores_copper_rail_curved.png b/textures/moreores_copper_rail_curved.png index e766793..64f2830 100644 Binary files a/textures/moreores_copper_rail_curved.png and b/textures/moreores_copper_rail_curved.png differ diff --git a/textures/moreores_copper_rail_t_junction.png b/textures/moreores_copper_rail_t_junction.png index 60f7aaa..406de1e 100644 Binary files a/textures/moreores_copper_rail_t_junction.png and b/textures/moreores_copper_rail_t_junction.png differ diff --git a/textures/moreores_mineral_mithril.png b/textures/moreores_mineral_mithril.png index ed0fbf2..e9219cb 100644 Binary files a/textures/moreores_mineral_mithril.png and b/textures/moreores_mineral_mithril.png differ diff --git a/textures/moreores_mineral_silver.png b/textures/moreores_mineral_silver.png index 93f9f43..82e9158 100644 Binary files a/textures/moreores_mineral_silver.png and b/textures/moreores_mineral_silver.png differ diff --git a/textures/moreores_mineral_tin.png b/textures/moreores_mineral_tin.png index 232d4b5..d2a240f 100644 Binary files a/textures/moreores_mineral_tin.png and b/textures/moreores_mineral_tin.png differ diff --git a/textures/moreores_mithril_block.png b/textures/moreores_mithril_block.png index dd7a246..7eda9cc 100644 Binary files a/textures/moreores_mithril_block.png and b/textures/moreores_mithril_block.png differ diff --git a/textures/moreores_silver_block.png b/textures/moreores_silver_block.png index 3cd846d..c2fec68 100644 Binary files a/textures/moreores_silver_block.png and b/textures/moreores_silver_block.png differ diff --git a/textures/moreores_silver_ingot.png b/textures/moreores_silver_ingot.png index 86dd54e..5af8d37 100644 Binary files a/textures/moreores_silver_ingot.png and b/textures/moreores_silver_ingot.png differ diff --git a/textures/moreores_tin_block.png b/textures/moreores_tin_block.png index 2f874c4..31ebce0 100644 Binary files a/textures/moreores_tin_block.png and b/textures/moreores_tin_block.png differ diff --git a/textures/moreores_tin_ingot.png b/textures/moreores_tin_ingot.png index eed5361..4e8c4f5 100644 Binary files a/textures/moreores_tin_ingot.png and b/textures/moreores_tin_ingot.png differ diff --git a/textures/moreores_tool_mithrilpick.png b/textures/moreores_tool_mithrilpick.png index efe9443..7f7c3a2 100644 Binary files a/textures/moreores_tool_mithrilpick.png and b/textures/moreores_tool_mithrilpick.png differ diff --git a/textures/moreores_tool_mithrilshovel.png b/textures/moreores_tool_mithrilshovel.png index 128e9f7..72ec2f5 100644 Binary files a/textures/moreores_tool_mithrilshovel.png and b/textures/moreores_tool_mithrilshovel.png differ diff --git a/textures/moreores_tool_silveraxe.png b/textures/moreores_tool_silveraxe.png index 31d9acf..a47eb13 100644 Binary files a/textures/moreores_tool_silveraxe.png and b/textures/moreores_tool_silveraxe.png differ diff --git a/textures/moreores_tool_silverpick.png b/textures/moreores_tool_silverpick.png index 4194c6e..a291d3f 100644 Binary files a/textures/moreores_tool_silverpick.png and b/textures/moreores_tool_silverpick.png differ diff --git a/textures/moreores_tool_silvershovel.png b/textures/moreores_tool_silvershovel.png index 775019f..74676b1 100644 Binary files a/textures/moreores_tool_silvershovel.png and b/textures/moreores_tool_silvershovel.png differ