diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 20:02:19 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 21:09:33 -0400 |
commit | da66780a569712c23ae4f2996cfb4608a9f9d69d (patch) | |
tree | 217556029a78bc23ad4564720afc86de97228a04 /moreblocks/stairsplus | |
parent | 615b22df4d423aded3613db7716943a2f389b047 (diff) | |
download | dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.gz dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.bz2 dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.xz dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.zip |
copy all standard Dreambuilder mods in from the old subgame
(exactly as last supplied there, updates to these mods will follow later)
Diffstat (limited to 'moreblocks/stairsplus')
-rw-r--r-- | moreblocks/stairsplus/API.md | 24 | ||||
-rw-r--r-- | moreblocks/stairsplus/aliases.lua | 70 | ||||
-rw-r--r-- | moreblocks/stairsplus/conversion.lua | 139 | ||||
-rw-r--r-- | moreblocks/stairsplus/init.lua | 61 | ||||
-rw-r--r-- | moreblocks/stairsplus/microblocks.lua | 138 | ||||
-rw-r--r-- | moreblocks/stairsplus/panels.lua | 118 | ||||
-rw-r--r-- | moreblocks/stairsplus/registrations.lua | 57 | ||||
-rw-r--r-- | moreblocks/stairsplus/slabs.lua | 209 | ||||
-rw-r--r-- | moreblocks/stairsplus/slopes.lua | 347 | ||||
-rw-r--r-- | moreblocks/stairsplus/stairs.lua | 224 |
10 files changed, 1387 insertions, 0 deletions
diff --git a/moreblocks/stairsplus/API.md b/moreblocks/stairsplus/API.md new file mode 100644 index 0000000..2db0f2b --- /dev/null +++ b/moreblocks/stairsplus/API.md @@ -0,0 +1,24 @@ +API documentation for Stairs+ +============================= + +* `stairsplus:register_all(modname, subname, recipeitem, fields)` + Registers a stair, slab, panel, microblock, and any other types of + nodes to be added in the future. + This also registers the node with the circular saw. + Example: + ```lua + stairsplus:register_all("moreblocks", "wood", "defaut:wood", { + description = "Wooden", + tiles = {"default_wood.png"}, + groups = {oddly_breakabe_by_hand=1}, + sounds = default.node_sound_wood_defaults(), + }) + ``` +The following register only a particular type of microblock. +You will probably never want to use them directly: + +* `stairsplus:register_stair(modname, subname, recipeitem, fields)` +* `stairsplus:register_slab(modname, subname, recipeitem, fields)` +* `stairsplus:register_panel(modname, subname, recipeitem, fields)` +* `stairsplus:register_micro(modname, subname, recipeitem, fields)` + diff --git a/moreblocks/stairsplus/aliases.lua b/moreblocks/stairsplus/aliases.lua new file mode 100644 index 0000000..c235d34 --- /dev/null +++ b/moreblocks/stairsplus/aliases.lua @@ -0,0 +1,70 @@ +--[[ +More Blocks: alias definitions + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local function register_stairsplus_alias(modname, origname, newname) + minetest.register_alias(modname.. ":slab_" ..origname, "moreblocks:slab_" ..newname) + minetest.register_alias(modname.. ":slab_" ..origname.. "_inverted", "moreblocks:slab_" ..newname.. "_inverted") + minetest.register_alias(modname.. ":slab_" ..origname.. "_wall", "moreblocks:slab_" ..newname.. "_wall") + minetest.register_alias(modname.. ":slab_" ..origname.. "_quarter", "moreblocks:slab_" ..newname.. "_quarter") + minetest.register_alias(modname.. ":slab_" ..origname.. "_quarter_inverted", "moreblocks:slab_" ..newname.. "_quarter_inverted") + minetest.register_alias(modname.. ":slab_" ..origname.. "_quarter_wall", "moreblocks:slab_" ..newname.. "_quarter_wall") + minetest.register_alias(modname.. ":slab_" ..origname.. "_three_quarter", "moreblocks:slab_" ..newname.. "_three_quarter") + minetest.register_alias(modname.. ":slab_" ..origname.. "_three_quarter_inverted", "moreblocks:slab_" ..newname.. "_three_quarter_inverted") + minetest.register_alias(modname.. ":slab_" ..origname.. "_three_quarter_wall", "moreblocks:slab_" ..newname.. "_three_quarter_wall") + minetest.register_alias(modname.. ":stair_" ..origname, "moreblocks:stair_" ..newname) + minetest.register_alias(modname.. ":stair_" ..origname.. "_inverted", "moreblocks:stair_" ..newname.. "_inverted") + minetest.register_alias(modname.. ":stair_" ..origname.. "_wall", "moreblocks:stair_" ..newname.. "_wall") + minetest.register_alias(modname.. ":stair_" ..origname.. "_wall_half", "moreblocks:stair_" ..newname.. "_wall_half") + minetest.register_alias(modname.. ":stair_" ..origname.. "_wall_half_inverted", "moreblocks:stair_" ..newname.. "_wall_half_inverted") + minetest.register_alias(modname.. ":stair_" ..origname.. "_half", "moreblocks:stair_" ..newname.. "_half") + minetest.register_alias(modname.. ":stair_" ..origname.. "_half_inverted", "moreblocks:stair_" ..newname.. "_half_inverted") + minetest.register_alias(modname.. ":stair_" ..origname.. "_right_half", "moreblocks:stair_" ..newname.. "_right_half") + minetest.register_alias(modname.. ":stair_" ..origname.. "_right_half_inverted", "moreblocks:stair_" ..newname.. "_right_half_inverted") + minetest.register_alias(modname.. ":stair_" ..origname.. "_wall_half", "moreblocks:stair_" ..newname.. "_wall_half") + minetest.register_alias(modname.. ":stair_" ..origname.. "_wall_half_inverted", "moreblocks:stair_" ..newname.. "_wall_half_inverted") + minetest.register_alias(modname.. ":stair_" ..origname.. "_inner", "moreblocks:stair_" ..newname.. "_inner") + minetest.register_alias(modname.. ":stair_" ..origname.. "_inner_inverted", "moreblocks:stair_" ..newname.. "_inner_inverted") + minetest.register_alias(modname.. ":stair_" ..origname.. "_outer", "moreblocks:stair_" ..newname.. "_outer") + minetest.register_alias(modname.. ":stair_" ..origname.. "_outer_inverted", "moreblocks:stair_" ..newname.. "_outer_inverted") + minetest.register_alias(modname.. ":panel_" ..origname.. "_bottom", "moreblocks:panel_" ..newname.. "_bottom") + minetest.register_alias(modname.. ":panel_" ..origname.. "_top", "moreblocks:panel_" ..newname.. "_top") + minetest.register_alias(modname.. ":panel_" ..origname.. "_vertical", "moreblocks:panel_" ..newname.. "_vertical") + minetest.register_alias(modname.. ":micro_" ..origname.. "_bottom", "moreblocks:micro_" ..newname.. "_bottom") + minetest.register_alias(modname.. ":micro_" ..origname.. "_top", "moreblocks:micro_" ..newname.. "_top") +end + +register_stairsplus_alias("stairsplus", "stone", "stone") +register_stairsplus_alias("stairsplus", "wood", "wood") +register_stairsplus_alias("stairsplus", "pinewood", "pinewood") +register_stairsplus_alias("stairsplus", "cobble", "cobble") +register_stairsplus_alias("stairsplus", "brick", "brick") +register_stairsplus_alias("stairsplus", "sandstone", "sandstone") +register_stairsplus_alias("stairsplus", "glass", "glass") +register_stairsplus_alias("stairsplus", "tree", "tree") +register_stairsplus_alias("stairsplus", "jungletree", "jungletree") +register_stairsplus_alias("stairsplus", "pinetree", "pinetree") +register_stairsplus_alias("stairsplus", "desert_stone", "desert_stone") +register_stairsplus_alias("stairsplus", "steelblock", "steelblock") +register_stairsplus_alias("stairsplus", "mossycobble", "mossycobble") + +register_stairsplus_alias("moreblocks", "coalstone", "coal_stone") +register_stairsplus_alias("moreblocks", "junglewood", "jungle_wood") +register_stairsplus_alias("moreblocks", "circlestonebrick", "circle_stone_bricks") +register_stairsplus_alias("moreblocks", "ironstone", "iron_stone") +register_stairsplus_alias("moreblocks", "coalglass", "coal_glass") +register_stairsplus_alias("moreblocks", "ironglass", "iron_glass") +register_stairsplus_alias("moreblocks", "glowglass", "glow_glass") +register_stairsplus_alias("moreblocks", "superglowglass", "super_glow_glass") +register_stairsplus_alias("moreblocks", "coalchecker", "coal_checker") +register_stairsplus_alias("moreblocks", "ironchecker", "iron_checker") +register_stairsplus_alias("moreblocks", "cactuschecker", "cactus_checker") +register_stairsplus_alias("moreblocks", "ironstonebrick", "iron_stone_bricks") +register_stairsplus_alias("moreblocks", "stonesquare", "stone_tile") +register_stairsplus_alias("moreblocks", "splitstonesquare", "split_stone_tile") +register_stairsplus_alias("moreblocks", "woodtile", "wood_tile") +register_stairsplus_alias("moreblocks", "woodtile_centered", "wood_tile_centered") +register_stairsplus_alias("moreblocks", "woodtile_full", "wood_tile_full") diff --git a/moreblocks/stairsplus/conversion.lua b/moreblocks/stairsplus/conversion.lua new file mode 100644 index 0000000..13966b6 --- /dev/null +++ b/moreblocks/stairsplus/conversion.lua @@ -0,0 +1,139 @@ +--[[ +More Blocks: conversion + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +-- Function to convert all stairs/slabs/etc nodes from +-- inverted, wall, etc to regular + 6d facedir + +local dirs1 = {21, 20, 23, 22, 21} +local dirs2 = {15, 8, 17, 6, 15} +local dirs3 = {14, 11, 16, 5, 14} + +function stairsplus:register_6dfacedir_conversion(modname, material) + --print("Register stairsplus 6d facedir conversion") + --print('ABM for '..modname..' "'..material..'"') + + local objects_list1 = { + modname.. ":slab_" ..material.. "_inverted", + modname.. ":slab_" ..material.. "_quarter_inverted", + modname.. ":slab_" ..material.. "_three_quarter_inverted", + modname.. ":stair_" ..material.. "_inverted", + modname.. ":stair_" ..material.. "_wall", + modname.. ":stair_" ..material.. "_wall_half", + modname.. ":stair_" ..material.. "_wall_half_inverted", + modname.. ":stair_" ..material.. "_half_inverted", + modname.. ":stair_" ..material.. "_right_half_inverted", + modname.. ":panel_" ..material.. "_vertical", + modname.. ":panel_" ..material.. "_top", + } + + local objects_list2 = { + modname.. ":slab_" ..material.. "_wall", + modname.. ":slab_" ..material.. "_quarter_wall", + modname.. ":slab_" ..material.. "_three_quarter_wall", + modname.. ":stair_" ..material.. "_inner_inverted", + modname.. ":stair_" ..material.. "_outer_inverted", + modname.. ":micro_" ..material.. "_top" + } + + for _, object in pairs(objects_list1) do + local flip_upside_down = false + local flip_to_wall = false + + local dest_object = object + + if string.find(dest_object, "_inverted") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_inverted", "") + end + + if string.find(object, "_top") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_top", "") + end + + if string.find(dest_object, "_wall") then + flip_to_wall = true + dest_object = string.gsub(dest_object, "_wall", "") + end + + if string.find(dest_object, "_vertical") then + flip_to_wall = true + dest_object = string.gsub(dest_object, "_vertical", "") + end + + if string.find(dest_object, "_half") and not string.find(dest_object, "_right_half") then + dest_object = string.gsub(dest_object, "_half", "_right_half") + elseif string.find(dest_object, "_right_half") then + dest_object = string.gsub(dest_object, "_right_half", "_half") + end + + --print(" +---> convert " ..object) + --print(" | to " ..dest_object) + + minetest.register_abm({ + nodenames = {object}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local fdir = node.param2 or 0 + + if flip_upside_down and not flip_to_wall then + nfdir = dirs1[fdir + 2] + elseif flip_to_wall and not flip_upside_down then + nfdir = dirs2[fdir + 1] + elseif flip_to_wall and flip_upside_down then + nfdir = dirs3[fdir + 2] + end + minetest.set_node(pos, {name = dest_object, param2 = nfdir}) + end + }) + end + + for _, object in pairs(objects_list2) do + local flip_upside_down = false + local flip_to_wall = false + + local dest_object = object + + if string.find(dest_object, "_inverted") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_inverted", "") + end + + if string.find(dest_object, "_top") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_top", "") + end + + if string.find(dest_object, "_wall") then + flip_to_wall = true + dest_object = string.gsub(dest_object, "_wall", "") + end + + --print(" +---> convert " ..object) + --print(" | to " ..dest_object) + + minetest.register_abm({ + nodenames = {object}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local fdir = node.param2 + local nfdir = 20 + + if flip_upside_down and not flip_to_wall then + nfdir = dirs1[fdir + 1] + elseif flip_to_wall and not flip_upside_down then + nfdir = dirs2[fdir + 2] + + end + minetest.set_node(pos, {name = dest_object, param2 = nfdir}) + end + }) + end +end + diff --git a/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua new file mode 100644 index 0000000..2a959c0 --- /dev/null +++ b/moreblocks/stairsplus/init.lua @@ -0,0 +1,61 @@ +--[[ +More Blocks: Stairs+ + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +-- Nodes will be called <modname>:{stair,slab,panel,micro}_<subname> + +local modpath = minetest.get_modpath("moreblocks").. "/stairsplus" + +stairsplus = {} +stairsplus.expect_infinite_stacks = false + +if not minetest.get_modpath("unified_inventory") +and minetest.setting_getbool("creative_mode") then + stairsplus.expect_infinite_stacks = true +end + +function stairsplus:prepare_groups(groups) + result = {} + if groups then + for k, v in pairs(groups) do + if k ~= "wood" and k ~= "stone" then + result[k] = v + end + end + end + if not moreblocks.config.stairsplus_in_creative_inventory then + result.not_in_creative_inventory = 1 + end + return result +end + +function stairsplus:register_all(modname, subname, recipeitem, fields) + self:register_stair(modname, subname, recipeitem, fields) + self:register_slab (modname, subname, recipeitem, fields) + self:register_slope(modname, subname, recipeitem, fields) + self:register_panel(modname, subname, recipeitem, fields) + self:register_micro(modname, subname, recipeitem, fields) + -- self:register_6dfacedir_conversion(modname, subname) -- Not needed as of Q3 2013, uncomment to fix old maps. +end + +function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) + stairsplus:register_all(modname, subname, recipeitem, { + groups = groups, + tiles = images, + description = description, + drop = drop, + light_source = light + }) +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 .. "/stairs.lua") +dofile(modpath .. "/slabs.lua") +dofile(modpath .. "/slopes.lua") +dofile(modpath .. "/panels.lua") +dofile(modpath .. "/microblocks.lua") +dofile(modpath .. "/registrations.lua") diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua new file mode 100644 index 0000000..680b3ca --- /dev/null +++ b/moreblocks/stairsplus/microblocks.lua @@ -0,0 +1,138 @@ +--[[ +More Blocks: microblock definitions + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local S = moreblocks.intllib + +-- Node will be called <modname>:micro_<subname> + +function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) + stairsplus:register_micro(modname, subname, recipeitem, { + groups = groups, + tiles = images, + description = description, + drop = drop, + light_source = light, + sounds = default.node_sound_stone_defaults(), + }) +end + +function stairsplus:register_micro(modname, subname, recipeitem, fields) + local 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}, + }, + } + } + + 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 = "facedir" + def.on_place = minetest.rotate_node + def.groups = stairsplus:prepare_groups(fields.groups) + def.description = desc + if fields.drop then + def.drop = modname.. ":micro_" ..fields.drop..alternate + end + minetest.register_node(":" ..modname.. ":micro_" ..subname..alternate, def) + 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 new file mode 100644 index 0000000..4fb3f13 --- /dev/null +++ b/moreblocks/stairsplus/panels.lua @@ -0,0 +1,118 @@ +--[[ +More Blocks: panel definitions + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local S = moreblocks.intllib + +-- Node will be called <modname>:panel_<subname> + +function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) + stairsplus:register_panel(modname, subname, recipeitem, { + groups = groups, + tiles = images, + description = description, + drop = drop, + light_source = light, + sounds = default.node_sound_stone_defaults(), + }) +end + +function stairsplus:register_panel(modname, subname, recipeitem, fields) + local 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}, + }, + } + } + + 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 = "facedir" + def.on_place = minetest.rotate_node + def.description = desc + def.groups = stairsplus:prepare_groups(fields.groups) + if fields.drop then + def.drop = modname.. ":panel_" ..fields.drop..alternate + end + minetest.register_node(":" ..modname.. ":panel_" ..subname..alternate, def) + 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/registrations.lua b/moreblocks/stairsplus/registrations.lua new file mode 100644 index 0000000..3e08565 --- /dev/null +++ b/moreblocks/stairsplus/registrations.lua @@ -0,0 +1,57 @@ +--[[ +More Blocks: registrations + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local default_nodes = { -- Default stairs/slabs/panels/microblocks: + "stone", + "cobble", + "mossycobble", + "brick", + "sandstone", + "steelblock", + "goldblock", + "copperblock", + "bronzeblock", + "diamondblock", + "desert_stone", + "desert_cobble", + "meselamp", + "glass", + "tree", + "wood", + "jungletree", + "junglewood", + "pine_tree", + "pine_wood", + "acacia_tree", + "acacia_wood", + "obsidian", + "obsidian_glass", + "stonebrick", + "desert_stonebrick", + "sandstonebrick", + "obsidianbrick", +} + +for _, name in pairs(default_nodes) do + local nodename = "default:" .. name + local ndef = minetest.registered_nodes[nodename] + if ndef then + local drop + if type(ndef.drop) == "string" then + drop = ndef.drop:sub(9) + end + stairsplus:register_all("moreblocks", name, nodename, { + description = ndef.description, + drop = drop, + groups = ndef.groups, + sounds = ndef.sounds, + tiles = ndef.tiles, + sunlight_propagates = true, + light_source = ndef.light_source + }) + end +end diff --git a/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua new file mode 100644 index 0000000..cc3502c --- /dev/null +++ b/moreblocks/stairsplus/slabs.lua @@ -0,0 +1,209 @@ +--[[ +More Blocks: slab definitions + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local S = moreblocks.intllib + +-- Node will be called <modname>:slab_<subname> + +function register_slab(modname, subname, recipeitem, groups, images, description, drop, light) + stairsplus:register_slab(modname, subname, recipeitem, { + groups = groups, + tiles = images, + description = description, + drop = drop, + light_source = light, + sounds = default.node_sound_stone_defaults(), + }) +end + +function stairsplus:register_slab(modname, subname, recipeitem, fields) + local defs = { + [""] = 8, + ["_quarter"] = 4, + ["_three_quarter"] = 12, + ["_1"] = 1, + ["_2"] = 2, + ["_14"] = 14, + ["_15"] = 15, + } + + local desc_base = S("%s Slab"):format(fields.description) + for alternate, num in pairs(defs) do + local def = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, (num/16)-0.5, 0.5}, + } + } + for k, v in pairs(fields) do + def[k] = v + end + def.drawtype = "nodebox" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.on_place = minetest.rotate_node + def.description = ("%s (%d/16)"):format(desc_base, num) + def.groups = stairsplus:prepare_groups(fields.groups) + if fields.drop then + def.drop = modname.. ":slab_" .. fields.drop .. alternate + end + minetest.register_node(":" .. modname .. ":slab_" .. subname .. alternate, def) + end + minetest.register_alias("stairs:slab_" .. subname, modname .. ":slab_" .. subname) + + 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 new file mode 100644 index 0000000..49058e3 --- /dev/null +++ b/moreblocks/stairsplus/slopes.lua @@ -0,0 +1,347 @@ +--[[ +More Blocks: slope definitions + +Copyright (c) 2011-2015 Calinou and contributors. +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) + stairsplus:register_slope(modname, subname, recipeitem, { + groups = groups, + tiles = images, + description = description, + drop = drop, + light_source = light, + sounds = default.node_sound_stone_defaults(), + }) +end + +function stairsplus:register_slope(modname, subname, recipeitem, fields) + local 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, + }, + } + + 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 = "facedir" + def.on_place = minetest.rotate_node + def.description = desc + def.groups = stairsplus:prepare_groups(fields.groups) + if fields.drop then + def.drop = modname.. ":slope_" ..fields.drop..alternate + end + minetest.register_node(":" ..modname.. ":slope_" ..subname..alternate, def) + 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 new file mode 100644 index 0000000..dde6d50 --- /dev/null +++ b/moreblocks/stairsplus/stairs.lua @@ -0,0 +1,224 @@ +--[[ +More Blocks: stair definitions + +Copyright (c) 2011-2015 Calinou and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +--]] + +local S = moreblocks.intllib + +-- Node will be called <modname>:stair_<subname> + +function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) + stairsplus:register_stair(modname, subname, recipeitem, { + groups = groups, + tiles = images, + description = description, + drop = drop, + light_source = light, + sounds = default.node_sound_stone_defaults(), + }) +end + +function stairsplus:register_stair(modname, subname, recipeitem, fields) + local 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}, + }, + }, + }, + } + + 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 = "facedir" + def.on_place = minetest.rotate_node + def.description = desc + def.groups = stairsplus:prepare_groups(fields.groups) + if fields.drop then + def.drop = modname .. ":stair_" .. fields.drop .. alternate + end + minetest.register_node(":" .. modname .. ":stair_" .. subname .. alternate, def) + end + minetest.register_alias("stairs:stair_" .. subname, modname .. ":stair_" .. subname) + + 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 |