summaryrefslogtreecommitdiff
path: root/moreblocks/stairsplus
diff options
context:
space:
mode:
Diffstat (limited to 'moreblocks/stairsplus')
-rw-r--r--moreblocks/stairsplus/API.md59
-rw-r--r--moreblocks/stairsplus/common.lua61
-rw-r--r--moreblocks/stairsplus/custom.lua98
-rw-r--r--moreblocks/stairsplus/defs.lua409
-rw-r--r--moreblocks/stairsplus/init.lua21
-rw-r--r--moreblocks/stairsplus/microblocks.lua121
-rw-r--r--moreblocks/stairsplus/panels.lua101
-rw-r--r--moreblocks/stairsplus/recipes.lua443
-rw-r--r--moreblocks/stairsplus/slabs.lua217
-rw-r--r--moreblocks/stairsplus/slopes.lua330
-rw-r--r--moreblocks/stairsplus/stairs.lua209
11 files changed, 1095 insertions, 974 deletions
diff --git a/moreblocks/stairsplus/API.md b/moreblocks/stairsplus/API.md
index 1011487..cd8d1a7 100644
--- a/moreblocks/stairsplus/API.md
+++ b/moreblocks/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
diff --git a/moreblocks/stairsplus/common.lua b/moreblocks/stairsplus/common.lua
new file mode 100644
index 0000000..a7134b2
--- /dev/null
+++ b/moreblocks/stairsplus/common.lua
@@ -0,0 +1,61 @@
+--[[
+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)
+ stairsplus.register_recipes(category, alternate, modname, subname, recipeitem)
+end \ No newline at end of file
diff --git a/moreblocks/stairsplus/custom.lua b/moreblocks/stairsplus/custom.lua
new file mode 100644
index 0000000..e456f7c
--- /dev/null
+++ b/moreblocks/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/moreblocks/stairsplus/defs.lua b/moreblocks/stairsplus/defs.lua
new file mode 100644
index 0000000..560b1f2
--- /dev/null
+++ b/moreblocks/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/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua
index 5cd415c..4f3a17e 100644
--- a/moreblocks/stairsplus/init.lua
+++ b/moreblocks/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 <modname>:{stair,slab,panel,micro}_<subname>
+-- Nodes will be called <modname>:{stair,slab,panel,micro,slope}_<subname>
local modpath = minetest.get_modpath("moreblocks").. "/stairsplus"
@@ -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,9 +70,13 @@ 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")
dofile(modpath .. "/slopes.lua")
dofile(modpath .. "/panels.lua")
dofile(modpath .. "/microblocks.lua")
+dofile(modpath .. "/custom.lua")
dofile(modpath .. "/registrations.lua")
diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua
index 50d8487..22c20a3 100644
--- a/moreblocks/stairsplus/microblocks.lua
+++ b/moreblocks/stairsplus/microblocks.lua
@@ -20,138 +20,25 @@ 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 desc = S("%s Microblock"):format(fields.description)
+ local defs = table.copy(stairsplus.defs["micro"])
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)
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/moreblocks/stairsplus/panels.lua b/moreblocks/stairsplus/panels.lua
index 98e77fd..ac641d8 100644
--- a/moreblocks/stairsplus/panels.lua
+++ b/moreblocks/stairsplus/panels.lua
@@ -20,118 +20,25 @@ 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 desc = S("%s Panel"):format(fields.description)
+ local defs = table.copy(stairsplus.defs["panel"])
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)
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/moreblocks/stairsplus/recipes.lua b/moreblocks/stairsplus/recipes.lua
new file mode 100644
index 0000000..56fcf68
--- /dev/null
+++ b/moreblocks/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/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua
index de7f031..3fa119e 100644
--- a/moreblocks/stairsplus/slabs.lua
+++ b/moreblocks/stairsplus/slabs.lua
@@ -20,235 +20,26 @@ 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 = {}
- 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}
-
- -- 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/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua
index 7d18b3d..7b82733 100644
--- a/moreblocks/stairsplus/slopes.lua
+++ b/moreblocks/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 <modname>:slope_<subname>
function register_slope(modname, subname, recipeitem, groups, images, description, drop, light)
@@ -123,244 +20,25 @@ 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 desc = S("%s Slope"):format(fields.description)
+ local defs = table.copy(stairsplus.defs["slope"])
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}
-
- -- 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/moreblocks/stairsplus/stairs.lua b/moreblocks/stairsplus/stairs.lua
index 815f7ac..5c38864 100644
--- a/moreblocks/stairsplus/stairs.lua
+++ b/moreblocks/stairsplus/stairs.lua
@@ -20,226 +20,25 @@ 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 desc = S("%s Stairs"):format(fields.description)
+ local defs = table.copy(stairsplus.defs["stair"])
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}
-
- -- 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