From c24873e3ebd2c10ef7a804f016a2a40491b0a11b Mon Sep 17 00:00:00 2001 From: Jat15 Date: Sun, 27 Aug 2017 23:01:44 +0200 Subject: [PATCH] [My Dooor Wood] Add compatibility stairs and stairsplus, sounds for node --- my_door_wood/depends.txt | 3 +++ my_door_wood/init.lua | 29 ++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 my_door_wood/depends.txt diff --git a/my_door_wood/depends.txt b/my_door_wood/depends.txt new file mode 100644 index 0000000..567219e --- /dev/null +++ b/my_door_wood/depends.txt @@ -0,0 +1,3 @@ +default +stairs? +moreblocks? \ No newline at end of file diff --git a/my_door_wood/init.lua b/my_door_wood/init.lua index 6aaf536..f3babaa 100644 --- a/my_door_wood/init.lua +++ b/my_door_wood/init.lua @@ -7,18 +7,45 @@ local door_wood = { -- color, desc, image {"yellow", "Clear Stained", "yellow"}, {"black", "Black", "black"}, } +local function my_door_wood_block_stairs(nodename, def) + local mod = string.match (nodename,"(.+):") + local name = string.match (nodename,":(.+)") + minetest.register_node(nodename,def) + if minetest.get_modpath("moreblocks") then + stairsplus:register_all( + mod, + name, + nodename, + { + description = def.description, + tiles = def.tiles, + groups = def.groups, + sounds = def.sounds, + } + ) + elseif minetest.get_modpath("stairs") then + stairs.register_stair_and_slab(name,nodename, + def.groups, + def.tiles, + ("%s Stair"):format(def.description), + ("%s Slab"):format(def.description), + def.sounds + ) + end +end for i in ipairs(door_wood) do local color = door_wood[i][1] local desc = door_wood[i][2] local img = door_wood[i][3] -minetest.register_node("my_door_wood:wood_"..color, { +my_door_wood_block_stairs("my_door_wood:wood_"..color, { description = desc.." Wood", drawtype = "normal", paramtype = "light", tiles = {"mydoors_"..img.."_wood.png"}, paramtype = "light", groups = {cracky = 2, choppy = 2}, + sounds = default.node_sound_wood_defaults(), })