From 832b8f8817e8f3a003211cb905a049224d0f2d43 Mon Sep 17 00:00:00 2001 From: Jat15 Date: Sat, 17 Feb 2018 21:08:08 +0100 Subject: [PATCH 01/16] Craft Circle Stone Brick and Stone tile (#82) * Craft Circle Stone Brick and Stone tile Craft Circle Stone Brick was similar furnace. Stone Tile is more similar with stone block. * Modify Circle Stone Brick * Modify craft Stone Tile --- CHANGELOG.md | 6 ++++++ crafting.lua | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 817f6b9..f720912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - The circular saw can no longer replace items from the player's inventory when it is full. +### Changed + +- New craft for: + - Stone Tile + - Circle Stone Bricks + ## [1.1.0] - 2017-10-04 ### Added diff --git a/crafting.lua b/crafting.lua index b6432c7..3fb9830 100644 --- a/crafting.lua +++ b/crafting.lua @@ -94,11 +94,11 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "moreblocks:circle_stone_bricks 8", + output = "moreblocks:circle_stone_bricks 5", recipe = { - {"default:stone", "default:stone", "default:stone"}, - {"default:stone", "", "default:stone"}, - {"default:stone", "default:stone", "default:stone"}, + {"", "default:stone", ""}, + {"default:stone", "default:coal_lump", "default:stone"}, + {"", "default:stone", ""}, } }) @@ -156,10 +156,11 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "moreblocks:stone_tile 4", + output = "moreblocks:stone_tile 9", recipe = { - {"default:cobble", "default:cobble"}, - {"default:cobble", "default:cobble"}, + {"default:cobble", "default:cobble", "default:cobble"}, + {"default:cobble", "default:stone", "default:cobble"}, + {"default:cobble", "default:cobble", "default:cobble"}, } }) From 4d2a7ab6fe88b5578faef60e30f7e6f6bdddd7ef Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sat, 3 Mar 2018 16:42:46 +0100 Subject: [PATCH 02/16] Move definitions to a separate file Make definitions table global Replace stairsplus.copytable() function with table.copy() --- stairsplus/defs.lua | 409 +++++++++++++++++++++++++++++++++++++ stairsplus/init.lua | 16 +- stairsplus/microblocks.lua | 55 +---- stairsplus/panels.lua | 55 +---- stairsplus/slabs.lua | 34 +-- stairsplus/slopes.lua | 209 +------------------ stairsplus/stairs.lua | 95 +-------- 7 files changed, 425 insertions(+), 448 deletions(-) create mode 100644 stairsplus/defs.lua diff --git a/stairsplus/defs.lua b/stairsplus/defs.lua new file mode 100644 index 0000000..a7b7bca --- /dev/null +++ b/stairsplus/defs.lua @@ -0,0 +1,409 @@ +--[[ +More Blocks: registrations + +Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + + +local box_slope = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -0.25, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.25, 0.5}, + {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5} + } +} + +local box_slope_half = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, + {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5}, + {-0.5, -0.25, 0, 0.5, -0.125, 0.5}, + {-0.5, -0.125, 0.25, 0.5, 0, 0.5}, + } +} + +local box_slope_half_raised = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5}, + {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5}, + {-0.5, 0.25, 0, 0.5, 0.375, 0.5}, + {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5}, + } +} + +--============================================================== + +local box_slope_inner = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.5, -0.25, 0.5, 0, 0.5}, + {-0.5, -0.5, -0.5, 0.25, 0, 0.5}, + {-0.5, 0, -0.5, 0, 0.25, 0.5}, + {-0.5, 0, 0, 0.5, 0.25, 0.5}, + {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}, + {-0.5, 0.25, -0.5, -0.25, 0.5, 0.5}, + } +} + +local box_slope_inner_half = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, + {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5}, + {-0.5, -0.375, -0.5, 0.25, -0.25, 0.5}, + {-0.5, -0.25, -0.5, 0, -0.125, 0.5}, + {-0.5, -0.25, 0, 0.5, -0.125, 0.5}, + {-0.5, -0.125, 0.25, 0.5, 0, 0.5}, + {-0.5, -0.125, -0.5, -0.25, 0, 0.5}, + } +} + +local box_slope_inner_half_raised = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5}, + {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5}, + {-0.5, 0.125, -0.5, 0.25, 0.25, 0.5}, + {-0.5, 0.25, -0.5, 0, 0.375, 0.5}, + {-0.5, 0.25, 0, 0.5, 0.375, 0.5}, + {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5}, + {-0.5, 0.375, -0.5, -0.25, 0.5, 0.5}, + } +} + +--============================================================== + +local box_slope_outer = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -0.25, 0.25, 0, 0.5}, + {-0.5, 0, 0, 0, 0.25, 0.5}, + {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5} + } +} + +local box_slope_outer_half = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, + {-0.5, -0.375, -0.25, 0.25, -0.25, 0.5}, + {-0.5, -0.25, 0, 0, -0.125, 0.5}, + {-0.5, -0.125, 0.25, -0.25, 0, 0.5} + } +} + +local box_slope_outer_half_raised = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5}, + {-0.5, 0.125, -0.25, 0.25, 0.25, 0.5}, + {-0.5, 0.25, 0, 0, 0.375, 0.5}, + {-0.5, 0.375, 0.25, -0.25, 0.5, 0.5} + } +} + +stairsplus.defs = { + ["micro"] = { + [""] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, + }, + }, + ["_1"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5}, + }, + }, + ["_2"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5}, + }, + }, + ["_4"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5}, + }, + }, + ["_12"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5}, + }, + }, + ["_14"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5}, + }, + }, + ["_15"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5}, + }, + } + }, + ["panel"] = { + [""] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, + }, + }, + ["_1"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5}, + }, + }, + ["_2"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5}, + }, + }, + ["_4"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5}, + }, + }, + ["_12"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5}, + }, + }, + ["_14"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5}, + }, + }, + ["_15"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5}, + }, + } + }, + ["slab"] = { + [""] = 8, + ["_quarter"] = 4, + ["_three_quarter"] = 12, + ["_1"] = 1, + ["_2"] = 2, + ["_14"] = 14, + ["_15"] = 15, + ["_two_sides"] = { + { -0.5, -0.5, -0.5, 0.5, -7/16, 7/16 }, + { -0.5, -0.5, 7/16, 0.5, 0.5, 0.5 } + }, + ["_three_sides"] = { + { -7/16, -0.5, -0.5, 0.5, -7/16, 7/16 }, + { -7/16, -0.5, 7/16, 0.5, 0.5, 0.5 }, + { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 } + }, + ["_three_sides_u"] = { + { -0.5, -0.5, -0.5, 0.5, 0.5, -7/16 }, + { -0.5, -0.5, -7/16, 0.5, -7/16, 7/16 }, + { -0.5, -0.5, 7/16, 0.5, 0.5, 0.5 } + } + }, + ["slope"] = { + [""] = { + mesh = "moreblocks_slope.obj", + collision_box = box_slope, + selection_box = box_slope, + + }, + ["_half"] = { + mesh = "moreblocks_slope_half.obj", + collision_box = box_slope_half, + selection_box = box_slope_half, + }, + ["_half_raised"] = { + mesh = "moreblocks_slope_half_raised.obj", + collision_box = box_slope_half_raised, + selection_box = box_slope_half_raised, + }, + + --============================================================== + + ["_inner"] = { + mesh = "moreblocks_slope_inner.obj", + collision_box = box_slope_inner, + selection_box = box_slope_inner, + }, + ["_inner_half"] = { + mesh = "moreblocks_slope_inner_half.obj", + collision_box = box_slope_inner_half, + selection_box = box_slope_inner_half, + }, + ["_inner_half_raised"] = { + mesh = "moreblocks_slope_inner_half_raised.obj", + collision_box = box_slope_inner_half_raised, + selection_box = box_slope_inner_half_raised, + }, + + --============================================================== + + ["_inner_cut"] = { + mesh = "moreblocks_slope_inner_cut.obj", + collision_box = box_slope_inner, + selection_box = box_slope_inner, + }, + ["_inner_cut_half"] = { + mesh = "moreblocks_slope_inner_cut_half.obj", + collision_box = box_slope_inner_half, + selection_box = box_slope_inner_half, + }, + ["_inner_cut_half_raised"] = { + mesh = "moreblocks_slope_inner_cut_half_raised.obj", + collision_box = box_slope_inner_half_raised, + selection_box = box_slope_inner_half_raised, + }, + + --============================================================== + + ["_outer"] = { + mesh = "moreblocks_slope_outer.obj", + collision_box = box_slope_outer, + selection_box = box_slope_outer, + }, + ["_outer_half"] = { + mesh = "moreblocks_slope_outer_half.obj", + collision_box = box_slope_outer_half, + selection_box = box_slope_outer_half, + }, + ["_outer_half_raised"] = { + mesh = "moreblocks_slope_outer_half_raised.obj", + collision_box = box_slope_outer_half_raised, + selection_box = box_slope_outer_half_raised, + }, + + --============================================================== + + ["_outer_cut"] = { + mesh = "moreblocks_slope_outer_cut.obj", + collision_box = box_slope_outer, + selection_box = box_slope_outer, + }, + ["_outer_cut_half"] = { + mesh = "moreblocks_slope_outer_cut_half.obj", + collision_box = box_slope_outer_half, + selection_box = box_slope_outer_half, + }, + ["_outer_cut_half_raised"] = { + mesh = "moreblocks_slope_outer_cut_half_raised.obj", + collision_box = box_slope_outer_half_raised, + selection_box = box_slope_outer_half_raised, + }, + ["_cut"] = { + mesh = "moreblocks_slope_cut.obj", + collision_box = box_slope_outer, + selection_box = box_slope_outer, + }, + }, + ["stair"] = { + [""] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + }, + ["_half"] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + }, + ["_right_half" ]= { + node_box = { + type = "fixed", + fixed = { + {0, -0.5, -0.5, 0.5, 0, 0.5}, + {0, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + }, + ["_inner"] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + {-0.5, 0, -0.5, 0, 0.5, 0}, + }, + }, + }, + ["_outer"] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + }, + ["_alt"] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + }, + ["_alt_1"] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.0625, -0.5, 0.5, 0, 0}, + {-0.5, 0.4375, 0, 0.5, 0.5, 0.5}, + }, + }, + }, + ["_alt_2"] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.125, -0.5, 0.5, 0, 0}, + {-0.5, 0.375, 0, 0.5, 0.5, 0.5}, + }, + }, + }, + ["_alt_4"] = { + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.25, -0.5, 0.5, 0, 0}, + {-0.5, 0.25, 0, 0.5, 0.5, 0.5}, + }, + }, + }, + }, +} + +for type,a in pairs(stairsplus.defs) do + for name,b in pairs(stairsplus.defs[type]) do + table.insert(stairsplus.shapes_list, { type .. "_", name }) + end +end \ No newline at end of file diff --git a/stairsplus/init.lua b/stairsplus/init.lua index 5cd415c..cfb6fcd 100644 --- a/stairsplus/init.lua +++ b/stairsplus/init.lua @@ -19,21 +19,6 @@ and minetest.settings:get_bool("creative_mode") then stairsplus.expect_infinite_stacks = true end -function stairsplus.copytable(orig) - local orig_type = type(orig) - local copy - if orig_type == 'table' then - copy = {} - for orig_key, orig_value in next, orig, nil do - copy[stairsplus.copytable(orig_key)] = stairsplus.copytable(orig_value) - end - setmetatable(copy, stairsplus.copytable(getmetatable(orig))) - else - copy = orig - end - return copy -end - function stairsplus:prepare_groups(groups) local result = {} if groups then @@ -85,6 +70,7 @@ end -- dofile(modpath.. "/aliases.lua") -- Not needed as of Q2 2013, uncomment to fix old maps. -- dofile(modpath.. "/conversion.lua") -- Not needed as of Q2 2013, uncomment to fix old maps. +dofile(modpath .. "/defs.lua") dofile(modpath .. "/stairs.lua") dofile(modpath .. "/slabs.lua") dofile(modpath .. "/slopes.lua") diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua index 50d8487..8a3b63d 100644 --- a/stairsplus/microblocks.lua +++ b/stairsplus/microblocks.lua @@ -20,71 +20,22 @@ function register_micro(modname, subname, recipeitem, groups, images, descriptio }) end -local microblocks_defs = { - [""] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, - }, - }, - ["_1"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5}, - }, - }, - ["_2"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5}, - }, - }, - ["_4"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5}, - }, - }, - ["_12"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5}, - }, - }, - ["_14"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5}, - }, - }, - ["_15"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5}, - }, - } -} - -for k,v in pairs(microblocks_defs) do - table.insert(stairsplus.shapes_list, { "micro_", k }) -end - function stairsplus:register_micro_alias(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(microblocks_defs) + local defs = table.copy(stairsplus.defs["micro"]) for alternate, def in pairs(defs) do minetest.register_alias(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate) end end function stairsplus:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(microblocks_defs) + local defs = table.copy(stairsplus.defs["micro"]) for alternate, def in pairs(defs) do minetest.register_alias_force(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate) end end function stairsplus:register_micro(modname, subname, recipeitem, fields) - local defs = stairsplus.copytable(microblocks_defs) + local defs = table.copy(stairsplus.defs["micro"]) local desc = S("%s Microblock"):format(fields.description) for alternate, def in pairs(defs) do for k, v in pairs(fields) do diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua index 98e77fd..e065cdd 100644 --- a/stairsplus/panels.lua +++ b/stairsplus/panels.lua @@ -20,71 +20,22 @@ function register_panel(modname, subname, recipeitem, groups, images, descriptio }) end -local panels_defs = { - [""] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, - }, - }, - ["_1"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5}, - }, - }, - ["_2"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5}, - }, - }, - ["_4"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5}, - }, - }, - ["_12"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5}, - }, - }, - ["_14"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5}, - }, - }, - ["_15"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5}, - }, - } -} - -for k,v in pairs(panels_defs) do - table.insert(stairsplus.shapes_list, { "panel_", k }) -end - function stairsplus:register_panel_alias(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(panels_defs) + local defs = table.copy(stairsplus.defs["panel"]) for alternate, def in pairs(defs) do minetest.register_alias(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate) end end function stairsplus:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(panels_defs) + local defs = table.copy(stairsplus.defs["panel"]) for alternate, def in pairs(defs) do minetest.register_alias_force(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate) end end function stairsplus:register_panel(modname, subname, recipeitem, fields) - local defs = stairsplus.copytable(panels_defs) + local defs = table.copy(stairsplus.defs["panel"]) local desc = S("%s Panel"):format(fields.description) for alternate, def in pairs(defs) do for k, v in pairs(fields) do diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua index de7f031..2d60d6d 100644 --- a/stairsplus/slabs.lua +++ b/stairsplus/slabs.lua @@ -20,50 +20,22 @@ function register_slab(modname, subname, recipeitem, groups, images, description }) end -local slabs_defs = { - [""] = 8, - ["_quarter"] = 4, - ["_three_quarter"] = 12, - ["_1"] = 1, - ["_2"] = 2, - ["_14"] = 14, - ["_15"] = 15, - ["_two_sides"] = { - { -0.5, -0.5, -0.5, 0.5, -7/16, 7/16 }, - { -0.5, -0.5, 7/16, 0.5, 0.5, 0.5 } - }, - ["_three_sides"] = { - { -7/16, -0.5, -0.5, 0.5, -7/16, 7/16 }, - { -7/16, -0.5, 7/16, 0.5, 0.5, 0.5 }, - { -0.5, -0.5, -0.5, -7/16, 0.5, 0.5 } - }, - ["_three_sides_u"] = { - { -0.5, -0.5, -0.5, 0.5, 0.5, -7/16 }, - { -0.5, -0.5, -7/16, 0.5, -7/16, 7/16 }, - { -0.5, -0.5, 7/16, 0.5, 0.5, 0.5 } - } -} - -for k,v in pairs(slabs_defs) do - table.insert(stairsplus.shapes_list, { "slab_", k }) -end - function stairsplus:register_slab_alias(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(slabs_defs) + local defs = table.copy(stairsplus.defs["slab"]) for alternate, def in pairs(defs) do minetest.register_alias(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate) end end function stairsplus:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(slabs_defs) + local defs = table.copy(stairsplus.defs["slab"]) for alternate, def in pairs(defs) do minetest.register_alias_force(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate) end end function stairsplus:register_slab(modname, subname, recipeitem, fields) - local defs = stairsplus.copytable(slabs_defs) + local defs = table.copy(stairsplus.defs["slab"]) local desc_base = S("%s Slab"):format(fields.description) for alternate, shape in pairs(defs) do local def = {} diff --git a/stairsplus/slopes.lua b/stairsplus/slopes.lua index 7d18b3d..892e856 100644 --- a/stairsplus/slopes.lua +++ b/stairsplus/slopes.lua @@ -7,109 +7,6 @@ Licensed under the zlib license. See LICENSE.md for more information. local S = moreblocks.intllib -local box_slope = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - {-0.5, -0.25, -0.25, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.25, 0.5}, - {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5} - } -} - -local box_slope_half = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, - {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5}, - {-0.5, -0.25, 0, 0.5, -0.125, 0.5}, - {-0.5, -0.125, 0.25, 0.5, 0, 0.5}, - } -} - -local box_slope_half_raised = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5}, - {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5}, - {-0.5, 0.25, 0, 0.5, 0.375, 0.5}, - {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5}, - } -} - ---============================================================== - -local box_slope_inner = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - {-0.5, -0.5, -0.25, 0.5, 0, 0.5}, - {-0.5, -0.5, -0.5, 0.25, 0, 0.5}, - {-0.5, 0, -0.5, 0, 0.25, 0.5}, - {-0.5, 0, 0, 0.5, 0.25, 0.5}, - {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}, - {-0.5, 0.25, -0.5, -0.25, 0.5, 0.5}, - } -} - -local box_slope_inner_half = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, - {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5}, - {-0.5, -0.375, -0.5, 0.25, -0.25, 0.5}, - {-0.5, -0.25, -0.5, 0, -0.125, 0.5}, - {-0.5, -0.25, 0, 0.5, -0.125, 0.5}, - {-0.5, -0.125, 0.25, 0.5, 0, 0.5}, - {-0.5, -0.125, -0.5, -0.25, 0, 0.5}, - } -} - -local box_slope_inner_half_raised = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5}, - {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5}, - {-0.5, 0.125, -0.5, 0.25, 0.25, 0.5}, - {-0.5, 0.25, -0.5, 0, 0.375, 0.5}, - {-0.5, 0.25, 0, 0.5, 0.375, 0.5}, - {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5}, - {-0.5, 0.375, -0.5, -0.25, 0.5, 0.5}, - } -} - ---============================================================== - -local box_slope_outer = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - {-0.5, -0.25, -0.25, 0.25, 0, 0.5}, - {-0.5, 0, 0, 0, 0.25, 0.5}, - {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5} - } -} - -local box_slope_outer_half = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, - {-0.5, -0.375, -0.25, 0.25, -0.25, 0.5}, - {-0.5, -0.25, 0, 0, -0.125, 0.5}, - {-0.5, -0.125, 0.25, -0.25, 0, 0.5} - } -} - -local box_slope_outer_half_raised = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5}, - {-0.5, 0.125, -0.25, 0.25, 0.25, 0.5}, - {-0.5, 0.25, 0, 0, 0.375, 0.5}, - {-0.5, 0.375, 0.25, -0.25, 0.5, 0.5} - } -} - -- Node will be called :slope_ function register_slope(modname, subname, recipeitem, groups, images, description, drop, light) @@ -123,122 +20,22 @@ function register_slope(modname, subname, recipeitem, groups, images, descriptio }) end -local slopes_defs = { - [""] = { - mesh = "moreblocks_slope.obj", - collision_box = box_slope, - selection_box = box_slope, - - }, - ["_half"] = { - mesh = "moreblocks_slope_half.obj", - collision_box = box_slope_half, - selection_box = box_slope_half, - }, - ["_half_raised"] = { - mesh = "moreblocks_slope_half_raised.obj", - collision_box = box_slope_half_raised, - selection_box = box_slope_half_raised, - }, - - --============================================================== - - ["_inner"] = { - mesh = "moreblocks_slope_inner.obj", - collision_box = box_slope_inner, - selection_box = box_slope_inner, - }, - ["_inner_half"] = { - mesh = "moreblocks_slope_inner_half.obj", - collision_box = box_slope_inner_half, - selection_box = box_slope_inner_half, - }, - ["_inner_half_raised"] = { - mesh = "moreblocks_slope_inner_half_raised.obj", - collision_box = box_slope_inner_half_raised, - selection_box = box_slope_inner_half_raised, - }, - - --============================================================== - - ["_inner_cut"] = { - mesh = "moreblocks_slope_inner_cut.obj", - collision_box = box_slope_inner, - selection_box = box_slope_inner, - }, - ["_inner_cut_half"] = { - mesh = "moreblocks_slope_inner_cut_half.obj", - collision_box = box_slope_inner_half, - selection_box = box_slope_inner_half, - }, - ["_inner_cut_half_raised"] = { - mesh = "moreblocks_slope_inner_cut_half_raised.obj", - collision_box = box_slope_inner_half_raised, - selection_box = box_slope_inner_half_raised, - }, - - --============================================================== - - ["_outer"] = { - mesh = "moreblocks_slope_outer.obj", - collision_box = box_slope_outer, - selection_box = box_slope_outer, - }, - ["_outer_half"] = { - mesh = "moreblocks_slope_outer_half.obj", - collision_box = box_slope_outer_half, - selection_box = box_slope_outer_half, - }, - ["_outer_half_raised"] = { - mesh = "moreblocks_slope_outer_half_raised.obj", - collision_box = box_slope_outer_half_raised, - selection_box = box_slope_outer_half_raised, - }, - - --============================================================== - - ["_outer_cut"] = { - mesh = "moreblocks_slope_outer_cut.obj", - collision_box = box_slope_outer, - selection_box = box_slope_outer, - }, - ["_outer_cut_half"] = { - mesh = "moreblocks_slope_outer_cut_half.obj", - collision_box = box_slope_outer_half, - selection_box = box_slope_outer_half, - }, - ["_outer_cut_half_raised"] = { - mesh = "moreblocks_slope_outer_cut_half_raised.obj", - collision_box = box_slope_outer_half_raised, - selection_box = box_slope_outer_half_raised, - }, - ["_cut"] = { - mesh = "moreblocks_slope_cut.obj", - collision_box = box_slope_outer, - selection_box = box_slope_outer, - }, -} - -for k,v in pairs(slopes_defs) do - table.insert(stairsplus.shapes_list, { "slope_", k }) -end - function stairsplus:register_slope_alias(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(slopes_defs) + local defs = table.copy(stairsplus.defs["slope"]) for alternate, def in pairs(defs) do minetest.register_alias(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate) end end function stairsplus:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(slopes_defs) + local defs = table.copy(stairsplus.defs["slope"]) for alternate, def in pairs(defs) do minetest.register_alias_force(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate) end end function stairsplus:register_slope(modname, subname, recipeitem, fields) - local defs = stairsplus.copytable(slopes_defs) + local defs = table.copy(stairsplus.defs["slope"]) local desc = S("%s Slope"):format(fields.description) for alternate, def in pairs(defs) do for k, v in pairs(fields) do diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua index 815f7ac..eb76663 100644 --- a/stairsplus/stairs.lua +++ b/stairsplus/stairs.lua @@ -20,111 +20,22 @@ function register_stair(modname, subname, recipeitem, groups, images, descriptio }) end -local stairs_defs = { - [""] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - }, - }, - }, - ["_half"] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0, 0, 0.5}, - {-0.5, 0, 0, 0, 0.5, 0.5}, - }, - }, - }, - ["_right_half" ]= { - node_box = { - type = "fixed", - fixed = { - {0, -0.5, -0.5, 0.5, 0, 0.5}, - {0, 0, 0, 0.5, 0.5, 0.5}, - }, - }, - }, - ["_inner"] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - {-0.5, 0, -0.5, 0, 0.5, 0}, - }, - }, - }, - ["_outer"] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0, 0.5, 0.5}, - }, - }, - }, - ["_alt"] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - }, - }, - }, - ["_alt_1"] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.0625, -0.5, 0.5, 0, 0}, - {-0.5, 0.4375, 0, 0.5, 0.5, 0.5}, - }, - }, - }, - ["_alt_2"] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.125, -0.5, 0.5, 0, 0}, - {-0.5, 0.375, 0, 0.5, 0.5, 0.5}, - }, - }, - }, - ["_alt_4"] = { - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.25, -0.5, 0.5, 0, 0}, - {-0.5, 0.25, 0, 0.5, 0.5, 0.5}, - }, - }, - }, -} - -for k,v in pairs(stairs_defs) do - table.insert(stairsplus.shapes_list, { "stair_", k }) -end - function stairsplus:register_stair_alias(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(stairs_defs) + local defs = table.copy(stairsplus.defs["stair"]) for alternate, def in pairs(defs) do minetest.register_alias(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate) end end function stairsplus:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new) - local defs = stairsplus.copytable(stairs_defs) + local defs = table.copy(stairsplus.defs["stair"]) for alternate, def in pairs(defs) do minetest.register_alias_force(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate) end end function stairsplus:register_stair(modname, subname, recipeitem, fields) - local defs = stairsplus.copytable(stairs_defs) + local defs = table.copy(stairsplus.defs["stair"]) local desc = S("%s Stairs"):format(fields.description) for alternate, def in pairs(defs) do for k, v in pairs(fields) do From c71194645392472a4cadbf1bb35764d74b6a93ec Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sat, 3 Mar 2018 20:15:09 +0100 Subject: [PATCH 03/16] Move node registrations to a separate file --- stairsplus/common.lua | 60 ++++++++++++++++++++++++++++++++++++++ stairsplus/init.lua | 1 + stairsplus/microblocks.lua | 15 +--------- stairsplus/panels.lua | 15 +--------- stairsplus/slabs.lua | 33 +-------------------- stairsplus/slopes.lua | 15 +--------- stairsplus/stairs.lua | 18 +----------- 7 files changed, 66 insertions(+), 91 deletions(-) create mode 100644 stairsplus/common.lua diff --git a/stairsplus/common.lua b/stairsplus/common.lua new file mode 100644 index 0000000..91803c8 --- /dev/null +++ b/stairsplus/common.lua @@ -0,0 +1,60 @@ +--[[ +More Blocks: registrations + +Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local S = moreblocks.intllib + + +stairsplus.register_single = function(category, alternate, info, modname, subname, recipeitem, fields) + local descriptions = { + ["micro"] = "Microblock", + ["slab"] = "Slab", + ["slope"] = "Slope", + ["panel"] = "Panel", + ["stair"] = "Stairs", + } + local def = {} + if category ~= "slab" then + def = table.copy(info) + end + + for k, v in pairs(fields) do + def[k] = v + end + def.drawtype = "nodebox" + if category == "slope" then + def.drawtype = "mesh" + end + def.paramtype = "light" + def.paramtype2 = def.paramtype2 or "facedir" + def.on_place = minetest.rotate_node + if category ~= "slab" then + def.description = S("%s " .. descriptions[category]):format(fields.description) + else + local desc_base = S("%s " .. descriptions[category]):format(fields.description) + if type(info) ~= "table" then + def.node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, (info/16)-0.5, 0.5}, + } + def.description = ("%s (%d/16)"):format(desc_base, info) + else + def.node_box = { + type = "fixed", + fixed = info, + } + def.description = desc_base .. alternate:gsub("_", " "):gsub("(%a)(%S*)", function(a, b) return a:upper() .. b end) + end + end + def.groups = stairsplus:prepare_groups(fields.groups) + if category == "stair" and alternate == "" then + def.groups.stair = 1 + end + if fields.drop and not (type(fields.drop) == "table") then + def.drop = modname.. ":" .. category .. "_" .. fields.drop .. alternate + end + minetest.register_node(":" ..modname.. ":" .. category .. "_" .. subname .. alternate, def) +end \ No newline at end of file diff --git a/stairsplus/init.lua b/stairsplus/init.lua index cfb6fcd..c9ca438 100644 --- a/stairsplus/init.lua +++ b/stairsplus/init.lua @@ -71,6 +71,7 @@ end -- dofile(modpath.. "/aliases.lua") -- Not needed as of Q2 2013, uncomment to fix old maps. -- dofile(modpath.. "/conversion.lua") -- Not needed as of Q2 2013, uncomment to fix old maps. dofile(modpath .. "/defs.lua") +dofile(modpath .. "/common.lua") dofile(modpath .. "/stairs.lua") dofile(modpath .. "/slabs.lua") dofile(modpath .. "/slopes.lua") diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua index 8a3b63d..4e7c51e 100644 --- a/stairsplus/microblocks.lua +++ b/stairsplus/microblocks.lua @@ -36,21 +36,8 @@ end function stairsplus:register_micro(modname, subname, recipeitem, fields) local defs = table.copy(stairsplus.defs["micro"]) - local desc = S("%s Microblock"):format(fields.description) for alternate, def in pairs(defs) do - for k, v in pairs(fields) do - def[k] = v - end - def.drawtype = "nodebox" - def.paramtype = "light" - def.paramtype2 = def.paramtype2 or "facedir" - def.on_place = minetest.rotate_node - def.groups = stairsplus:prepare_groups(fields.groups) - def.description = desc - if fields.drop and not (type(fields.drop) == "table") then - def.drop = modname.. ":micro_" ..fields.drop..alternate - end - minetest.register_node(":" ..modname.. ":micro_" ..subname..alternate, def) + stairsplus.register_single("micro", alternate, def, modname, subname, recipeitem, fields) end minetest.register_alias(modname.. ":micro_" ..subname.. "_bottom", modname.. ":micro_" ..subname) diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua index e065cdd..a33cc5f 100644 --- a/stairsplus/panels.lua +++ b/stairsplus/panels.lua @@ -36,21 +36,8 @@ end function stairsplus:register_panel(modname, subname, recipeitem, fields) local defs = table.copy(stairsplus.defs["panel"]) - local desc = S("%s Panel"):format(fields.description) for alternate, def in pairs(defs) do - for k, v in pairs(fields) do - def[k] = v - end - def.drawtype = "nodebox" - def.paramtype = "light" - def.paramtype2 = def.paramtype2 or "facedir" - def.on_place = minetest.rotate_node - def.description = desc - def.groups = stairsplus:prepare_groups(fields.groups) - if fields.drop and not (type(fields.drop) == "table") then - def.drop = modname.. ":panel_" ..fields.drop..alternate - end - minetest.register_node(":" ..modname.. ":panel_" ..subname..alternate, def) + stairsplus.register_single("panel", alternate, def, modname, subname, recipeitem, fields) end minetest.register_alias(modname.. ":panel_" ..subname.. "_bottom", modname.. ":panel_" ..subname) diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua index 2d60d6d..a8d920b 100644 --- a/stairsplus/slabs.lua +++ b/stairsplus/slabs.lua @@ -38,38 +38,7 @@ 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 - local def = {} - for k, v in pairs(fields) do - def[k] = v - end - if type(shape) ~= "table" then - def.node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, (shape/16)-0.5, 0.5}, - } - def.description = ("%s (%d/16)"):format(desc_base, shape) - else - def.node_box = { - type = "fixed", - fixed = shape, - } - local desc_x = alternate:gsub("_", " ") - desc_x = desc_x:gsub("(%a)(%S*)", function(a, b) return a:upper() .. b end) - def.description = desc_base .. desc_x - end - - def.drawtype = "nodebox" - def.paramtype = "light" - def.paramtype2 = def.paramtype2 or "facedir" - def.on_place = minetest.rotate_node - def.groups = stairsplus:prepare_groups(fields.groups) - if alternate == "" then - def.groups.slab = 1 - end - if fields.drop and not (type(fields.drop) == "table") then - def.drop = modname.. ":slab_" .. fields.drop .. alternate - end - minetest.register_node(":" .. modname .. ":slab_" .. subname .. alternate, def) + stairsplus.register_single("slab", alternate, shape, modname, subname, recipeitem, fields) end circular_saw.known_nodes[recipeitem] = {modname, subname} diff --git a/stairsplus/slopes.lua b/stairsplus/slopes.lua index 892e856..adf755e 100644 --- a/stairsplus/slopes.lua +++ b/stairsplus/slopes.lua @@ -36,21 +36,8 @@ end function stairsplus:register_slope(modname, subname, recipeitem, fields) local defs = table.copy(stairsplus.defs["slope"]) - local desc = S("%s Slope"):format(fields.description) for alternate, def in pairs(defs) do - for k, v in pairs(fields) do - def[k] = v - end - def.drawtype = "mesh" - def.paramtype = "light" - def.paramtype2 = def.paramtype2 or "facedir" - def.on_place = minetest.rotate_node - def.description = desc - def.groups = stairsplus:prepare_groups(fields.groups) - if fields.drop and not (type(fields.drop) == "table") then - def.drop = modname.. ":slope_" ..fields.drop..alternate - end - minetest.register_node(":" ..modname.. ":slope_" ..subname..alternate, def) + stairsplus.register_single("slope", alternate, def, modname, subname, recipeitem, fields) end circular_saw.known_nodes[recipeitem] = {modname, subname} diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua index eb76663..5160f0b 100644 --- a/stairsplus/stairs.lua +++ b/stairsplus/stairs.lua @@ -36,24 +36,8 @@ end function stairsplus:register_stair(modname, subname, recipeitem, fields) local defs = table.copy(stairsplus.defs["stair"]) - local desc = S("%s Stairs"):format(fields.description) for alternate, def in pairs(defs) do - for k, v in pairs(fields) do - def[k] = v - end - def.drawtype = "nodebox" - def.paramtype = "light" - def.paramtype2 = def.paramtype2 or "facedir" - def.on_place = minetest.rotate_node - def.description = desc - def.groups = stairsplus:prepare_groups(fields.groups) - if alternate == "" then - def.groups.stair = 1 - end - if fields.drop and not (type(fields.drop) == "table") then - def.drop = modname .. ":stair_" .. fields.drop .. alternate - end - minetest.register_node(":" .. modname .. ":stair_" .. subname .. alternate, def) + stairsplus.register_single("stair", alternate, def, modname, subname, recipeitem, fields) end circular_saw.known_nodes[recipeitem] = {modname, subname} From d5edcb2a1033e5e03d9a1c7650456445ade8db4c Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sun, 4 Mar 2018 11:16:43 +0100 Subject: [PATCH 04/16] Add a register_custom_subset function --- stairsplus/custom.lua | 98 +++++++++++++++++++++++++++++++++++++++++++ stairsplus/defs.lua | 2 +- stairsplus/init.lua | 1 + 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 stairsplus/custom.lua diff --git a/stairsplus/custom.lua b/stairsplus/custom.lua new file mode 100644 index 0000000..e456f7c --- /dev/null +++ b/stairsplus/custom.lua @@ -0,0 +1,98 @@ +--[[ +More Blocks: microblock definitions + +Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local S = moreblocks.intllib + +--[[ +Subset table should have the following format: (You can remove entries as needed.) + +local subset = { + { "micro", "" }, + { "micro", "_1" }, + { "micro", "_2" }, + { "micro", "_4" }, + { "micro", "_12" }, + { "micro", "_14" }, + { "micro", "_15" }, + { "panel", "" }, + { "panel", "_1" }, + { "panel", "_2" }, + { "panel", "_4" }, + { "panel", "_12" }, + { "panel", "_14" }, + { "panel", "_15" }, + { "slab", "" }, + { "slab", "_quarter" }, + { "slab", "_three_quarter" }, + { "slab", "_1" }, + { "slab", "_2" }, + { "slab", "_14" }, + { "slab", "_15" }, + { "slab", "_two_sides" }, + { "slab", "_three_sides" }, + { "slab", "_three_sides_u" }, + { "slope", "" }, + { "slope", "_half" }, + { "slope", "_half_raised" }, + { "slope", "_inner" }, + { "slope", "_inner_half" }, + { "slope", "_inner_half_raised" }, + { "slope", "_inner_cut" }, + { "slope", "_inner_cut_half" }, + { "slope", "_inner_cut_half_raised" }, + { "slope", "_outer" }, + { "slope", "_outer_half" }, + { "slope", "_outer_half_raised" }, + { "slope", "_outer_cut" }, + { "slope", "_outer_cut_half" }, + { "slope", "_outer_cut_half_raised" }, + { "slope", "_cut" }, + { "stair", "" }, + { "stair", "_half" }, + { "stair", "_right_half" }, + { "stair", "_inner" }, + { "stair", "_outer" }, + { "stair", "_alt" }, + { "stair", "_alt_1" }, + { "stair", "_alt_2" }, + { "stair", "_alt_4" }, +} +--]] + +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, + description = description, + drop = drop, + light_source = light, + sounds = default.node_sound_stone_defaults(), + }) +end + +function stairsplus:register_custom_subset_alias(subset, modname_old, subname_old, modname_new, subname_new) + local subset = table.copy(subset) + for k, v in pairs(subset) do + minetest.register_alias(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2]) + end +end + +function stairsplus:register_custom_subset_alias_force(subset, modname_old, subname_old, modname_new, subname_new) + local subset = table.copy(subset) + for k, v in pairs(subset) do + minetest.register_alias_force(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2]) + end +end + +function stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields) + local subset = table.copy(subset) + for k, v in pairs(subset) do + stairsplus.register_single(v[1], v[2], stairsplus.defs[v[1]][v[2]], modname, subname, recipeitem, fields) + end + + circular_saw.known_nodes[recipeitem] = {modname, subname} +end diff --git a/stairsplus/defs.lua b/stairsplus/defs.lua index a7b7bca..560b1f2 100644 --- a/stairsplus/defs.lua +++ b/stairsplus/defs.lua @@ -335,7 +335,7 @@ stairsplus.defs = { }, }, }, - ["_right_half" ]= { + ["_right_half"] = { node_box = { type = "fixed", fixed = { diff --git a/stairsplus/init.lua b/stairsplus/init.lua index c9ca438..bb1ed2b 100644 --- a/stairsplus/init.lua +++ b/stairsplus/init.lua @@ -77,4 +77,5 @@ dofile(modpath .. "/slabs.lua") dofile(modpath .. "/slopes.lua") dofile(modpath .. "/panels.lua") dofile(modpath .. "/microblocks.lua") +dofile(modpath .. "/custom.lua") dofile(modpath .. "/registrations.lua") From 7d701da5b9ed1a11ef0d66f031458d342de79a1f Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sun, 4 Mar 2018 12:16:45 +0100 Subject: [PATCH 05/16] Move recipe definitions to a separate file and function. --- stairsplus/common.lua | 1 + stairsplus/init.lua | 3 +- stairsplus/microblocks.lua | 51 ----- stairsplus/panels.lua | 31 --- stairsplus/recipes.lua | 443 +++++++++++++++++++++++++++++++++++++ stairsplus/slabs.lua | 150 ------------- stairsplus/slopes.lua | 106 --------- stairsplus/stairs.lua | 96 -------- 8 files changed, 446 insertions(+), 435 deletions(-) create mode 100644 stairsplus/recipes.lua diff --git a/stairsplus/common.lua b/stairsplus/common.lua index 91803c8..a7134b2 100644 --- a/stairsplus/common.lua +++ b/stairsplus/common.lua @@ -57,4 +57,5 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam def.drop = modname.. ":" .. category .. "_" .. fields.drop .. alternate end minetest.register_node(":" ..modname.. ":" .. category .. "_" .. subname .. alternate, def) + stairsplus.register_recipes(category, alternate, modname, subname, recipeitem) end \ No newline at end of file diff --git a/stairsplus/init.lua b/stairsplus/init.lua index bb1ed2b..4f3a17e 100644 --- a/stairsplus/init.lua +++ b/stairsplus/init.lua @@ -5,7 +5,7 @@ Copyright (c) 2011-2017 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] --- Nodes will be called :{stair,slab,panel,micro}_ +-- Nodes will be called :{stair,slab,panel,micro,slope}_ local modpath = minetest.get_modpath("moreblocks").. "/stairsplus" @@ -71,6 +71,7 @@ end -- dofile(modpath.. "/aliases.lua") -- Not needed as of Q2 2013, uncomment to fix old maps. -- dofile(modpath.. "/conversion.lua") -- Not needed as of Q2 2013, uncomment to fix old maps. dofile(modpath .. "/defs.lua") +dofile(modpath .. "/recipes.lua") dofile(modpath .. "/common.lua") dofile(modpath .. "/stairs.lua") dofile(modpath .. "/slabs.lua") diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua index 4e7c51e..22c20a3 100644 --- a/stairsplus/microblocks.lua +++ b/stairsplus/microblocks.lua @@ -39,57 +39,6 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields) for alternate, def in pairs(defs) do stairsplus.register_single("micro", alternate, def, modname, subname, recipeitem, fields) end - minetest.register_alias(modname.. ":micro_" ..subname.. "_bottom", modname.. ":micro_" ..subname) circular_saw.known_nodes[recipeitem] = {modname, subname} - - -- Some saw-less recipes: - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":micro_" .. subname .. " 7", - recipe = {modname .. ":stair_" .. subname .. "_inner"}, - }) - - minetest.register_craft({ - output = modname .. ":micro_" .. subname .. " 6", - type = "shapeless", - recipe = {modname .. ":stair_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":micro_" .. subname .. " 5", - recipe = {modname .. ":stair_" .. subname .. "_outer"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":micro_" .. subname .. " 4", - recipe = {modname .. ":slab_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":micro_" .. subname .. " 4", - recipe = {modname .. ":stair_" .. subname .. "_alt"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":micro_" .. subname .. " 3", - recipe = {modname .. ":stair_" .. subname .. "_right_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":micro_" .. subname .. " 2", - recipe = {modname .. ":panel_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, - }) end diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua index a33cc5f..ac641d8 100644 --- a/stairsplus/panels.lua +++ b/stairsplus/panels.lua @@ -39,37 +39,6 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields) for alternate, def in pairs(defs) do stairsplus.register_single("panel", alternate, def, modname, subname, recipeitem, fields) end - minetest.register_alias(modname.. ":panel_" ..subname.. "_bottom", modname.. ":panel_" ..subname) circular_saw.known_nodes[recipeitem] = {modname, subname} - - -- Some saw-less recipes: - - minetest.register_craft({ - output = modname .. ":panel_" .. subname .. " 12", - recipe = { - {recipeitem, ""}, - {recipeitem, recipeitem}, - }, - }) - - minetest.register_craft({ - output = modname .. ":panel_" .. subname .. " 12", - recipe = { - {"", recipeitem}, - {recipeitem, recipeitem}, - }, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":panel_" .. subname, - recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, - }) end diff --git a/stairsplus/recipes.lua b/stairsplus/recipes.lua new file mode 100644 index 0000000..56fcf68 --- /dev/null +++ b/stairsplus/recipes.lua @@ -0,0 +1,443 @@ +--[[ +More Blocks: Stairs+ + +Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + + +stairsplus.register_recipes = function(category, alternate, modname, subname, recipeitem) + if category == "micro" and alternate == "" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":micro_" .. subname .. " 7", + recipe = {modname .. ":stair_" .. subname .. "_inner"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":micro_" .. subname .. " 6", + recipe = {modname .. ":stair_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":micro_" .. subname .. " 5", + recipe = {modname .. ":stair_" .. subname .. "_outer"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":micro_" .. subname .. " 4", + recipe = {modname .. ":slab_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":micro_" .. subname .. " 4", + recipe = {modname .. ":stair_" .. subname .. "_alt"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":micro_" .. subname .. " 3", + recipe = {modname .. ":stair_" .. subname .. "_right_half"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":micro_" .. subname .. " 2", + recipe = {modname .. ":panel_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, + }) + + minetest.register_alias(modname .. ":micro_" .. subname .. "_bottom", modname .. ":micro_" .. subname) + elseif category == "panel" and alternate == "" then + minetest.register_craft({ + output = modname .. ":panel_" .. subname .. " 12", + recipe = { + {recipeitem, ""}, + {recipeitem, recipeitem}, + }, + }) + + minetest.register_craft({ + output = modname .. ":panel_" .. subname .. " 12", + recipe = { + {"", recipeitem}, + {recipeitem, recipeitem}, + }, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":panel_" .. subname, + recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, + }) + + minetest.register_alias(modname.. ":panel_" ..subname.. "_bottom", modname.. ":panel_" ..subname) + elseif category == "slab" then + if alternate == "" then + minetest.register_craft({ + output = modname .. ":slab_" .. subname .. " 6", + recipe = {{recipeitem, recipeitem, recipeitem}}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname, + recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, + }) + + -- uncomment this rule when conflict is no longer likely to happen + -- https://github.com/minetest/minetest/issues/2881 + -- minetest.register_craft({ + -- type = "shapeless", + -- output = modname .. ":slab_" .. subname, + -- recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, + -- }) + + -- then remove these two + minetest.register_craft({ + output = modname .. ":slab_" .. subname, + recipe = {{modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}}, + }) + + minetest.register_craft({ + output = modname .. ":slab_" .. subname, + recipe = { + {modname .. ":panel_" .. subname}, + {modname .. ":panel_" .. subname}, + }, + }) + ------------------------------ + + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. " 3", + recipe = {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname, + recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname, + recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname, + recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname, + recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname, + recipe = {modname .. ":slope_" .. subname .. "_outer_half", modname .. ":slope_" .. subname .. "_inner_half"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname, + recipe = {modname .. ":slope_" .. subname .. "_outer_cut_half", modname .. ":slope_" .. subname .. "_inner_cut_half"}, + }) + elseif alternate == "_quarter" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slab_" .. subname .. "_three_quarter", modname .. ":slab_" .. subname .. "_quarter"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_quarter", + recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_quarter", + recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"}, + }) + elseif alternate == "_three_quarter" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_three_quarter", + recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname .. "_quarter"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_three_quarter", + recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_three_quarter", + recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, + }) + elseif alternate == "_2" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slab_" .. subname .. "_14", modname .. ":slab_" .. subname .. "_2"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_2", + recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"}, + }) + elseif alternate == "_14" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_14", + recipe = {modname .. ":slab_" .. subname .. "_three_quarter", modname .. ":slab_" .. subname .. "_2"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_14", + recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, + }) + elseif alternate == "_15" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slab_" .. subname .. "_15", modname .. ":slab_" .. subname .. "_1"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slab_" .. subname .. "_15", + recipe = {modname .. ":slab_" .. subname .. "_14", modname .. ":slab_" .. subname .. "_1"}, + }) + end + elseif category == "slope" then + if alternate == "" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname, modname .. ":slope_" .. subname}, + }) + elseif alternate == "_half" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half_raised"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half", + modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"}, + }) + elseif alternate == "_outer" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_outer", modname .. ":slope_" .. subname .. "_inner"}, + }) + elseif alternate == "_outer_half" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_outer_half", modname .. ":slope_" .. subname .. "_inner_half_raised"}, + }) + elseif alternate == "_inner_half" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_outer_half_raised", modname .. ":slope_" .. subname .. "_inner_half"}, + }) + elseif alternate == "_outer_cut" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_outer_cut", modname .. ":slope_" .. subname .. "_inner_cut"}, + }) + elseif alternate == "_outer_cut_half" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_outer_cut_half", modname .. ":slope_" .. subname .. "_inner_cut_half_raised"}, + }) + elseif alternate == "_cut" then + minetest.register_craft({ + type = "shapeless", + output = recipeitem, + recipe = {modname .. ":slope_" .. subname .. "_cut", modname .. ":slope_" .. subname .. "_cut"}, + }) + elseif alternate == "_half_raised" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slope_" .. subname .. "_half_raised", + recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half", + modname .. ":slope_" .. subname .. "_half"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slope_" .. subname .. "_half_raised", + recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_half"}, + }) + elseif alternate == "_inner_half_raised" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slope_" .. subname .. "_inner_half_raised", + recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_half"}, + }) + elseif alternate == "_outer_half_raised" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slope_" .. subname .. "_outer_half_raised", + recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_outer_half"}, + }) + elseif alternate == "_inner_cut_half_raised" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":slope_" .. subname .. "_inner_cut_half_raised", + recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_cut_half"}, + }) + end + elseif category == "stair" then + if alternate == "" then + minetest.register_craft({ + output = modname .. ":stair_" .. subname .. " 8", + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + minetest.register_craft({ + output = modname .. ":stair_" .. subname .. " 8", + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname, + recipe = {modname .. ":panel_" .. subname, modname .. ":slab_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname, + recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname, + recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname, + recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, + }) + elseif alternate == "_inner" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname .. "_inner", + recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, + }) + elseif alternate == "_outer" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname .. "_outer", + recipe = {modname .. ":micro_" .. subname, modname .. ":slab_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname .. "_outer", + recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, + }) + elseif alternate == "_half" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname .. "_half", + recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, + }) + + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname .. "_half", + recipe = {modname .. ":panel_" .. subname, modname .. ":micro_" .. subname}, + }) + elseif alternate == "_right_half" then + minetest.register_craft({ + type = "shapeless", + output = modname .. ":stair_" .. subname .. "_right_half", + recipe = {modname .. ":stair_" .. subname .. "_half"}, + }) + elseif alternate == "_alt" then + minetest.register_craft({ -- See mirrored variation of the recipe below. + output = modname .. ":stair_" .. subname .. "_alt", + recipe = { + {modname .. ":panel_" .. subname, ""}, + {"" , modname .. ":panel_" .. subname}, + }, + }) + + minetest.register_craft({ -- Mirrored variation of the recipe above. + output = modname .. ":stair_" .. subname .. "_alt", + recipe = { + {"" , modname .. ":panel_" .. subname}, + {modname .. ":panel_" .. subname, ""}, + }, + }) + end + end +end \ No newline at end of file diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua index a8d920b..3fa119e 100644 --- a/stairsplus/slabs.lua +++ b/stairsplus/slabs.lua @@ -42,154 +42,4 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields) end circular_saw.known_nodes[recipeitem] = {modname, subname} - - -- Some saw-less recipes: - - minetest.register_craft({ - output = modname .. ":slab_" .. subname .. " 6", - recipe = {{recipeitem, recipeitem, recipeitem}}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname, - recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, - }) - - -- uncomment this rule when conflict is no longer likely to happen - -- https://github.com/minetest/minetest/issues/2881 - -- minetest.register_craft({ - -- type = "shapeless", - -- output = modname .. ":slab_" .. subname, - -- recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, - -- }) - - -- then remove these two - minetest.register_craft({ - output = modname .. ":slab_" .. subname, - recipe = {{modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}}, - }) - - minetest.register_craft({ - output = modname .. ":slab_" .. subname, - recipe = { - {modname .. ":panel_" .. subname}, - {modname .. ":panel_" .. subname}, - }, - }) - ------------------------------ - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slab_" .. subname .. "_three_quarter", modname .. ":slab_" .. subname .. "_quarter"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slab_" .. subname .. "_14", modname .. ":slab_" .. subname .. "_2"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slab_" .. subname .. "_15", modname .. ":slab_" .. subname .. "_1"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname, - recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname, - recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname, - recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_quarter", - recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_quarter", - recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_2", - recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_three_quarter", - recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname .. "_quarter"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_three_quarter", - recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_three_quarter", - recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_14", - recipe = {modname .. ":slab_" .. subname .. "_three_quarter", modname .. ":slab_" .. subname .. "_2"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_14", - recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. "_15", - recipe = {modname .. ":slab_" .. subname .. "_14", modname .. ":slab_" .. subname .. "_1"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname .. " 3", - recipe = {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname}, - }) end diff --git a/stairsplus/slopes.lua b/stairsplus/slopes.lua index adf755e..7b82733 100644 --- a/stairsplus/slopes.lua +++ b/stairsplus/slopes.lua @@ -41,110 +41,4 @@ function stairsplus:register_slope(modname, subname, recipeitem, fields) end circular_saw.known_nodes[recipeitem] = {modname, subname} - - -- Some saw-less recipes: - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname, modname .. ":slope_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half_raised"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half", - modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_outer", modname .. ":slope_" .. subname .. "_inner"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_outer_half", modname .. ":slope_" .. subname .. "_inner_half_raised"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_outer_half_raised", modname .. ":slope_" .. subname .. "_inner_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_outer_cut", modname .. ":slope_" .. subname .. "_inner_cut"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_outer_cut_half", modname .. ":slope_" .. subname .. "_inner_cut_half_raised"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = recipeitem, - recipe = {modname .. ":slope_" .. subname .. "_cut", modname .. ":slope_" .. subname .. "_cut"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname, - recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname, - recipe = {modname .. ":slope_" .. subname .. "_outer_half", modname .. ":slope_" .. subname .. "_inner_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slab_" .. subname, - recipe = {modname .. ":slope_" .. subname .. "_outer_cut_half", modname .. ":slope_" .. subname .. "_inner_cut_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slope_" .. subname .. "_half_raised", - recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half", - modname .. ":slope_" .. subname .. "_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slope_" .. subname .. "_half_raised", - recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slope_" .. subname .. "_inner_half_raised", - recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slope_" .. subname .. "_outer_half_raised", - recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_outer_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":slope_" .. subname .. "_inner_cut_half_raised", - recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_cut_half"}, - }) end diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua index 5160f0b..5c38864 100644 --- a/stairsplus/stairs.lua +++ b/stairsplus/stairs.lua @@ -41,100 +41,4 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields) end circular_saw.known_nodes[recipeitem] = {modname, subname} - - -- Some saw-less recipes: - - minetest.register_craft({ - output = modname .. ":stair_" .. subname .. " 8", - recipe = { - {recipeitem, "", ""}, - {recipeitem, recipeitem, ""}, - {recipeitem, recipeitem, recipeitem}, - }, - }) - - minetest.register_craft({ - output = modname .. ":stair_" .. subname .. " 8", - recipe = { - {"", "", recipeitem}, - {"", recipeitem, recipeitem}, - {recipeitem, recipeitem, recipeitem}, - }, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname, - recipe = {modname .. ":panel_" .. subname, modname .. ":slab_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname, - recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname .. "_outer", - recipe = {modname .. ":micro_" .. subname, modname .. ":slab_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname .. "_half", - recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname .. "_half", - recipe = {modname .. ":panel_" .. subname, modname .. ":micro_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname .. "_right_half", - recipe = {modname .. ":stair_" .. subname .. "_half"}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname, - recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname .. "_inner", - recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname .. "_outer", - recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname}, - }) - - minetest.register_craft({ - type = "shapeless", - output = modname .. ":stair_" .. subname, - recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}, - }) - - minetest.register_craft({ -- See mirrored variation of the recipe below. - output = modname .. ":stair_" .. subname .. "_alt", - recipe = { - {modname .. ":panel_" .. subname, ""}, - {"" , modname .. ":panel_" .. subname}, - }, - }) - - minetest.register_craft({ -- Mirrored variation of the recipe above. - output = modname .. ":stair_" .. subname .. "_alt", - recipe = { - {"" , modname .. ":panel_" .. subname}, - {modname .. ":panel_" .. subname, ""}, - }, - }) end From 8ff1cb598f79d5b34957b40b4c9ad6afcf7376a7 Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sun, 4 Mar 2018 12:41:55 +0100 Subject: [PATCH 06/16] Update documentation --- CHANGELOG.md | 5 ++++ stairsplus/API.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f720912..5ad0dca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Listring add for circular saw. +- Stairs+: New API function: + `stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)` ### Fixed @@ -22,6 +24,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - New craft 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 ## [1.1.0] - 2017-10-04 diff --git a/stairsplus/API.md b/stairsplus/API.md index 1011487..cd8d1a7 100644 --- a/stairsplus/API.md +++ b/stairsplus/API.md @@ -20,4 +20,63 @@ You will probably never want to use them directly: * `stairsplus:register_slab(modname, subname, recipeitem, fields)` * `stairsplus:register_panel(modname, subname, recipeitem, fields)` * `stairsplus:register_micro(modname, subname, recipeitem, fields)` +* `stairsplus:register_slope(modname, subname, recipeitem, fields)` +If you only want to register a subset of stairsplus nodes, +you can use the `stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)` function. +The subset table should have the following format: + +```lua + local subset = { + { "micro", "" }, + { "micro", "_1" }, + { "micro", "_2" }, + { "micro", "_4" }, + { "micro", "_12" }, + { "micro", "_14" }, + { "micro", "_15" }, + { "panel", "" }, + { "panel", "_1" }, + { "panel", "_2" }, + { "panel", "_4" }, + { "panel", "_12" }, + { "panel", "_14" }, + { "panel", "_15" }, + { "slab", "" }, + { "slab", "_quarter" }, + { "slab", "_three_quarter" }, + { "slab", "_1" }, + { "slab", "_2" }, + { "slab", "_14" }, + { "slab", "_15" }, + { "slab", "_two_sides" }, + { "slab", "_three_sides" }, + { "slab", "_three_sides_u" }, + { "slope", "" }, + { "slope", "_half" }, + { "slope", "_half_raised" }, + { "slope", "_inner" }, + { "slope", "_inner_half" }, + { "slope", "_inner_half_raised" }, + { "slope", "_inner_cut" }, + { "slope", "_inner_cut_half" }, + { "slope", "_inner_cut_half_raised" }, + { "slope", "_outer" }, + { "slope", "_outer_half" }, + { "slope", "_outer_half_raised" }, + { "slope", "_outer_cut" }, + { "slope", "_outer_cut_half" }, + { "slope", "_outer_cut_half_raised" }, + { "slope", "_cut" }, + { "stair", "" }, + { "stair", "_half" }, + { "stair", "_right_half" }, + { "stair", "_inner" }, + { "stair", "_outer" }, + { "stair", "_alt" }, + { "stair", "_alt_1" }, + { "stair", "_alt_2" }, + { "stair", "_alt_4" }, + } +``` +You can remove entries as needed. \ No newline at end of file From 10dd84a7f190204f713dd551ec3b3d17cef7d959 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 22 Apr 2018 00:14:17 +0200 Subject: [PATCH 07/16] Remove brackets around the initial version number in the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad0dca..2b9c5f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Wool (all colors) - Other mods can now get a list of all the defined Stairs+ shapes -## [1.0.0] - 2017-02-19 +## 1.0.0 - 2017-02-19 - Initial versioned release. From 846214993ff6502632808806d68263c16f98105c Mon Sep 17 00:00:00 2001 From: fozolo Date: Thu, 19 Jul 2018 13:24:30 -0400 Subject: [PATCH 08/16] Add aliases for MTG corner stairs (#117) --- stairsplus/registrations.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stairsplus/registrations.lua b/stairsplus/registrations.lua index 1e86954..dc89234 100644 --- a/stairsplus/registrations.lua +++ b/stairsplus/registrations.lua @@ -71,6 +71,8 @@ for _, name in pairs(default_nodes) do mod = "moreblocks" stairsplus:register_all(mod, name, nodename, ndef) minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name) + minetest.register_alias_force("stairs:stair_outer_" .. name, mod .. ":stair_" .. name .. "_outer") + minetest.register_alias_force("stairs:stair_inner_" .. name, mod .. ":stair_" .. name .. "_inner") minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name) end @@ -86,6 +88,8 @@ if minetest.get_modpath("farming") then mod = "moreblocks" stairsplus:register_all(mod, name, nodename, ndef) minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name) + minetest.register_alias_force("stairs:stair_outer_" .. name, mod .. ":stair_" .. name .. "_outer") + minetest.register_alias_force("stairs:stair_inner_" .. name, mod .. ":stair_" .. name .. "_inner") minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name) end end From 5fc5fce74e18856ce898c46b75ecb07fca914784 Mon Sep 17 00:00:00 2001 From: WoosterUK Date: Fri, 27 Jul 2018 11:11:05 +0100 Subject: [PATCH 09/16] Fix double definition of paper from papyrus (#124) --- redefinitions.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/redefinitions.lua b/redefinitions.lua index 13b8f0b..437c2d3 100644 --- a/redefinitions.lua +++ b/redefinitions.lua @@ -25,6 +25,11 @@ minetest.register_craft({ } }) +minetest.clear_craft({ + recipe = { + {"default:papyrus", "default:papyrus", "default:papyrus"} + } +}) minetest.register_craft({ output = "default:paper 4", recipe = { From 723db44933721cc14e85ec40ada5ae5e936cb7d7 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 5 Oct 2018 18:46:55 +0100 Subject: [PATCH 10/16] Make wood_tile_center craftable (#129) place wood_tile_center craft recipe before wood_tile so that it's craftable, otherwise crafting a wood_tile_center gives a normal wood_tile since they all belong to group:wood. --- crafting.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crafting.lua b/crafting.lua index 3fb9830..5b14602 100644 --- a/crafting.lua +++ b/crafting.lua @@ -35,6 +35,15 @@ minetest.register_craft({ recipe = {"default:junglegrass", "default:cobble"}, }) +minetest.register_craft({ + output = "moreblocks:wood_tile_center 9", + recipe = { + {"group:wood", "group:wood", "group:wood"}, + {"group:wood", "moreblocks:wood_tile", "group:wood"}, + {"group:wood", "group:wood", "group:wood"}, + } +}) + minetest.register_craft({ output = "moreblocks:wood_tile 9", recipe = { @@ -50,15 +59,6 @@ minetest.register_craft({ recipe = {"moreblocks:wood_tile_flipped"} }) -minetest.register_craft({ - output = "moreblocks:wood_tile_center 9", - recipe = { - {"group:wood", "group:wood", "group:wood"}, - {"group:wood", "moreblocks:wood_tile", "group:wood"}, - {"group:wood", "group:wood", "group:wood"}, - } -}) - minetest.register_craft({ output = "moreblocks:wood_tile_full 4", recipe = { From 01ec8290f6e7ded9da087340be63644b35b9cfef Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Fri, 23 Nov 2018 11:25:04 -0500 Subject: [PATCH 11/16] basic_materials stairs/slopes/et. al (keeping original technic item names) --- depends.txt | 1 + stairsplus/registrations.lua | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/depends.txt b/depends.txt index e8ecf06..d27d8a5 100644 --- a/depends.txt +++ b/depends.txt @@ -3,3 +3,4 @@ intllib? stairs? farming? wool? +basic_materials? diff --git a/stairsplus/registrations.lua b/stairsplus/registrations.lua index dc89234..5d681e8 100644 --- a/stairsplus/registrations.lua +++ b/stairsplus/registrations.lua @@ -112,6 +112,21 @@ if minetest.get_modpath("wool") then end end +-- basic_materials, keeping the original technic-oriented names +-- for backwards compatibility + +if minetest.get_modpath("basic_materials") then + stairsplus:register_all("technic","concrete","basic_materials:concrete_block",{ + description = "Concrete", + tiles = {"basic_materials_concrete_block.png",}, + groups = {cracky=1, level=2, concrete=1}, + sounds = default.node_sound_stone_defaults(), + }) + + minetest.register_alias("prefab:concrete_stair","technic:stair_concrete") + minetest.register_alias("prefab:concrete_slab","technic:slab_concrete") +end + -- Alias cuts of split_stone_tile_alt which was renamed checker_stone_tile. stairsplus:register_alias_all("moreblocks", "split_stone_tile_alt", "moreblocks", "checker_stone_tile") From 1482a7810fdb40bb5cf30d6e8377a3eadfa67e42 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sat, 24 Nov 2018 10:44:35 -0500 Subject: [PATCH 12/16] make stairs from cement too. --- stairsplus/registrations.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stairsplus/registrations.lua b/stairsplus/registrations.lua index 5d681e8..d4f3430 100644 --- a/stairsplus/registrations.lua +++ b/stairsplus/registrations.lua @@ -125,6 +125,15 @@ if minetest.get_modpath("basic_materials") then minetest.register_alias("prefab:concrete_stair","technic:stair_concrete") minetest.register_alias("prefab:concrete_slab","technic:slab_concrete") + + stairsplus:register_all("gloopblocks", "cement", "basic_materials:cement_block", { + description = "Cement", + tiles = {"basic_materials_cement_block.png"}, + groups = {cracky=2, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + end -- Alias cuts of split_stone_tile_alt which was renamed checker_stone_tile. From ca45478761403bdd220c88f182a9a96b5a6b7ddc Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sat, 24 Nov 2018 11:27:16 -0500 Subject: [PATCH 13/16] brass block stairs/slabs/etc (#135) --- stairsplus/registrations.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stairsplus/registrations.lua b/stairsplus/registrations.lua index d4f3430..254450f 100644 --- a/stairsplus/registrations.lua +++ b/stairsplus/registrations.lua @@ -112,7 +112,7 @@ if minetest.get_modpath("wool") then end end --- basic_materials, keeping the original technic-oriented names +-- basic_materials, keeping the original other-mod-oriented names -- for backwards compatibility if minetest.get_modpath("basic_materials") then @@ -134,6 +134,12 @@ if minetest.get_modpath("basic_materials") then sunlight_propagates = true, }) + stairsplus:register_all("technic", "brass_block", "basic_materials:brass_block", { + description="Brass Block", + groups={cracky=1, not_in_creative_inventory=1}, + tiles={"basic_materials_brass_block.png"}, + }) + end -- Alias cuts of split_stone_tile_alt which was renamed checker_stone_tile. From 0ace9fe493257597e8f0de656563f6abb92f7767 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 24 Nov 2018 17:34:55 +0100 Subject: [PATCH 14/16] Update the changelog to reflect recent commits --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9c5f2..91c5af7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added +- Stairs+ nodes for `basic_materials`'s concrete, cement and brass blocks. - Listring add for circular saw. -- Stairs+: New API function: - `stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)` +- **Stairs+:** New API function + `stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)`. ### Fixed +- The papyrus crafting recipe override is now properly applied over the + `default` mod's recipe. +- Centered wooden tiles are now craftable. - Wool Stairs+ nodes can no longer be used in crafting. - The circular saw can no longer replace items from the player's inventory when it is full. From 26f59baba0658dc677a4279a6d81c5a963e06b84 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 24 Nov 2018 17:36:04 +0100 Subject: [PATCH 15/16] Update copyright year range for 2018 --- LICENSE.md | 2 +- README.md | 2 +- aliases.lua | 2 +- circular_saw.lua | 2 +- config.lua | 2 +- crafting.lua | 2 +- init.lua | 2 +- nodes.lua | 2 +- ownership.lua | 2 +- redefinitions.lua | 2 +- stairsplus/aliases.lua | 2 +- stairsplus/conversion.lua | 2 +- stairsplus/init.lua | 2 +- stairsplus/microblocks.lua | 2 +- stairsplus/panels.lua | 2 +- stairsplus/recipes.lua | 4 ++-- stairsplus/registrations.lua | 2 +- stairsplus/slabs.lua | 2 +- stairsplus/slopes.lua | 2 +- stairsplus/stairs.lua | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index a3511ad..f68debf 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # zlib license -Copyright (c) 2011-2017 Hugo Locurcio and contributors +Copyright (c) 2011-2018 Hugo Locurcio and contributors **This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.** diff --git a/README.md b/README.md index 6c37b74..33b9d6b 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ versions than 0.4.16 will generally not be fixed. ## License -Copyright © 2011-2017 Hugo Locurcio and contributors +Copyright © 2011-2018 Hugo Locurcio and contributors - More Blocks code is licensed under the zlib license, see [`LICENSE.md`](LICENSE.md) for details. diff --git a/aliases.lua b/aliases.lua index f1dbe84..59f5d5c 100644 --- a/aliases.lua +++ b/aliases.lua @@ -1,7 +1,7 @@ --[[ More Blocks: alias definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/circular_saw.lua b/circular_saw.lua index fe241e5..94e680e 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -1,7 +1,7 @@ --[[ More Blocks: circular saw -Copyright (c) 2011-2017 Hugo Locurcio, Sokomine and contributors. +Copyright (c) 2011-2018 Hugo Locurcio, Sokomine and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/config.lua b/config.lua index 8d49c3b..84dcaf2 100644 --- a/config.lua +++ b/config.lua @@ -1,7 +1,7 @@ --[[ More Blocks: configuration handling -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/crafting.lua b/crafting.lua index 5b14602..5fdd82f 100644 --- a/crafting.lua +++ b/crafting.lua @@ -1,7 +1,7 @@ --[[ More Blocks: crafting recipes -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/init.lua b/init.lua index c12f5e0..168768a 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ ** More Blocks ** By Calinou, with the help of ShadowNinja and VanessaE. -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. ===================================================================== --]] diff --git a/nodes.lua b/nodes.lua index efa1f94..f898068 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: node definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/ownership.lua b/ownership.lua index c569ae7..eb1ae0e 100644 --- a/ownership.lua +++ b/ownership.lua @@ -1,7 +1,7 @@ --[[ More Blocks: ownership handling -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/redefinitions.lua b/redefinitions.lua index 437c2d3..fd24c80 100644 --- a/redefinitions.lua +++ b/redefinitions.lua @@ -1,7 +1,7 @@ --[[ More Blocks: redefinitions of default stuff -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/aliases.lua b/stairsplus/aliases.lua index a4d95f0..224dce7 100644 --- a/stairsplus/aliases.lua +++ b/stairsplus/aliases.lua @@ -1,7 +1,7 @@ --[[ More Blocks: alias definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/conversion.lua b/stairsplus/conversion.lua index 887f3e3..bc8e77e 100644 --- a/stairsplus/conversion.lua +++ b/stairsplus/conversion.lua @@ -1,7 +1,7 @@ --[[ More Blocks: conversion -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/init.lua b/stairsplus/init.lua index 4f3a17e..624b7c8 100644 --- a/stairsplus/init.lua +++ b/stairsplus/init.lua @@ -1,7 +1,7 @@ --[[ More Blocks: Stairs+ -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua index 22c20a3..dc8ddfd 100644 --- a/stairsplus/microblocks.lua +++ b/stairsplus/microblocks.lua @@ -1,7 +1,7 @@ --[[ More Blocks: microblock definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua index ac641d8..5e2bf7b 100644 --- a/stairsplus/panels.lua +++ b/stairsplus/panels.lua @@ -1,7 +1,7 @@ --[[ More Blocks: panel definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/recipes.lua b/stairsplus/recipes.lua index 56fcf68..ec908bd 100644 --- a/stairsplus/recipes.lua +++ b/stairsplus/recipes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: Stairs+ -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -440,4 +440,4 @@ stairsplus.register_recipes = function(category, alternate, modname, subname, re }) end end -end \ No newline at end of file +end diff --git a/stairsplus/registrations.lua b/stairsplus/registrations.lua index 254450f..6262a6d 100644 --- a/stairsplus/registrations.lua +++ b/stairsplus/registrations.lua @@ -1,7 +1,7 @@ --[[ More Blocks: registrations -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua index 3fa119e..11618a2 100644 --- a/stairsplus/slabs.lua +++ b/stairsplus/slabs.lua @@ -1,7 +1,7 @@ --[[ More Blocks: slab definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/slopes.lua b/stairsplus/slopes.lua index 7b82733..63635eb 100644 --- a/stairsplus/slopes.lua +++ b/stairsplus/slopes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: slope definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua index 5c38864..0ccf081 100644 --- a/stairsplus/stairs.lua +++ b/stairsplus/stairs.lua @@ -1,7 +1,7 @@ --[[ More Blocks: stair definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] From 9d953ccebfeabb366ad3dcf89142167d183ff8fe Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 24 Nov 2018 17:39:42 +0100 Subject: [PATCH 16/16] Bump to version v1.2.0 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91c5af7..53c4458 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.2.0] - 2018-11-24 + ### Added - Stairs+ nodes for `basic_materials`'s concrete, cement and brass blocks. @@ -56,5 +58,6 @@ 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/v1.1.0...HEAD +[Unreleased]: https://github.com/minetest-mods/moreblocks/compare/v1.2.0...HEAD +[1.2.0]: https://github.com/minetest-mods/moreblocks/compare/v1.1.0...v1.2.0 [1.1.0]: https://github.com/minetest-mods/moreblocks/compare/v1.0.0...v1.1.0