From 0e3c55ffc34a8b4358a361f785da59af33d88d12 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Dec 2020 14:17:53 +0100 Subject: [PATCH] update --- mods/moreblocks/CHANGELOG.md | 34 +++++--- mods/moreblocks/README.md | 2 +- mods/moreblocks/crafting.lua | 88 +++++++++++++++++++ mods/moreblocks/nodes.lua | 65 ++++++++++++++ mods/moreblocks/redefinitions.lua | 37 ++++++-- mods/moreblocks/stairsplus/common.lua | 93 ++++++++++++++++++++- mods/techpack/tubelib/tubes.lua | 11 +++ mods/techpack/tubelib_addons1/harvester.lua | 26 +++++- mods/techpack/tubelib_addons1/quarry.lua | 13 ++- mods/techpack/tubelib_addons1/reformer.lua | 3 + 10 files changed, 345 insertions(+), 27 deletions(-) diff --git a/mods/moreblocks/CHANGELOG.md b/mods/moreblocks/CHANGELOG.md index b50f6d69..af7f67ad 100644 --- a/mods/moreblocks/CHANGELOG.md +++ b/mods/moreblocks/CHANGELOG.md @@ -7,20 +7,33 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [2.1.0] - 2020-12-14 + +### Added + +- Clean Glass versions of Trap and (Super) Glowing Glass. +- Compressed desert cobblestone. + +### Changed + +- Revised placing strategy that takes into account which side of the face + (top/bottom for horizontal, left/right for vertical placement) is being clicked. + Aux (sprint/special, default E) key can be used to place the node with the orientation + it would have if placed from the other side. + When placing nodes next to nodes of the same gategory (e.g.slab to slab) the other + node's orientation is copied, flipping it placing on top or below an upright or + upside-down node. In this case the aux key will disable the special processing of + same-category nodes. + +### Fixed + +- Revised minetest_game crafting recipe overrides to match Minetest 5.0.0 and later. + ### Removed - Legacy Stairs+ conversion code. - It was only required to import worlds last edited before Q3 2013. -### Changed - -- Switch to GitHub Actions. - - Benefits include faster responses. - -### Added - -- Compressed desert cobblestone. - ## [2.0.0] - 2019-11-25 ### Added @@ -104,7 +117,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Initial versioned release. -[Unreleased]: https://github.com/minetest-mods/moreblocks/compare/v2.0.0...HEAD +[Unreleased]: https://github.com/minetest-mods/moreblocks/compare/v2.1.0...HEAD +[2.1.0]: https://github.com/minetest-mods/moreblocks/compare/v2.0.0...v2.1.0 [2.0.0]: https://github.com/minetest-mods/moreblocks/compare/v1.3.0...v2.0.0 [1.3.0]: https://github.com/minetest-mods/moreblocks/compare/v1.2.0...v1.3.0 [1.2.0]: https://github.com/minetest-mods/moreblocks/compare/v1.1.0...v1.2.0 diff --git a/mods/moreblocks/README.md b/mods/moreblocks/README.md index 38a1dd4a..2d5d575e 100644 --- a/mods/moreblocks/README.md +++ b/mods/moreblocks/README.md @@ -58,7 +58,7 @@ on that line. ## Version compatibility -More Blocks is currently primarily tested with Minetest 5.1.0. +More Blocks is currently primarily tested with Minetest 5.3.0. It may or may not work with newer or older versions. Issues arising in older versions than 5.0.0 will generally not be fixed. diff --git a/mods/moreblocks/crafting.lua b/mods/moreblocks/crafting.lua index cd07711c..34d1dc04 100644 --- a/mods/moreblocks/crafting.lua +++ b/mods/moreblocks/crafting.lua @@ -348,12 +348,36 @@ minetest.register_craft({ recipe = {"moreblocks:sweeper", "default:glass"}, }) +minetest.register_craft({ + output = "moreblocks:trap_clean_glass", + type = "shapeless", + recipe = {"default:mese_crystal_fragment", "moreblocks:clean_glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_clean_glass", + type = "shapeless", + recipe = {"moreblocks:sweeper", "moreblocks:trap_glass"}, +}) + minetest.register_craft({ output = "moreblocks:glow_glass", type = "shapeless", recipe = {"default:torch", "default:glass"}, }) +minetest.register_craft({ + output = "moreblocks:clean_glow_glass", + type = "shapeless", + recipe = {"default:torch", "moreblocks:clean_glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:clean_glow_glass", + type = "shapeless", + recipe = {"moreblocks:sweeper", "moreblocks:glow_glass"}, +}) + minetest.register_craft({ output = "moreblocks:trap_glow_glass", type = "shapeless", @@ -366,6 +390,26 @@ minetest.register_craft({ recipe = {"default:mese_crystal_fragment", "moreblocks:glow_glass"}, }) +-- several recipes are possible for the trap+clean+glow, we only present 3 of them +minetest.register_craft({ + output = "moreblocks:trap_clean_glow_glass", + type = "shapeless", + recipe = {"default:mese_crystal_fragment", "moreblocks:clean_glow_glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_clean_glow_glass", + type = "shapeless", + recipe = {"default:mese_crystal_fragment", "moreblocks:clean_glass", "default:torch"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_clean_glow_glass", + type = "shapeless", + recipe = {"moreblocks:sweeper", "moreblocks:trap_glow_glass" }, +}) + + minetest.register_craft({ output = "moreblocks:super_glow_glass", type = "shapeless", @@ -378,6 +422,24 @@ minetest.register_craft({ recipe = {"default:torch", "moreblocks:glow_glass"}, }) +minetest.register_craft({ + output = "moreblocks:clean_super_glow_glass", + type = "shapeless", + recipe = {"default:torch", "default:torch", "moreblocks:clean_glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:clean_super_glow_glass", + type = "shapeless", + recipe = {"default:torch", "moreblocks:clean_glow_glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:clean_super_glow_glass", + type = "shapeless", + recipe = {"moreblocks:sweeper", "moreblocks:super_glow_glass"}, +}) + minetest.register_craft({ output = "moreblocks:trap_super_glow_glass", @@ -391,6 +453,32 @@ minetest.register_craft({ recipe = {"default:mese_crystal_fragment", "moreblocks:super_glow_glass"}, }) +-- several recipes are possible for the trap+clean+glow, we only present 4 of them +minetest.register_craft({ + output = "moreblocks:trap_clean_super_glow_glass", + type = "shapeless", + recipe = {"default:mese_crystal_fragment", "moreblocks:clean_super_glow_glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_clean_super_glow_glass", + type = "shapeless", + recipe = {"default:mese_crystal_fragment", "moreblocks:clean_glow_glass", "default:torch"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_clean_super_glow_glass", + type = "shapeless", + recipe = {"default:mese_crystal_fragment", "moreblocks:clean_glass", "default:torch", "default:torch"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_clean_super_glow_glass", + type = "shapeless", + recipe = {"moreblocks:sweeper", "moreblocks:trap_super_glow_glass" }, +}) + + minetest.register_craft({ output = "moreblocks:coal_stone", type = "shapeless", diff --git a/mods/moreblocks/nodes.lua b/mods/moreblocks/nodes.lua index e255e0ad..79abcb57 100644 --- a/mods/moreblocks/nodes.lua +++ b/mods/moreblocks/nodes.lua @@ -349,6 +349,19 @@ local nodes = { sounds = sound_stone, no_stairs = true, }, + ["trap_clean_glass"] = { + description = S("Trap Clean Glass"), + drawtype = "glasslike_framed_optional", + tiles = {"moreblocks_clean_glass.png^moreblocks_trap_box_glass.png", "moreblocks_clean_glass_detail.png"}, + use_texture_alpha = true, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + walkable = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = sound_glass, + no_stairs = true, + }, ["trap_sandstone"] = { description = S("Trap Sandstone"), drawtype = "glasslike_framed", @@ -407,6 +420,18 @@ local nodes = { groups = {cracky = 3, oddly_breakable_by_hand = 3}, sounds = sound_glass, }, + ["clean_glow_glass"] = { + description = S("Clean Glow Glass"), + drawtype = "glasslike_framed_optional", + tiles = {"moreblocks_clean_glass.png^[colorize:#E9CD61", "moreblocks_clean_glass_detail.png^[colorize:#E9CD61"}, + use_texture_alpha = true, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + light_source = 11, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = sound_glass, + }, ["trap_glow_glass"] = { description = S("Trap Glow Glass"), drawtype = "glasslike_framed_optional", @@ -421,6 +446,20 @@ local nodes = { sounds = sound_glass, no_stairs = true, }, + ["trap_clean_glow_glass"] = { + description = S("Trap Clean Glow Glass"), + drawtype = "glasslike_framed_optional", + tiles = {"moreblocks_clean_glass.png^[colorize:#E9CD61^moreblocks_trap_box_glass.png", "moreblocks_clean_glass_detail.png^[colorize:#E9CD61"}, + use_texture_alpha = true, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + light_source = 11, + walkable = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = sound_glass, + no_stairs = true, + }, ["super_glow_glass"] = { description = S("Super Glow Glass"), drawtype = "glasslike_framed_optional", @@ -433,6 +472,18 @@ local nodes = { groups = {cracky = 3, oddly_breakable_by_hand = 3}, sounds = sound_glass, }, + ["clean_super_glow_glass"] = { + description = S("Clean Super Glow Glass"), + drawtype = "glasslike_framed_optional", + tiles = {"moreblocks_clean_glass.png^[colorize:#FFFF78", "moreblocks_clean_glass_detail.png^[colorize:#FFFF78"}, + use_texture_alpha = true, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + light_source = default.LIGHT_MAX, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = sound_glass, + }, ["trap_super_glow_glass"] = { description = S("Trap Super Glow Glass"), drawtype = "glasslike_framed_optional", @@ -447,6 +498,20 @@ local nodes = { sounds = sound_glass, no_stairs = true, }, + ["trap_clean_super_glow_glass"] = { + description = S("Trap Clean Super Glow Glass"), + drawtype = "glasslike_framed_optional", + tiles = {"moreblocks_clean_glass.png^[colorize:#FFFF78^moreblocks_trap_box_glass.png", "moreblocks_clean_glass_detail.png^[colorize:#FFFF78"}, + use_texture_alpha = true, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + light_source = default.LIGHT_MAX, + walkable = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = sound_glass, + no_stairs = true, + }, ["rope"] = { description = S("Rope"), drawtype = "signlike", diff --git a/mods/moreblocks/redefinitions.lua b/mods/moreblocks/redefinitions.lua index 6cb8ea43..1856c989 100644 --- a/mods/moreblocks/redefinitions.lua +++ b/mods/moreblocks/redefinitions.lua @@ -7,24 +7,42 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Redefinitions of some default crafting recipes: -minetest.register_craft({ - output = "default:sign_wall 4", +-- Signs: +1 +minetest.clear_craft({ recipe = { - {"default:wood", "default:wood", "default:wood"}, - {"default:wood", "default:wood", "default:wood"}, - {"", "default:stick", ""}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'group:stick', ''}, + } +}) + +minetest.clear_craft({ + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, } }) minetest.register_craft({ - output = "default:ladder 4", + output = 'default:sign_wall_steel 4', recipe = { - {"default:stick", "", "default:stick"}, - {"default:stick", "default:stick", "default:stick"}, - {"default:stick", "", "default:stick"}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'group:stick', ''}, } }) +minetest.register_craft({ + output = 'default:sign_wall_wood 4', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, + } +}) + + minetest.clear_craft({ recipe = { {"default:papyrus", "default:papyrus", "default:papyrus"} @@ -37,6 +55,7 @@ minetest.register_craft({ } }) + minetest.register_craft({ output = "default:rail 24", recipe = { diff --git a/mods/moreblocks/stairsplus/common.lua b/mods/moreblocks/stairsplus/common.lua index de852caf..15e86520 100644 --- a/mods/moreblocks/stairsplus/common.lua +++ b/mods/moreblocks/stairsplus/common.lua @@ -15,6 +15,97 @@ local descriptions = { ["stair"] = S("%s Stairs"), } +-- Extends the standad rotate_node placement so that it takes into account +-- the side (top/bottom or left/right) of the face being pointed at. +-- As with the standard rotate_node, sneak can be used to force the perpendicular +-- placement (wall placement on floor/ceiling, floor/ceiling placement on walls). +-- Additionally, the aux / sprint / special key can be used to place the node +-- as if from the opposite side. +-- +-- When placing a node next to one of the same category (e.g. slab to slab or +-- stair to stair), the default placement (regardless of sneak) is to copy the +-- under node's param2, flipping if placed above or below it. The aux key disable +-- this behavior. +local wall_right_dirmap = {9, 18, 7, 12} +local wall_left_dirmap = {11, 16, 5, 14} +local ceil_dirmap = {20, 23, 22, 21} + +stairsplus.rotate_node_aux = function(itemstack, placer, pointed_thing) + local sneak = placer and placer:get_player_control().sneak + local aux = placer and placer:get_player_control().aux1 + + -- namestring for what we are placing, up to the first _ (exclusive) + local item_prefix = itemstack:get_name():gsub("_.*$", "") + -- namestring for what we are placing against + local under = pointed_thing.under + local under_node = minetest.get_node(under) + local under_prefix = under_node and under_node.name:gsub("_.*$", "") + + local same_cat = item_prefix == under_prefix + + -- standard (floor) facedir, also used for sneak placement against the lower half of the wall + local p2 = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0 + + -- check which face and which quadrant we are interested in + -- this is used both to check if we're handling parallel placement in the same-category case, + -- and in general for sneak placement + local face_pos = minetest.pointed_thing_to_face_pos(placer, pointed_thing) + local face_off = vector.subtract(face_pos, under) + local wallmounted = minetest.dir_to_wallmounted(face_off) + + if same_cat and not aux then + p2 = under_node.param2 + -- flip if placing above or below an upright or upside-down node + -- TODO should we also flip when placing next to a side-mounted node? + if wallmounted < 2 then + if p2 < 4 then + p2 = (p2 + 2) % 4 + p2 = ceil_dirmap[p2 + 1] + elseif p2 > 19 then + p2 = ceil_dirmap[p2 - 19] - 20 + p2 = (p2 + 2) % 4 + end + end + else + -- for same-cat placement, aux is used to disable param2 copying + if same_cat then + aux = not aux + end + + local remap = nil + + -- standard placement against the wall + local use_wallmap = (wallmounted > 1 and not sneak) or (wallmounted < 2 and sneak) + + -- standard placement against the ceiling, or sneak placement against the upper half of the wall + local use_ceilmap = wallmounted == 1 and not sneak + use_ceilmap = use_ceilmap or (wallmounted > 1 and sneak and face_off.y > 0) + + if use_wallmap then + local left = (p2 == 0 and face_off.x < 0) or + (p2 == 1 and face_off.z > 0) or + (p2 == 2 and face_off.x > 0) or + (p2 == 3 and face_off.z < 0) + if aux then + left = not left + end + remap = left and wall_left_dirmap or wall_right_dirmap + elseif use_ceilmap then + remap = ceil_dirmap + end + + if aux then + p2 = (p2 + 2) % 4 + end + + if remap then + p2 = remap[p2 + 1] + end + end + + return minetest.item_place(itemstack, placer, pointed_thing, p2) +end + stairsplus.register_single = function(category, alternate, info, modname, subname, recipeitem, fields) local src_def = minetest.registered_nodes[recipeitem] or {} local desc_base = descriptions[category]:format(fields.description) @@ -42,7 +133,7 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam -- Darken light sources slightly to make up for their smaller visual size def.light_source = math.max(0, (def.light_source or 0) - 1) - def.on_place = minetest.rotate_node + def.on_place = stairsplus.rotate_node_aux def.groups = stairsplus:prepare_groups(fields.groups) if category == "slab" then diff --git a/mods/techpack/tubelib/tubes.lua b/mods/techpack/tubelib/tubes.lua index d467fde7..14e3cf8d 100644 --- a/mods/techpack/tubelib/tubes.lua +++ b/mods/techpack/tubelib/tubes.lua @@ -35,6 +35,15 @@ local Tube = tubelib2.Tube:new({ tubelib.Tube = Tube +local function ON_BLAST(id) + return function (pos) + local node = minetest.get_node(pos) + minetest.remove_node(pos) + Tube:after_dig_tube(pos, node) + return {id} + end +end + minetest.register_node("tubelib:tubeS", { description = S("Tubelib Tube"), tiles = { -- Top, base, right, left, front, back @@ -80,6 +89,7 @@ minetest.register_node("tubelib:tubeS", { is_ground_content = false, groups = {choppy=2, cracky=3}, sounds = default.node_sound_wood_defaults(), + on_blast = ON_BLAST("tubelib:tubeS"), }) minetest.register_node("tubelib:tubeA", { @@ -121,6 +131,7 @@ minetest.register_node("tubelib:tubeA", { groups = {choppy=2, cracky=3, not_in_creative_inventory=1}, sounds = default.node_sound_wood_defaults(), drop = "tubelib:tubeS", + on_blast = ON_BLAST("tubelib:tubeA"), }) minetest.register_craft({ diff --git a/mods/techpack/tubelib_addons1/harvester.lua b/mods/techpack/tubelib_addons1/harvester.lua index a5852344..4c98b9d3 100644 --- a/mods/techpack/tubelib_addons1/harvester.lua +++ b/mods/techpack/tubelib_addons1/harvester.lua @@ -119,7 +119,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) local inv = M(pos):get_inventory() if listname == "main" then return stack:get_count() - elseif listname == "fuel" and stack:get_name() == "tubelib_addons1:biofuel" then + elseif listname == "fuel" and tubelib.is_fuel(stack) then return stack:get_count() end return 0 @@ -147,6 +147,16 @@ local function remove_all_sapling_items(pos) end end +local function is_plantable_ground(node) + if minetest.get_item_group(node.name, "soil") ~= 0 then + return true + end + if minetest.get_item_group(node.name, "sand") ~= 0 then + return true + end + return false +end + -- Remove wood/leave nodes and place sapling if necessary -- Return false if inventory is full -- else return true @@ -163,7 +173,7 @@ local function remove_or_replace_node(this, pos, inv, node, order) minetest.remove_node(pos) inv:add_item("main", ItemStack(order.drop)) this.num_items = this.num_items + 1 - if tubelib_addons1.GroundNodes[next_node.name] ~= nil and order.plant then -- hit the ground? + if is_plantable_ground(next_node) and order.plant then -- hit the ground? minetest.set_node(pos, {name=order.plant, paramtype2 = "wallmounted", param2=1}) if order.t1 ~= nil then -- We have to simulate "on_place" and start the timer by hand @@ -180,7 +190,12 @@ end -- check the fuel level and return false if empty local function check_fuel(pos, this, meta) if this.fuel <= 0 then - if tubelib.get_this_item(meta, "fuel", 1) == nil then + local fuel_item = tubelib.get_this_item(meta, "fuel", 1) + if fuel_item == nil then + return false + end + if not tubelib.is_fuel(fuel_item) then + tubelib.put_item(meta, "fuel", fuel_item) return false end this.fuel = BURNING_TIME @@ -222,7 +237,7 @@ local function harvest_field(this, meta) if node and node.name ~= "air" then local order = tubelib_addons1.FarmingNodes[node.name] or tubelib_addons1.Flowers[node.name] if order then - if not remove_or_replace_node(this, pos, inv, node, order) then + if not minetest.is_protected(pos, this.owner) and not remove_or_replace_node(this, pos, inv, node, order) then return false end else @@ -433,6 +448,9 @@ tubelib.register_node("tubelib_addons1:harvester_base", {"tubelib_addons1:harves return tubelib.get_item(M(pos), "main") end, on_push_item = function(pos, side, item) + if not tubelib.is_fuel(item) then + return false + end return tubelib.put_item(M(pos), "fuel", item) end, on_unpull_item = function(pos, side, item) diff --git a/mods/techpack/tubelib_addons1/quarry.lua b/mods/techpack/tubelib_addons1/quarry.lua index bc64107a..75c26d9f 100644 --- a/mods/techpack/tubelib_addons1/quarry.lua +++ b/mods/techpack/tubelib_addons1/quarry.lua @@ -122,7 +122,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) local inv = M(pos):get_inventory() if listname == "main" then return stack:get_count() - elseif listname == "fuel" and stack:get_name() == "tubelib_addons1:biofuel" then + elseif listname == "fuel" and tubelib.is_fuel(stack) then return stack:get_count() end return 0 @@ -164,10 +164,16 @@ local function quarry_next_node(pos, meta) -- check fuel local fuel = meta:get_int("fuel") or 0 if fuel <= 0 then - if tubelib.get_this_item(meta, "fuel", 1) == nil then + local fuel_item = tubelib.get_this_item(meta, "fuel", 1) + if fuel_item == nil then State:fault(pos, meta) return end + if not tubelib.is_fuel(fuel_item) then + State:fault(pos, meta) + tubelib.put_item(meta, "fuel", fuel_item) + return + end fuel = BURNING_TIME else fuel = fuel - 1 @@ -443,6 +449,9 @@ tubelib.register_node("tubelib_addons1:quarry", return tubelib.get_item(M(pos), "main") end, on_push_item = function(pos, side, item) + if not tubelib.is_fuel(item) then + return false + end return tubelib.put_item(M(pos), "fuel", item) end, on_unpull_item = function(pos, side, item) diff --git a/mods/techpack/tubelib_addons1/reformer.lua b/mods/techpack/tubelib_addons1/reformer.lua index 3803251f..90e37711 100644 --- a/mods/techpack/tubelib_addons1/reformer.lua +++ b/mods/techpack/tubelib_addons1/reformer.lua @@ -342,6 +342,9 @@ minetest.register_craft({ }, }) +function tubelib.is_fuel(stack) + return stack:get_name() == "tubelib_addons1:biofuel" +end tubelib.register_node("tubelib_addons1:reformer", {"tubelib_addons1:reformer_defect"}, { on_pull_item = function(pos, side)