diff --git a/mods/stairs/LICENSE.txt b/mods/stairs/LICENSE.txt index dc44a2b..cca02cd 100644 --- a/mods/stairs/LICENSE.txt +++ b/mods/stairs/LICENSE.txt @@ -1,7 +1,7 @@ License for Code ---------------- -Copyright (C) 2016 cd2 (cdqwertz) +Copyright (C) 2015 cd2 (cdqwertz) This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -9,3 +9,8 @@ the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. http://www.gnu.org/licenses/lgpl-2.1.html + +License for Media +----------------- + +CC-BY-SA 3.0 UNPORTED. Created by cd2 (cdqwertz) diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index 01a0634..468deba 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -1,4 +1,7 @@ stairs = {} + +stairs.blocks = {} + function stairs.register_stair_and_slab(name, base) if not minetest.registered_nodes[base] then return @@ -18,6 +21,9 @@ function stairs.register_stair_and_slab(name, base) }, sounds = minetest.registered_nodes[base].sounds or nil, }) + + stairs.blocks[base] = name.."_slab" + minetest.register_node(name.."_stair", { description = minetest.registered_nodes[base].description .. " Stair", tiles = minetest.registered_nodes[base].tiles, @@ -35,6 +41,8 @@ function stairs.register_stair_and_slab(name, base) sounds = minetest.registered_nodes[base].sounds or nil, }) + stairs.blocks[name.."_slab"] = name.."_stair" + minetest.register_node(name.."_stair_corner_1", { description = minetest.registered_nodes[base].description .. " Corner", tiles = minetest.registered_nodes[base].tiles, @@ -53,6 +61,8 @@ function stairs.register_stair_and_slab(name, base) sounds = minetest.registered_nodes[base].sounds or nil, }) + stairs.blocks[name.."_stair"] = name.."_stair_corner_1" + minetest.register_node(name.."_stair_corner_2", { description = minetest.registered_nodes[base].description .. " Corner", tiles = minetest.registered_nodes[base].tiles, @@ -70,6 +80,10 @@ function stairs.register_stair_and_slab(name, base) sounds = minetest.registered_nodes[base].sounds or nil, }) + stairs.blocks[name.."_stair_corner_1"] = name.."_stair_corner_2" + + stairs.blocks[name.."_stair_corner_2"] = base + minetest.register_node(name.."_wall", { description = minetest.registered_nodes[base].description .. " Wall", tiles = minetest.registered_nodes[base].tiles, @@ -118,19 +132,6 @@ function stairs.register_stair_and_slab(name, base) }, sounds = minetest.registered_nodes[base].sounds or nil, }) - minetest.register_craft({ - output = name.."_stair 3", - recipe = { - {base, ""}, - {base, base}, - } - }) - minetest.register_craft({ - output = name.."_slab 4", - recipe = { - {base, base}, - } - }) end stairs.register_stair_and_slab("stairs:stonebrick", "default:stonebrick") @@ -138,6 +139,40 @@ stairs.register_stair_and_slab("stairs:stone_tile", "default:stone_tile") stairs.register_stair_and_slab("stairs:stone", "default:stone") stairs.register_stair_and_slab("stairs:cobble", "default:cobble") stairs.register_stair_and_slab("stairs:brick", "default:brick") -stairs.register_stair_and_slab("stairs:basalt", "lava:basalt") stairs.register_stair_and_slab("stairs:wood", "default:wood") stairs.register_stair_and_slab("stairs:wooden_planks", "default:wooden_planks") + +stairs.register_stair_and_slab("stairs:grass", "default:grass") +stairs.register_stair_and_slab("stairs:dirt", "default:dirt") + +minetest.register_craftitem("stairs:chisel", { + description = "Chisel", + inventory_image = "stairs_chisel.png", + + on_use = function(itemstack, user, pt) + if pt.type == "node" then + if stairs.blocks[minetest.get_node(pt.under).name] then + if minetest.registered_nodes[stairs.blocks[minetest.get_node(pt.under).name]].paramtype2 == "facedir" then + minetest.set_node(pt.under, {name=stairs.blocks[minetest.get_node(pt.under).name], param2 = minetest.dir_to_facedir(vector.subtract(pt.under, pt.above))}) + else + minetest.set_node(pt.under, {name=stairs.blocks[minetest.get_node(pt.under).name]}) + end + end + end + return itemstack + end, + + on_place = function(itemstack, placer, pt) + if pt.type == "node" then + local n = minetest.get_node(pt.under) + if minetest.registered_nodes[n.name].paramtype2 == "facedir" then + n.param2 = n.param2 + 1; + if n.param2 > 3 then + n.param2 = 0; + end + minetest.set_node(pt.under, n) + end + end + return itemstack + end +}) diff --git a/mods/stairs/textures/stairs_chisel.png b/mods/stairs/textures/stairs_chisel.png new file mode 100644 index 0000000..99516a4 Binary files /dev/null and b/mods/stairs/textures/stairs_chisel.png differ