blockgame/mods/bg_tree/node_leaves.lua
trans_soup 4ea8050c67 simplify leaves falling from trees.
by using minetest builtin support for nodes that fall when they're not
supported.
2023-10-17 19:15:52 +02:00

63 lines
1.1 KiB
Lua

local modname = minetest.get_current_modname()
local function reg_leaves (name, def)
def.description = def.description or name
def.texture = def.texture or name
def.tiles = {modname .. "_" .. def.texture .. ".png"}
def.drawtype = "glasslike"
def.paramtype = "light"
def.sunlight_propagates = true
def.groups = blockgame.underride(def.groups, {
planty = 1,
extends_leaves_support = 1,
air_flowable = 1,
falling_node = 1,
})
blockgame.register_node(modname .. ":" .. name, def)
end
local nutty_drops = {
max_items = 3,
items = {
{
rarity = 8,
items = {modname .. ":nut"},
},
{
rarity = 12,
items = {modname .. ":nut 2"},
},
{
rarity = 1,
items = {modname .. ":leaves"},
},
},
}
reg_leaves("leaves", {
description = "Leaves",
})
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,
},
})
reg_leaves("leaves_decomposing", {
description = "Decomposing Leaves",
groups = {
supports_leaves = 0,
},
})