star_wars/mods/bakedclay/init.lua

133 lines
3.3 KiB
Lua

-- Baked Clay by TenPlus1
local clay = {
{"white", "White"},
{"grey", "Grey"},
{"black", "Black"},
{"red", "Red"},
{"yellow", "Yellow"},
{"green", "Green"},
{"cyan", "Cyan"},
{"blue", "Blue"},
{"magenta", "Magenta"},
{"orange", "Orange"},
{"violet", "Violet"},
{"brown", "Brown"},
{"pink", "Pink"},
{"dark_grey", "Dark Grey"},
{"dark_green", "Dark Green"},
}
local stairs_mod = minetest.get_modpath("stairs")
local stairsplus_mod = minetest.get_modpath("moreblocks")
and minetest.global_exists("stairsplus")
for _, clay in pairs(clay) do
-- node definition
minetest.register_node("bakedclay:" .. clay[1], {
description = clay[2] .. " Baked Clay",
tiles = {"baked_clay_" .. clay[1] ..".png"},
groups = {cracky = 3, bakedclay = 1},
sounds = default.node_sound_stone_defaults(),
})
-- craft from dye and any baked clay
minetest.register_craft({
output = "bakedclay:" .. clay[1] .. " 8",
recipe = {
{"group:bakedclay", "group:bakedclay", "group:bakedclay"},
{"group:bakedclay", "dye:" .. clay[1], "group:bakedclay"},
{"group:bakedclay", "group:bakedclay", "group:bakedclay"}
},
})
-- register stairsplus stairs if found
if stairsplus_mod then
stairsplus:register_all("bakedclay", "baked_clay_" .. clay[1], "bakedclay:" .. clay[1], {
description = clay[2] .. " Baked Clay",
tiles = {"baked_clay_" .. clay[1] .. ".png"},
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(),
})
stairsplus:register_alias_all("bakedclay", clay[1], "bakedclay", "baked_clay_" .. clay[1])
minetest.register_alias("stairs:slab_bakedclay_".. clay[1], "bakedclay:slab_baked_clay_" .. clay[1])
minetest.register_alias("stairs:stair_bakedclay_".. clay[1], "bakedclay:stair_baked_clay_" .. clay[1])
-- register all stair types for stairs redo
elseif stairs_mod and stairs.mod then
stairs.register_all("bakedclay_" .. clay[1], "bakedclay:" .. clay[1],
{cracky = 3},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " Baked Clay",
default.node_sound_stone_defaults())
-- register stair and slab using default stairs
elseif stairs_mod then
stairs.register_stair_and_slab("bakedclay_".. clay[1], "bakedclay:".. clay[1],
{cracky = 3},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " Baked Clay Stair",
clay[2] .. " Baked Clay Slab",
default.node_sound_stone_defaults())
end
end
-- cook clay block into white baked clay
minetest.register_craft({
type = "cooking",
output = "bakedclay:white",
recipe = "default:clay_block",
})
-- register a few extra dye colour options
minetest.register_craft( {
type = "shapeless",
output = "dye:dark_grey 3",
recipe = {"dye:black", "dye:black", "dye:white"}
})
minetest.register_craft( {
type = "shapeless",
output = "dye:dark_green 3",
recipe = {"dye:green", "dye:green", "dye:black"}
})
minetest.register_craft( {
type = "shapeless",
output = "dye:grey 3",
recipe = {"dye:black", "dye:white", "dye:white"}
})
minetest.register_craft( {
type = "shapeless",
output = "dye:black 4",
recipe = {"default:coal_lump"}
})
minetest.register_craft( {
type = "shapeless",
output = "dye:brown 4",
recipe = {"default:dry_shrub"}
})
-- 2x2 red bakedclay makes 16x clay brick
minetest.register_craft( {
output = "default:clay_brick 16",
recipe = {
{"bakedclay:red", "bakedclay:red"},
{"bakedclay:red", "bakedclay:red"},
}
})
print ("[MOD] Baked Clay loaded")