minetest-mm/mods/mydoors/my_door_wood/init.lua

61 lines
1.5 KiB
Lua
Raw Normal View History

2020-10-30 10:15:03 +01:00
local door_wood = { -- color, desc, image
{"red", "Red Stained", "red"},
{"grey", "Grey Stained", "grey"},
{"dark_grey", "Dark Grey Stained", "dark_grey"},
{"brown", "Brown Stained", "brown"},
{"white", "White Stained", "white"},
{"yellow", "Clear Stained", "yellow"},
{"black", "Black", "black"},
}
2024-12-19 12:55:40 +01:00
local function my_door_wood_block_stairs(nodename, def)
2021-10-25 14:38:22 +02:00
local mod = string.match(nodename, "(.+):")
local name = string.match(nodename, ":(.+)")
minetest.register_node(nodename, def)
2020-10-30 10:15:03 +01:00
if minetest.get_modpath("moreblocks") then
stairsplus:register_all(
mod,
name,
nodename,
{
description = def.description,
tiles = def.tiles,
groups = def.groups,
sounds = def.sounds,
}
)
2024-12-19 12:55:40 +01:00
elseif minetest.get_modpath("stairs") then
2020-10-30 10:15:03 +01:00
stairs.register_stair_and_slab(name,nodename,
def.groups,
def.tiles,
("%s Stair"):format(def.description),
("%s Slab"):format(def.description),
def.sounds
2024-12-19 12:55:40 +01:00
)
end
2020-10-30 10:15:03 +01:00
end
2021-10-25 14:38:22 +02:00
local function add_door(color, desc, img)
my_door_wood_block_stairs("my_door_wood:wood_"..color, {
description = desc.." Wood",
drawtype = "normal",
tiles = {"mydoors_"..img.."_wood.png"},
paramtype = "light",
2024-12-19 12:55:40 +01:00
groups = {cracky = 2, choppy = 2, wood = 1},
2021-10-25 14:38:22 +02:00
sounds = default.node_sound_wood_defaults(),
})
2020-10-30 10:15:03 +01:00
2021-10-25 14:38:22 +02:00
-- Crafts
minetest.register_craft({
output = "my_door_wood:wood_"..color,
recipe = {
{"default:wood", "", ""},
{"dye:"..color, "", ""},
{"", "", ""}
}
})
end
2020-10-30 10:15:03 +01:00
2021-10-25 14:38:22 +02:00
for _,door in ipairs(door_wood) do
add_door(unpack(door))
2020-10-30 10:15:03 +01:00
end