mirror of
https://notabug.org/TenPlus1/bakedclay.git
synced 2024-08-20 15:34:06 +02:00
tweak and tidy code, add lucky block
This commit is contained in:
parent
4fdbff14f8
commit
a3c96afbda
@ -2,6 +2,7 @@ Baked Clay
|
|||||||
|
|
||||||
This mod lets the player bake clay into hardened blocks and colour them with
|
This mod lets the player bake clay into hardened blocks and colour them with
|
||||||
dye (8x baked clay and 1x dye in centre), stairs and slabs are also available.
|
dye (8x baked clay and 1x dye in centre), stairs and slabs are also available.
|
||||||
|
Cooking baked clay turns it into glazed terracotta blocks.
|
||||||
|
|
||||||
https://forum.minetest.net/viewtopic.php?id=8890
|
https://forum.minetest.net/viewtopic.php?id=8890
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ Changelog:
|
|||||||
- 0.2 - Any colour of baked clay can be re-dyed into another colour
|
- 0.2 - Any colour of baked clay can be re-dyed into another colour
|
||||||
- 0.1 - Initial Release
|
- 0.1 - Initial Release
|
||||||
|
|
||||||
Lucky Blocks: 9
|
Lucky Blocks: 10
|
||||||
|
|
||||||
|
|
||||||
Note: Under settings you will find 'colored_clay_compatibility' switch that when enabled will register aliases for the older colored clay mod and it's stairplus stairs.
|
Note: Under settings you will find 'colored_clay_compatibility' switch that when enabled will register aliases for the older colored clay mod and it's stairplus stairs.
|
||||||
|
130
init.lua
130
init.lua
@ -17,7 +17,7 @@ local clay = {
|
|||||||
{"brown", "Brown"},
|
{"brown", "Brown"},
|
||||||
{"pink", "Pink"},
|
{"pink", "Pink"},
|
||||||
{"dark_grey", "Dark Grey"},
|
{"dark_grey", "Dark Grey"},
|
||||||
{"dark_green", "Dark Green"},
|
{"dark_green", "Dark Green"}
|
||||||
}
|
}
|
||||||
|
|
||||||
local techcnc_mod = minetest.get_modpath("technic_cnc")
|
local techcnc_mod = minetest.get_modpath("technic_cnc")
|
||||||
@ -27,42 +27,50 @@ local stairsplus_mod = minetest.get_modpath("moreblocks")
|
|||||||
|
|
||||||
for _, clay in pairs(clay) do
|
for _, clay in pairs(clay) do
|
||||||
|
|
||||||
-- node definition
|
-- node
|
||||||
|
|
||||||
minetest.register_node("bakedclay:" .. clay[1], {
|
minetest.register_node("bakedclay:" .. clay[1], {
|
||||||
description = clay[2] .. " Baked Clay",
|
description = clay[2] .. " Baked Clay",
|
||||||
tiles = {"baked_clay_" .. clay[1] ..".png"},
|
tiles = {"baked_clay_" .. clay[1] ..".png"},
|
||||||
groups = {cracky = 3, bakedclay = 1},
|
groups = {cracky = 3, bakedclay = 1},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
-- craft from dye and any baked clay
|
-- craft recipe
|
||||||
|
|
||||||
if clay[1] ~= "natural" then
|
if clay[1] ~= "natural" then
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "bakedclay:" .. clay[1] .. " 8",
|
output = "bakedclay:" .. clay[1] .. " 8",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:bakedclay", "group:bakedclay", "group:bakedclay"},
|
{"group:bakedclay", "group:bakedclay", "group:bakedclay"},
|
||||||
{"group:bakedclay", "dye:" .. clay[1], "group:bakedclay"},
|
{"group:bakedclay", "dye:" .. clay[1], "group:bakedclay"},
|
||||||
{"group:bakedclay", "group:bakedclay", "group:bakedclay"}
|
{"group:bakedclay", "group:bakedclay", "group:bakedclay"}
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- register stairsplus stairs if found
|
-- stairs plus
|
||||||
if stairsplus_mod then
|
if stairsplus_mod then
|
||||||
|
|
||||||
stairsplus:register_all("bakedclay", "baked_clay_" .. clay[1], "bakedclay:" .. clay[1], {
|
stairsplus:register_all("bakedclay", "baked_clay_" .. clay[1],
|
||||||
|
"bakedclay:" .. clay[1], {
|
||||||
description = clay[2] .. " Baked Clay",
|
description = clay[2] .. " Baked Clay",
|
||||||
tiles = {"baked_clay_" .. clay[1] .. ".png"},
|
tiles = {"baked_clay_" .. clay[1] .. ".png"},
|
||||||
groups = {cracky = 3},
|
groups = {cracky = 3},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
stairsplus:register_alias_all("bakedclay", clay[1], "bakedclay", "baked_clay_" .. clay[1])
|
stairsplus:register_alias_all("bakedclay", clay[1],
|
||||||
minetest.register_alias("stairs:slab_bakedclay_".. clay[1], "bakedclay:slab_baked_clay_" .. clay[1])
|
"bakedclay", "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
|
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
|
||||||
elseif stairs_mod and stairs.mod then
|
elseif stairs_mod and stairs.mod then
|
||||||
|
|
||||||
stairs.register_all("bakedclay_" .. clay[1], "bakedclay:" .. clay[1],
|
stairs.register_all("bakedclay_" .. clay[1], "bakedclay:" .. clay[1],
|
||||||
@ -71,7 +79,7 @@ for _, clay in pairs(clay) do
|
|||||||
clay[2] .. " Baked Clay",
|
clay[2] .. " Baked Clay",
|
||||||
default.node_sound_stone_defaults())
|
default.node_sound_stone_defaults())
|
||||||
|
|
||||||
-- register stair and slab using default stairs
|
-- default stairs
|
||||||
elseif stairs_mod then
|
elseif stairs_mod then
|
||||||
|
|
||||||
stairs.register_stair_and_slab("bakedclay_".. clay[1], "bakedclay:".. clay[1],
|
stairs.register_stair_and_slab("bakedclay_".. clay[1], "bakedclay:".. clay[1],
|
||||||
@ -123,6 +131,25 @@ for _, clay in pairs(clay) do
|
|||||||
end
|
end
|
||||||
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
|
||||||
|
})
|
||||||
|
|
||||||
-- cook clay block into white baked clay
|
-- cook clay block into white baked clay
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -139,15 +166,6 @@ minetest.register_craft( {
|
|||||||
recipe = {"dye:black", "dye:black", "dye:white"}
|
recipe = {"dye:black", "dye:black", "dye:white"}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 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
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "dye:green 4",
|
output = "dye:green 4",
|
||||||
@ -160,7 +178,17 @@ minetest.register_craft( {
|
|||||||
recipe = {"default:dry_shrub"}
|
recipe = {"default:dry_shrub"}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 2x2 red bakedclay makes 16x clay brick
|
-- 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
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "default:clay_brick 16",
|
output = "default:clay_brick 16",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -201,10 +229,17 @@ local function add_simple_flower(name, desc, box, f_groups)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local flowers = {
|
local flowers = {
|
||||||
{"delphinium", "Blue Delphinium", {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_cyan = 1}},
|
{"delphinium", "Blue Delphinium",
|
||||||
{"thistle", "Thistle", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_magenta = 1}},
|
{-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_cyan = 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}},
|
{"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}}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _,item in pairs(flowers) do
|
for _,item in pairs(flowers) do
|
||||||
@ -227,7 +262,7 @@ minetest.register_decoration({
|
|||||||
},
|
},
|
||||||
y_min = 10,
|
y_min = 10,
|
||||||
y_max = 90,
|
y_max = 90,
|
||||||
decoration = "bakedclay:delphinium",
|
decoration = "bakedclay:delphinium"
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
@ -244,7 +279,7 @@ minetest.register_decoration({
|
|||||||
},
|
},
|
||||||
y_min = 15,
|
y_min = 15,
|
||||||
y_max = 90,
|
y_max = 90,
|
||||||
decoration = "bakedclay:thistle",
|
decoration = "bakedclay:thistle"
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
@ -263,7 +298,7 @@ minetest.register_decoration({
|
|||||||
y_max = 90,
|
y_max = 90,
|
||||||
decoration = "bakedclay:lazarus",
|
decoration = "bakedclay:lazarus",
|
||||||
spawn_by = "default:jungletree",
|
spawn_by = "default:jungletree",
|
||||||
num_spawn_by = 1,
|
num_spawn_by = 1
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
@ -282,13 +317,15 @@ minetest.register_decoration({
|
|||||||
y_max = 15,
|
y_max = 15,
|
||||||
decoration = "bakedclay:mannagrass",
|
decoration = "bakedclay:mannagrass",
|
||||||
spawn_by = "group:water",
|
spawn_by = "group:water",
|
||||||
num_spawn_by = 1,
|
num_spawn_by = 1
|
||||||
})
|
})
|
||||||
|
|
||||||
-- add lucky blocks
|
-- lucky blocks
|
||||||
|
|
||||||
if minetest.get_modpath("lucky_block") then
|
if minetest.get_modpath("lucky_block") then
|
||||||
|
|
||||||
local p = "bakedclay:"
|
local p = "bakedclay:"
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"dro", {"bakedclay:"}, 10, true},
|
{"dro", {"bakedclay:"}, 10, true},
|
||||||
{"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
|
{"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
|
||||||
@ -320,13 +357,38 @@ lucky_block:add_blocks({
|
|||||||
{name = p.."red", max = 30},
|
{name = p.."red", max = 30},
|
||||||
{name = p.."violet", max = 30},
|
{name = p.."violet", max = 30},
|
||||||
{name = p.."white", max = 30},
|
{name = p.."white", max = 30},
|
||||||
{name = p.."yellow", max = 30},
|
{name = p.."yellow", max = 30}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
lucky_block:purge_block_list()
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
-- colored clay compatibility
|
-- colored clay compatibility
|
||||||
|
|
||||||
if minetest.settings:get_bool("colored_clay_compatibility") == true then
|
if minetest.settings:get_bool("colored_clay_compatibility") == true then
|
||||||
|
|
||||||
local cc = {
|
local cc = {
|
||||||
|
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 589 B |
Loading…
Reference in New Issue
Block a user