minetest-mm/mods/bakedclay/init.lua

428 lines
10 KiB
Lua
Raw Normal View History

2020-10-26 17:38:53 +01:00
-- Baked Clay by TenPlus1
local clay = {
{"natural", "Natural"},
{"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"},
2021-07-24 12:22:10 +02:00
{"dark_green", "Dark Green"}
2020-10-26 17:38:53 +01:00
}
local techcnc_mod = minetest.get_modpath("technic_cnc")
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
2021-07-24 12:22:10 +02:00
-- node
2020-10-26 17:38:53 +01:00
minetest.register_node("bakedclay:" .. clay[1], {
description = clay[2] .. " Baked Clay",
tiles = {"baked_clay_" .. clay[1] ..".png"},
groups = {cracky = 3, bakedclay = 1},
2021-07-24 12:22:10 +02:00
sounds = default.node_sound_stone_defaults()
2020-10-26 17:38:53 +01:00
})
2021-07-24 12:22:10 +02:00
-- craft recipe
2020-10-26 17:38:53 +01:00
if clay[1] ~= "natural" then
2021-07-24 12:22:10 +02:00
2020-10-26 17:38:53 +01:00
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"}
2021-07-24 12:22:10 +02:00
}
2020-10-26 17:38:53 +01:00
})
end
2021-07-24 12:22:10 +02:00
-- stairs plus
2020-10-26 17:38:53 +01:00
if stairsplus_mod then
2021-07-24 12:22:10 +02:00
stairsplus:register_all("bakedclay", "baked_clay_" .. clay[1],
"bakedclay:" .. clay[1], {
2020-10-26 17:38:53 +01:00
description = clay[2] .. " Baked Clay",
tiles = {"baked_clay_" .. clay[1] .. ".png"},
groups = {cracky = 3},
2021-07-24 12:22:10 +02:00
sounds = default.node_sound_stone_defaults()
2020-10-26 17:38:53 +01:00
})
2021-07-24 12:22:10 +02:00
stairsplus:register_alias_all("bakedclay", clay[1],
"bakedclay", "baked_clay_" .. clay[1])
2020-10-26 17:38:53 +01:00
2021-07-24 12:22:10 +02:00
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])
-- stairs redo
2020-10-26 17:38:53 +01:00
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())
2021-07-24 12:22:10 +02:00
-- default stairs
2020-10-26 17:38:53 +01:00
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
-- register bakedclay for use in technic_cnc mod
if techcnc_mod then
technic_cnc.register_all("bakedclay:" .. clay[1],
{cracky = 3, not_in_creative_inventory = 1},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " Baked Clay")
end
end
2021-07-24 12:22:10 +02:00
-- Terracotta blocks (textures by D3monPixel, thanks for use :)
for _, clay in pairs(clay) do
if clay[1] ~= "natural" then
local texture = "baked_clay_terracotta_" .. clay[1] ..".png"
minetest.register_node("bakedclay:terracotta_" .. clay[1], {
description = clay[2] .. " Glazed Terracotta",
tiles = {
texture .. "",
texture .. "",
texture .. "^[transformR180",
texture .. "",
texture .. "^[transformR270",
texture .. "^[transformR90",
},
paramtype2 = "facedir",
groups = {cracky = 3, terracotta = 1},
sounds = default.node_sound_stone_defaults(),
on_place = minetest.rotate_node
})
minetest.register_craft({
type = "cooking",
output = "bakedclay:terracotta_" .. clay[1],
recipe = "bakedclay:" .. clay[1]
})
end
end
-- special light blue glazed terracotta block
local texture = "baked_clay_terracotta_light_blue.png"
minetest.register_node("bakedclay:terracotta_light_blue", {
description = "Light Blue Glazed Terracotta",
tiles = {
texture .. "",
texture .. "",
texture .. "^[transformR180",
texture .. "",
texture .. "^[transformR270",
texture .. "^[transformR90",
},
paramtype2 = "facedir",
groups = {cracky = 3, terracotta = 1},
sounds = default.node_sound_stone_defaults(),
on_place = minetest.rotate_node
})
2020-10-26 17:38:53 +01:00
-- cook clay block into white baked clay
minetest.register_craft({
type = "cooking",
output = "bakedclay:natural",
recipe = "default:clay",
})
-- 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:green 4",
recipe = {"default:cactus"}
})
minetest.register_craft( {
type = "shapeless",
output = "dye:brown 4",
recipe = {"default:dry_shrub"}
})
2021-07-24 12:22:10 +02:00
-- only add light grey recipe if unifieddye mod isnt present (conflict)
if not minetest.get_modpath("unifieddyes") then
minetest.register_craft( {
type = "shapeless",
output = "dye:grey 3",
recipe = {"dye:black", "dye:white", "dye:white"}
})
end
-- 2x2 red baked clay makes 16x clay brick
2020-10-26 17:38:53 +01:00
minetest.register_craft( {
output = "default:clay_brick 16",
recipe = {
{"bakedclay:red", "bakedclay:red"},
{"bakedclay:red", "bakedclay:red"},
}
})
-- register some new flowers to fill in missing dye colours
-- flower registration (borrowed from default game)
local function add_simple_flower(name, desc, box, f_groups)
f_groups.snappy = 3
f_groups.flower = 1
f_groups.flora = 1
f_groups.attached_node = 1
minetest.register_node("bakedclay:" .. name, {
description = desc,
drawtype = "plantlike",
waving = 1,
tiles = {"baked_clay_" .. name .. ".png"},
inventory_image = "baked_clay_" .. name .. ".png",
wield_image = "baked_clay_" .. name .. ".png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
stack_max = 99,
groups = f_groups,
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = box
}
})
end
local flowers = {
2021-07-24 12:22:10 +02:00
{"delphinium", "Blue Delphinium",
{-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_cyan = 1}},
{"thistle", "Thistle",
{-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_magenta = 1}},
{"lazarus", "Lazarus Bell",
{-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_pink = 1}},
{"mannagrass", "Reed Mannagrass",
{-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_dark_green = 1}}
2020-10-26 17:38:53 +01:00
}
for _,item in pairs(flowers) do
add_simple_flower(unpack(item))
end
-- mapgen for new flowers
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.004,
spread = {x = 100, y = 100, z = 100},
seed = 7133,
octaves = 3,
persist = 0.6
},
y_min = 10,
y_max = 90,
2021-07-24 12:22:10 +02:00
decoration = "bakedclay:delphinium"
2020-10-26 17:38:53 +01:00
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.004,
spread = {x = 100, y = 100, z = 100},
seed = 7134,
octaves = 3,
persist = 0.6
},
y_min = 15,
y_max = 90,
2021-07-24 12:22:10 +02:00
decoration = "bakedclay:thistle"
2020-10-26 17:38:53 +01:00
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.01,
spread = {x = 100, y = 100, z = 100},
seed = 7135,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = 90,
decoration = "bakedclay:lazarus",
spawn_by = "default:jungletree",
2021-07-24 12:22:10 +02:00
num_spawn_by = 1
2020-10-26 17:38:53 +01:00
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:sand"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.009,
spread = {x = 100, y = 100, z = 100},
seed = 7136,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = 15,
decoration = "bakedclay:mannagrass",
spawn_by = "group:water",
2021-07-24 12:22:10 +02:00
num_spawn_by = 1
2020-10-26 17:38:53 +01:00
})
2021-07-24 12:22:10 +02:00
-- lucky blocks
2020-10-26 17:38:53 +01:00
if minetest.get_modpath("lucky_block") then
2021-07-24 12:22:10 +02:00
2020-10-26 17:38:53 +01:00
local p = "bakedclay:"
2021-07-24 12:22:10 +02:00
2020-10-26 17:38:53 +01:00
lucky_block:add_blocks({
{"dro", {"bakedclay:"}, 10, true},
{"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange",
p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural"}, 0},
{"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange",
p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural"}, 0, true},
{"dro", {p.."delphinium"}, 5},
{"dro", {p.."lazarus"}, 5},
{"dro", {p.."mannagrass"}, 5},
{"dro", {p.."thistle"}, 6},
{"flo", 5, {p.."natural", p.."black", p.."blue", p.."brown", p.."cyan",
p.."dark_green", p.."dark_grey", p.."green", p.."grey", p.."magenta",
p.."orange", p.."pink", p.."red", p.."violet", p.."white", p.."yellow"}, 2},
{"nod", "default:chest", 0, {
{name = p.."natural", max = 30},
{name = p.."black", max = 30},
{name = p.."blue", max = 30},
{name = p.."brown", max = 30},
{name = p.."cyan", max = 30},
{name = p.."dark_green", max = 30},
{name = p.."dark_grey", max = 30},
{name = p.."green", max = 30},
{name = p.."grey", max = 30},
{name = p.."magenta", max = 30},
{name = p.."orange", max = 30},
{name = p.."pink", max = 30},
{name = p.."red", max = 30},
{name = p.."violet", max = 30},
{name = p.."white", max = 30},
2021-07-24 12:22:10 +02:00
{name = p.."yellow", max = 30}
2020-10-26 17:38:53 +01:00
}},
})
2021-07-24 12:22:10 +02:00
p = "bakedclay:terracotta_"
lucky_block:add_blocks({
{"nod", "default:chest", 0, {
{name = p.."light_blue", max = 20},
{name = p.."black", max = 20},
{name = p.."blue", max = 20},
{name = p.."brown", max = 20},
{name = p.."cyan", max = 20},
{name = p.."dark_green", max = 20},
{name = p.."dark_grey", max = 20},
{name = p.."green", max = 20},
{name = p.."grey", max = 20},
{name = p.."magenta", max = 20},
{name = p.."orange", max = 20},
{name = p.."pink", max = 20},
{name = p.."red", max = 20},
{name = p.."violet", max = 20},
{name = p.."white", max = 20},
{name = p.."yellow", max = 20}
}}
})
end
2020-10-26 17:38:53 +01:00
-- colored clay compatibility
2021-07-24 12:22:10 +02:00
2020-10-26 17:38:53 +01:00
if minetest.settings:get_bool("colored_clay_compatibility") == true then
local cc = {
{"black", "black"},
{"blue", "blue"},
{"bright", "natural"},
{"brown", "brown"},
{"cyan", "cyan"},
{"dark_green", "dark_green"},
{"dark_grey", "dark_grey"},
{"green", "green"},
{"grey", "grey"},
{"hardened", "natural"},
{"magenta", "magenta"},
{"orange", "orange"},
{"pink", "pink"},
{"red", "red"},
{"violet", "violet"},
{"white", "white"},
{"yellow", "yellow"}
}
for n = 1, #cc do
local nod1 = "colored_clay:" .. cc[n][1]
local nod2 = "bakedclay:" .. cc[n][2]
minetest.register_alias(nod1, nod2)
if stairsplus_mod then
stairsplus:register_alias_all("colored_clay", cc[n][1], "bakedclay", cc[n][2])
end
end
end
print ("[MOD] Baked Clay loaded")