89 lines
1.6 KiB
Lua
89 lines
1.6 KiB
Lua
local modname = minetest.get_current_modname()
|
|
|
|
local leaves_level_max = 4
|
|
|
|
local base_def = {
|
|
drawtype = "allfaces_optional",
|
|
paramtype = "light",
|
|
sunlight_propagates = true,
|
|
groups = {
|
|
planty = 1,
|
|
extends_leaves_support = 1,
|
|
air_flowable = 1,
|
|
falling_node = 1,
|
|
leafy = 1,
|
|
},
|
|
}
|
|
|
|
local function reg_leaves (name, def)
|
|
def = blockgame.underride(def, base_def)
|
|
|
|
local texture = def.texture or name
|
|
def = blockgame.underride(def, {
|
|
description = name,
|
|
tiles = {modname .. "_" .. texture .. ".png"},
|
|
|
|
})
|
|
|
|
blockgame.register_node(name, def)
|
|
end
|
|
|
|
local nutty_drops = {
|
|
max_items = 3,
|
|
items = {
|
|
{
|
|
rarity = 20,
|
|
items = {modname .. ":nut 2"},
|
|
},
|
|
{
|
|
rarity = 16,
|
|
items = {modname .. ":nut"},
|
|
},
|
|
{
|
|
rarity = 1,
|
|
items = {modname .. ":leaves"},
|
|
},
|
|
},
|
|
}
|
|
|
|
blockgame.register_leveled_node(modname .. ":leaves", blockgame.underride({
|
|
description = "Leaves",
|
|
level_max = leaves_level_max,
|
|
tiles = {
|
|
modname .. "_leaves.png",
|
|
},
|
|
walkable = false,
|
|
supports_falling = true,
|
|
level_max = leaves_level_max,
|
|
}, base_def))
|
|
|
|
reg_leaves("leaves_growing", {
|
|
description = "Growing Leaves",
|
|
texture = "leaves_alive",
|
|
drop = nutty_drops,
|
|
groups = {
|
|
falling_node = 0,
|
|
},
|
|
})
|
|
reg_leaves("leaves_alive", {
|
|
description = "Leaves",
|
|
drop = nutty_drops,
|
|
groups = {
|
|
falling_node = 0,
|
|
},
|
|
})
|
|
|
|
blockgame.register_leveled_node("leaves_decomposing", blockgame.underride({
|
|
description = "Decomposing Leaves",
|
|
level_max = leaves_level_max,
|
|
tiles = {
|
|
modname .. "_leaves_decomposing.png",
|
|
},
|
|
groups = {
|
|
leaves_decomposing = leaves_level_max,
|
|
},
|
|
walkable = false,
|
|
supports_falling = true,
|
|
level_max = leaves_level_max,
|
|
}, base_def))
|